Background/Problem Statement:

I’ve recently returned to playing Foxhole, an MMO war game that involves lots of repetitive clicking, e.g., Shift+clicking ten times to gather supplies at mines, or clicking-and-holding for minutes at a time to construct buildings and vehicles. I’m looking for the easiest way to do on Linux what AutoHotkey does for Windows users.

Potential Solutions:

I’m using Bazzite Linux, Gnome, Wayland. I know how to set custom shortcuts in Gnome settings (Settings > Keyboard > Keyboard Shortcuts). The thing is I don’t want these custom shortcuts to be always active, so I’m considering writing a pair of executable scripts that would enable me to quickly & easily start listening for the macro shortcuts at the beginning of my gaming session and stop listening when I’m done gaming.

So my workflow would be as follows:

  1. At the beginning of my gaming session, I’ll double click the first script to initiate something like ydotoold. This script will also contain two or three lines of gsettings set commands to create custom keyboard shortcuts, which trigger ydotool commands to emulate mouse clicks. For Windows users, the AHK version of this would be simply double clicking to start the AHK script.
  2. At the end of my gaming session, since I don’t want to leave these custom shortcuts out there when I’m not playing, I will double click the second script, which stops ydotoold and removes the two or three custom keyboard shortcuts for the mouse clicking macros. This is where Windows users simply close AHK.

While I’m comfortable with the command line, this approach of managing Gnome settings through the command line would be new territory for me, and it will require a decent amount of trial and error. Before I proceed, I’d like to know if there’s a more straightforward way to achieve this.

Has anyone else accomplished something similar, and if so, would you be kind enough to share how you did it? Thanks!

EDIT: Adding links to some documentation I’ve found in my research so far. I haven’t set anything up yet, but I figure this might help others trying to do something similar.

  • yo_scottie_oh@lemmy.mlOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    5 days ago

    Thanks for the pointer to that Baeldung blog post. I’ve seen references to evdev and libevdev on previous adventures in configuring game pads and HOTAS setups for games that don’t support them natively. Also, fair point about python vs bash—I’ve edited the post to be language agnostic.

    • Chris@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      5 days ago

      If you have a keyboard running qmk or something you may be able to just write a macro for that. I’m not super familiar with it though