Git Product home page Git Product logo

Comments (15)

ecspresso avatar ecspresso commented on July 29, 2024 2

@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.

ecspresso avatar ecspresso commented on July 29, 2024 2

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.

rwjack avatar rwjack commented on July 29, 2024 1

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.

ElectricRCAircraftGuy avatar ElectricRCAircraftGuy commented on July 29, 2024 1

@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.

rwjack avatar rwjack commented on July 29, 2024 1

@ElectricRCAircraftGuy Kudos! Thanks bud

from ydotool.

Paiusco avatar Paiusco commented on July 29, 2024 1

@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.

shellheim avatar shellheim commented on July 29, 2024 1

@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 avatar ElectricRCAircraftGuy commented on July 29, 2024 1

@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.

ElectricRCAircraftGuy avatar ElectricRCAircraftGuy commented on July 29, 2024

@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.

ecspresso avatar ecspresso commented on July 29, 2024

I can see people talking about the service but it seems to be missing for me.

from ydotool.

Paiusco avatar Paiusco commented on July 29, 2024

@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.

shellheim avatar shellheim commented on July 29, 2024

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.

ReimuNotMoe avatar ReimuNotMoe commented on July 29, 2024

Thanks so much for your contribution, I'm very grateful.

I have pinned this issue now.

from ydotool.

Edwardius avatar Edwardius commented on July 29, 2024

Is it not possible to make installation as compact as apt install ydotool?

from ydotool.

Paiusco avatar Paiusco commented on July 29, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.