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
5a23d5ee
Unverified
Commit
5a23d5ee
authored
Nov 28, 2023
by
peelz
Committed by
GitHub
Nov 28, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add notification hint to bypass dnd/inhibition (#334)
parent
ab46163f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
6 deletions
+23
-6
notiDaemon.vala
src/notiDaemon/notiDaemon.vala
+15
-6
notiModel.vala
src/notiModel/notiModel.vala
+8
-0
No files found.
src/notiDaemon/notiDaemon.vala
View file @
5a23d5ee
...
@@ -186,12 +186,20 @@ namespace SwayNotificationCenter {
...
@@ -186,12 +186,20 @@ namespace SwayNotificationCenter {
synchronous_ids
.
set
(
param
.
synchronous
,
id
);
synchronous_ids
.
set
(
param
.
synchronous
,
id
);
}
}
// Only show popup notification if it is ENABLED or TRANSIENT
bool
show_notification
=
state
==
NotificationStatusEnum
.
ENABLED
if
((
state
==
NotificationStatusEnum
.
ENABLED
||
state
==
NotificationStatusEnum
.
TRANSIENT
)
||
state
==
NotificationStatusEnum
.
TRANSIENT
;
&&
!
control_center
.
get_visibility
()
// Don't show the notification window if the control center is open
// Also check if urgency is Critical and not inhibited and dnd
if
(
control_center
.
get_visibility
())
{
&&
(
param
.
urgency
==
UrgencyLevels
.
CRITICAL
show_notification
=
false
;
||
(!
dnd
&&
!
swaync_daemon
.
inhibited
&&
param
.
urgency
!=
UrgencyLevels
.
CRITICAL
)))
{
}
bool
bypass_dnd
=
param
.
urgency
==
UrgencyLevels
.
CRITICAL
||
param
.
swaync_bypass_dnd
;
// Don't show the notification window if dnd or inhibited
if
(!
bypass_dnd
&&
(
dnd
||
swaync_daemon
.
inhibited
))
{
show_notification
=
false
;
}
if
(
show_notification
)
{
if
(
replace_notification
>
0
)
{
if
(
replace_notification
>
0
)
{
NotificationWindow
.
instance
.
replace_notification
(
replace_notification
,
param
);
NotificationWindow
.
instance
.
replace_notification
(
replace_notification
,
param
);
}
else
{
}
else
{
...
@@ -201,6 +209,7 @@ namespace SwayNotificationCenter {
...
@@ -201,6 +209,7 @@ namespace SwayNotificationCenter {
// Remove the old notification due to it not being replaced
// Remove the old notification due to it not being replaced
NotificationWindow
.
instance
.
close_notification
(
replace_notification
,
false
);
NotificationWindow
.
instance
.
close_notification
(
replace_notification
,
false
);
}
}
// Only add notification to CC if it isn't IGNORED and not transient/TRANSIENT
// Only add notification to CC if it isn't IGNORED and not transient/TRANSIENT
if
(
state
!=
NotificationStatusEnum
.
IGNORED
if
(
state
!=
NotificationStatusEnum
.
IGNORED
&&
state
!=
NotificationStatusEnum
.
TRANSIENT
&&
state
!=
NotificationStatusEnum
.
TRANSIENT
...
...
src/notiModel/notiModel.vala
View file @
5a23d5ee
...
@@ -110,6 +110,9 @@ namespace SwayNotificationCenter {
...
@@ -110,6 +110,9 @@ namespace SwayNotificationCenter {
/** Disables scripting for notification */
/** Disables scripting for notification */
public
bool
swaync_no_script
{
get
;
set
;
}
public
bool
swaync_no_script
{
get
;
set
;
}
/** Always show the notification, regardless of dnd/inhibit state */
public
bool
swaync_bypass_dnd
{
get
;
set
;
}
public
Array
<
Action
>
actions
{
get
;
set
;
}
public
Array
<
Action
>
actions
{
get
;
set
;
}
public
NotifyParams
(
uint32
applied_id
,
public
NotifyParams
(
uint32
applied_id
,
...
@@ -147,6 +150,11 @@ namespace SwayNotificationCenter {
...
@@ -147,6 +150,11 @@ namespace SwayNotificationCenter {
swaync_no_script
=
hint_value
.
get_boolean
();
swaync_no_script
=
hint_value
.
get_boolean
();
}
}
break
;
break
;
case
"SWAYNC_BYPASS_DND"
:
if
(
hint_value
.
is_of_type
(
VariantType
.
BOOLEAN
))
{
swaync_bypass_dnd
=
hint_value
.
get_boolean
();
}
break
;
case
"value"
:
case
"value"
:
if
(
hint_value
.
is_of_type
(
VariantType
.
INT32
))
{
if
(
hint_value
.
is_of_type
(
VariantType
.
INT32
))
{
this
.
has_synch
=
true
;
this
.
has_synch
=
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