wms/wms_termtogle.sh

19 lines
361 B
Bash
Raw Normal View History

2023-03-06 19:08:25 +01:00
#!/bin/bash
2023-03-07 14:01:29 +01:00
## toggle between terminals ##
2023-08-08 04:42:24 +02:00
. /tmp/wms_var
2023-03-06 19:08:25 +01:00
2024-01-21 04:05:04 +01:00
# terminal name.
TNAME=$(echo $TERMINAL | cut -d ' ' -f 1)
2023-03-06 19:08:25 +01:00
2024-01-21 04:05:04 +01:00
# print all windows, filter and target the first in stack.
2023-03-06 19:08:25 +01:00
TARGET=$(
2024-01-21 04:05:04 +01:00
for wid in $(lsw); do
2023-03-06 19:08:25 +01:00
printf '%s\n' "$wid $(atomx WM_CLASS $wid)"
done | grep "$TNAME" | cut -d ' ' -f 1 | head -n 1)
2024-01-21 04:05:04 +01:00
# focus terminal.
wms_mainrole.sh $TARGET
2023-03-06 19:08:25 +01:00