mirror of
https://github.com/starr-dusT/dotfiles.git
synced 2025-02-19 19:27:31 -08:00
21 lines
563 B
Bash
21 lines
563 B
Bash
#!/bin/sh
|
|
|
|
SCREEN_POS=$(swaymsg -t get_outputs \
|
|
| jq -r \
|
|
'.[] | select(.focused).rect | "\(.width)x\(.height)\\+\(.x)\\+\(.y)"')
|
|
|
|
# ripgrep
|
|
XWAYLAND_OUTPUT=$(xrandr | rg -oP "[A-Z]+[0-9]+(?= [a-z]+ $SCREEN_POS)")
|
|
|
|
MONITOR_ID=$(rofi --help | rg $XWAYLAND_OUTPUT -B1 \
|
|
| sed -sr '/ID/!d;s/[^:]*:\s([0-9])/\1/')
|
|
|
|
# GNU grep
|
|
#XWAYLAND_OUTPUT=$(xrandr | grep -oP "[A-Z]+[0-9]+(?= connected $SCREEN_POS)
|
|
|
|
#MONITOR_ID=$(rofi --help | grep $XWAYLAND_OUTPUT -B1 \
|
|
#| sed -sr '/ID/!d;s/[^:]*:\s([0-9])/\1/')
|
|
|
|
# stdin for dmenu mode
|
|
rofi -m $MONITOR_ID $@ </dev/stdin
|