-
Notifications
You must be signed in to change notification settings - Fork 26
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
Binding macro keys to shell commands #15
Comments
It should be possible to achieve that by using System Settings > Keyboard > Shortcut (in GNOME, might be different in KDE) and attach a custom command to a key combination of your choice. Just make sure your script is set as executable ( |
Hmm, that's true, but that's a bit indirect and wastes a binding. (Though I suppose there are some bindings you'll never use, like |
It's some kind of reinventing the wheel. It might "waste" a key bind (you can bind anything you want, even unrealistic shortcuts like Ctrl + Super + Alt + L) , but it's already been done by other devs and the code is already available. And chances are high, if you already have a desktop environment installed, you don't even have to download additional software. Problem is, this adds another layer of complexity to the driver. Users would need to decide, whether to bind a script or record a macro. While recording a macro is pretty much straight forward, binding a script would need manual editing - like writing the script by hand in the first place. But then again, if you'd already need to write scripts and bind them to keys manually, why not do it using a proven, stable software? I think there is no right or wrong, whether feature xyz is a good idea or not. When I'm unsure about a feature, I like to refer to the vendor's official drivers: they really implement the very basic stuff (macros, assigning keys etc.). On the other hand, Windows users don't use scripts excessively as Linux users, so this might have impacted their design decision. I will leave this open for further discussion, I want to decide on this, once we got session daemons implemented (planned for |
I think that's a sensible decision. The process of creating a keybind is pretty solid as-is, so we' would have to think of a good way to add scripting without making the process convoluted or confusing. In my view, since binding to a script is not really thing one can just do on-the-fly (since it would involve typing the full name of the script or command), it perhaps may be better implemented as a command line tool or modification to the configuration file. Speaking of the vendor's official drivers, that's actually where I came up with this idea. Logitech has this interface for the G710+ on Windows, and one of the things you can do with a G key is to run an application when it's pressed. In terms of basing features off of those in the Windows driver, I like that sidewinderd is frugal: the GUI sometimes feels like typical bloatware that comes with hardware on Windows. |
It's the same for KDE. |
Hi there, I've thought about this idea again. First of all, I wanted to let you know, that @cmaster11 created a fork for this. You can find his branch here: https://github.com/cmaster11/sidewinderd. His idea was to use a new element in XML files called "CommandEvent", which lets sidewinderd execute that command. In my opinion, that's a very good way to solve this. My concerns are more about security. Think about the following scenario: you have a macro, and malicious code (or a user) modifies your macro files to execute a command, which tries to delete everything it can. So, next time you press one of your G-Keys, that command will get executed. Even if you're not running sidewinderd as root (which currently doesn't work by design anyway), it will still delete most of your Still, I'm not your mom and will let you - ladies and gentlemen - decide, whether you want this or not (knowing the security risks). Per default, this feature will be disabled and you will need to explicitly enable it using configuration file. I will take a similar direction, @cmaster11 already took. Cheers, |
You could do some SSH-like sanity checks that ensures the file is owned by the calling user and not writable by others. Then if the permissions are bad it simply refuses to execute them. While this wouldn't prevent malicious code running as your user from injecting evil macros, if they're running as the target user anyways, they may as well |
I'm still wondering what the most sensible way to accomplish this would be. |
Is it possible to have a key binding run a shell command? This way a macro key could be used to, for example, start a batch job, run a program in a certain configuration, etc.
The text was updated successfully, but these errors were encountered: