You are not logged in.
bunsen-utilities has been updated and bl-exit has changed significantly. I was able to change prior versions of bl-exit by adding
call("bl-lock")
under the
def suspend():
function(?).
So, under the new version of bl-exit, I've tried the following under the
def suspend_action(self, button):
function(?):
call("bl-lock")
--and--
self.call("bl-lock")
neither of which works. So, how can I incorporate bl-lock in the new bl-exit script?
Last edited by KrunchTime (2016-06-24 19:26:19)
Offline
Have you tried running bl-exit in a terminal, and seeing what error messages may be produced? For example, with 'call("bl-lock")' and clicking "Suspend", I get:
$ bl-exit
** Message: light-locker is not running
Last edited by damo (2016-06-23 20:10:15)
Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt «» BunsenLabs on DeviantArt
Offline
No, I have not.
Edit: OK, I've ran bl-exit from the command line and I'm getting the following errors, which are basically programming errors. I somewhat understand the errors, but not sure how to correct as I'm not a Python programmer.
with call("bl-exit"):
Traceback (most recent call last):
File "/usr/bin/bl-exit", line 318, in suspend_action
call("bl-lock")
NameError: global name 'call' is not defined
with self.call("bl-exit"):
Traceback (most recent call last):
File "/usr/bin/bl-exit", line 318, in suspend_action
self.call("bl-lock")
AttributeError: 'BlexitWindow' object has no attribute 'call'
Last edited by KrunchTime (2016-06-23 20:16:59)
Offline
You can also do
bl-exit --suspend
Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt «» BunsenLabs on DeviantArt
Offline
@KrunchTime,
Here is a patch that does what you requested.
Untested though.
Let me know if it does not work for you.
/h/m/tmp diff -u /usr/bin/bl-exit ./bl-exit.new
--- /usr/bin/bl-exit 2016-06-23 14:02:00.000000000 +0200
+++ ./bl-exit.new 2016-06-24 12:04:09.894717799 +0200
@@ -53,6 +53,11 @@
def do_action(self, action):
print("do_action: {}".format(action), file=sys.stderr)
+ if action == "Suspend":
+ try:
+ subprocess.call("bl-lock")
+ except OSError as e:
+ self.on_error(str(e))
self.send_dbus(action)
def send_dbus(self, method):
Edit:
Don't change the indentation. Indentation has meaning in python.
Offline
@xaos52: Thank you very much. It works like a charm. For the benefit of others who may want to do the same, I placed the patch under the BlexitBase class as follows:
def do_action(self, action):
print("do_action: {}".format(action), file=sys.stderr)
self.send_dbus(action)
def do_action(self, action):
print("do_action: {}".format(action), file=sys.stderr)
if action == "Suspend":
try:
subprocess.call("bl-lock")
except OSError as e:
self.on_error(str(e))
self.send_dbus(action)
def send_dbus(self, method):
try:
if self.dbus_iface is None:
self.setup_dbus_connection()
if method[:3] == "Can":
command = "self.dbus_iface.{}()".format(method)
else:
command = "self.dbus_iface.{}(['True'])".format(method)
response = eval(command)
return str(response)
except dbus.DBusException as e:
self.on_error(str(e))
Last edited by KrunchTime (2016-06-24 19:29:11)
Offline