Super hacky shell wrapper around lemonbar that aims to poll as little as possible, minimising bar updates to the screen and reduce resource usage.
git clone https://mcol.xyz/code/lemontools
Log | Files | Refs | README | LICENSE

commit 925b2a4f6be20a7d09867067b67206e3a56f5ead
parent f48275c93cfe2311b7c84e9664eb5724c3696aca
Author: mcol <mcol@posteo.net>
Date:   Sat, 16 Feb 2019 00:54:20 +0000

added xwinctl module

Diffstat:
Amodules/xwinctl | 53+++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+), 0 deletions(-)

diff --git a/modules/xwinctl b/modules/xwinctl @@ -0,0 +1,53 @@ +#---------------------------------------------------------------------------------- +# X window control module +#---------------------------------------------------------------------------------- + +# This displays three buttons which have different click events +# +# Settings: +# $xwinctl_pad : pixel padding to put between the icons. (Default: '10') +# $xwinctl_format : format string. Default below +# $xwinctl_button_l, xwinctl_button_c, xwinctl_button_r : button text. Default below +# +# Clicks: +# $click_xwinctl_l, $click_xwinctl_c, $click_xwinctl_r should be specified +# like normal click variables + + +_xwinctl() { + get_clicks xwinctl_l + get_clicks xwinctl_c + get_clicks xwinctl_r + + # default format - $xwinctl_buttons is replaced by the formatted icons and + # click strings + [[ -z "$xwinctl_format" ]] && + xwinctl_format='${pad}${xwinctl_buttons}${pad}' + + # default buttons + [[ -z "$xwinctl_button_l" ]] && + xwinctl_button_l= + [[ -z "$xwinctl_button_c" ]] && + xwinctl_button_c= + [[ -z "$xwinctl_button_r" ]] && + xwinctl_button_r= + + # add click strings + xwinctl_button_l=${xwinctl_l_pre}$xwinctl_button_l${xwinctl_l_post} + xwinctl_button_c=${xwinctl_c_pre}$xwinctl_button_c${xwinctl_c_post} + xwinctl_button_r=${xwinctl_r_pre}$xwinctl_button_r${xwinctl_r_post} + + # convert integer into lemonbar spacing text (default 10) + xwinctl_pad=%{O${xwinctl_pad:-10}} + + # combine all of the above + xwinctl_buttons=${xwinctl_button_l}${xwinctl_pad} + xwinctl_buttons=${xwinctl_buttons}${xwinctl_button_c}${xwinctl_pad} + xwinctl_buttons=${xwinctl_buttons}${xwinctl_button_r} + xwinctl_format=$(eval echo $xwinctl_format) + + # pipe to fifo + echo "xwinctl='$xwinctl_format'" > $fifo 2>> $log & +} + +# vim: ft=sh