You are not logged in.

#1 2019-08-25 06:18:09

ss
Member
Registered: 2018-06-04
Posts: 89

Cannot give focus to specified window in dwm using xdotool

I want to set focus to the specified window in my program so that users can start typing directly in the terminal.
I'm using dwm, st and sxiv in Arch. The program is started in st, then at a certain point images will be shown in sxiv, which will grab the focus, but the user need to type something in st. So I need to ensure that the windows focus will be set back to st.

I get the windows id of st by

winid=$(xprop -root _NET_ACTIVE_WINDOW | cut -d' ' -f5)

Then after starting sxiv, I try to give focus back to st by

xdotool windowfocus "$winid"

But it doesn't work. I also experimented this method manually by starting several terminal windows and try to switch focus with xdotool. Nothing worked.
Any suggestions?

Offline

#2 2019-08-26 15:42:40

seth
Member
Registered: 2012-09-03
Posts: 12,647

Re: Cannot give focus to specified window in dwm using xdotool

dwm looks sort of ewmh compatible, try wmctrl instead.

Offline

Board footer

Powered by FluxBB