-
-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tutorial: how to install and use ydotool
#207
Comments
Just in time, I was getting lost trying to install it. Still having trouble finding how to simulate arrow keys. Oh, it's just |
@rwjack , yeah, it appears to be You can view all key codes locally with: gedit /usr/include/linux/input-event-codes.h For full instructions to press and release # Kill the `ydotoold` background running processes
sudo pkill ydotoold
# start the background daemon
sudo -b ydotoold --socket-path="$HOME/.ydotool_socket" --socket-own="$(id -u):$(id -g)"
# press key right, then release it
YDOTOOL_SOCKET="$HOME/.ydotool_socket" ydotool key 106:1 106:0 I don't mention it in my article, but you can also add that environment variable to the bottom of your export YDOTOOL_SOCKET="$HOME/.ydotool_socket" Then you could just run this in place of the last command above: ydotool key 106:1 106:0 |
@ElectricRCAircraftGuy Kudos! Thanks bud |
@ElectricRCAircraftGuy That was a great guide, thank you. I made a script (that i have named #!/bin/sh
if [ $# -ne 1 ] || ( [ "$1" != "start" ] && [ "$1" != "stop" ] && [ "$1" != "update" ] && [ "$1" != "status" ] );then
echo "`basename $0`: missing OPTION
Usage: `basename $0` [OPTION]
'`basename $0` start' to start the ydotool service.
'`basename $0` stop' to stop the ydotool service
'`basename $0` update' to update (or install) ydotool."
exit 1
fi
# Visa status
if [ "$1" = "status" ]; then
sudo systemctl status ydotool.service
fi
# Start ydtoold
if [ "$1" = "start" ]; then
sudo systemctl start ydotool.service
sudo systemctl status ydotool.service
fi
# Stop ydtoold
if [ "$1" = "stop" ]; then
sudo systemctl stop ydotool.service
sudo systemctl status ydotool.service
fi
# Update (update git folder, build and make install) ydotool and ydotoold.
if [ "$1" = "update" ] ; then
sudo -v
# pre reqs
sudo apt update && sudo apt install cmake scdoc pkg-config
# Check if ydotool repo is downloaded
if [ ! -d /opt/ydotool ]; then
cd /tmp
git clone https://github.com/ReimuNotMoe/ydotool.git
sudo mv /tmp/ydotool/ /opt/
fi
cd /opt/ydotool/
# Get latest version
git pull
# Make
mkdir -p build && cd build
cmake ..
time make -j "$(nproc)"
# Install
sudo make install
# Remove the need for sudo
sudo chmod +s $(which ydotool)
# Install systemd service
sudo rm /etc/systemd/system/ydotool.service
sudo ln -s /usr/lib/systemd/user/ydotool.service /etc/systemd/system/
# Reload the systemd daemon
sudo systemctl daemon-reload
# Reload enable the service
sudo systemctl enable ydotool
# Reload start ydotool
sudo systemctl start ydotool
# Check that it is running
sudo systemctl status ydotool
echo "ydotoold version: $(ydotoold --version)"
echo ""
if ! grep -q 'export YDOTOOL_SOCKET="/tmp/.ydotool_socket"' $HOME/.profile; then
echo '' >> "$HOME/.profile"
echo '# ydotoold socket location' >> "$HOME/.profile"
echo 'export YDOTOOL_SOCKET="/tmp/.ydotool_socket"' >> "$HOME/.profile"
echo "YDOTOOL_SOCKET is being exported in $HOME/.profile."
echo "Please relog to enable the new profile settings."
fi
fi EDIT: Now properly installs the service. EDIT 2: Enable the service after installing it. EDIT 3: Forgot to install cmake scdoc pkg-config |
@ecspresso , nice job. There are still more things I don't know. Using |
I can see people talking about the service but it seems to be missing for me. |
I found this where someone explains how to build and install ydotool in detail. It is also explained how to add the service. I have updated my above script. |
@ElectricRCAircraftGuy if you have time, let's update that guide, split them into how to install and a use guide? I can help with that. Then we can move towards submitting a PR mentioning those links as a guide |
I had it working in a previous system but didn't write it down so wasted quite a few hours figuring it out again, so I did write up here. |
@shellheim I think there are some improvements. I'm wondering that even the You also don't need to |
@Paiusco Man, I am so damm grateful to you. Thank you very much. I had completely forgotten about that flag. I am gonna fix the gist in the morning. Again, thank you very much! edit: the gist should be much better by now. |
Thanks so much for your contribution, I'm very grateful. I have pinned this issue now. |
I'm not going to have time :( I'm a single dad now, and sole income. (And this is lower priority on my list.) |
Is it not possible to make installation as compact as |
@Edwardius if you look at #233 you'll see that the package that debian-like distro currently ships is 5years old, so this is controlled by the distro/repo and not by us. |
Note: If you are on ubuntu/debian you can also (try) to download the binaries from the releases page instead of needing to compile it. |
I've also just written a basic setup-guide: https://docs.o-x-l.com/automation/ydotool.html |
Anyidea how to run
Its asking for sudo, if i directly run it from terminal. Then in consideration with above user-service file, how can i achieve sudo. Also there's another program |
change the
You will have your numbers, to get them run echo $(id -u):$(id -g) then sudo restart the file, it should work. |
You might consider linking to this in your documentation. This was a lot of work for me to figure it out, so I think it will be useful to many people:
Tutorial: Getting started with
ydotool
to automate key presses (or mouse movements) in LinuxI go over installation, launching the daemon in a way that doesn't require your user to use root to connect to it, pressing key sequences, and where to find them, how to view the help menus, etc.
The text was updated successfully, but these errors were encountered: