Skip to content

Commit

Permalink
Run windowmap commands with --sync flag
Browse files Browse the repository at this point in the history
This will ensure that tdrop waits until the window is mapped before activating
it.  Otherwise tdrop can incorrectly focus another desktop.

Fixes issue #369
  • Loading branch information
peskovdev authored and noctuid committed Oct 3, 2023
1 parent eda1244 commit 4da819d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tdrop
Original file line number Diff line number Diff line change
Expand Up @@ -440,20 +440,20 @@ update_geometry_settings_for_monitor() {
map_and_reset_geometry() {
if [[ -n $width ]] && [[ -n $height ]] && [[ -n $xoff ]] \
&& [[ -n $yoff ]]; then
xdotool windowmap "$wid" windowmove "$wid" "$xoff" "$yoff" \
xdotool windowmap --sync "$wid" windowmove "$wid" "$xoff" "$yoff" \
windowsize "$wid" "$width" "$height" 2> /dev/null
elif [[ -n $width ]] && [[ -n $height ]]; then
xdotool windowmap "$wid" windowsize "$wid" "$width" "$height" \
xdotool windowmap --sync "$wid" windowsize "$wid" "$width" "$height" \
2> /dev/null
elif [[ -n $xoff ]] && [[ -n $yoff ]]; then
xdotool windowmap "$wid" windowmove "$wid" "$xoff" "$yoff" \
xdotool windowmap --sync "$wid" windowmove "$wid" "$xoff" "$yoff" \
2> /dev/null
else
xdotool windowmap "$wid" 2> /dev/null
xdotool windowmap --sync "$wid" 2> /dev/null
fi
# windowmap does not activate for all window managers; windowactivate should
# be run separately or can activate window on another desktop on some window
# managers (e.g. bspwm)
# windowmap does not activate the window for all window managers;
# windowactivate should be run separately after windowmap --sync or it can
# activate a window on another desktop on some window managers (e.g. bspwm)
xdotool windowactivate "$wid" 2> /dev/null
}

Expand Down

0 comments on commit 4da819d

Please sign in to comment.