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
ea6b68f8
Commit
ea6b68f8
authored
Jun 25, 2022
by
Erik Reider
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug where replacing notifitions aren't visible
parent
a9322731
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
27 deletions
+28
-27
notiDaemon.vala
src/notiDaemon/notiDaemon.vala
+4
-4
notificationWindow.ui
src/notificationWindow/notificationWindow.ui
+1
-1
notificationWindow.vala
src/notificationWindow/notificationWindow.vala
+23
-22
No files found.
src/notiDaemon/notiDaemon.vala
View file @
ea6b68f8
...
...
@@ -51,7 +51,7 @@ namespace SwayNotificationCenter {
/** Method to close notification and send DISMISSED signal */
public
void
manually_close_notification
(
uint32
id
,
bool
timeout
)
throws
DBusError
,
IOError
{
NotificationWindow
.
instance
.
close_notification
(
id
);
NotificationWindow
.
instance
.
close_notification
(
id
,
false
);
if
(!
timeout
)
{
control_center
.
close_notification
(
id
);
NotificationClosed
(
id
,
ClosedReasons
.
DISMISSED
);
...
...
@@ -155,7 +155,7 @@ namespace SwayNotificationCenter {
// Replace notification logic
if
(
id
==
replaces_id
)
{
param
.
replaces
=
true
;
NotificationWindow
.
instance
.
close_notification
(
id
);
NotificationWindow
.
instance
.
close_notification
(
id
,
true
);
control_center
.
close_notification
(
id
,
true
);
}
else
if
(
param
.
synchronous
!=
null
&&
param
.
synchronous
.
length
>
0
)
{
...
...
@@ -166,7 +166,7 @@ namespace SwayNotificationCenter {
param
.
synchronous
,
null
,
out
r_id
))
{
param
.
replaces
=
true
;
// Close the notification
NotificationWindow
.
instance
.
close_notification
(
r_id
);
NotificationWindow
.
instance
.
close_notification
(
r_id
,
true
);
control_center
.
close_notification
(
r_id
,
true
);
}
synchronous_ids
.
set
(
param
.
synchronous
,
id
);
...
...
@@ -253,7 +253,7 @@ namespace SwayNotificationCenter {
*/
[
DBus
(
name
=
"CloseNotification"
)]
public
void
close_notification
(
uint32
id
)
throws
DBusError
,
IOError
{
NotificationWindow
.
instance
.
close_notification
(
id
);
NotificationWindow
.
instance
.
close_notification
(
id
,
false
);
control_center
.
close_notification
(
id
);
NotificationClosed
(
id
,
ClosedReasons
.
CLOSED_BY_CLOSENOTIFICATION
);
}
...
...
src/notificationWindow/notificationWindow.ui
View file @
ea6b68f8
...
...
@@ -2,7 +2,7 @@
<!-- Generated with glade 3.38.2 -->
<interface>
<requires
lib=
"gtk+"
version=
"3.24"
/>
<template
class=
"SwayNotificationCenterNotiWindow"
parent=
"GtkApplicationWindow"
>
<template
class=
"SwayNotificationCenterNoti
fication
Window"
parent=
"GtkApplicationWindow"
>
<property
name=
"can-focus"
>
False
</property>
<property
name=
"role"
>
NotificationWindow
</property>
<property
name=
"resizable"
>
False
</property>
...
...
src/notificationWindow/notificationWindow.vala
View file @
ea6b68f8
namespace
SwayNotificationCenter
{
public
class
NotificationWindow
:
Object
{
private
static
NotiWindow
?
window
=
null
;
// Use a NotiWindow singleton due to a nasty notification
// enter_notify_event bug where GTK still thinks that the cursor is at
// that location after closing the last notification. The next notification
// would sometimes automatically be hovered...
public
static
NotiWindow
instance
{
[
GtkTemplate
(
ui
=
"/org/erikreider/sway-notification-center/notificationWindow/notificationWindow.ui"
)]
public
class
NotificationWindow
:
Gtk
.
ApplicationWindow
{
private
static
NotificationWindow
?
window
=
null
;
/**
* A NotificationWindow singleton due to a nasty notification
* enter_notify_event bug where GTK still thinks that the cursor is at
* that location after closing the last notification. The next notification
* would sometimes automatically be hovered...
* The only way to "solve" this is to close the window and reopen a new one.
*/
public
static
NotificationWindow
instance
{
get
{
if
(
window
==
null
)
{
window
=
new
NotiWindow
();
window
=
new
Noti
fication
Window
();
}
else
if
(!
window
.
get_mapped
()
||
!
window
.
get_realized
()
||
!(
window
.
get_child
()
is
Gtk
.
Widget
))
{
window
.
destroy
();
window
=
new
NotiWindow
();
window
=
new
Noti
fication
Window
();
}
return
window
;
}
}
}
[
GtkTemplate
(
ui
=
"/org/erikreider/sway-notification-center/notificationWindow/notificationWindow.ui"
)]
public
class
NotiWindow
:
Gtk
.
ApplicationWindow
{
[
GtkChild
]
unowned
Gtk
.
ScrolledWindow
scrolled_window
;
...
...
@@ -36,7 +36,7 @@ namespace SwayNotificationCenter {
private
const
int
MAX_HEIGHT
=
600
;
p
ublic
Noti
Window
()
{
p
rivate
Notification
Window
()
{
if
(!
GtkLayerShell
.
is_supported
())
{
stderr
.
printf
(
"GTKLAYERSHELL IS NOT SUPPORTED!\n"
);
stderr
.
printf
(
"Swaync only works on Wayland!\n"
);
...
...
@@ -123,21 +123,22 @@ namespace SwayNotificationCenter {
public
void
close_all_notifications
()
{
if
(!
this
.
get_realized
())
return
;
foreach
(
var
w
in
box
.
get_children
())
{
remove_notification
((
Notification
)
w
);
remove_notification
((
Notification
)
w
,
false
);
}
}
private
void
remove_notification
(
Notification
noti
)
{
private
void
remove_notification
(
Notification
?
noti
,
bool
replaces
)
{
// Remove notification and its destruction timeout
if
(
noti
!=
null
)
{
noti
.
remove_noti_timeout
();
noti
.
destroy
();
}
if
(!
get_realized
()
||
!
get_mapped
()
||
!(
get_child
()
is
Gtk
.
Widget
)
||
box
.
get_children
().
length
()
==
0
)
{
if
(!
replaces
&&
(!
get_realized
()
||
!
get_mapped
()
||
!(
get_child
()
is
Gtk
.
Widget
)
||
box
.
get_children
().
length
()
==
0
))
{
close
();
return
;
}
...
...
@@ -167,11 +168,11 @@ namespace SwayNotificationCenter {
scroll_to_start
(
list_reverse
);
}
public
void
close_notification
(
uint32
id
)
{
public
void
close_notification
(
uint32
id
,
bool
replaces
)
{
foreach
(
var
w
in
box
.
get_children
())
{
var
noti
=
(
Notification
)
w
;
if
(
noti
!=
null
&&
noti
.
param
.
applied_id
==
id
)
{
remove_notification
(
noti
);
remove_notification
(
noti
,
replaces
);
break
;
}
}
...
...
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