Skip to content
Snippets Groups Projects
Commit 3d3a3bd3 authored by Pavel Kácha's avatar Pavel Kácha
Browse files

Convert subprocess to i3 exec call

parent 4306feb7
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,6 @@ import glob
from operator import itemgetter
import ipc
import alsaaudio
import subprocess
battery_warn = 5
battery_poweroff = 3
......@@ -144,9 +143,9 @@ def main(argv=None):
batt_perc_overall = max(batt_percs)
if batt_perc_overall<=battery_warn and int(batt_perc_overall)<int(last_batt_perc):
last_batt_perc = batt_perc_overall
subprocess.call(["i3-nagbar", "-m", "Battery low (%s)" % ", ".join("%s%%" % p for p in batt_percs)], stdin=DEVNULL, stdout=DEVNULL)
i3command.command(ipc.COMMAND, 'exec i3-nagbar -m "Battery low (%s)"' % ' '.join("%s%%" % p for p in batt_percs))
if batt_perc_overall<=battery_poweroff:
subprocess.call(["/usr/sbin/poweroff"], stdin=DEVNULL, stdout=DEVNULL)
i3command.command(ipc.COMMAND, 'exec /usr/sbin/poweroff')
# Date/time
out.append({"name": "datetime", "full_text": datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"), "color": "#%06x" % color})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment