Is it possible to map out keyboard shortcuts to emulate a click of certain tray icons?

For example, I'd love to be able to map Win Super+R to a click of the "Recent documents" tray icon (it looks like an analog clock), if not at least directly to the "Recent" sidebar section of Nemo. How could I do this, if it's even possible? Otherwise, I may have to try to emulate it through Keysharp...

10 points · 2 comments · view on lemmy.world

2 Comments

tomenzgg@midwest.social · 2 pts · 71d (1 reply)

I think Mint's still on X11 so you should be able to control the mouse with xdotool.

Assuming the tray icon is in the same place every time, you could write a command with xdotool that moves the mouse cursor over the tray icon and clicks it; then just map that command to the appropriate key binding through Mint's in-built key binding settings.

Flagstaff@programming.dev · 2 pts · 71d

That's pretty creative, though my tray icons switch around based on what's there. I suppose I could automate icon detection with screenshots of the icons and ImageSearch()ing via Keysharp... but I realize that I didn't describe what I was really hoping for accurately; aside from certain icons like the Wi-Fi icon (which I'd wanna interact with via Win+A), I'm also generally hoping to get the actual, manual box-highlighting feature and just arrow over to the one I want and smack Enter. Oh, well. I'll try to keep xdotool in mind for the future, though! Yes, Mint's definitely still on X11, as far as I know... I wonder what catastrophes await its Wayland shift...