Mint 19 - xdotool

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
squalo
Level 1
Level 1
Posts: 28
Joined: Sun Jul 26, 2015 7:38 am

Mint 19 - xdotool

Post by squalo »

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
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
gm10

Re: Mint 19 - xdotool

Post by gm10 »

Maybe a stupid question but did you even install it?

Code: Select all

apt install xdotool
squalo
Level 1
Level 1
Posts: 28
Joined: Sun Jul 26, 2015 7:38 am

Re: Mint 19 - xdotool

Post by squalo »

good question ;-)
Of course I did.
User avatar
smurphos
Level 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Mint 19 - xdotool

Post by smurphos »

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.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
squalo
Level 1
Level 1
Posts: 28
Joined: Sun Jul 26, 2015 7:38 am

Re: Mint 19 - xdotool

Post by squalo »

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

Re: Mint 19 - xdotool

Post by gm10 »

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: 28
Joined: Sun Jul 26, 2015 7:38 am

Re: Mint 19 - xdotool

Post by squalo »

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

Re: Mint 19 - xdotool

Post by gm10 »

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: 95
Joined: Tue Feb 13, 2018 1:16 pm

Re: Mint 19 - xdotool

Post by mint4all »

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 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Mint 19 - xdotool

Post by smurphos »

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.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
User avatar
mint4all
Level 2
Level 2
Posts: 95
Joined: Tue Feb 13, 2018 1:16 pm

Re: Mint 19 - xdotool

Post by mint4all »

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!
Locked

Return to “MATE”