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
ae19d5c4
Verified
Commit
ae19d5c4
authored
Mar 28, 2026
by
Kirill Unitsaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
backlight: add OSD notification on brightness change
parent
5d2211c4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
backlight.vala
src/controlCenter/widgets/backlight/backlight.vala
+26
-0
No files found.
src/controlCenter/widgets/backlight/backlight.vala
View file @
ae19d5c4
using
GLib
;
namespace
XimperShellNotificationCenter.Widgets
{
[
DBus
(
name
=
"ru.ximperlinux.shell.OSD"
)]
interface
OsdService
:
Object
{
public
abstract
void
show_brightness_osd
(
double
percent
)
throws
DBusError
,
IOError
;
}
[
GtkTemplate
(
ui
=
"/ru/ximperlinux/shell/NotificationCenter/ui/widgets/backlight.ui"
)]
public
class
Backlight
:
BaseWidget
{
public
override
string
widget_name
{
...
...
@@ -39,6 +45,7 @@ namespace XimperShellNotificationCenter.Widgets {
unowned
Gtk
.
Box
single_source_box
;
int
min_brightness
=
0
;
OsdService
?
osd_proxy
=
null
;
public
Backlight
(
string
suffix
)
{
base
(
suffix
);
...
...
@@ -48,6 +55,14 @@ namespace XimperShellNotificationCenter.Widgets {
min_brightness
=
int
.
max
(
0
,
get_prop
<
int
>
(
config
,
"min"
));
}
try
{
osd_proxy
=
Bus
.
get_proxy_sync
(
BusType
.
SESSION
,
"ru.ximperlinux.shell.OSD"
,
"/ru/ximperlinux/shell/OSD"
);
}
catch
(
Error
e
)
{
debug
(
"OSD service not available: %s"
,
e
.
message
);
}
detect_sources
();
int
total
=
display_sources
.
length
+
kbd_sources
.
length
;
...
...
@@ -203,6 +218,7 @@ namespace XimperShellNotificationCenter.Widgets {
(
float
)
scl
.
get_value
());
scl
.
tooltip_text
=
((
int
)
scl
.
get_value
()).
to_string
();
notify_osd
(
scl
.
get_value
());
});
}
#if HAVE_DDC
...
...
@@ -221,6 +237,7 @@ namespace XimperShellNotificationCenter.Widgets {
(
float
)
scl
.
get_value
());
scl
.
tooltip_text
=
((
int
)
scl
.
get_value
()).
to_string
();
notify_osd
(
scl
.
get_value
());
});
}
#endif
...
...
@@ -295,6 +312,15 @@ namespace XimperShellNotificationCenter.Widgets {
}
}
private
void
notify_osd
(
double
percent
)
{
if
(
osd_proxy
==
null
)
return
;
try
{
osd_proxy
.
show_brightness_osd
(
percent
);
}
catch
(
Error
e
)
{
debug
(
"OSD call failed: %s"
,
e
.
message
);
}
}
public
override
void
on_cc_visibility_change
(
bool
val
)
{
for
(
int
i
=
0
;
i
<
display_sources
.
length
;
i
++)
{
if
(
display_sources
[
i
].
sysfs
!=
null
)
{
...
...
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