-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Enhancement] Add option to hide on lost focus #18
Comments
This seems pretty useful, so I'll consider adding it as an actual flag. Ideally you'd just be able to do this with If I run this in a dropdown, it will work at first, but it will also activate when remapping the window (requiring me to kill xdotool):
This might be a bug in xdotool or just have to do with my WM. I'll try it in some other WMs. |
I found the same. I eventually got it sort of working using
But then I could only unmap the window when the focus was lost as pressing my tdrop keyboard shortcut lost focus, so xdotool unmapped the window and tdrop mapped it again :) I didn't try much more than that and raised the enhancement request hoping someone more knowledgeable could implement it or suggest a better way to do this with a hook. |
Yeah that was the only workaround I could think of. If you wanted to use more than one
It works ~5/6 times for me if I increase the sleep time and kill xdotool before the tdrop command, but that's still not very good. I made an issue (see jordansissel/xdotool#124). Hopefully this is fixed in xdotool eventually or one time rules are added to prevent the need to kill xdotool afterwards. There may be some other utility that could replace xdotool (though I didn't see any equivalent feature in wmutils, xdo, or wmctrl at first glance). What window manager are you using? |
Running gnome 3.18 so WM is mutter I assume. |
it is so nice to find such an awesome project that iS STILL BEING MAINTAINED BY THE DEV OMG |
Unfortunately, there isn't much I can do until the issue I opened for xdotool is addressed in xdotool. A solution is probably possible for a few window managers using their own functionality (e.g. bspwm), but for this to work in the general case, xdotool needs to be changed or an alternative program used. None of the xdotool alternatives have an equivalent of xdotool's "behave" command as far as I am aware. |
Hello! xdotool author here. Thanks for linking these bugs together :) I'll see what we can do. |
@lpinner I'd like to keep this open until there is some solution. |
I managed to get it working with tdrop -C 'xdotool behave $(xdotool getactivewindow) blur exec /home/alexesmet/Documents/scripts/unmap_if_not_tdrop.sh $(xdotool getactivewindow)' -am -w 70% -x 15% -y 0 alacritty -o window.decorations=none --class=tdrop -t tdrop As you can see, it calls my #!/usr/bin/sh
if [ "$(xdotool getactivewindow getwindowname)" != "tdrop" ]
then
xdotool windowunmap $1
fi It receives id of the dropdown window as a first parameter (I just understood it can be removed). I had to extract this bit into a script because I was not ture how to plug |
I wrote a program that automatically hides the window managed by tdrop by listening to the focus switch event emitted by the x11 server Installationcargo install autohide-tdrop Usage~/.config/sxhkd/sxhkdrc ctrl + t
tdrop -n tdrop_kitty --post-create-hook "autohide-tdrop &" -ma -h 60% -w 70% -x 15% -y 0 env GLFW_IM_MODULE=ibus kitty --class=tdrop_kitty plz see https://github.com/I-Want-ToBelieve/autohide-tdrop/tree/main |
I decided to dig in this because I had some performance issues with @I-Want-ToBelieve After so much tries with sxhkd(you can safely remove bspwm part of config and -N if needed):
So basically we kill xdotool when explicitly close tdrop. And exec will kill xdotool after window hides(loses focus) therefore we used -P and not -C cause calling each time. [edit] |
@Darukutsu for ‘killall xdotool’, would you rather xdotool have a way to terminate itself? I’m open to adding such a feature to xdotool. or maybe add a flag to the xdotool behave command to exit after performing the task once. |
@Darukutsu I also encountered an edge case today. Under normal circumstances, when the listening window exits, the autohide-tdrop process will also be terminated. However, if x11 server crashes, autohide-tdrop will occupy a single CPU core. I have reported this bug upstream, bread-graphics/breadx#93 (comment) I have followed the breadx author's prompt to switch the dependency from breadx to x11rb and released version 1.0.3. x11rb is able to report x11 server crash errors, which I caught, so now x11 server crashes will not cause infinite loops. |
Would you consider adding a 'hide on lost focus' option, like the way the Guake/Tilda terminals unmap themselves when they lose focus?
Looks like it might be possible with something like
xdotool behave $wid blur exec xdotool windowunmap $wid
The text was updated successfully, but these errors were encountered: