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
f4ddf0fc
Verified
Commit
f4ddf0fc
authored
Mar 27, 2026
by
Kirill Unitsaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
control-center: make notifications widget optional
parent
8ac5050f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
99 additions
and
59 deletions
+99
-59
controlCenter.vala
src/controlCenter/controlCenter.vala
+27
-18
dndTile.vala
src/controlCenter/widgets/quickSettings/tiles/dndTile.vala
+4
-0
title.vala
src/controlCenter/widgets/title/title.vala
+12
-5
main.vala
src/main.vala
+49
-35
notiDaemon.vala
src/notiDaemon/notiDaemon.vala
+4
-0
ximperShellNotificationCenterDaemon.vala
...tionCenterDaemon/ximperShellNotificationCenterDaemon.vala
+3
-1
No files found.
src/controlCenter/controlCenter.vala
View file @
f4ddf0fc
...
...
@@ -22,7 +22,9 @@ namespace XimperShellNotificationCenter {
Object
(
css_name
:
"blankwindow"
);
widgets
=
new
List
<
unowned
Widgets
.
BaseWidget
>
();
widgets
.
append
(
notifications_widget
);
if
(
notifications_widget
!=
null
)
{
widgets
.
append
(
notifications_widget
);
}
if
(
app
.
use_layer_shell
)
{
if
(!
GtkLayerShell
.
is_supported
())
{
...
...
@@ -164,7 +166,12 @@ namespace XimperShellNotificationCenter {
}
break
;
default
:
return
notifications_widget
.
key_press_event_cb
(
keyval
,
keycode
,
state
);
if
(
notifications_widget
!=
null
)
{
return
notifications_widget
.
key_press_event_cb
(
keyval
,
keycode
,
state
);
}
return
false
;
}
// Override the builtin list navigation
return
true
;
...
...
@@ -189,12 +196,6 @@ namespace XimperShellNotificationCenter {
w
=
DEFAULT_WIDGETS
;
}
// Add the notifications widget if not found in the list
if
(!(
"notifications"
in
w
))
{
warning
(
"Notification widget not included in \"widgets\" config. "
+
"Using default bottom position"
);
w
+=
"notifications"
;
}
bool
has_notifications
=
false
;
foreach
(
string
key
in
w
)
{
// Add the widget if it is valid
...
...
@@ -203,16 +204,18 @@ namespace XimperShellNotificationCenter {
key
,
out
is_notifications
);
if
(
is_notifications
)
{
if
(
notifications_widget
==
null
)
{
continue
;
}
if
(
has_notifications
)
{
warning
(
"Cannot have multiple \"notifications\" widgets! Skipping\"%s\""
,
key
);
warning
(
"Cannot have multiple "
+
"\"notifications\" widgets! "
+
"Skipping \"%s\""
,
key
);
continue
;
}
has_notifications
=
true
;
notifications_widget
.
reload_config
();
// Append the notifications widget to the box in the order of the provided list
box
.
append
(
notifications_widget
);
continue
;
}
...
...
@@ -334,18 +337,24 @@ namespace XimperShellNotificationCenter {
default
:
case
PositionY
.
TOP
:
align_y
=
Gtk
.
Align
.
START
;
// Set cc widget position
notifications_widget
.
set_list_is_reversed
(
false
);
if
(
notifications_widget
!=
null
)
{
notifications_widget
.
set_list_is_reversed
(
false
);
}
break
;
case
PositionY
.
CENTER
:
align_y
=
Gtk
.
Align
.
CENTER
;
// Set cc widget position
notifications_widget
.
set_list_is_reversed
(
false
);
if
(
notifications_widget
!=
null
)
{
notifications_widget
.
set_list_is_reversed
(
false
);
}
break
;
case
PositionY
.
BOTTOM
:
align_y
=
Gtk
.
Align
.
END
;
// Set cc widget position
notifications_widget
.
set_list_is_reversed
(
true
);
if
(
notifications_widget
!=
null
)
{
notifications_widget
.
set_list_is_reversed
(
true
);
}
break
;
}
// Fit the ControlCenter to the monitor height
...
...
src/controlCenter/widgets/quickSettings/tiles/dndTile.vala
View file @
f4ddf0fc
...
...
@@ -12,6 +12,10 @@ namespace XimperShellNotificationCenter.Widgets {
});
}
public
override
bool
is_available
()
{
return
notifications_widget
!=
null
;
}
private
void
update_icon
()
{
icon
.
set_from_icon_name
(
active
?
"notifications-disabled-symbolic"
...
...
src/controlCenter/widgets/title/title.vala
View file @
f4ddf0fc
...
...
@@ -37,12 +37,19 @@ namespace XimperShellNotificationCenter.Widgets {
}
title_widget
.
set_text
(
title
);
clear_all_button
.
set_visible
(
has_clear_all_button
);
clear_all_button
.
set_sensitive
(!
notifications_widget
.
is_empty
());
ximper_shell_notification_center_daemon
.
subscribe_v2
.
connect
((
count
)
=>
{
clear_all_button
.
set_sensitive
(
count
>
0
);
});
clear_all_button
.
set_visible
(
has_clear_all_button
&&
notifications_widget
!=
null
);
if
(
notifications_widget
!=
null
)
{
clear_all_button
.
set_sensitive
(
!
notifications_widget
.
is_empty
());
ximper_shell_notification_center_daemon
.
subscribe_v2
.
connect
((
count
)
=>
{
clear_all_button
.
set_sensitive
(
count
>
0
);
});
}
}
[
GtkCallback
]
...
...
src/main.vala
View file @
f4ddf0fc
...
...
@@ -110,26 +110,37 @@ namespace XimperShellNotificationCenter {
noti_daemon
=
new
NotiDaemon
();
ximper_shell_notification_center_daemon
=
new
XimperShellNotificationCenterDaemon
();
// Notification Daemon
Bus
.
own_name_on_connection
(
conn
,
"org.freedesktop.Notifications"
,
bus_name_flags
,
()
=>
{
try
{
conn
.
register_object
(
"/org/freedesktop/Notifications"
,
noti_daemon
);
init
.
callback
();
}
catch
(
Error
e
)
{
error
(
"Could not register notification service: \"%s\""
,
e
.
message
);
// Register notification daemon only if notifications widget is enabled
bool
has_notifications
=
false
;
foreach
(
string
w
in
ConfigModel
.
instance
.
widgets
.
data
)
{
if
(
w
.
has_prefix
(
"notifications"
))
{
has_notifications
=
true
;
break
;
}
},
()
=>
{
stderr
.
printf
(
"Could not acquire notification name. "
+
"Please close any other notification daemon "
+
"like mako or dunst\n"
);
Process
.
exit
(
1
);
});
yield
;
}
if
(
has_notifications
)
{
Bus
.
own_name_on_connection
(
conn
,
"org.freedesktop.Notifications"
,
bus_name_flags
,
()
=>
{
try
{
conn
.
register_object
(
"/org/freedesktop/Notifications"
,
noti_daemon
);
init
.
callback
();
}
catch
(
Error
e
)
{
error
(
"Could not register notification service: \"%s\""
,
e
.
message
);
}
},
()
=>
{
stderr
.
printf
(
"Could not acquire notification name. "
+
"Please close any other notification daemon "
+
"like mako or dunst\n"
);
Process
.
exit
(
1
);
});
yield
;
}
// Ximper Shell Notification Center Daemon
// Name is already owned by GApplication via register()
...
...
@@ -143,23 +154,26 @@ namespace XimperShellNotificationCenter {
xdg_activation
=
new
XdgActivationHelper
();
floating_notifications
=
new
NotificationWindow
();
notifications_widget
=
new
Widgets
.
Notifications
();
control_center
=
new
ControlCenter
();
add_window
(
floating_notifications
);
add_window
(
control_center
);
noti_daemon
.
on_dnd_toggle
.
connect
((
dnd
)
=>
{
// Hide all non-critical notifications on toggle
if
(
dnd
&&
floating_notifications
.
visible
)
{
noti_daemon
.
remove_all_floating_notifications
(
true
,
(
noti
)
=>
{
return
noti
.
param
.
urgency
!=
UrgencyLevels
.
CRITICAL
;
});
}
if
(
has_notifications
)
{
notifications_widget
=
new
Widgets
.
Notifications
();
floating_notifications
=
new
NotificationWindow
();
add_window
(
floating_notifications
);
noti_daemon
.
on_dnd_toggle
.
connect
((
dnd
)
=>
{
if
(
dnd
&&
floating_notifications
.
visible
)
{
noti_daemon
.
remove_all_floating_notifications
(
true
,
(
noti
)
=>
{
return
noti
.
param
.
urgency
!=
UrgencyLevels
.
CRITICAL
;
});
}
ximper_shell_notification_center_daemon
.
emit_subscribe
();
});
}
ximper_shell_notification_center_daemon
.
emit_subscribe
();
});
control_center
=
new
ControlCenter
();
// Update on start
ximper_shell_notification_center_daemon
.
emit_subscribe
();
...
...
src/notiDaemon/notiDaemon.vala
View file @
f4ddf0fc
...
...
@@ -23,6 +23,7 @@ namespace XimperShellNotificationCenter {
internal
uint
n_notifications
{
get
{
if
(
notifications_widget
==
null
)
return
0
;
return
notifications_widget
.
n_notifications
;
}
}
...
...
@@ -85,6 +86,7 @@ namespace XimperShellNotificationCenter {
/** Hides all floating notifications (closes transient) */
internal
inline
void
remove_all_floating_notifications
(
bool
transition
,
notification_filter_func
?
func
)
{
if
(
floating_notifications
==
null
)
return
;
debug
(
"Hiding all floating notifications"
);
floating_notifications
.
remove_all_notifications
(
transition
,
(
notification
)
=>
{
if
(
func
==
null
||
func
(
notification
))
{
...
...
@@ -104,6 +106,7 @@ namespace XimperShellNotificationCenter {
/** Hides/closes latest floating notification */
internal
void
hide_latest_floating_notification
(
bool
close
)
{
if
(
floating_notifications
==
null
)
return
;
NotifyParams
?
param
=
floating_notifications
.
get_latest_notification
();
if
(
param
==
null
)
{
return
;
...
...
@@ -119,6 +122,7 @@ namespace XimperShellNotificationCenter {
/** Activates the `action_index` action of the latest notification */
internal
void
invoke_latest_floating_action
(
uint32
action_index
)
{
if
(
floating_notifications
==
null
)
return
;
floating_notifications
.
latest_notification_action
(
action_index
);
}
...
...
src/ximperShellNotificationCenterDaemon/ximperShellNotificationCenterDaemon.vala
View file @
f4ddf0fc
...
...
@@ -237,7 +237,9 @@ namespace XimperShellNotificationCenter {
return
false
;
}
floating_notifications
.
set_monitor
(
monitor
);
if
(
floating_notifications
!=
null
)
{
floating_notifications
.
set_monitor
(
monitor
);
}
return
true
;
}
}
...
...
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