Fix map/unmap hooks

- Fix variable naming (remove _hook)
- Other minor stylistic changes (e.g. quotes)
break
noctuid 8 years ago
parent d3346ec81e
commit 428ee7c738

58
tdrop

@ -77,33 +77,32 @@ See man page for more details.
} }
# * Default Options and Option Parsing # * Default Options and Option Parsing
# xdotool can take percentages; cannot take decimal percentages though # xdotool can take percentages; cannot take decimal percentages though
width="100%" width="100%"
height="45%" height="45%"
xoff=0 xoff=0
yoff=2 yoff=2
session_name="" session_name=
num="" num=
pre_create="" pre_create=
post_create="" post_create=
pre_float="" pre_float=
post_float="" post_float=
pre_map="" pre_map=
post_map="" post_map=
pre_unmap="" pre_unmap=
post_unmap="" post_unmap=
dec_fix="" dec_fix=
subtract_when_same="" subtract_when_same=
is_floating="" is_floating=
program_flags="" program_flags=
clearwid=false clearwid=false
cancel_auto_show=true cancel_auto_show=true
auto_detect_wm=false auto_detect_wm=false
monitor_aware=false monitor_aware=false
wm="" wm=
user_set_wm=false user_set_wm=false
class="" class=
while getopts :h:w:x:y:s:n:c:C:l:L:p:P:u:U:d:f:-:am opt while getopts :h:w:x:y:s:n:c:C:l:L:p:P:u:U:d:f:-:am opt
do do
case $opt in case $opt in
@ -193,7 +192,7 @@ if [[ -n $dec_fix ]] && [[ ! $dec_fix =~ ^-?[0-9]+x-?[0-9]+$ ]]; then
fi fi
# non-user-settable global vars # non-user-settable global vars
wid="" wid=
# used for -m option; at first tdrop assumes that there is a focused window # used for -m option; at first tdrop assumes that there is a focused window
# on the current desktop; if there isn't (and the WM doesn't have some way to # on the current desktop; if there isn't (and the WM doesn't have some way to
# query the current monitor), this will be set to false, and tdrop will have to # query the current monitor), this will be set to false, and tdrop will have to
@ -203,7 +202,6 @@ wid=""
focused_window_exists=true focused_window_exists=true
# * Multiple Monitor Automatic Re-Sizing # * Multiple Monitor Automatic Re-Sizing
percent_of_total() { # percent total percent_of_total() { # percent total
awk "BEGIN {printf(\"%.0f\", 0.01*${1%\%}*$2)}" awk "BEGIN {printf(\"%.0f\", 0.01*${1%\%}*$2)}"
} }
@ -419,13 +417,13 @@ post_float() {
} }
pre_create() { pre_create() {
if [[ -n "$pre_create" ]]; then if [[ -n $pre_create ]]; then
eval "$pre_create" eval "$pre_create"
fi fi
} }
post_create() { post_create() {
if [[ -n "$post_create" ]]; then if [[ -n $post_create ]]; then
eval "$post_create" eval "$post_create"
fi fi
} }
@ -439,8 +437,8 @@ pre_map() {
pre_float pre_float
fi fi
fi fi
if [[ -n $pre_map_hook ]]; then if [[ -n $pre_map ]]; then
eval "$pre_map_hook" eval "$pre_map"
fi fi
} }
@ -449,26 +447,26 @@ map_and_post_map() {
map_and_reset_geometry map_and_reset_geometry
float=${1:-true} float=${1:-true}
if [[ $float != false ]]; then if [[ $float != false ]]; then
if [[ -n "$post_float" ]]; then if [[ -n $post_float ]]; then
eval "$post_float" eval "$post_float"
elif $auto_detect_wm; then elif $auto_detect_wm; then
post_float post_float
fi fi
fi fi
if [[ -n "$post_map_hook" ]]; then if [[ -n $post_map ]]; then
eval "$post_map_hook" eval "$post_map"
fi fi
} }
pre_unmap() { pre_unmap() {
if [[ -n "$pre_unmap_hook" ]]; then if [[ -n $pre_unmap ]]; then
eval "$pre_unmap_hook" eval "$pre_unmap"
fi fi
} }
post_unmap() { post_unmap() {
if [[ -n "$post_unmap_hook" ]]; then if [[ -n $post_unmap ]]; then
eval "$post_unmap_hook" eval "$post_unmap"
fi fi
} }

Loading…
Cancel
Save