Mint 19 - xdotool

Forum rules
Before you post please read how to get help
Post Reply
squalo
Level 1
Level 1
Posts: 12
Joined: Sun Jul 26, 2015 7:38 am

Mint 19 - xdotool

Post by squalo » Wed Oct 31, 2018 8:34 am

Hi
switching form ubuntu-mate to Mint-mate, I recognized that my script sending keys with xdotool does not work anymore.
I.e. I want to send some "key down" strokes to "mate-screenshot" but nothing happens, although Window ID is correct.

Did this behaviour got something to do with the mate version (former 1.16 now 1.20)? (using a diff. gtk version now?)

This is unfortunately a bit annoying. Are there perhaps remedies?

Thx in advance.

BR

gm10
Level 13
Level 13
Posts: 4533
Joined: Thu Jun 21, 2018 5:11 pm

Re: Mint 19 - xdotool

Post by gm10 » Wed Oct 31, 2018 9:24 am

Maybe a stupid question but did you even install it?

Code: Select all

apt install xdotool

squalo
Level 1
Level 1
Posts: 12
Joined: Sun Jul 26, 2015 7:38 am

Re: Mint 19 - xdotool

Post by squalo » Wed Oct 31, 2018 9:47 am

good question ;-)
Of course I did.

User avatar
smurphos
Level 8
Level 8
Posts: 2204
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher...

Re: Mint 19 - xdotool

Post by smurphos » Wed Oct 31, 2018 10:01 am

Do you want to share your script. I'm using xdotool for a few things in Cinnamon 19 and it is working OK. Happy to help troubleshoot.

squalo
Level 1
Level 1
Posts: 12
Joined: Sun Jul 26, 2015 7:38 am

Re: Mint 19 - xdotool

Post by squalo » Wed Oct 31, 2018 10:05 am

i.e.:
#!/bin/sh
/usr/bin/mate-screenshot -i &
sleep 0.4
xdotool search --onlyvisible --name '^Bildschirmfoto aufnehmen$' key Down
...
without trailing "key down" I get the correct window ID.

gm10
Level 13
Level 13
Posts: 4533
Joined: Thu Jun 21, 2018 5:11 pm

Re: Mint 19 - xdotool

Post by gm10 » Wed Oct 31, 2018 11:02 am

squalo wrote:
Wed Oct 31, 2018 10:05 am
i.e.:
#!/bin/sh
/usr/bin/mate-screenshot -i &
sleep 0.4
xdotool search --onlyvisible --name '^Bildschirmfoto aufnehmen$' key Down
...
without trailing "key down" I get the correct window ID.
As per the xdotool manual, it uses a different protocol for sending keystrokes to other windows than the active one and that this will likely fail. I've never seen it work but maybe smurphos knows more.

I do know that you'll be fine if you activate the window first:

Code: Select all

xdotool search --onlyvisible --class mate-screenshot windowactivate; xdotool key Down
If you need another window to remain active then store its id and re-activate it afterwards.

squalo
Level 1
Level 1
Posts: 12
Joined: Sun Jul 26, 2015 7:38 am

Re: Mint 19 - xdotool

Post by squalo » Wed Oct 31, 2018 12:06 pm

Thanks. This works for me now on Mint19Mate , activating first the window.

But my old script had worked also all the time on 16.04 Ubuntu-Mate.
So somehow it must (have been) worked sending keystrokes to other windows.

gm10
Level 13
Level 13
Posts: 4533
Joined: Thu Jun 21, 2018 5:11 pm

Re: Mint 19 - xdotool

Post by gm10 » Wed Oct 31, 2018 12:09 pm

squalo wrote:
Wed Oct 31, 2018 12:06 pm
But my old script had worked also all the time on 16.04 Ubuntu-Mate.
So somehow it must (have been) worked sending keystrokes to other windows.
It might be due to a change in xdotool or X server, I don't know. I'm not regularly using xdotool so I'm not aware of the history, that's where maybe smurphos can provide more insight since he said he's experienced with it.

User avatar
mint4all
Level 2
Level 2
Posts: 88
Joined: Tue Feb 13, 2018 1:16 pm

Re: Mint 19 - xdotool

Post by mint4all » Wed Oct 31, 2018 12:46 pm

squalo wrote:
Wed Oct 31, 2018 12:06 pm
Thanks. This works for me now on Mint19Mate , activating first the window.

But my old script had worked also all the time on 16.04 Ubuntu-Mate.
So somehow it must (have been) worked sending keystrokes to other windows.
Greetings!

I am using xdotool for a special project (display/hiding of a tablet-like panel), and happened to look just now at the manual re. keyboarding. Afaict, the correct syntax for your "key Down" function, per the manual, s/b "keydown" (all lower case, no spaces). Worth a try to correct your script's syntax?

Cheers, m4a

User avatar
smurphos
Level 8
Level 8
Posts: 2204
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher...

Re: Mint 19 - xdotool

Post by smurphos » Thu Nov 01, 2018 3:36 am

mint4all -xdotool keydown <key> and xdotool key <key> and xdotool keyup <key> are valid syntax with slightly different effects. Have a closer look at man xdotool.

key Down emulates pressing and releasing the Down arrow key.

squalo - your original constructions fails on Mint Cinnamon 19 as-well with Gnome Screenshot - but gm10s works. I don't know if something has changed. I'll give it a try in Cinnamon 18.3 sometime.

User avatar
mint4all
Level 2
Level 2
Posts: 88
Joined: Tue Feb 13, 2018 1:16 pm

Re: Mint 19 - xdotool

Post by mint4all » Fri Nov 02, 2018 11:30 pm

smurphos wrote:
Thu Nov 01, 2018 3:36 am
mint4all -xdotool keydown <key> and xdotool key <key> and xdotool keyup <key> are valid syntax with slightly different effects. Have a closer look at man xdotool.

key Down emulates pressing and releasing the Down arrow key.

squalo - your original constructions fails on Mint Cinnamon 19 as-well with Gnome Screenshot - but gm10s works. I don't know if something has changed. I'll give it a try in Cinnamon 18.3 sometime.
Thanks very much for your explanation -- as always, deeply appreciated!

Post Reply

Return to “MATE”