aboutsummaryrefslogtreecommitdiff
path: root/src/usr/share
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2020-03-11 12:35:10 -0400
committerB Stack <bgstack15@gmail.com>2020-03-11 12:35:10 -0400
commitbe87206a369b09e595e498504eef1540e2c91c41 (patch)
treee753e64e7ca90b1dc0eab2b6afa4cd92ccab50c3 /src/usr/share
parentadd initial debuild stuff (diff)
downloadlogout-manager-be87206a369b09e595e498504eef1540e2c91c41.tar.gz
logout-manager-be87206a369b09e595e498504eef1540e2c91c41.tar.bz2
logout-manager-be87206a369b09e595e498504eef1540e2c91c41.zip
use alternatives, and actually run commands
Diffstat (limited to 'src/usr/share')
-rw-r--r--src/usr/share/logout-manager/lmlib.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/usr/share/logout-manager/lmlib.py b/src/usr/share/logout-manager/lmlib.py
index 7c9dc1e..40ee3a0 100644
--- a/src/usr/share/logout-manager/lmlib.py
+++ b/src/usr/share/logout-manager/lmlib.py
@@ -13,36 +13,45 @@
# Improve:
# Documentation:
-import configparser, platform, os
+import configparser, platform, os, subprocess
logout_manager_version="2020-03-10a"
class Actions:
+ def __take_action(command):
+ print(command)
+ command=str(command).split()
+ command2=[]
+ for i in command:
+ command2.append(str(i.strip('"')))
+ command=command2
+ subprocess.run(command)
+
@staticmethod
def hibernate(config, event=None):
#print("need to run the /sys/power/state trick, if available")
- print(config.get_hibernate_command())
+ Actions.__take_action(config.get_hibernate_command())
@staticmethod
def lock(config, event=None):
#print("please lock the screen.")
- print(config.get_lock_command())
+ Actions.__take_action(config.get_lock_command())
@staticmethod
def logout(config, event=None):
#print("please log out of current session!")
- print(config.get_logout_command())
+ Actions.__take_action(config.get_logout_command())
@staticmethod
def reboot(config, event=None):
#print("please reboot.")
- print(config.get_reboot_command())
+ Actions.__take_action(config.get_reboot_command())
@staticmethod
def shutdown(config, event=None):
#print("please shut yourself down!")
- print(config.get_shutdown_command())
+ Actions.__take_action(config.get_shutdown_command())
class Config:
def __init__(self):
bgstack15