|
|
@ -101,70 +101,70 @@ name=
|
|
|
|
while getopts :h:w:x:y:s:n:c:C:l:L:p:P:u:U:d:f:-:amt opt
|
|
|
|
while getopts :h:w:x:y:s:n:c:C:l:L:p:P:u:U:d:f:-:amt opt
|
|
|
|
do
|
|
|
|
do
|
|
|
|
case $opt in
|
|
|
|
case $opt in
|
|
|
|
h) height=$OPTARG;;
|
|
|
|
h) height=$OPTARG;;
|
|
|
|
w) width=$OPTARG;;
|
|
|
|
w) width=$OPTARG;;
|
|
|
|
x) xoff=$OPTARG;;
|
|
|
|
x) xoff=$OPTARG;;
|
|
|
|
y) yoff=$OPTARG;;
|
|
|
|
y) yoff=$OPTARG;;
|
|
|
|
s) session_name=$OPTARG;;
|
|
|
|
s) session_name=$OPTARG;;
|
|
|
|
n) num=$OPTARG;;
|
|
|
|
n) num=$OPTARG;;
|
|
|
|
c) pre_create=$OPTARG;;
|
|
|
|
c) pre_create=$OPTARG;;
|
|
|
|
C) post_create=$OPTARG;;
|
|
|
|
C) post_create=$OPTARG;;
|
|
|
|
l) pre_float=$OPTARG;;
|
|
|
|
l) pre_float=$OPTARG;;
|
|
|
|
L) post_float=$OPTARG;;
|
|
|
|
L) post_float=$OPTARG;;
|
|
|
|
p) pre_map=$OPTARG;;
|
|
|
|
p) pre_map=$OPTARG;;
|
|
|
|
P) post_map=$OPTARG;;
|
|
|
|
P) post_map=$OPTARG;;
|
|
|
|
u) pre_unmap=$OPTARG;;
|
|
|
|
u) pre_unmap=$OPTARG;;
|
|
|
|
U) post_unmap=$OPTARG;;
|
|
|
|
U) post_unmap=$OPTARG;;
|
|
|
|
d) dec_fix=$OPTARG;;
|
|
|
|
d) dec_fix=$OPTARG;;
|
|
|
|
S) subtract_when_same=false;;
|
|
|
|
S) subtract_when_same=false;;
|
|
|
|
i) is_floating=$OPTARG;;
|
|
|
|
i) is_floating=$OPTARG;;
|
|
|
|
f) program_flags=$OPTARG;;
|
|
|
|
f) program_flags=$OPTARG;;
|
|
|
|
a) auto_detect_wm=true;;
|
|
|
|
a) auto_detect_wm=true;;
|
|
|
|
m) monitor_aware=true;;
|
|
|
|
m) monitor_aware=true;;
|
|
|
|
t) pointer_monitor_detection=true;;
|
|
|
|
t) pointer_monitor_detection=true;;
|
|
|
|
-)
|
|
|
|
-)
|
|
|
|
if [[ $OPTARG =~ ^(auto-detect-wm|monitor-aware|pointer-monitor-detection|clear|no-cancel|help)$ ]] || \
|
|
|
|
if [[ $OPTARG =~ ^(auto-detect-wm|monitor-aware|pointer-monitor-detection|clear|no-cancel|help)$ ]] || \
|
|
|
|
[[ $OPTARG == *=* ]]; then
|
|
|
|
[[ $OPTARG == *=* ]]; then
|
|
|
|
OPTION=${OPTARG%%=*}
|
|
|
|
OPTION=${OPTARG%%=*}
|
|
|
|
OPTARG=${OPTARG#*=}
|
|
|
|
OPTARG=${OPTARG#*=}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
OPTION=$OPTARG
|
|
|
|
OPTION=$OPTARG
|
|
|
|
# shellcheck disable=SC2124
|
|
|
|
# shellcheck disable=SC2124
|
|
|
|
OPTARG=${@:$OPTIND:1}
|
|
|
|
OPTARG=${@:$OPTIND:1}
|
|
|
|
((OPTIND++))
|
|
|
|
((OPTIND++))
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
case $OPTION in
|
|
|
|
case $OPTION in
|
|
|
|
height) height=$OPTARG;;
|
|
|
|
height) height=$OPTARG;;
|
|
|
|
width) width=$OPTARG;;
|
|
|
|
width) width=$OPTARG;;
|
|
|
|
x-offset) xoff=$OPTARG;;
|
|
|
|
x-offset) xoff=$OPTARG;;
|
|
|
|
y-offset) yoff=$OPTARG;;
|
|
|
|
y-offset) yoff=$OPTARG;;
|
|
|
|
session) session_name=$OPTARG;;
|
|
|
|
session) session_name=$OPTARG;;
|
|
|
|
number) num=$OPTARG;;
|
|
|
|
number) num=$OPTARG;;
|
|
|
|
pre-create-hook) pre_create=$OPTARG;;
|
|
|
|
pre-create-hook) pre_create=$OPTARG;;
|
|
|
|
post-create-hook) post_create=$OPTARG;;
|
|
|
|
post-create-hook) post_create=$OPTARG;;
|
|
|
|
pre-map-float-command) pre_float=$OPTARG;;
|
|
|
|
pre-map-float-command) pre_float=$OPTARG;;
|
|
|
|
post-map-float-command) post_float=$OPTARG;;
|
|
|
|
post-map-float-command) post_float=$OPTARG;;
|
|
|
|
pre-map-hook) pre_map=$OPTARG;;
|
|
|
|
pre-map-hook) pre_map=$OPTARG;;
|
|
|
|
post-map-hook) post_map=$OPTARG;;
|
|
|
|
post-map-hook) post_map=$OPTARG;;
|
|
|
|
pre-unmap-hook) pre_unmap=$OPTARG;;
|
|
|
|
pre-unmap-hook) pre_unmap=$OPTARG;;
|
|
|
|
post-unmap-hook) post_unmap=$OPTARG;;
|
|
|
|
post-unmap-hook) post_unmap=$OPTARG;;
|
|
|
|
decoration-fix) dec_fix=$OPTARG;;
|
|
|
|
decoration-fix) dec_fix=$OPTARG;;
|
|
|
|
no-subtract-when-same) subtract_when_same=false;;
|
|
|
|
no-subtract-when-same) subtract_when_same=false;;
|
|
|
|
is-floating) is_floating=$OPTARG;;
|
|
|
|
is-floating) is_floating=$OPTARG;;
|
|
|
|
program-flags) program_flags=$OPTARG;;
|
|
|
|
program-flags) program_flags=$OPTARG;;
|
|
|
|
auto-detect-wm) auto_detect_wm=true;;
|
|
|
|
auto-detect-wm) auto_detect_wm=true;;
|
|
|
|
monitor-aware) monitor_aware=true;;
|
|
|
|
monitor-aware) monitor_aware=true;;
|
|
|
|
pointer-monitor-detection) pointer_monitor_detection=true;;
|
|
|
|
pointer-monitor-detection) pointer_monitor_detection=true;;
|
|
|
|
wm) wm=$OPTARG
|
|
|
|
wm) wm=$OPTARG
|
|
|
|
user_set_wm=true;;
|
|
|
|
user_set_wm=true;;
|
|
|
|
class) class=$OPTARG;;
|
|
|
|
class) class=$OPTARG;;
|
|
|
|
name) name=$OPTARG;;
|
|
|
|
name) name=$OPTARG;;
|
|
|
|
clear) clearwid=true;;
|
|
|
|
clear) clearwid=true;;
|
|
|
|
no-cancel) cancel_auto_show=false;;
|
|
|
|
no-cancel) cancel_auto_show=false;;
|
|
|
|
help) print_help;;
|
|
|
|
help) print_help;;
|
|
|
|
|
|
|
|
*) print_help illegal_opt;;
|
|
|
|
|
|
|
|
esac;;
|
|
|
|
*) print_help illegal_opt;;
|
|
|
|
*) print_help illegal_opt;;
|
|
|
|
esac;;
|
|
|
|
|
|
|
|
*) print_help illegal_opt;;
|
|
|
|
|
|
|
|
esac
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
done
|
|
|
|
shift "$((OPTIND-1))"
|
|
|
|
shift "$((OPTIND-1))"
|
|
|
@ -180,7 +180,7 @@ fi
|
|
|
|
|
|
|
|
|
|
|
|
if [[ $# -ne 1 ]]; then
|
|
|
|
if [[ $# -ne 1 ]]; then
|
|
|
|
echo >&2 "Exactly 1 positional argument is required." \
|
|
|
|
echo >&2 "Exactly 1 positional argument is required." \
|
|
|
|
"For help use -h or --help or see the manpage." | \
|
|
|
|
"For help use -h or --help or see the manpage." | \
|
|
|
|
tee -a "$MUTDROP_PATH"/log
|
|
|
|
tee -a "$MUTDROP_PATH"/log
|
|
|
|
exit 1
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
@ -193,7 +193,7 @@ if [[ ! $height$width$xoff$yoff =~ ^[0-9%-]*$ ]]; then
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [[ -n $dec_fix ]] && [[ ! $dec_fix =~ ^-?[0-9]+x-?[0-9]+$ ]]; then
|
|
|
|
if [[ -n $dec_fix ]] && [[ ! $dec_fix =~ ^-?[0-9]+x-?[0-9]+$ ]]; then
|
|
|
|
echo >&2 "The decoration fix value must have form 'num'x'num'." \
|
|
|
|
echo >&2 "The decoration fix value must have form 'num'x'num'." \
|
|
|
|
"The numbers can be negative or zero." | tee -a "$MUTDROP_PATH"/log
|
|
|
|
"The numbers can be negative or zero." | tee -a "$MUTDROP_PATH"/log
|
|
|
|
exit 1
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
@ -269,7 +269,7 @@ update_geometry_settings_for_monitor() {
|
|
|
|
# TODO use jq if installed
|
|
|
|
# TODO use jq if installed
|
|
|
|
# I'd rather not make jq a dependency
|
|
|
|
# I'd rather not make jq a dependency
|
|
|
|
current_monitor=$(i3-msg -t get_workspaces | sed 's/{"num"/\n/g' | \
|
|
|
|
current_monitor=$(i3-msg -t get_workspaces | sed 's/{"num"/\n/g' | \
|
|
|
|
gawk -F ',' '/focused":true/ {sub(".*output",""); gsub("[:\"]",""); print $1}')
|
|
|
|
gawk -F ',' '/focused":true/ {sub(".*output",""); gsub("[:\"]",""); print $1}')
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
local monitor_geo x_begin y_begin x_width y_height
|
|
|
|
local monitor_geo x_begin y_begin x_width y_height
|
|
|
@ -327,7 +327,7 @@ update_geometry_settings_for_monitor() {
|
|
|
|
|
|
|
|
|
|
|
|
map_and_reset_geometry() {
|
|
|
|
map_and_reset_geometry() {
|
|
|
|
xdotool windowmap "$wid" windowmove "$wid" "$xoff" "$yoff" \
|
|
|
|
xdotool windowmap "$wid" windowmove "$wid" "$xoff" "$yoff" \
|
|
|
|
windowsize "$wid" "$width" "$height" 2> /dev/null
|
|
|
|
windowsize "$wid" "$width" "$height" 2> /dev/null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# * WM Detection and Hooks
|
|
|
|
# * WM Detection and Hooks
|
|
|
@ -579,7 +579,7 @@ create_win_return_wid() {
|
|
|
|
if [[ -n "$wids" ]]; then
|
|
|
|
if [[ -n "$wids" ]]; then
|
|
|
|
while read -r wid; do
|
|
|
|
while read -r wid; do
|
|
|
|
if [[ ! $blacklist =~ (^|$'\n')"$wid"($|$'\n') ]] && \
|
|
|
|
if [[ ! $blacklist =~ (^|$'\n')"$wid"($|$'\n') ]] && \
|
|
|
|
[[ $(get_visibility "$wid") == IsViewable ]]; then
|
|
|
|
[[ $(get_visibility "$wid") == IsViewable ]]; then
|
|
|
|
visible_wid=true
|
|
|
|
visible_wid=true
|
|
|
|
program_wid=$wid
|
|
|
|
program_wid=$wid
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|