Open vargn opened 11 months ago
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:
bwmenu
process only exits after the clipboard is cleared, so the script doesn't continue until that happens.I hope this works for you or gives you an idea how to fix it for your exact usecase
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?