diff options
| author | Robert Günzler <r@gnzler.io> | 2023-07-08 05:37:51 +0900 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2023-07-08 05:38:36 +0900 |
| commit | fbbea1e4a92bbd96c4db33c50a9c441a5f844af1 (patch) | |
| tree | b07670fbefcdd7fb6312f0e2a027a0afc0e99077 /bin/modemenu | |
| parent | 1a220f1578ce0e18cffff97ae8ba68d6a4dfea4d (diff) | |
bin: update menus
Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to 'bin/modemenu')
| -rwxr-xr-x | bin/modemenu | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/bin/modemenu b/bin/modemenu new file mode 100755 index 0000000..64ef18e --- /dev/null +++ b/bin/modemenu @@ -0,0 +1,34 @@ +#!/bin/bash +set -e +[ -n "$DEBUG" ] && set -x + +get_output() { + swaymsg -t get_outputs | + jq -cr '.[] | select(.type=="output") | [.name, .make + " " + .model] | @tsv' | + menu --accept-single | + cut -d $'\t' -f 1 +} + +list_modes() { + local output=$1 + swaymsg -t get_outputs | + jq -cr --arg name "$output" '.[] | select(.type=="output" and .name==$name) | .modes[] | [([.width, "x", .height, "@", .refresh, "Hz"]|join("")), .picture_aspect_ratio // ""] | @tsv' +} + +output=$(get_output) + +mode=$( ( + list_modes "$output" + echo -e "\tset scale..." +) | column -t -s $'\t' | + menu) + +case "$mode" in +*"set scale"*) + scale=$(echo -e "1.0\n1.5\n2.0" | MENU_PROMPT="set scale" menu) + exec swaymsg output "$output" scale "$scale" + ;; +*) + exec swaymsg output "$output" mode "$mode" + ;; +esac |