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
9e9f6ee5
Commit
9e9f6ee5
authored
Aug 17, 2025
by
Erik Reider
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Vastly simplified how blank windows are added and removed
parent
1207af86
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
32 deletions
+22
-32
swayncDaemon.vala
src/swayncDaemon/swayncDaemon.vala
+22
-32
No files found.
src/swayncDaemon/swayncDaemon.vala
View file @
9e9f6ee5
...
@@ -63,23 +63,8 @@ namespace SwayNotificationCenter {
...
@@ -63,23 +63,8 @@ namespace SwayNotificationCenter {
stderr
.
printf
(
e
.
message
+
"\n"
);
stderr
.
printf
(
e
.
message
+
"\n"
);
}
}
monitors
.
items_changed
.
connect
(()
=>
{
monitors
.
items_changed
.
connect
(
monitors_changed
);
// Blank windows
monitors_changed
(
0
,
0
,
monitors
.
get_n_items
());
close_blank_windows
();
bool
visibility
=
noti_daemon
.
control_center
.
get_visibility
();
init_blank_windows
(
visibility
);
// Set preferred output
try
{
set_cc_monitor
(
ConfigModel
.
instance
.
control_center_preferred_output
);
set_noti_window_monitor
(
ConfigModel
.
instance
.
notification_window_preferred_output
);
}
catch
(
Error
e
)
{
critical
(
e
.
message
);
}
});
init_blank_windows
(
false
);
}
}
private
void
on_noti_bus_aquired
(
DBusConnection
conn
)
{
private
void
on_noti_bus_aquired
(
DBusConnection
conn
)
{
...
@@ -92,25 +77,30 @@ namespace SwayNotificationCenter {
...
@@ -92,25 +77,30 @@ namespace SwayNotificationCenter {
}
}
}
}
private
void
init_blank_windows
(
bool
visible
)
{
private
void
monitors_changed
(
uint
position
,
uint
removed
,
uint
added
)
{
close_blank_windows
();
bool
visible
=
noti_daemon
.
control_center
.
get_visibility
();
for
(
uint
i
=
0
;
i
<
removed
;
i
++)
{
unowned
BlankWindow
win
=
blank_windows
.
index
(
position
+
i
);
win
.
close
();
blank_windows
.
remove_index
(
position
+
i
);
}
// Add a window to all monitors
for
(
uint
i
=
0
;
i
<
added
;
i
++)
{
for
(
int
i
=
0
;
i
<
monitors
.
get_n_items
();
i
++)
{
Gdk
.
Monitor
monitor
=
(
Gdk
.
Monitor
)
monitors
.
get_item
(
position
+
i
);
Object
?
obj
=
monitors
.
get_item
(
i
);
BlankWindow
win
=
new
BlankWindow
(
monitor
);
if
(
obj
==
null
||
!(
obj
is
Gdk
.
Monitor
))
continue
;
BlankWindow
win
=
new
BlankWindow
((
Gdk
.
Monitor
)
obj
);
win
.
set_visible
(
visible
);
win
.
set_visible
(
visible
);
blank_windows
.
append_val
(
win
);
blank_windows
.
insert_val
(
position
+
i
,
win
);
}
}
}
private
void
close_blank_windows
()
{
// Set preferred output
while
(
blank_windows
.
length
>
0
)
{
try
{
uint
i
=
blank_windows
.
length
-
1
;
set_cc_monitor
(
unowned
BlankWindow
?
win
=
blank_windows
.
index
(
i
);
ConfigModel
.
instance
.
control_center_preferred_output
);
win
.
close
();
set_noti_window_monitor
(
blank_windows
.
remove_index
(
i
);
ConfigModel
.
instance
.
notification_window_preferred_output
);
}
catch
(
Error
e
)
{
critical
(
e
.
message
);
}
}
}
}
...
...
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