aboutsummaryrefslogtreecommitdiff
path: root/wmutils/bin/mon
diff options
context:
space:
mode:
authorxero <x@xero.nu>2017-01-22 23:22:55 -0500
committerxero <x@xero.nu>2017-01-22 23:22:55 -0500
commit5a4d4a06a287985fbf5b458056881d3d0a0c71aa (patch)
tree0daa8de87d60c396ca3dbadccbdfe735fc5f72d8 /wmutils/bin/mon
parent4d6c6b497c3e4d5d6bd4e7728f42303f23120f27 (diff)
downloaddotfiles_ascii-5a4d4a06a287985fbf5b458056881d3d0a0c71aa.tar.xz
dotfiles_ascii-5a4d4a06a287985fbf5b458056881d3d0a0c71aa.zip
add wmutils setup
Diffstat (limited to 'wmutils/bin/mon')
-rwxr-xr-xwmutils/bin/mon48
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