make nyxt sleeker

This commit is contained in:
Chris Cochrun 2021-09-25 06:59:26 -05:00
parent 72b6c49e94
commit c5d884ccb5
10 changed files with 247 additions and 109 deletions

32
scripts/swayprop Executable file
View file

@ -0,0 +1,32 @@
#!/bin/bash
ALL_NODES='recurse(.nodes[]?, .floating_nodes[]?) | select(.pid and .visible)'
WINDOW_NAME='(.app_id // .window_properties.class)'
ID_PREFIX='"\(.id):"'
WINDOW_PROTOCOL='(if .shell == "xwayland" then "X11" else "wayland" end)'
WINDOW_GEOMETRY='(.rect | "\(.x),\(.y) \(.width)x\(.height) ")'
WINDOW_PID='(.pid | tostring)'
# Output format, e.g. "1234 - 12:firefox (wayland)" or "5678 - 17:discord (X11)"
FORMAT="$WINDOW_PID + \" - \" + $ID_PREFIX + $WINDOW_NAME + \" (\" + $WINDOW_PROTOCOL + \")\""
FILT="$ALL_NODES | $WINDOW_GEOMETRY + $FORMAT"
function getprop() {
typeset -A views
local selected
while read POS GEOM INFO; do
views["$POS $GEOM"]="$INFO"
done
selected="$(printf "%s\n" "${!views[@]}" | slurp)"
if [[ -n "$selected" ]]; then
printf '%s\n' "${views[${selected}]}"
fi
}
if [[ "$1" == "wait" ]]; then
swaymsg -t subscribe '["workspace"]' | jq -r ".current | $FILT" | getprop
else
swaymsg -t get_tree | jq -r "$FILT" | getprop
fi