-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwp
executable file
·54 lines (48 loc) · 1.76 KB
/
wp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# SetWall - Wallpaper manager
#
# Copyright (C) 2014 Cristian Andrei Calin <cristian.calin@outlook.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import dbus
import dbus.service
import sys
import os
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('Notify', '0.7')
gi.require_version('AppIndicator3', '0.1')
gi.require_version('Keybinder', '3.0')
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from wpm.application import *
# Import global constants
from wpm.globals import global_constants
if __name__ == '__main__':
try:
session_bus = dbus.SessionBus()
session_obj = session_bus.get_object(
"%s.%s" % (global_constants.BASE_ID, global_constants.APP_NAME),
"%s/%s" % (global_constants.APP_PATH, global_constants.APP_NAME)
)
if len(sys.argv) == 2:
exec("result = session_obj.%s()" % sys.argv[1])
elif len(sys.argv) > 2:
exec("result = session_obj.%s(\"%s\")" % (sys.argv[1], "\",\"".join(sys.argv[2:])))
if result is not None:
print(result)
except dbus.DBusException as e:
print("%s could not be contacted" % global_constants.APP_FRIENDLY_NAME)
print(e)
exit(1)