From 3c526fc058e0c31edcf8597316c8618d5b7dbf74 Mon Sep 17 00:00:00 2001 From: Aire-One Date: Tue, 17 Apr 2018 02:12:55 +0200 Subject: [PATCH 1/2] Fix -a option wrong concatenation of arguments. --- awmtt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awmtt.sh b/awmtt.sh index 9d209a2..3f542d2 100644 --- a/awmtt.sh +++ b/awmtt.sh @@ -217,7 +217,7 @@ parse_options() { [[ ! "$D" =~ ^[0-9] ]] && errorout "$D is not a valid display number";; -N|--notest) RC_FILE="$HOME"/.config/awesome/rc.lua;; -S|--size) shift; SIZE="$1";; - -a|--aopt) shift; AWESOME_OPTIONS+="$1";; + -a|--aopt) shift; AWESOME_OPTIONS+="$1 ";; -x|--xopts) shift; XEPHYR_OPTIONS="$@";; -h|--help) usage;; *) args+=("$1");; From 299912f6aa7a3744db9e47da7c3f150b25bf6883 Mon Sep 17 00:00:00 2001 From: Aire-One Date: Tue, 4 Sep 2018 17:04:45 +0200 Subject: [PATCH 2/2] Change test file detection regex --- awmtt.sh | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) mode change 100644 => 100755 awmtt.sh diff --git a/awmtt.sh b/awmtt.sh old mode 100644 new mode 100755 index 3f542d2..3228b6f --- a/awmtt.sh +++ b/awmtt.sh @@ -13,7 +13,7 @@ awmtt theme (get | set | list | random) [-N] Arguments: start Spawn nested Awesome via Xephyr stop Stops the last Xephyr process - all Stop all instances of Xephyr + all Stop all instances of Xephyr restart Restart all instances of Xephyr run Run a command inside a Xephyr instance (specify which one with -D) theme Some basic theming control via: @@ -21,7 +21,7 @@ Arguments: set Set theme to list List available themes random Set a random theme - + Options: -B|--binary Specify path to awesome binary (for testing custom awesome builds) -C|--config Specify configuration file @@ -32,7 +32,7 @@ Options: -a|--aopt Pass option to awesome binary (e.g. --no-argb or --check). Can be repeated. -x|--xopts Pass options to xephyr binary (e.g. -keybd ephyr,,,xkblayout=de). Needs to be last. -h|--help Show this help text and exit - + Examples: awmtt start (uses defaults: -C $HOME/.config/awesome/rc.lua.test -D 1 -S 1024x640) awmtt start -C /etc/xdg/awesome/rc.lua -D 3 -S 1280x800 @@ -74,7 +74,7 @@ fi #{{{ Hostname Check - this is probably only useful for me. I have the same rc.lua running on two different machines HOSTNAME=$(uname -n) #}}} - + #{{{ Functions #{{{ Start function start() { @@ -85,14 +85,15 @@ start() { break; fi; done - + "$XEPHYR" :$D -name xephyr_$D -ac -br -noreset -screen "$SIZE" $XEPHYR_OPTIONS >/dev/null 2>&1 & sleep 1 DISPLAY=:$D.0 "$AWESOME" -c "$RC_FILE" $AWESOME_OPTIONS & sleep 1 - + # print some useful info - if [[ "$RC_FILE" =~ .test$ ]]; then + # test files are detected by a .test or -testrc.lua endding + if [[ "$RC_FILE" =~ .test$ || "$RC_FILE" =~ -testrc.lua$ ]]; then echo "Using a test file ($RC_FILE)" else echo "Caution: NOT using a test file ($RC_FILE)" @@ -142,13 +143,13 @@ theme() { else ls /usr/share/awesome/themes "$HOME"/.config/awesome/themes fi - } + } case "$1" in l|list) theme_list exit 0 ;; esac - + # Check for Beautiful library BEAUTIFUL=$(grep -c 'beautiful.init' "$RC_FILE") [[ "$BEAUTIFUL" -ge 1 ]] || errorout 'Could not detect theme library "beautiful". Exiting.' @@ -160,7 +161,7 @@ theme() { else curtheme=$(grep -oP "[^\/]+(?=\/theme.lua)" "$RC_FILE") fi - + # Change theme theme_set() { if [[ "$HOSTNAME" == laptop ]]; then @@ -192,7 +193,7 @@ theme() { theme_set D=11 && start } - + case "$1" in g|get) theme_get;; s|set) theme_set "${args[@]}";; @@ -228,7 +229,7 @@ parse_options() { #}}} #}}} -#{{{ Main +#{{{ Main main() { case "$input" in start) start "${args[@]}";;