From e0cff05b0c3ad73794b9ace40e212511f4f3907d Mon Sep 17 00:00:00 2001 From: Maarten van Gompel Date: Sun, 28 Mar 2021 22:15:25 +0200 Subject: [PATCH] compatibility with megapixels 0.16: power button takes a picture instead of toggling the keyboard, only when megapixels is active --- scripts/core/sxmo_powerbutton.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/core/sxmo_powerbutton.sh b/scripts/core/sxmo_powerbutton.sh index b63de09..1cdb4bb 100755 --- a/scripts/core/sxmo_powerbutton.sh +++ b/scripts/core/sxmo_powerbutton.sh @@ -7,5 +7,11 @@ if [ -x "$XDG_CONFIG_HOME/sxmo/hooks/powerbutton" ]; then "$XDG_CONFIG_HOME/sxmo/hooks/powerbutton" else - sxmo_keyboard.sh toggle + XPROPOUT="$(xprop -id "$(xdotool getactivewindow)")" + WMCLASS="${1:-$(echo "$XPROPOUT" | grep WM_CLASS | cut -d ' ' -f3-)}" + if echo "$WMCLASS" | grep -i "megapixels"; then + xdotool key --clearmodifiers "space" + else + sxmo_keyboard.sh toggle + fi fi