Comments (15)
@ElectricRCAircraftGuy That was a great guide, thank you. I made a script (that i have named ydotool-manage
on my computer) based on your guide to start, stop and update from one place.
#!/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.
More information here https://askubuntu.com/questions/1413829/how-can-i-install-and-use-the-latest-ydotool-keyboard-automation-tool-working-o
EDIT 2: Enable the service after installing it.
EDIT 3: Forgot to install cmake scdoc pkg-config
from ydotool.
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.
from ydotool.
Just in time, I was getting lost trying to install it.
Still having trouble finding how to simulate arrow keys.
Oh, it's just KEY_RIGHT
from ydotool.
@rwjack , yeah, it appears to be KEY_RIGHT
, or key code 106
, as shown here: https://github.com/torvalds/linux/blob/master/include/uapi/linux/input-event-codes.h#L181
You can view all key codes locally with:
gedit /usr/include/linux/input-event-codes.h
For full instructions to press and release KEY_RIGHT
, it should be this:
# 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 ~/.bashrc
file, as this:
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
from ydotool.
@ElectricRCAircraftGuy Kudos! Thanks bud
from ydotool.
@shellheim I think there are some improvements. I'm wondering that even the ydotool.service
is now named ydotoold.service
You also don't need to chown
on the socket created, ydotoold accepts this as a parameter when run, so you can edit the service file so you're the owner of the socket, or even change the permission (similar to what a chmod
would do), so even that you're not the owner, you can still access the socket
from ydotool.
@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.
from ydotool.
@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'm not going to have time :(
I'm a single dad now, and sole income.
from ydotool.
@ecspresso , nice job. There are still more things I don't know. Using systemd
to stop/start/restart it may be better. Check out this comment here (all the comments under my answer): https://askubuntu.com/questions/1470593/how-can-i-write-a-program-to-press-keys-such-as-windows-d-in-wayland-repla#comment2596097_1473061
from ydotool.
I can see people talking about the service but it seems to be missing for me.
from ydotool.
@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
from ydotool.
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.
from ydotool.
Thanks so much for your contribution, I'm very grateful.
I have pinned this issue now.
from ydotool.
Is it not possible to make installation as compact as apt install ydotool
?
from ydotool.
@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.
If you want to get something newer, you may move to a "rolling distro" instead.
from ydotool.
Related Issues (20)
- `udev` rule to `g+rw` the `/dev/uinput` does not work HOT 10
- How do I update ydotool HOT 1
- Extended Ascii 128-255 not supported? HOT 1
- Socket can't be changed HOT 4
- Everything working except mosuemove HOT 2
- Specifying somewhere about Fedora's behaviour? HOT 2
- Make the help message about daemon not running include the service name HOT 1
- Where are the "click" keycodes coming from? HOT 1
- How can I increase speed of the type function? HOT 3
- Why CMake is halted at 3.4? HOT 1
- Why use systemd user service and not systemd? HOT 3
- RFE: use socket activation on systemd systems HOT 10
- socket perms for system-wide access ? HOT 4
- Add man pages HOT 5
- failed to open uinput device: No such device HOT 4
- Why the rewrite in JavaScript and not (insert another language)? HOT 1
- Possible to type in specific window? HOT 2
- Needs sudo before each command HOT 6
- everything ok but key command not work?
- mousemove y position doesn't work with absolute
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ydotool.