diff options
author | xero <x@xero.nu> | 2017-01-22 23:22:55 -0500 |
---|---|---|
committer | xero <x@xero.nu> | 2017-01-22 23:22:55 -0500 |
commit | 5a4d4a06a287985fbf5b458056881d3d0a0c71aa (patch) | |
tree | 0daa8de87d60c396ca3dbadccbdfe735fc5f72d8 /wmutils/bin/mon | |
parent | 4d6c6b497c3e4d5d6bd4e7728f42303f23120f27 (diff) | |
download | dotfiles_ascii-5a4d4a06a287985fbf5b458056881d3d0a0c71aa.tar.xz dotfiles_ascii-5a4d4a06a287985fbf5b458056881d3d0a0c71aa.zip |
add wmutils setup
Diffstat (limited to 'wmutils/bin/mon')
-rwxr-xr-x | wmutils/bin/mon | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/wmutils/bin/mon b/wmutils/bin/mon new file mode 100755 index 0000000..82b5f7d --- /dev/null +++ b/wmutils/bin/mon @@ -0,0 +1,48 @@ +#!/bin/sh +# +# ██████████ ██████ ███████ +# ░░██░░██░░██ ██░░░░██░░██░░░██ +# ░██ ░██ ░██░██ ░██ ░██ ░██ +# ░██ ░██ ░██░██ ░██ ░██ ░██ +# ███ ░██ ░██░░██████ ███ ░██ +# ░░░ ░░ ░░ ░░░░░░ ░░░ ░░ +# + +usage() { + echo "usage: $(basename $0) [-lr <id>]\n -l list monitor ids\n -r get resolution by id\n" >&2 + exit 1 +} + +list() { + mons=`xrandr | grep -e "^.* connected" | cut -d " " --field "1"` + for mon in $mons; do + echo "$mon" + done +} + +res() { + [ -z $1 ] && usage + res=`xrandr\ + | grep -e "^$1 connected"\ + | cut --delimiter=' ' --fields='3'\ + | sed "s/[x\+]/ /g"` + echo $res +} + +while getopts "lr:" opt +do + case $opt in + # list + l) + list + ;; + # res + r) + res $OPTARG + ;; + *) + usage + ;; + esac +done +[ -z $1 ] && usage |