commit bbc74b7323db7cf09558374f84fad074d7d7c339 parent cc01c2f47a8f2f2253bf035061226cf2114fb026 Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Wed, 4 Nov 2020 11:05:32 +0100 add screenkey-toggle Diffstat:
A | .local/bin/screenkey-toggle | | | 21 | +++++++++++++++++++++ |
1 file changed, 21 insertions(+), 0 deletions(-)
diff --git a/.local/bin/screenkey-toggle b/.local/bin/screenkey-toggle @@ -0,0 +1,21 @@ +#!/bin/sh +composer=xcompmgr +screenkey="$(which screenkey)" + +die() +{ + printf '%s: error: %s\n' "${0##*/}" "$1" >&2 + exit 1 +} + +if pgrep -f "${screenkey}" >/dev/null 2>&1; then + if pgrep "${composer}" >/dev/null 2>&1; then + pkill "${composer}" + fi + pkill -f "${screenkey}" +else + if ! pgrep "${composer}" >/dev/null 2>&1; then + nohup "${composer}" >/dev/null 2>&1 & + fi + nohup "${screenkey}" --font-color red --opacity 0.0 >/dev/null 2>&1 & +fi