Merge pull request #76 from ublue-os/rename-inhibit

fix(power-button-handler): Rename 'inhibit' string to 'systemd-inhibit'
This commit is contained in:
Kyle Gospodnetich 2023-07-26 21:22:22 -07:00 committed by GitHub
commit d5418f5ed0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,23 +19,23 @@ for device in devices:
longpresstimer = None longpresstimer = None
inhibit = ['systemd-inhibit', systemd-inhibit = ['systemd-inhibit',
'--what=handle-power-key:handle-suspend-key:handle-hibernate-key', '--what=handle-power-key:handle-suspend-key:handle-hibernate-key',
'sleep', 'sleep',
'infinity'] 'infinity']
def inhibit(): def inhibit():
for proc in psutil.process_iter(): for proc in psutil.process_iter():
if inhibit == proc.cmdline(): if systemd-inhibit == proc.cmdline():
return return
print ( "Starting inhibitor" ) print ( "Starting inhibitor" )
with daemon.DaemonContext(): with daemon.DaemonContext():
subprocess.call(inhibit) subprocess.call(systemd-inhibit)
def uninhibit(): def uninhibit():
print ( "Stopping inhibitor" ) print ( "Stopping inhibitor" )
subprocess.call(['pkill', '-f', ' '.join(inhibit)]) subprocess.call(['pkill', '-f', ' '.join(systemd-inhibit)])
def longpress(): def longpress():
os.system( "~/.steam/root/ubuntu12_32/steam -ifrunning steam://longpowerpress" ) os.system( "~/.steam/root/ubuntu12_32/steam -ifrunning steam://longpowerpress" )