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 {
...
@@ -51,7 +51,7 @@ namespace SwayNotificationCenter {
/** Method to close notification and send DISMISSED signal */
/** Method to close notification and send DISMISSED signal */
public
void
manually_close_notification
(
uint32
id
,
bool
timeout
)
public
void
manually_close_notification
(
uint32
id
,
bool
timeout
)
throws
DBusError
,
IOError
{
throws
DBusError
,
IOError
{
NotificationWindow
.
instance
.
close_notification
(
id
);
NotificationWindow
.
instance
.
close_notification
(
id
,
false
);
if
(!
timeout
)
{
if
(!
timeout
)
{
control_center
.
close_notification
(
id
);
control_center
.
close_notification
(
id
);
NotificationClosed
(
id
,
ClosedReasons
.
DISMISSED
);
NotificationClosed
(
id
,
ClosedReasons
.
DISMISSED
);
...
@@ -155,7 +155,7 @@ namespace SwayNotificationCenter {
...
@@ -155,7 +155,7 @@ namespace SwayNotificationCenter {
// Replace notification logic
// Replace notification logic
if
(
id
==
replaces_id
)
{
if
(
id
==
replaces_id
)
{
param
.
replaces
=
true
;
param
.
replaces
=
true
;
NotificationWindow
.
instance
.
close_notification
(
id
);
NotificationWindow
.
instance
.
close_notification
(
id
,
true
);
control_center
.
close_notification
(
id
,
true
);
control_center
.
close_notification
(
id
,
true
);
}
else
if
(
param
.
synchronous
!=
null
}
else
if
(
param
.
synchronous
!=
null
&&
param
.
synchronous
.
length
>
0
)
{
&&
param
.
synchronous
.
length
>
0
)
{
...
@@ -166,7 +166,7 @@ namespace SwayNotificationCenter {
...
@@ -166,7 +166,7 @@ namespace SwayNotificationCenter {
param
.
synchronous
,
null
,
out
r_id
))
{
param
.
synchronous
,
null
,
out
r_id
))
{
param
.
replaces
=
true
;
param
.
replaces
=
true
;
// Close the notification
// Close the notification
NotificationWindow
.
instance
.
close_notification
(
r_id
);
NotificationWindow
.
instance
.
close_notification
(
r_id
,
true
);
control_center
.
close_notification
(
r_id
,
true
);
control_center
.
close_notification
(
r_id
,
true
);
}
}
synchronous_ids
.
set
(
param
.
synchronous
,
id
);
synchronous_ids
.
set
(
param
.
synchronous
,
id
);
...
@@ -253,7 +253,7 @@ namespace SwayNotificationCenter {
...
@@ -253,7 +253,7 @@ namespace SwayNotificationCenter {
*/
*/
[
DBus
(
name
=
"CloseNotification"
)]
[
DBus
(
name
=
"CloseNotification"
)]
public
void
close_notification
(
uint32
id
)
throws
DBusError
,
IOError
{
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
);
control_center
.
close_notification
(
id
);
NotificationClosed
(
id
,
ClosedReasons
.
CLOSED_BY_CLOSENOTIFICATION
);
NotificationClosed
(
id
,
ClosedReasons
.
CLOSED_BY_CLOSENOTIFICATION
);
}
}
...
...
src/notificationWindow/notificationWindow.ui
View file @
ea6b68f8
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<!-- Generated with glade 3.38.2 -->
<!-- Generated with glade 3.38.2 -->
<interface>
<interface>
<requires
lib=
"gtk+"
version=
"3.24"
/>
<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=
"can-focus"
>
False
</property>
<property
name=
"role"
>
NotificationWindow
</property>
<property
name=
"role"
>
NotificationWindow
</property>
<property
name=
"resizable"
>
False
</property>
<property
name=
"resizable"
>
False
</property>
...
...
src/notificationWindow/notificationWindow.vala
View file @
ea6b68f8
namespace
SwayNotificationCenter
{
namespace
SwayNotificationCenter
{
public
class
NotificationWindow
:
Object
{
[
GtkTemplate
(
ui
=
"/org/erikreider/sway-notification-center/notificationWindow/notificationWindow.ui"
)]
private
static
NotiWindow
?
window
=
null
;
public
class
NotificationWindow
:
Gtk
.
ApplicationWindow
{
// Use a NotiWindow singleton due to a nasty notification
private
static
NotificationWindow
?
window
=
null
;
// enter_notify_event bug where GTK still thinks that the cursor is at
/**
// that location after closing the last notification. The next notification
* A NotificationWindow singleton due to a nasty notification
// would sometimes automatically be hovered...
* enter_notify_event bug where GTK still thinks that the cursor is at
public
static
NotiWindow
instance
{
* 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
{
get
{
if
(
window
==
null
)
{
if
(
window
==
null
)
{
window
=
new
NotiWindow
();
window
=
new
Noti
fication
Window
();
}
else
if
(!
window
.
get_mapped
()
||
}
else
if
(!
window
.
get_mapped
()
||
!
window
.
get_realized
()
||
!
window
.
get_realized
()
||
!(
window
.
get_child
()
is
Gtk
.
Widget
))
{
!(
window
.
get_child
()
is
Gtk
.
Widget
))
{
window
.
destroy
();
window
.
destroy
();
window
=
new
NotiWindow
();
window
=
new
Noti
fication
Window
();
}
}
return
window
;
return
window
;
}
}
}
}
}
[
GtkTemplate
(
ui
=
"/org/erikreider/sway-notification-center/notificationWindow/notificationWindow.ui"
)]
public
class
NotiWindow
:
Gtk
.
ApplicationWindow
{
[
GtkChild
]
[
GtkChild
]
unowned
Gtk
.
ScrolledWindow
scrolled_window
;
unowned
Gtk
.
ScrolledWindow
scrolled_window
;
...
@@ -36,7 +36,7 @@ namespace SwayNotificationCenter {
...
@@ -36,7 +36,7 @@ namespace SwayNotificationCenter {
private
const
int
MAX_HEIGHT
=
600
;
private
const
int
MAX_HEIGHT
=
600
;
p
ublic
Noti
Window
()
{
p
rivate
Notification
Window
()
{
if
(!
GtkLayerShell
.
is_supported
())
{
if
(!
GtkLayerShell
.
is_supported
())
{
stderr
.
printf
(
"GTKLAYERSHELL IS NOT SUPPORTED!\n"
);
stderr
.
printf
(
"GTKLAYERSHELL IS NOT SUPPORTED!\n"
);
stderr
.
printf
(
"Swaync only works on Wayland!\n"
);
stderr
.
printf
(
"Swaync only works on Wayland!\n"
);
...
@@ -123,21 +123,22 @@ namespace SwayNotificationCenter {
...
@@ -123,21 +123,22 @@ namespace SwayNotificationCenter {
public
void
close_all_notifications
()
{
public
void
close_all_notifications
()
{
if
(!
this
.
get_realized
())
return
;
if
(!
this
.
get_realized
())
return
;
foreach
(
var
w
in
box
.
get_children
())
{
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
// Remove notification and its destruction timeout
if
(
noti
!=
null
)
{
if
(
noti
!=
null
)
{
noti
.
remove_noti_timeout
();
noti
.
remove_noti_timeout
();
noti
.
destroy
();
noti
.
destroy
();
}
}
if
(!
get_realized
()
if
(!
replaces
||
!
get_mapped
()
&&
(!
get_realized
()
||
!(
get_child
()
is
Gtk
.
Widget
)
||
!
get_mapped
()
||
box
.
get_children
().
length
()
==
0
)
{
||
!(
get_child
()
is
Gtk
.
Widget
)
||
box
.
get_children
().
length
()
==
0
))
{
close
();
close
();
return
;
return
;
}
}
...
@@ -167,11 +168,11 @@ namespace SwayNotificationCenter {
...
@@ -167,11 +168,11 @@ namespace SwayNotificationCenter {
scroll_to_start
(
list_reverse
);
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
())
{
foreach
(
var
w
in
box
.
get_children
())
{
var
noti
=
(
Notification
)
w
;
var
noti
=
(
Notification
)
w
;
if
(
noti
!=
null
&&
noti
.
param
.
applied_id
==
id
)
{
if
(
noti
!=
null
&&
noti
.
param
.
applied_id
==
id
)
{
remove_notification
(
noti
);
remove_notification
(
noti
,
replaces
);
break
;
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