[modules/caffeine] quotes
This commit is contained in:
parent
55a94ac770
commit
6ff8932c99
1 changed files with 9 additions and 9 deletions
|
@ -19,7 +19,7 @@ import bumblebee.engine
|
|||
class Module(bumblebee.engine.Module):
|
||||
def __init__(self, engine, config):
|
||||
super(Module, self).__init__(engine, config,
|
||||
bumblebee.output.Widget(full_text="")
|
||||
bumblebee.output.Widget(full_text='')
|
||||
)
|
||||
self._active = False
|
||||
self._xid = None
|
||||
|
@ -37,10 +37,10 @@ class Module(bumblebee.engine.Module):
|
|||
return missing
|
||||
|
||||
def _get_i3bar_xid(self):
|
||||
xid = bumblebee.util.execute("xdotool search --class \"i3bar\"").partition('\n')[0].strip()
|
||||
xid = bumblebee.util.execute('xdotool search --class \'i3bar\'').partition('\n')[0].strip()
|
||||
if xid.isdigit():
|
||||
return xid
|
||||
logging.warning("Module caffeine: xdotool couldn't get X window ID of \"i3bar\".")
|
||||
logging.warning('Module caffeine: xdotool couldn't get X window ID of \'i3bar\'.')
|
||||
return None
|
||||
|
||||
def _notify(self):
|
||||
|
@ -48,9 +48,9 @@ class Module(bumblebee.engine.Module):
|
|||
return
|
||||
|
||||
if self._active:
|
||||
bumblebee.util.execute("notify-send \"Consuming caffeine\"")
|
||||
bumblebee.util.execute('notify-send \'Consuming caffeine\'')
|
||||
else:
|
||||
bumblebee.util.execute("notify-send \"Out of coffee\"")
|
||||
bumblebee.util.execute('notify-send \'Out of coffee\'')
|
||||
|
||||
def _suspend_screensaver(self):
|
||||
self._xid = self._get_i3bar_xid()
|
||||
|
@ -60,7 +60,7 @@ class Module(bumblebee.engine.Module):
|
|||
pid = os.fork()
|
||||
if pid == 0:
|
||||
os.setsid()
|
||||
bumblebee.util.execute("xdg-screensaver suspend {}".format(self._xid))
|
||||
bumblebee.util.execute('xdg-screensaver suspend {}'.format(self._xid))
|
||||
os._exit(0)
|
||||
else:
|
||||
os.waitpid(pid, 0)
|
||||
|
@ -79,13 +79,13 @@ class Module(bumblebee.engine.Module):
|
|||
|
||||
def state(self, _):
|
||||
if self._active:
|
||||
return "activated"
|
||||
return "deactivated"
|
||||
return 'activated'
|
||||
return 'deactivated'
|
||||
|
||||
def _toggle(self, _):
|
||||
missing = self._check_requirements()
|
||||
if missing:
|
||||
logging.warning('Could not run caffeine - missing %s!', ", ".join(missing))
|
||||
logging.warning('Could not run caffeine - missing %s!', ', '.join(missing))
|
||||
return
|
||||
|
||||
self._active = not self._active
|
||||
|
|
Loading…
Reference in a new issue