-
Notifications
You must be signed in to change notification settings - Fork 57
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
Focus last active i3 window #82
Comments
I can't be the only one with this issue? Please point me in the right direction :) |
I wrote the following bwmenu wrapper script to deal with this: #!/bin/bash
# store current mouse location
mouse_location="$(xdotool getmouselocation --shell)"
while IFS= read -r line; do
declare "$line"
done <<< "$mouse_location"
# store resolution of current monitor
current_monitor_resolution="$(get_focused_monitor_resolution)"
while IFS= read -r line; do
declare "$line"
done <<< "$current_monitor_resolution"
# mark currently focused window
i3-msg mark "bwmenu-mark"
# move mouse to upper-left of screen
warpd --move '1 1'
# call bwmenu and pass along all given parameters
bwmenu "$@"
# move mouse back to where it was before calling bwmenu
# (modulo resolution of current monitor, since warpd is relative to current monitor)
warpd --move "$((X % WIDTH)) $((Y % HEIGHT))"
# focus on window with mark
i3-msg '[con_mark="bwmenu-mark"] focus'
# remove mark
i3-msg unmark "bwmenu-mark"
It does make some assumptions though:
I hope this works for you or gives you an idea how to fix it for your exact usecase |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have follow
focus_follows_mouse yes
in my i3 config file. So when I launch the bwmenu rofi window and copy the password. The window that will be focused is where my mouse cursor happens to be. Even though I might have previously navigated windows using keybinds. This is a bit annoying as I often have to re-navigate to the window I had active when launching the bwmenu. What should I add to the bwmenu script so that it will focus the last active window and not the window where the mouse cursos is currently placed?The text was updated successfully, but these errors were encountered: