Skip to content

Fixed ydotool, removed hardcoded username#3

Open
0atman wants to merge 1 commit intoGitJuhb:mainfrom
0atman:main
Open

Fixed ydotool, removed hardcoded username#3
0atman wants to merge 1 commit intoGitJuhb:mainfrom
0atman:main

Conversation

@0atman
Copy link

@0atman 0atman commented Aug 21, 2025

Hi Jordan! Thanks for making this tool, a genius use of claude to just wire everything up to make a better interface - I'm curious how long it took from start to that first commit?

Anyway, there were two lines I had to fix to get it working on my system, I've commented them inline.

I resisted doing huge refactorings because that's not really what this project is about, But if you would accept another PR with some fixes in (like there's some bare exceptions that are bad practice in Python, that sort of thing) do let me know, and I'd be happy to help out!

Cheers!

(I didn't use ai to make this pr, mistakes are my own!)

try:
# Try ydotool first
subprocess.run(['ydotool', '--socket-path', '/run/ydotoold/socket', 'type', text + ' '],
subprocess.run(['ydotool', 'type', '-d1', '-H1', text + ' '],
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why ydotool has changed its interface to not require a socket path param, but require an env variable. Anyway, this worked for me. I'm on 1.0.4, which I believe is the latest, in NixOS unstable.

# Run enhanced version (with pre-buffer to capture initial words)
cd /home/jordan/voice-typing-nix
exec nix-shell shell.nix --run "python enhanced-voice-typing.py $DEFAULT_ARGS $*" No newline at end of file
cd "$(dirname "$0")"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is the correct way to CD into the folder that the script is running from. It looked like there might be some more comprehensive options, but this works fine for me.

cd /home/jordan/voice-typing-nix
exec nix-shell shell.nix --run "python enhanced-voice-typing.py $DEFAULT_ARGS $*" No newline at end of file
cd "$(dirname "$0")"
YDOTOOL_SOCKET=/run/ydotoold/socket exec nix-shell shell.nix --run "python enhanced-voice-typing.py $DEFAULT_ARGS $*"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the other side of the Python code change above. It looks like there was a change in the env or param for ydotool? This environment variable matches up with one that is set in your nix service definition file.

inn0minatus pushed a commit to inn0minatus/voice-typing-linux that referenced this pull request Dec 29, 2025
Changes from GitJuhb#3 by 0atman:

1. Update ydotool invocation:
   - Remove --socket-path flag (now uses YDOTOOL_SOCKET env var)
   - Add -d1 (1ms delay between keys) and -H1 (1ms hold time) flags
   - Improves typing reliability and prevents missed characters

2. Set YDOTOOL_SOCKET environment variable:
   - Modern ydotool versions prefer env var over CLI flag
   - Ensures compatibility with ydotool 1.0.4+

These changes fix ydotool compatibility issues on newer systems.

Ref: GitJuhb#3
inn0minatus added a commit to inn0minatus/voice-typing-linux that referenced this pull request Dec 29, 2025
Changes from GitJuhb#3 by 0atman:

1. Update ydotool invocation:
   - Remove --socket-path flag (now uses YDOTOOL_SOCKET env var)
   - Add -d1 (1ms delay between keys) and -H1 (1ms hold time) flags
   - Improves typing reliability and prevents missed characters

2. Set YDOTOOL_SOCKET environment variable:
   - Modern ydotool versions prefer env var over CLI flag
   - Ensures compatibility with ydotool 1.0.4+

These changes fix ydotool compatibility issues on newer systems.

Ref: GitJuhb#3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant