Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
ximper-shell-notification-center
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
ximper-shell-notification-center
Commits
bcf5da3f
Verified
Commit
bcf5da3f
authored
Mar 31, 2026
by
Kirill Unitsaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
night-light: replace blocking sync calls with async
parent
4a898d03
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
24 deletions
+16
-24
nightLightTile.vala
...rolCenter/widgets/quickSettings/tiles/nightLightTile.vala
+16
-24
No files found.
src/controlCenter/widgets/quickSettings/tiles/nightLightTile.vala
View file @
bcf5da3f
...
...
@@ -2,6 +2,7 @@ namespace XimperShellNotificationCenter.Widgets {
public
class
NightLightTile
:
QuickSettingsTile
{
private
const
int
NEUTRAL_TEMP
=
6000
;
private
int
temperature
=
4500
;
private
bool
_is_available
=
false
;
public
NightLightTile
(
Json
.
Object
?
cfg
)
{
base
(
"night-light-disabled-symbolic"
,
...
...
@@ -14,40 +15,31 @@ namespace XimperShellNotificationCenter.Widgets {
temperature
=
temp
;
}
}
_is_available
=
Environment
.
find_program_in_path
(
"hyprsunset"
)
!=
null
;
}
public
override
bool
is_available
()
{
try
{
string
output
;
Process
.
spawn_command_line_sync
(
"pgrep -x hyprsunset"
,
out
output
,
null
,
null
);
return
output
.
strip
().
length
>
0
;
}
catch
(
SpawnError
e
)
{
return
false
;
}
return
_is_available
;
}
public
override
void
on_cc_visibility_change
(
bool
visible
)
{
if
(
visible
&&
is_available
()
)
{
sync_state
();
if
(
visible
&&
_is_available
)
{
sync_state
.
begin
();
}
}
private
void
sync_state
()
{
try
{
string
output
;
Process
.
spawn_command_line_sync
(
"hyprctl hyprsunset temperature"
,
out
output
,
null
,
null
);
int
current
=
int
.
parse
(
output
.
strip
());
active
=
(
current
<
NEUTRAL_TEMP
);
update_icon
();
}
catch
(
SpawnError
e
)
{
debug
(
"Failed to get temperature: %s"
,
e
.
message
);
}
private
async
void
sync_state
()
{
string
msg
;
yield
Functions
.
execute_command
(
"hyprctl hyprsunset temperature"
,
{},
out
msg
);
int
current
=
int
.
parse
(
msg
.
strip
());
active
=
(
current
<
NEUTRAL_TEMP
);
update_icon
();
}
public
override
void
on_toggle
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment