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
4286390e
Verified
Commit
4286390e
authored
Mar 24, 2026
by
Kirill Unitsaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
quick-settings: add Caffeine tile with logind idle inhibitor
parent
c181135e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
100 additions
and
0 deletions
+100
-0
caffeine-off-symbolic.svg
data/icons/scalable/actions/caffeine-off-symbolic.svg
+10
-0
caffeine-on-symbolic.svg
data/icons/scalable/actions/caffeine-on-symbolic.svg
+10
-0
ximper_shell_notification_center.gresource.xml
data/ximper_shell_notification_center.gresource.xml
+2
-0
quickSettings.vala
src/controlCenter/widgets/quickSettings/quickSettings.vala
+3
-0
caffeineTile.vala
...ntrolCenter/widgets/quickSettings/tiles/caffeineTile.vala
+74
-0
meson.build
src/meson.build
+1
-0
No files found.
data/icons/scalable/actions/caffeine-off-symbolic.svg
0 → 100644
View file @
4286390e
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
height=
"16"
width=
"16"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
>
<g
style=
"display:inline"
>
<path
d=
"m 283.12476,634.39715 c 0.0901,2.39982 -2.5e-4,4.90096 0.90536,7.16242 0.56561,1.4515 1.83385,2.55431 3.30794,2.90589 1.73814,0.41114 3.64376,0.40412 5.29688,-0.34623 1.60312,-0.72608 2.57953,-2.39439 2.98402,-4.09315 0.48766,-1.97915 0.54999,-4.03862 0.59785,-6.06897 -0.18011,-1.15523 -1.25844,-1.84731 -2.20555,-2.3009 -2.30084,-1.01772 -4.91035,-1.09851 -7.34309,-0.60961 -1.29974,0.30095 -2.77781,0.86169 -3.36661,2.20531 -0.1485,0.35955 -0.20354,0.75631 -0.1768,1.14524 z m 11.6374,0.11136 c -0.0441,0.91126 -0.96505,1.35565 -1.68872,1.6268 -1.99848,0.66073 -4.17612,0.68978 -6.22022,0.24168 -0.87456,-0.24018 -1.9114,-0.56182 -2.32332,-1.47943 -0.29096,-0.86897 0.46051,-1.62212 1.18574,-1.91228 1.63288,-0.67936 3.44794,-0.70226 5.17963,-0.56565 1.19133,0.15082 2.47787,0.35598 3.42954,1.17357 0.24954,0.23294 0.4418,0.55854 0.43735,0.91531 z"
style=
"fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:2.15345359"
transform=
"translate(-283.00021,-629)"
/>
<path
d=
"m 296.01831,634.29869 c -0.42246,0.1058 -0.81557,0.29843 -1.20581,0.48706 0.25,0.48958 0.5,0.97917 0.75,1.46875 0.52953,-0.26079 1.07925,-0.48948 1.65621,-0.62136 0.19598,0.29034 0.0613,0.65559 0.0965,0.98001 -0.0265,0.76535 -0.0891,1.53332 -0.2618,2.281 -0.19796,0.24661 -0.50311,0.0211 -0.71411,-0.0864 -0.30932,-0.0721 -0.53729,-0.31117 -0.83024,-0.41286 -0.12503,-0.008 -0.14438,0.15951 -0.217,0.23727 -0.23278,0.37411 -0.46557,0.74823 -0.69835,1.12235 0.81565,0.49866 1.72225,0.99381 2.70984,0.93005 0.59894,-0.0615 1.14074,-0.51865 1.25926,-1.11639 0.18671,-0.66571 0.27615,-1.35495 0.35899,-2.03989 0.0715,-0.82121 0.0983,-1.67218 -0.1491,-2.46792 -0.15932,-0.48309 -0.5391,-0.9535 -1.0785,-0.99879 -0.5706,-0.0824 -1.12444,0.12918 -1.67588,0.23714 z"
style=
"fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:1.64499998"
transform=
"translate(-283.00021,-629)"
/>
</g>
<g
style=
"display:inline"
>
<path
d=
"m 6.555174,3.6689621 c -1.97865,-0.004 -4.74917,0.59448 -4.36893,1.9299 0.27853,0.9782 2.7468,1.37112 4.2822,1.34057 2.39093,-0.0476 3.99564,-0.15186 4.49936,-1.16589 0.66845,-1.34563 -2.32411,-2.10075 -4.41263,-2.10458 z"
style=
"fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:1.7"
/>
</g>
</svg>
data/icons/scalable/actions/caffeine-on-symbolic.svg
0 → 100644
View file @
4286390e
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
height=
"16"
width=
"16"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
>
<g
style=
"display:inline"
>
<path
d=
"m 283.12476,634.39715 c 0.0901,2.39982 -2.5e-4,4.90096 0.90536,7.16242 0.56561,1.4515 1.83385,2.55431 3.30794,2.90589 1.73814,0.41114 3.64376,0.40412 5.29688,-0.34623 1.60312,-0.72608 2.57953,-2.39439 2.98402,-4.09315 0.48766,-1.97915 0.54999,-4.03862 0.59785,-6.06897 -0.18011,-1.15523 -1.25844,-1.84731 -2.20555,-2.3009 -2.30084,-1.01772 -4.91035,-1.09851 -7.34309,-0.60961 -1.29974,0.30095 -2.77781,0.86169 -3.36661,2.20531 -0.1485,0.35955 -0.20354,0.75631 -0.1768,1.14524 z m 11.6374,0.11136 c -0.0441,0.91126 -0.96505,1.35565 -1.68872,1.6268 -1.99848,0.66073 -4.17612,0.68978 -6.22022,0.24168 -0.87456,-0.24018 -1.9114,-0.56182 -2.32332,-1.47943 -0.29096,-0.86897 0.46051,-1.62212 1.18574,-1.91228 1.63288,-0.67936 3.44794,-0.70226 5.17963,-0.56565 1.19133,0.15082 2.47787,0.35598 3.42954,1.17357 0.24954,0.23294 0.4418,0.55854 0.43735,0.91531 z"
style=
"fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:2.15345359"
transform=
"translate(-283.00021,-629)"
/>
<path
d=
"m 296.01831,634.29869 c -0.42246,0.1058 -0.81557,0.29843 -1.20581,0.48706 0.25,0.48958 0.5,0.97917 0.75,1.46875 0.52953,-0.26079 1.07925,-0.48948 1.65621,-0.62136 0.19598,0.29034 0.0613,0.65559 0.0965,0.98001 -0.0265,0.76535 -0.0891,1.53332 -0.2618,2.281 -0.19796,0.24661 -0.50311,0.0211 -0.71411,-0.0864 -0.30932,-0.0721 -0.53729,-0.31117 -0.83024,-0.41286 -0.12503,-0.008 -0.14438,0.15951 -0.217,0.23727 -0.23278,0.37411 -0.46557,0.74823 -0.69835,1.12235 0.81565,0.49866 1.72225,0.99381 2.70984,0.93005 0.59894,-0.0615 1.14074,-0.51865 1.25926,-1.11639 0.18671,-0.66571 0.27615,-1.35495 0.35899,-2.03989 0.0715,-0.82121 0.0983,-1.67218 -0.1491,-2.46792 -0.15932,-0.48309 -0.5391,-0.9535 -1.0785,-0.99879 -0.5706,-0.0824 -1.12444,0.12918 -1.67588,0.23714 z"
style=
"fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:1.64499998"
transform=
"translate(-283.00021,-629)"
/>
</g>
<g
style=
"display:inline"
>
<path
d=
"m 5.2441406,-0.23632812 c 0,0 -0.3394129,0.25195871 -0.6777344,0.6328125 -0.3383213,0.38085377 -0.7447236,0.90721162 -0.75,1.63085942 -0.00521,0.7085985 0.3672604,1.2099598 0.6132813,1.5761718 0.2460209,0.3662121 0.3798468,0.5897235 0.3691406,0.8867188 -0.020225,0.5610635 -0.8476562,1.1152343 -0.8476562,1.1152344 l 0.6230469,1.140625 c 0,0 1.4692012,-0.7044492 1.5234374,-2.2089844 C 6.1241401,3.8024329 5.7656251,3.2597634 5.5097656,2.8789062 5.2539062,2.498049 5.1154484,2.2737803 5.1171875,2.0371094 5.118311,1.8830216 5.2957281,1.5336911 5.5390625,1.2597656 5.7823969,0.98584026 6.0234375,0.80273438 6.0234375,0.80273438 Z m 3.3261719,0 c 0,0 -0.3394129,0.25195871 -0.6777344,0.6328125 C 7.5542568,0.77733815 7.1478545,1.303696 7.1425781,2.0273438 7.1373712,2.7359423 7.5098385,3.2373036 7.7558594,3.6035156 8.0018802,3.9697277 8.1357062,4.1932391 8.125,4.4902344 8.1047745,5.0512979 7.2773438,5.6054687 7.2773438,5.6054688 l 0.6230468,1.140625 c 0,0 1.4692013,-0.7044492 1.5234375,-2.2089844 C 9.450312,3.8024329 9.0917969,3.2597634 8.8359375,2.8789062 8.5800781,2.498049 8.4416203,2.2737803 8.4433594,2.0371094 8.4444829,1.8830216 8.6219,1.5336911 8.8652344,1.2597656 9.1085687,0.98584026 9.3496094,0.80273438 9.3496094,0.80273438 Z"
style=
"fill:#ffffff"
/>
</g>
</svg>
data/ximper_shell_notification_center.gresource.xml
View file @
4286390e
...
@@ -6,6 +6,8 @@
...
@@ -6,6 +6,8 @@
<file
preprocess=
"xml-stripblanks"
>
icons/scalable/actions/ximper-shell-notification-center-up-small-symbolic.svg
</file>
<file
preprocess=
"xml-stripblanks"
>
icons/scalable/actions/ximper-shell-notification-center-up-small-symbolic.svg
</file>
<file
preprocess=
"xml-stripblanks"
>
icons/scalable/actions/ximper-shell-notification-center-down-small-symbolic.svg
</file>
<file
preprocess=
"xml-stripblanks"
>
icons/scalable/actions/ximper-shell-notification-center-down-small-symbolic.svg
</file>
<file
preprocess=
"xml-stripblanks"
>
icons/scalable/actions/dark-mode-symbolic.svg
</file>
<file
preprocess=
"xml-stripblanks"
>
icons/scalable/actions/dark-mode-symbolic.svg
</file>
<file
preprocess=
"xml-stripblanks"
>
icons/scalable/actions/caffeine-on-symbolic.svg
</file>
<file
preprocess=
"xml-stripblanks"
>
icons/scalable/actions/caffeine-off-symbolic.svg
</file>
<file
preprocess=
"xml-stripblanks"
>
ui/notification_window.ui
</file>
<file
preprocess=
"xml-stripblanks"
>
ui/notification_window.ui
</file>
<file
preprocess=
"xml-stripblanks"
>
ui/notification.ui
</file>
<file
preprocess=
"xml-stripblanks"
>
ui/notification.ui
</file>
...
...
src/controlCenter/widgets/quickSettings/quickSettings.vala
View file @
4286390e
...
@@ -21,6 +21,9 @@ namespace XimperShellNotificationCenter.Widgets {
...
@@ -21,6 +21,9 @@ namespace XimperShellNotificationCenter.Widgets {
case
"command"
:
case
"command"
:
tile
=
new
CommandTile
(
cfg
);
tile
=
new
CommandTile
(
cfg
);
break
;
break
;
case
"caffeine"
:
tile
=
new
CaffeineTile
(
cfg
);
break
;
default
:
default
:
warning
(
"Unknown quick-settings tile: %s"
,
warning
(
"Unknown quick-settings tile: %s"
,
type_id
);
type_id
);
...
...
src/controlCenter/widgets/quickSettings/tiles/caffeineTile.vala
0 → 100644
View file @
4286390e
namespace
XimperShellNotificationCenter.Widgets
{
[
DBus
(
name
=
"org.freedesktop.login1.Manager"
)]
interface
Login1Manager
:
Object
{
public
abstract
UnixInputStream
inhibit
(
string
what
,
string
who
,
string
why
,
string
mode
)
throws
GLib
.
Error
;
}
public
class
CaffeineTile
:
QuickSettingsTile
{
private
Login1Manager
?
login1
=
null
;
private
int
inhibit_fd
=
-
1
;
public
CaffeineTile
(
Json
.
Object
?
cfg
)
{
base
(
"display-brightness-symbolic"
,
_
(
"Caffeine"
));
update_icon
();
try
{
login1
=
Bus
.
get_proxy_sync
(
BusType
.
SYSTEM
,
"org.freedesktop.login1"
,
"/org/freedesktop/login1"
);
}
catch
(
Error
e
)
{
warning
(
"logind not available: %s"
,
e
.
message
);
set_visible
(
false
);
}
}
private
void
update_icon
()
{
icon
.
set_from_icon_name
(
active
?
"caffeine-on-symbolic"
:
"caffeine-off-symbolic"
);
}
public
override
void
on_toggle
()
{
if
(
login1
==
null
)
return
;
if
(
active
)
{
release_inhibitor
();
}
else
{
acquire_inhibitor
();
}
}
private
void
acquire_inhibitor
()
{
try
{
var
stream
=
login1
.
inhibit
(
"idle"
,
"ximper-shell-notification-center"
,
_
(
"Caffeine mode"
),
"block"
);
inhibit_fd
=
stream
.
fd
;
// Prevent stream from closing fd on dispose
stream
.
set_close_fd
(
false
);
active
=
true
;
update_icon
();
}
catch
(
Error
e
)
{
warning
(
"Failed to inhibit idle: %s"
,
e
.
message
);
}
}
private
void
release_inhibitor
()
{
if
(
inhibit_fd
>=
0
)
{
Posix
.
close
(
inhibit_fd
);
inhibit_fd
=
-
1
;
}
active
=
false
;
update_icon
();
}
public
override
void
on_cc_visibility_change
(
bool
visible
)
{
}
}
}
src/meson.build
View file @
4286390e
...
@@ -61,6 +61,7 @@ widget_sources = [
...
@@ -61,6 +61,7 @@ widget_sources = [
'controlCenter/widgets/quickSettings/tiles/darkModeTile.vala',
'controlCenter/widgets/quickSettings/tiles/darkModeTile.vala',
'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',
]
]
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