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
965f4092
Verified
Commit
965f4092
authored
Mar 24, 2026
by
Kirill Unitsaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
quick-settings: add Night Light tile with hyprsunset integration
parent
dc9f44e4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
0 deletions
+78
-0
nightLightTile.vala
...rolCenter/widgets/quickSettings/tiles/nightLightTile.vala
+77
-0
meson.build
src/meson.build
+1
-0
No files found.
src/controlCenter/widgets/quickSettings/tiles/nightLightTile.vala
0 → 100644
View file @
965f4092
namespace
XimperShellNotificationCenter.Widgets
{
public
class
NightLightTile
:
QuickSettingsTile
{
private
const
int
NEUTRAL_TEMP
=
6000
;
private
int
temperature
=
4500
;
public
NightLightTile
(
Json
.
Object
?
cfg
)
{
base
(
"night-light-disabled-symbolic"
,
_
(
"Night Light"
));
if
(
cfg
!=
null
)
{
int
temp
=
(
int
)
cfg
.
get_int_member_with_default
(
"temperature"
,
0
);
if
(
temp
>
0
)
{
temperature
=
temp
;
}
}
}
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
;
}
}
public
override
void
on_cc_visibility_change
(
bool
visible
)
{
if
(
visible
&&
is_available
())
{
sync_state
();
}
}
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
);
}
}
public
override
void
on_toggle
()
{
active
=
!
active
;
update_icon
();
if
(
active
)
{
run_hyprctl
.
begin
(
"hyprctl hyprsunset temperature %d"
.
printf
(
temperature
));
}
else
{
run_hyprctl
.
begin
(
"hyprctl hyprsunset identity"
);
}
}
private
void
update_icon
()
{
icon
.
set_from_icon_name
(
active
?
"night-light-symbolic"
:
"night-light-disabled-symbolic"
);
}
private
async
void
run_hyprctl
(
string
cmd
)
{
string
msg
;
yield
Functions
.
execute_command
(
cmd
,
{},
out
msg
);
}
}
}
src/meson.build
View file @
965f4092
...
@@ -62,6 +62,7 @@ widget_sources = [
...
@@ -62,6 +62,7 @@ widget_sources = [
'controlCenter/widgets/quickSettings/tiles/powerProfilesTile.vala',
'controlCenter/widgets/quickSettings/tiles/powerProfilesTile.vala',
'controlCenter/widgets/quickSettings/tiles/commandTile.vala',
'controlCenter/widgets/quickSettings/tiles/commandTile.vala',
'controlCenter/widgets/quickSettings/tiles/caffeineTile.vala',
'controlCenter/widgets/quickSettings/tiles/caffeineTile.vala',
'controlCenter/widgets/quickSettings/tiles/nightLightTile.vala',
]
]
app_sources = [
app_sources = [
...
...
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