Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
osdd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jiří Kalvoda
osdd
Commits
c7ecaa3c
Commit
c7ecaa3c
authored
2 years ago
by
Jiří Kalvoda
Browse files
Options
Downloads
Patches
Plain Diff
Not2osd using python lib
parent
9b49096a
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
not2osd
+6
-12
6 additions, 12 deletions
not2osd
with
6 additions
and
12 deletions
not2osd
+
6
−
12
View file @
c7ecaa3c
...
...
@@ -24,7 +24,7 @@ import dbus
import
dbus.service
import
dbus.mainloop.glib
import
os
import
subprocess
import
osd
import
sys
import
time
import
re
...
...
@@ -75,19 +75,12 @@ class NotificationFetcher(dbus.service.Object):
#print("expire_timeout", expire_timeout)
su
=
strip_tags
(
summary
[
0
:
300
]).
split
(
"
\n
"
)
bo
=
strip_tags
(
body
[
0
:
500
]).
split
(
"
\n
"
)
for
i
in
range
(
len
(
su
)):
if
su
[
i
]
!=
""
and
su
[
i
][
0
]
==
'
-
'
:
su
[
i
]
=
'
'
+
su
[
i
];
for
i
in
range
(
len
(
bo
)):
if
bo
[
i
]
!=
""
and
bo
[
i
][
0
]
==
'
-
'
:
bo
[
i
]
=
'
'
+
bo
[
i
];
for
i
in
range
(
len
(
bo
)):
if
bo
[
i
]
==
"
This site has been updated in the background.
"
:
return
notification_id
if
(
expire_timeout
<=
0
)
or
(
expire_timeout
>
20000
):
expire_timeout
=
5000
cmd
=
[
"
osdc
"
,
"
--duration=
"
+
str
(
expire_timeout
),
"
--min-duration=1000
"
,
"
--color=#99F
"
,
"
--outline-color=red
"
]
+
su
+
[
"
--outline-color=black
"
]
+
bo
subprocess
.
call
(
cmd
)
osd
.
notify
((
"
duration
"
,
str
(
expire_timeout
)),
(
"
outline_color
"
,
"
red
"
),
*
su
,
(
"
outline_color
"
,
"
black
"
),
*
bo
,
color
=
"
#99F
"
,
duration
=
str
(
expire_timeout
),
min_duration
=
"
1000
"
)
return
notification_id
@dbus.service.method
(
"
org.freedesktop.Notifications
"
,
in_signature
=
''
,
out_signature
=
'
as
'
)
...
...
@@ -106,6 +99,7 @@ class NotificationFetcher(dbus.service.Object):
def
GetServerInformation
(
self
):
return
(
"
statnot
"
,
"
http://code.k2h.se
"
,
"
0.0.2
"
,
"
1
"
)
if
__name__
==
'
__main__
'
:
dbus
.
mainloop
.
glib
.
DBusGMainLoop
(
set_as_default
=
True
)
session_bus
=
dbus
.
SessionBus
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment