Meta key lockup using xdotool

Ok I’m using a method of getting ZX Tune to respond to hotkeys, that involves binding a shortcut to a script, which runs wmctrl to bring the window to the foreground, then xdotool to send the appropriate keyboard key press to pause/play. It actually works pretty well! Except…

At some point randomly, the shortcut fails, and then I notice the shift key is software stuck (the way it’s behaving in other programs, selecting things) so I press shift again to unstick it.

At this point, the Meta (Windows) key no longer responds. I can’t press it to open the application launcher and search for an app, which is the biggest inconvenience there. The only way to get it back is to reboot.

Regarding ZX Tune actually getting hotkey support built in, the bitbucket issue for this is 6 years old so not holding my breath. But it’s the most convenient player that plays VGM files.

1 Like

Without:

  • the actual script
  • knowing whether it works when you create another user ( E.G. domarius2) and checking whether it works there, we’ll be unable to answer your question…

Also have a look here for your meta key…

:cry:

1 Like

No worries, here’s the script. Let me know if I absolutely need to try again with a new user to provide more info.

#!/bin/bash
win=$(xdotool search --name 'zxtune-qt' | head -1)
echo $win
wmctrl -a zxtune-qt 
xdotool key --clearmodifiers --window $win alt+c 

As for the scancode thing, it’s not like in the link you sent, where the guy can’t bind his key at all. My meta key is fine until this glitchy event happens. If you mean for me to find out the scan code of the key, I ran “showkey -s” at the terminal but it kept saying “Couldn’t get a file descriptor referring to the console.”

  1. Could you first try to change:

    xdotool key --clearmodifiers --window $win alt+c 
    

    to:

    xdotool key --clearmodifiers  alt+c --window $win 
    

:crossed_fingers:

  1. That’ll narrow the search to a user profile issue or a system issue.

:man_shrugging:

Thanks man. I’ve updated the script.

Also it just occoured to me that I’ve only seen this bug since I started using the Shift+F5 shortcut. My keyboard doesn’t have media keys so I’ve previously had F5 shortcut trigger a “media play/pause” key press without issue for many months now, it’s been working fine with Audacity. It’s only because ZX Tune doesn’t respond to media keys, that I came up with the combo Shift+F5 as an alternative to trigger the zxtune_pause.sh script. And I think the problem is since then.

Maybe it’s triggering something wierd to happen, because F keys (especially F5) usually have other uses, and in this case it could be the specific combo of Shift with F5 under certain conditions that’s causing the bug.

I’ve bound the zxtune_pause.sh script to just F5 for now to see how that goes (since I’m just using ZX Tune at the moment anyway).

I should probably change it to something other than F5 actually. it’s just that F5 is the key with the play icon on it, because if you hold the Fn key and press F5, it actually generates a media play/pause. But I don’t want to do that :laughing:

Don’t! Take something that is completely free like Ctrl+Alt+5 (which is just below F5.

Keep up informed how it goes…

:+1:

Ok so I’ve been using this with just the shortcut keys bound to F8, F9, and F10, no modifiers (such as shift) and given the frequency of the previous problem, I should’ve experienced it by now, but I haven’t. I actually also made that script change you said to do, so I can’t be 100% sure it’s not that which fixed it, but my feeling is it was the shortcut key combo I was using.

So I can consider this problem fixed!

I’ve marked this answer as the solution to your question as it is by far the most likely to have solved the problem:

If someone else runs into this problem, and it would not be, we’ll re-open this one and take it further then.

:innocent:
P.S. In the future, please don’t forget to come back and click the 3 dots below the answer to mark a solution like this below the answer that helped you most:
Solution
so that the next person that has the exact same problem you just had will benefit from your post as well as your question will now be in the “solved” status.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.