Post

How ADHD Gamer Play PowerWash

free up a finger by Using xdotool in Linux.

How ADHD Gamer Play PowerWash

๐Ÿ‘พ use xdotool to simulate TAB

So looks like someoneโ€™s got ADHD but have to play PowerWash. ๐Ÿคทโ€โ™€๏ธ

Letโ€™s make sure we can press TAB automatically every 8 seconds. Hereโ€™s a simple way to do it with a script on Linux.

You can use xdotool, a tool that simulates keyboard input. Install it with:

1
sudo apt-get install xdotool

Once thatโ€™s installed, create a script to press TAB every 8 seconds.

  1. Create a new script file:
1
nano press_tab.sh
  1. Paste this into the file:
1
2
3
4
5
6
#!/bin/bash
while true
do
    xdotool key Tab
    sleep 8
done
  1. Save and exit the editor (press Ctrl+X, then Y, then Enter).

  2. Make the script executable:

1
chmod +x press_tab.sh
  1. Run the script:
1
./press_tab.sh

Now, every 8 seconds, it will press TAB for you! ๐ŸŸข You can stop the script by pressing Ctrl+C when youโ€™re done.


๐Ÿ‘ป Use nohup to run it in the background

We can make this run without needing to keep the terminal open and make it less resource-hungry by running it as a background service.

To make it less intrusive and run in the background without occupying much of the terminal, we can use nohup (no hangup), which allows the script to run even after you close the terminal. Hereโ€™s how you can set it up:

  1. Prepare the script:

Make sure your script is ready (you should already have press_tab.sh from earlier).

  1. Run the script in the background:

Use nohup to run it in the background:

1
nohup ./press_tab.sh &

This will run the script in the background and keep it going even after you close the terminal. The & ensures that it runs in the background, and nohup makes sure it doesnโ€™t stop when the terminal closes.

๐Ÿ”ช Check and Stop the script

You can check if itโ€™s running by looking for the press_tab.sh process with:

1
ps aux | grep press_tab.sh

Stopping the script is easy! You have a couple of options:

๐Ÿ™…โ€โ™€๏ธ 1. Using ps to find the process and kill it:

If you ran the script using nohup or in the background, you can kill it by finding the process ID (PID) and using the kill command.

  1. Find the PID: Open a terminal and run:

    1
    
    ps aux | grep press_tab.sh
    

    You should see something like this:

    1
    
    your_user_name   12345  0.0  0.1  123456  7890 ?  S    10:00   0:00 ./press_tab.sh
    

    The number in the second column (12345 in this example) is the PID (Process ID).

  2. Kill the process: To stop the script, run:

    1
    
    kill 12345
    

    Replace 12345 with the actual PID number you found.

If you want to forcefully kill it (just in case), you can use:

1
kill -9 12345

๐Ÿ‘ฉโ€โš–๏ธ 2. If itโ€™s running as a background job with nohup:

If youโ€™re running the script using nohup and have it in the background, you can just use jobs to find the job ID and then kill it.

  1. List the jobs:
1
jobs

Youโ€™ll see something like:

1
[1]+  12345  Stopped                 ./press_tab.sh
  1. Kill the job:
1
kill %1

Here %1 refers to the job number (in this case, 1). You can also use kill %n, where n is the job number.

Once the script is killed, it will stop pressing TAB for you. ๐Ÿ›‘

๐Ÿ’– Support me with crypto or PayPal! ๐Ÿ’˜

๐Ÿ’ต USDT (TRC20):
TJCANuMYSdgLKRKnpCtscXrS5NgDbBAvF9

๐ŸŸ  Bitcoin (BTC):
bc1qrc9vhrrhnc9v9s9q9rjn24aj608j44p5hzsxft

Or support me on Ko-fi:

Support me on Ko-fi

Any amount helps me continue creating content ๐Ÿ’ฌ๐Ÿ’ป

This post is licensed under CC BY 4.0 by the author.