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

Idea/Question: Quick and easy way to launch spacefn #4

Open
maciejmotyka opened this issue Dec 10, 2019 · 2 comments
Open

Idea/Question: Quick and easy way to launch spacefn #4

maciejmotyka opened this issue Dec 10, 2019 · 2 comments

Comments

@maciejmotyka
Copy link

I wanted to share my way of quickly launching spacefn and ask if it's safe to do it this way. This is all very basic Linux magic, but maybe less experienced users can learn something from it.
I have 2 scripts sfn and sfn2, which enable spacefn for either my laptop keyboard or an external keyboard. I put them into /usr/local/bin. Both are the same except for my_device

#! bin/env bash
nohup spacefn /dev/input/my_device &
exit

Then I do

sudo chmod +x /usr/local/bin/sfn{1,2}
sudo chown root:root /path/to/spacefn
sudo chmod u+s /path/to/spacefn

and I'm able to launch spacefn without specifying the device, typing password, having to keep a terminal open or put the process to the background to be able to close the terminal.

Do you see any downsides? How do you launch spacefn?

@ftassi
Copy link

ftassi commented Mar 17, 2020

Worked for me, thanks.
Maybe we should add this in the README instead of having it here as an issue?

@maciejmotyka
Copy link
Author

If @abrasive wants to include it, I can make a PR.

N.B. There's a possibility for this way of launching to fail in certain situation.
My external keyboard usually writes to /dev/input/event17 or /dev/input/event18, so I've set up the script to launch spacefn for both of them. From time to time, however, the keyboard would be assigned to some other 'event' and this method fails.
A more robust solution could be to write a script that would listen to all of the input streams and ask user to push few keys to detect the correct one, prior to launching spacefn.

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

2 participants