I have a script where I activate a shortcut after clicking a mouse button, but I need the window under the cursor to be focused for this to work. I tried sending a normal click before the shortcut, but it can cause accidental clicks. Is there a way to trigger a raise/focus to the window below the cursor?
Asked
Active
Viewed 390 times
1 Answers
0
I found a solution:
# Find the id of the window under the cursor
sedGetValue='s/.*=\(.*\)/\1/'
id=`xdotool getmouselocation --shell 2>/dev/null | grep WINDOW | sed "$sedGetValue"`
# Focus the window
wmctrl -iR "$id"
madprops
- 129
- 1
- 1
- 5