i3pyblocks.blocks.x11
Blocks related to X11, based on python-xlib.
Blocks dedicated to control some X11 features. For example, CaffeineBlock
shows the state of DPMS and screensaver and allow you to toggle DPMS between
ON and OFF.
Since query python-xlib calls are blocking, we execute than in a
ThreadPoolExecutor to avoid locking up the i3pyblocks. Since most X11 calls
do not take much time, this event should be rare, but it is better to be safe
(and correct!) than sorry.
Module Contents
Classes
Block that controls of X11 DPMS and screensaver. |
- class i3pyblocks.blocks.x11.CaffeineBlock(format_on: str = 'CAFFEINE ON', format_off: str = 'CAFFEINE OFF', sleep: int = 3, **kwargs)
Bases:
i3pyblocks.blocks.PollingSyncBlockBlock that controls of X11 DPMS and screensaver.
When turned on, this blocks disables both DPMS and screensaver, effectively, keeping your screen on. When it is turned off this block re-enables both DPMS and screensaver. This is very similar to Caffeine extension in Gnome, or Amphetamine on macOS.
- Parameters
format_on – format string to shown when DPMS and screensaver is off.
format_off – format string to shown when DPMS and screensaver is on.
sleep – Sleep in seconds between each call to
run().**kwargs – Extra arguments to be passed to
PollingBlockclass.
- get_state(self) bool
- click_handler_sync(self, **_kwargs) None
- run_sync(self) None