|
|
@ -440,32 +440,32 @@ maybe_cancel_auto_show() {
|
|
|
|
term_create() {
|
|
|
|
term_create() {
|
|
|
|
local term_command
|
|
|
|
local term_command
|
|
|
|
if [[ -n $program_flags ]]; then
|
|
|
|
if [[ -n $program_flags ]]; then
|
|
|
|
term_command="$term $program_flags"
|
|
|
|
term_command="$program $program_flags"
|
|
|
|
else
|
|
|
|
else
|
|
|
|
term_command=$term
|
|
|
|
term_command=$program
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [[ $term == terminix ]]; then
|
|
|
|
if [[ $program == terminix ]]; then
|
|
|
|
sleep_term_time=0.3
|
|
|
|
sleep_term_time=0.3
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [[ -n $session_name ]]; then
|
|
|
|
if [[ -n $session_name ]]; then
|
|
|
|
# ugly workarounds due to how different terms' different -e flags work
|
|
|
|
# ugly workarounds due to how different terms' different -e flags work
|
|
|
|
if [[ $term == urxvt ]]; then
|
|
|
|
if [[ $program == urxvt ]]; then
|
|
|
|
$term_command -e bash -c "sleep $sleep_term_time && xdotool getactivewindow > /tmp/tdrop/$term$num && xdotool getactivewindow windowmove $xoff $yoff windowsize $width $height && tmux attach-session -dt $session_name || tmuxinator start $session_name || tmux new-session -s $session_name" &
|
|
|
|
$term_command -e bash -c "sleep $sleep_term_time && xdotool getactivewindow > /tmp/tdrop/$program$num && xdotool getactivewindow windowmove $xoff $yoff windowsize $width $height && tmux attach-session -dt $session_name || tmuxinator start $session_name || tmux new-session -s $session_name" &
|
|
|
|
elif [[ $term == terminix ]]; then
|
|
|
|
elif [[ $program == terminix ]]; then
|
|
|
|
$term_command -x "bash -c 'sleep $sleep_term_time && xdotool getactivewindow > /tmp/tdrop/$term$num && xdotool getactivewindow windowmove $xoff $yoff windowsize $width $height && tmux attach-session -dt $session_name || tmuxinator start $session_name || tmux new-session -s $session_name'" &
|
|
|
|
$term_command -x "bash -c 'sleep $sleep_term_time && xdotool getactivewindow > /tmp/tdrop/$program$num && xdotool getactivewindow windowmove $xoff $yoff windowsize $width $height && tmux attach-session -dt $session_name || tmuxinator start $session_name || tmux new-session -s $session_name'" &
|
|
|
|
else
|
|
|
|
else
|
|
|
|
# starting with '/bin/bash -c' because required by termite
|
|
|
|
# starting with '/bin/bash -c' because required by termite
|
|
|
|
$term_command -e "/bin/bash -c 'sleep $sleep_term_time && xdotool getactivewindow > /tmp/tdrop/$term$num && xdotool getactivewindow windowmove $xoff $yoff windowsize $width $height && tmux attach-session -dt $session_name || tmuxinator start $session_name || tmux new-session -s $session_name'" &
|
|
|
|
$term_command -e "/bin/bash -c 'sleep $sleep_term_time && xdotool getactivewindow > /tmp/tdrop/$program$num && xdotool getactivewindow windowmove $xoff $yoff windowsize $width $height && tmux attach-session -dt $session_name || tmuxinator start $session_name || tmux new-session -s $session_name'" &
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
else
|
|
|
|
# not using hold, because flag is different for different terminals
|
|
|
|
# not using hold, because flag is different for different terminals
|
|
|
|
if [[ $term == urxvt ]]; then
|
|
|
|
if [[ $program == urxvt ]]; then
|
|
|
|
$term_command -e bash -c "sleep $sleep_term_time && xdotool getactivewindow > /tmp/tdrop/$term$num && xdotool getactivewindow windowmove $xoff $yoff windowsize $width $height && $SHELL" &
|
|
|
|
$term_command -e bash -c "sleep $sleep_term_time && xdotool getactivewindow > /tmp/tdrop/$program$num && xdotool getactivewindow windowmove $xoff $yoff windowsize $width $height && $SHELL" &
|
|
|
|
elif [[ $term == terminix ]]; then
|
|
|
|
elif [[ $program == terminix ]]; then
|
|
|
|
$term_command -x "bash -c 'sleep $sleep_term_time && xdotool getactivewindow > /tmp/tdrop/$term$num && xdotool getactivewindow windowmove $xoff $yoff windowsize $width $height && $SHELL'" &
|
|
|
|
$term_command -x "bash -c 'sleep $sleep_term_time && xdotool getactivewindow > /tmp/tdrop/$program$num && xdotool getactivewindow windowmove $xoff $yoff windowsize $width $height && $SHELL'" &
|
|
|
|
else
|
|
|
|
else
|
|
|
|
# not using hold, because flag is different for different terminals
|
|
|
|
# not using hold, because flag is different for different terminals
|
|
|
|
$term_command -e "/bin/bash -c 'sleep $sleep_term_time && xdotool getactivewindow > /tmp/tdrop/$term$num && xdotool getactivewindow windowmove $xoff $yoff windowsize $width $height && $SHELL'" &
|
|
|
|
$term_command -e "/bin/bash -c 'sleep $sleep_term_time && xdotool getactivewindow > /tmp/tdrop/$program$num && xdotool getactivewindow windowmove $xoff $yoff windowsize $width $height && $SHELL'" &
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -473,9 +473,9 @@ term_create() {
|
|
|
|
win_create() {
|
|
|
|
win_create() {
|
|
|
|
local win_command
|
|
|
|
local win_command
|
|
|
|
if [[ -n $program_flags ]]; then
|
|
|
|
if [[ -n $program_flags ]]; then
|
|
|
|
win_command="$term $program_flags"
|
|
|
|
win_command="$program $program_flags"
|
|
|
|
else
|
|
|
|
else
|
|
|
|
win_command=$term
|
|
|
|
win_command=$program
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
$win_command &
|
|
|
|
$win_command &
|
|
|
|
# need to wait for window to be created
|
|
|
|
# need to wait for window to be created
|
|
|
@ -497,7 +497,7 @@ win_create() {
|
|
|
|
# only works with pre-command
|
|
|
|
# only works with pre-command
|
|
|
|
xdotool windowmove "$wid" "$xoff" "$yoff" \
|
|
|
|
xdotool windowmove "$wid" "$xoff" "$yoff" \
|
|
|
|
windowsize "$wid" "$width" "$height"
|
|
|
|
windowsize "$wid" "$width" "$height"
|
|
|
|
echo "$wid" > /tmp/tdrop/"$term$num"
|
|
|
|
echo "$wid" > /tmp/tdrop/"$program$num"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
current_create() {
|
|
|
|
current_create() {
|
|
|
@ -513,7 +513,7 @@ wid_toggle() {
|
|
|
|
mkdir -p /tmp/tdrop
|
|
|
|
mkdir -p /tmp/tdrop
|
|
|
|
# get saved window id if already created
|
|
|
|
# get saved window id if already created
|
|
|
|
local wid exists visibility
|
|
|
|
local wid exists visibility
|
|
|
|
wid=$(< /tmp/tdrop/"$term$num")
|
|
|
|
wid=$(< /tmp/tdrop/"$program$num")
|
|
|
|
exists=true
|
|
|
|
exists=true
|
|
|
|
if [[ -n $wid ]]; then
|
|
|
|
if [[ -n $wid ]]; then
|
|
|
|
visibility=$(get_visibility "$wid")
|
|
|
|
visibility=$(get_visibility "$wid")
|
|
|
@ -521,17 +521,17 @@ wid_toggle() {
|
|
|
|
if [[ -z $visibility ]] || [[ -z $(xprop -id "$wid") ]]; then
|
|
|
|
if [[ -z $visibility ]] || [[ -z $(xprop -id "$wid") ]]; then
|
|
|
|
# window no longer exists
|
|
|
|
# window no longer exists
|
|
|
|
exists=false
|
|
|
|
exists=false
|
|
|
|
> /tmp/tdrop/"$term$num"
|
|
|
|
> /tmp/tdrop/"$program$num"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
else
|
|
|
|
exists=false
|
|
|
|
exists=false
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if $exists; then
|
|
|
|
if $exists; then
|
|
|
|
if [[ $visibility == IsUnMapped ]]; then
|
|
|
|
if [[ $visibility == IsUnMapped ]]; then
|
|
|
|
if [[ $term == current ]]; then
|
|
|
|
if [[ $program == current ]]; then
|
|
|
|
map_pre_command "$(< /tmp/tdrop/current"$num"_type)"
|
|
|
|
map_pre_command "$(< /tmp/tdrop/current"$num"_type)"
|
|
|
|
else
|
|
|
|
else
|
|
|
|
map_pre_command "$term"
|
|
|
|
map_pre_command "$program"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
# update here if possible so this doesn't cause a delay
|
|
|
|
# update here if possible so this doesn't cause a delay
|
|
|
|
# between the window being remapped and resized
|
|
|
|
# between the window being remapped and resized
|
|
|
@ -578,9 +578,9 @@ wid_toggle() {
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
# make it
|
|
|
|
# make it
|
|
|
|
map_pre_command "$term"
|
|
|
|
map_pre_command "$program"
|
|
|
|
local wid
|
|
|
|
local wid
|
|
|
|
if [[ $term == current ]]; then
|
|
|
|
if [[ $program == current ]]; then
|
|
|
|
wid=$(current_create)
|
|
|
|
wid=$(current_create)
|
|
|
|
xdotool windowunmap "$wid"
|
|
|
|
xdotool windowunmap "$wid"
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -594,7 +594,7 @@ wid_toggle() {
|
|
|
|
local count
|
|
|
|
local count
|
|
|
|
count=0
|
|
|
|
count=0
|
|
|
|
while [[ -z $wid ]] && [[ $count -lt 100 ]]; do
|
|
|
|
while [[ -z $wid ]] && [[ $count -lt 100 ]]; do
|
|
|
|
wid=$(< /tmp/tdrop/"$term$num")
|
|
|
|
wid=$(< /tmp/tdrop/"$program$num")
|
|
|
|
sleep 0.01
|
|
|
|
sleep 0.01
|
|
|
|
((count++))
|
|
|
|
((count++))
|
|
|
|
done
|
|
|
|
done
|
|
|
@ -730,24 +730,24 @@ auto_show() {
|
|
|
|
# Main
|
|
|
|
# Main
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
if $auto_detect_wm; then
|
|
|
|
|
|
|
|
wm=$(get_window_manager)
|
|
|
|
|
|
|
|
wm_autoset_for_all
|
|
|
|
|
|
|
|
if [[ $term == auto_show ]] || [[ $term == auto_hide ]]; then
|
|
|
|
|
|
|
|
wm_autoset_for_hide_show
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
wm_autoset_for_dropdown
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [[ -n $1 ]]; then
|
|
|
|
if [[ -n $1 ]]; then
|
|
|
|
|
|
|
|
program=${*:0-1}
|
|
|
|
|
|
|
|
if $auto_detect_wm; then
|
|
|
|
|
|
|
|
wm=$(get_window_manager)
|
|
|
|
|
|
|
|
wm_autoset_for_all
|
|
|
|
|
|
|
|
if [[ $program == auto_show ]] || [[ $program == auto_hide ]]; then
|
|
|
|
|
|
|
|
wm_autoset_for_hide_show
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
wm_autoset_for_dropdown
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
if $clearwid; then
|
|
|
|
if $clearwid; then
|
|
|
|
> /tmp/tdrop/"$term$num"
|
|
|
|
> /tmp/tdrop/"$program$num"
|
|
|
|
elif [[ $term == toggle_auto_hide ]]; then
|
|
|
|
elif [[ $program == toggle_auto_hide ]]; then
|
|
|
|
toggle_auto_hide
|
|
|
|
toggle_auto_hide
|
|
|
|
elif [[ $term == auto_hide ]]; then
|
|
|
|
elif [[ $program == auto_hide ]]; then
|
|
|
|
auto_hide
|
|
|
|
auto_hide
|
|
|
|
elif [[ $term == auto_show ]]; then
|
|
|
|
elif [[ $program == auto_show ]]; then
|
|
|
|
auto_show
|
|
|
|
auto_show
|
|
|
|
else
|
|
|
|
else
|
|
|
|
wid_toggle
|
|
|
|
wid_toggle
|
|
|
|