diff options
| author | bozo.kopic <bozo.kopic@gmail.com> | 2020-06-22 18:35:08 +0200 |
|---|---|---|
| committer | bozo.kopic <bozo.kopic@gmail.com> | 2020-06-22 18:35:08 +0200 |
| commit | c2926f4be4a7b18649672c4f6f58f8978898932a (patch) | |
| tree | fda97d0577aae08fc983bc3db9d12f155840c84a /terminal.sh | |
| parent | a0bd7bdcb2241f5106d77fcebbc5d00e9088e7a3 (diff) | |
.
Diffstat (limited to 'terminal.sh')
| -rwxr-xr-x | terminal.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/terminal.sh b/terminal.sh new file mode 100755 index 0000000..2db68d3 --- /dev/null +++ b/terminal.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +CLASSNAME=scratchpad_term +RESIZE_CMD="resize set 100 ppt 100 ppt" +MOVE_CMD="move position 0 0" + +if ps -C i3 > /dev/null ; then + CMD=i3-msg + PROP=instance + RESIZE+=", resize shrink height 22 px" +elif ps -C sway > /dev/null ; then + CMD=swaymsg + PROP=app_id +else + exit 1 +fi + +$CMD -t get_tree | jq -e "[.. | .$PROP? | . == \"$CLASSNAME\"] | any" +[[ $? -ne 0 ]] && alacritty --class $CLASSNAME -e tmux new-session -A -s default + +$CMD [$PROP=\"$CLASSNAME\"] scratchpad show, $RESIZE_CMD, $MOVE_CMD |
