From 5a4d4a06a287985fbf5b458056881d3d0a0c71aa Mon Sep 17 00:00:00 2001 From: xero Date: Sun, 22 Jan 2017 23:22:55 -0500 Subject: add wmutils setup --- wmutils/bin/mon | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 wmutils/bin/mon (limited to 'wmutils/bin/mon') 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 ]\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 -- cgit v1.2.1