Skip to content
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

Implicit Enter Press When Reading From File #256

Open
g-h-97 opened this issue Nov 5, 2024 · 1 comment
Open

Implicit Enter Press When Reading From File #256

g-h-97 opened this issue Nov 5, 2024 · 1 comment

Comments

@g-h-97
Copy link

g-h-97 commented Nov 5, 2024

Hello,

I have noticed that ydotool always adds an implicit \n at the end when reading from a file using -f flag. For example, let's say I have a file with the following

cd /home/user/
ls
rm file.txt

I would assume that ydotool will type and execute the first and second commands (cd and ls) but only type the last one (rm) and I should press the final enter to execute it. However, this is not the case and ydotool behaves as if the file is like this (with a trailing new line after the rm

cd /home/user/
ls
rm file.txt

Another point worth mentioning is that passing the text I want to type via CLI does not show the same behavior, as in, new lines are types only if they're explicitly there,

Regards,

@g-h-97
Copy link
Author

g-h-97 commented Nov 5, 2024

I also want to mention that the below command works correctly but unfortunately it completely omits newlines, so it cannot be used for multiline files,

echo -n "ls" | ydotool type -f - && sleep 5

Edit: The sleep 5 is to observer ydotool behavior and not confuse it with program exit,

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

No branches or pull requests

1 participant