Close
Showing results 1 to 10 of 14

Threaded View

  1. #10

    Default

    I will detail what I have done in case anyone is interested.

    I am using this script for Lord of the Rings Online, but the game's engine is very similar to WoW, meaning this would likely work for WoW too. LOTRO does not have native linux support, so I run it through wine. To get this to work, you need to use the option "emulate a virtual desktop." xdotool is also needed.

    I set up a keybinding using the Custom Shorcuts program for KDE. I have tried the keybind software in both GNOME and XFCE, and didn't like what they offer. Xbindkeys works on any desktop environment, but I had some issues with it being buggy. It is at least worth a shot if the default keybind software doesn't work. I will post a guide below on how to use Xbindkeys.

    I have this bound this to alt+1, where pressing alt and 1 at the same time execute this command:

    xdotool search --name "The Lord of the Rings Online™" key --window %@ b


    here is how this command works:
    xdotool: states that this is a xdotool function
    search --name: states that we are going to search by program name
    "The Lord of the Rings Online™": this is the full program name for LOTRO. Change this for a different program
    key: we are going to be pressing a key
    --window: send this key to a specified window, rather than just whatever window is in focus
    %@: sends the key to all windows in the stack. I will give a more detailed explanation of this below
    b: presses the b key. This can be changed to whatever you like. Type xev into the terminal and then press a key. It will tell you the "code" for that key.


    Other advice:
    One command I tried that didn't work was xdotool key --window $(xdotool search --pid $(pidof lotroclient.exe)) b
    It would press b, but it would also press c for some reason. If you run into a problem like this, where a random key is pressed, try making slight changes to your code.

    When I ran the game in fullscreen mode, alt tabbing between clients was laggy. Changing this to borderless fullscreen made alt tabbing much faster.


    How a window stack works (optional read):
    When no window is specified, the command xdotool key b will send the keypress to whatever window is focused. To get around this, the option --window can be used with a window's code to send the keypress to that window. You can see the window code of a window using the command xdotool search --name "The Lord of the Rings Online™" An example output is:
    102760453
    132120613
    To not just have these codes displayed, but to also send a key to one, this code can be used: xdotool search --name "The Lord of the Rings Online™" key b
    The only problem is that it defaults to the first code of the two, which doesn't work. I hard coded both of these window codes into commands:
    xdotool key --window 102760453 b
    xdotool key --window 132120613 b
    Only the bottom one worked. Fortunately, the top one did nothing at all, so sending the key press to both window "codes" is not a problem.
    Revising xdotool search --name "The Lord of the Rings Online™" key b
    into xdotool search --name "The Lord of the Rings Online™" key --window %@ b
    sends the keypress to both windows. The input %1 sends to sends the command to the first in the list, %2 to the second in the list, %3 to the third if there was one, and %@ sends to all in the list.


    How to use Xbindkeys (again, optional):
    If you're using Ubuntu, or an Ubuntu based system, install with
    sudo apt-get install xbindkeys
    You should have a filed .xbindsrc in you home directory. If not, create one. An example script to put in the file is:

    "bash ~/keybinds/kadd.sh"
    KP_Add


    KP_Add is the keypress to trigger the effect (again, use xev in the console to find the key press' code). The line above is what happens when the key is pressed. For me, it runs a simple bash file with the following contents:

    #!/bin/bash
    xdotool search --name "The Lord of the Rings Online™" key --window %1 1
    xdotool search --name "The Lord of the Rings Online™" key --window %2 1

    For some reason, using %@ doesn't work with either Xbindkeys or the Gnome custom keybind program. This means you have to specify them manually if you are not using KDE.
    Last edited by JohnOwl : 05-17-2020 at 05:01 PM

Tags for this Thread

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •