From 2937b69f11679747fc185fa98c046e1eec592223 Mon Sep 17 00:00:00 2001 From: noctuid Date: Fri, 8 Jul 2016 14:33:09 -0400 Subject: [PATCH] Move dropdown when it is open on another desktop For most WMs (awesome is an exception), windows that are open on another desktop are reported as unmapped which causes nothing to happen if a tdrop command is run (unmapping/mapping don't work in this case). Moving a dropdown to the current desktop is possible with xdotool though (basically the same as wmctrl's -R). This is a temporary solution that may be need to be refined in the future. A potential issue is whether pre/post map hooks should be run in this case (e.g. rules should not be added again for bspwm). This could be fixed later by actually unmapping the window or by adding more specific hooks. Addresses #21. --- tdrop | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tdrop b/tdrop index b04dd82..b83cbe3 100755 --- a/tdrop +++ b/tdrop @@ -603,10 +603,17 @@ wid_toggle() { fi if $exists; then if [[ $visibility == IsUnMapped ]]; then - if [[ $program == current ]]; then - map_pre_command "$(< /tmp/tdrop/current"$num"_type)" + # visibility will be IsUnMapped on most WMs if the dropdown is open + # on another desktop + xdotool set_desktop_for_window "$wid" "$(xdotool get_desktop)" + if [[ $(get_visibility "$wid") == IsUnMapped ]]; then + if [[ $program == current ]]; then + map_pre_command "$(< /tmp/tdrop/current"$num"_type)" + else + map_pre_command "$program" + fi else - map_pre_command "$program" + xdotool windowactivate "$wid" fi # update here if possible so this doesn't cause a delay # between the window being remapped and resized