From 1cecfd4a0cbcf72317538d654eebbf9a54be5c8d Mon Sep 17 00:00:00 2001 From: Miles Alan Date: Mon, 25 May 2020 13:02:16 -0500 Subject: [PATCH] Implement selection mode toggle for St --- scripts/core/sxmo_appmenu.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/core/sxmo_appmenu.sh b/scripts/core/sxmo_appmenu.sh index 9026652..183def6 100755 --- a/scripts/core/sxmo_appmenu.sh +++ b/scripts/core/sxmo_appmenu.sh @@ -2,7 +2,8 @@ WIN=$(xdotool getwindowfocus) programchoicesinit() { - WMCLASS="${1:-$(xprop -id $(xdotool getactivewindow) | grep WM_CLASS | cut -d ' ' -f3-)}" + XPROPOUT="$(xprop -id $(xdotool getactivewindow))" + WMCLASS="${1:-$(echo "$XPROPOUT" | grep WM_CLASS | cut -d ' ' -f3-)}" # Default system menu (no matches) CHOICES="$(echo " @@ -69,10 +70,11 @@ programchoicesinit() { ")" && WINNAME=Mpv && return # St - echo $WMCLASS | grep -i "st-256color" && CHOICES="$(echo " + echo $WMCLASS | grep -i "st-256color" && STSELMODEON="$(echo "$XPROPOUT" | grep -E '^_ST_SELMODE.+=' | cut -d= -f2 | tr -d ' ')" && CHOICES="$(echo " Type complete ^ 0 ^ key Ctrl+Shift+u Copy complete ^ 0 ^ key Ctrl+Shift+i - Copy selection ^ 0 ^ key Ctrl+Shift+c + Selmode $([ $STSELMODEON == 1 ] && echo 'On → Off' || echo 'Off → On') ^ 0 ^ key Ctrl+Shift+s + $([ $STSELMODEON == 1 ] && echo 'Copy selection ^ 0 ^ key Ctrl+Shift+c') Paste ^ 0 ^ key Ctrl+Shift+v Zoom + ^ 1 ^ key Ctrl+Shift+Prior Zoom - ^ 1 ^ key Ctrl+Shift+Next