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
afdbd906
Commit
afdbd906
authored
4 years ago
by
Jiří Kalvoda
Browse files
Options
Downloads
Patches
Plain Diff
not2osd is now python3!
parent
2c61364e
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
+11
-66
11 additions, 66 deletions
not2osd
with
11 additions
and
66 deletions
not2osd
+
11
−
66
View file @
afdbd906
#!/usr/bin/env python
2
#!/usr/bin/env python
3
#
#
# not2osd - Bridge from DBus notifications to osd
# not2osd - Bridge from DBus notifications to osd
...
@@ -23,14 +23,12 @@
...
@@ -23,14 +23,12 @@
import
dbus
import
dbus
import
dbus.service
import
dbus.service
import
dbus.mainloop.glib
import
dbus.mainloop.glib
import
gobject
import
os
import
os
import
subprocess
import
subprocess
import
sys
import
sys
import
thread
import
time
import
time
from
htmlentitydefs
import
name2codepoint
as
n2cp
import
re
import
re
from
gi.repository
import
GObject
as
gobject
...
@@ -68,15 +66,15 @@ class NotificationFetcher(dbus.service.Object):
...
@@ -68,15 +66,15 @@ class NotificationFetcher(dbus.service.Object):
out_signature
=
'
u
'
)
out_signature
=
'
u
'
)
def
Notify
(
self
,
app_name
,
notification_id
,
app_icon
,
def
Notify
(
self
,
app_name
,
notification_id
,
app_icon
,
summary
,
body
,
actions
,
hints
,
expire_timeout
):
summary
,
body
,
actions
,
hints
,
expire_timeout
):
print
"
app_name
"
,
app_name
#
print
(
"app_name", app_name
)
print
"
notification_id
"
,
notification_id
#
print
(
"notification_id", notification_id
)
print
"
app_icon
"
,
app_icon
#
print
(
"app_icon", app_icon
)
print
"
summary
"
,
summary
#
print
(
"summary", summary
)
print
"
body
"
,
body
#
print
(
"body", body
)
print
"
actions
"
,
actions
#
print
(
"actions", actions
)
print
"
expire_timeout
"
,
expire_timeout
#
print
(
"expire_timeout", expire_timeout
)
su
=
strip_tags
(
unicode
(
summary
)).
split
(
"
\n
"
)
su
=
strip_tags
((
summary
)).
split
(
"
\n
"
)
bo
=
strip_tags
(
unicode
(
body
)).
split
(
"
\n
"
)
bo
=
strip_tags
((
body
)).
split
(
"
\n
"
)
for
i
in
range
(
len
(
su
)):
for
i
in
range
(
len
(
su
)):
if
su
[
i
]
!=
""
and
su
[
i
][
0
]
==
'
-
'
:
if
su
[
i
]
!=
""
and
su
[
i
][
0
]
==
'
-
'
:
su
[
i
]
=
'
'
+
su
[
i
];
su
[
i
]
=
'
'
+
su
[
i
];
...
@@ -119,59 +117,6 @@ class NotificationFetcher(dbus.service.Object):
...
@@ -119,59 +117,6 @@ class NotificationFetcher(dbus.service.Object):
return
(
"
statnot
"
,
"
http://code.k2h.se
"
,
"
0.0.2
"
,
"
1
"
)
return
(
"
statnot
"
,
"
http://code.k2h.se
"
,
"
0.0.2
"
,
"
1
"
)
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
for
curarg
in
sys
.
argv
[
1
:]:
if
curarg
in
(
'
-v
'
,
'
--version
'
):
#print "%s CURVERSION" % sys.argv[0]
sys
.
exit
(
1
)
elif
curarg
in
(
'
-h
'
,
'
--help
'
):
#print " Usage: %s [-h] [--help] [-v] [--version] [configuration file]" % sys.argv[0]
#print " -h, --help: Print this help and exit"
#print " -v, --version: Print version and exit"
#print ""
#print " Configuration:"
#print " A file can be read to set the configuration."
#print " This configuration file must be written in valid python,"
#print " which will be read if the filename is given on the command line."
#print " You do only need to set the variables you want to change, and can"
#print " leave the rest out."
#print ""
##print " Below is an example of a configuration which sets the defaults."
#print ""
#print " # Default time a notification is show, unless specified in notification"
#print " DEFAULT_NOTIFY_TIMEOUT = 3000 # milliseconds"
#print " "
#print " # Maximum time a notification is allowed to show"
###print " MAX_NOTIFY_TIMEOUT = 5000 # milliseconds"
#print " "
#print " # Maximum number of characters in a notification. "
#print " NOTIFICATION_MAX_LENGTH = 100 # number of characters"
#print " "
#print " # Time between regular status updates"
#print " STATUS_UPDATE_INTERVAL = 2.0 # seconds"
#print " "
##print " # Command to fetch status text from. We read from stdout."
#print " # Each argument must be an element in the array"
##print " # os must be imported to use os.getenv"
##print " import os"
#print " STATUS_COMMAND = ['/bin/sh', '%s/.statusline.sh' % os.getenv('HOME')] "
##print ""
#print " # Always show text from STATUS_COMMAND? If false, only show notifications"
#print " USE_STATUSTEXT=True"
#print " "
#print " # Put incoming notifications in a queue, so each one is shown."
#print " # If false, the most recent notification is shown directly."
#print " QUEUE_NOTIFICATIONS=True"
#print " "
#print " # update_text(text) is called when the status text should be updated"
#print " # If there is a pending notification to be formatted, it is appended as"
#print " # the final argument to the STATUS_COMMAND, e.g. as $1 in default shellscript"
##print ""
#print " # dwm statusbar update"
#print " import subprocess"
#print " def update_text(text):"
#print " subprocess.call(['xsetroot', '-name', text])"
sys
.
exit
(
1
)
dbus
.
mainloop
.
glib
.
DBusGMainLoop
(
set_as_default
=
True
)
dbus
.
mainloop
.
glib
.
DBusGMainLoop
(
set_as_default
=
True
)
session_bus
=
dbus
.
SessionBus
()
session_bus
=
dbus
.
SessionBus
()
name
=
dbus
.
service
.
BusName
(
"
org.freedesktop.Notifications
"
,
session_bus
)
name
=
dbus
.
service
.
BusName
(
"
org.freedesktop.Notifications
"
,
session_bus
)
...
...
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