i3pyblocks.blocks.datetime¶
Blocks based on datetime.
Module Contents¶
Classes¶
Block that shows date and time for current location. |
-
class
i3pyblocks.blocks.datetime.DateTimeBlock(format_date: str = '%D', format_time: str = '%T', sleep: int = 1, **kwargs)¶ Bases:
i3pyblocks.blocks.PollingBlockBlock that shows date and time for current location.
This blocks alternates between Time and Date display by clicks in the Block. Keep in mind that
format_dateandformat_timenames are arbitrary and both formats have capacity to display both date and time.- Parameters
format_date – Format string when showing date. Uses strftime placeholders.
format_time – Format string when showing time. Uses strftime placeholders.
sleep – Sleep in seconds between each call to
run(). If you’re not showing seconds in this block it makes sense to increase this value.**kwargs – Extra arguments to be passed to
PollingBlockclass.
-
toggle_date_time(self) → None¶
-
async
click_handler(self, **_kwargs) → None¶ Callback called when a click event happens to this Block.
Each of this method arguments is from click events in i3bar protocol since they’re mapped directly (so a
{"x": 1}results in ax=1).- Parameters
x – X11 root window coordinates where the click occurred.
y – X11 root window coordinates where the click occurred.
button – X11 button ID (for example 1 to 3 for left/middle/right mouse button).
relative_x – Coordinates where the click occurred, with respect to the top left corner of the block.
relative_y – Coordinates where the click occurred, with respect to the top left corner of the block.
width – Width (in px) of the block.
height – Height (in px) of the block.
modifier – A list of the modifiers active when the click occurred. The order in which modifiers are listed is not guaranteed.
See also
i3pyblocks.types.MouseButtonhas the mapping of the available mouse button IDs.i3pyblocks.types.KeyModifierhas the mapping of the available modifiers.
-
async
run(self) → None¶ Main loop in PollingBlock.
This is the method that will be run at each X
sleepseconds.Since this is an abstract method, it should be overriden before usage.