Keyboard shortcut

Could I ask for a little guidance please.

Is it possible to run the command wg-quick up ********* (needs to run as root), with a keyboard shortcut? Running in a terminal is fine.

I’ve tried assigning it using Application Shortcuts in the xfce Keyboard settings but nothing happens, is there a way to do it?

As an experiment:
( It’s almost functioning … it needs work; if this can get You started :wink: )

I made myself a small one with F12.

bind '"xterm && \e[24~":"/home/fpar/\n"'

bind '"konsole && \e[24~":"/home/fpar/\n"'

My script is and it’s permission are adjusted to:
$ chmod 777

P.S. I think Mr. Kresimir is very knowledgeable in that field iirc.

Thank you, I’ll look into that.

Your question is interesting, and I see it as a learning for me. I did a couple of searches and the good ones seem to be based on Xorg. I’ll be watching the cavalry of knowledgeable forum members with there style of doing it.

I found a way to achieve what I wanted to do.

Created a systemd service file /usr/lib/systemd/service/azire-up.service

Description=Azire Up



And the command to be run in file /usr/local/bin/azire-up

Then the assigned shortcut in keyboard manager is systemctl start azire-up.service

When I press the assigned keys I just have authorise with password and it executes. I’m OK enough with that.

I created a similar service to bring the wireguard tunnel down with another shortcut.

1 Like

With a bit more research I made it easier.

I changed the keyboard shortcut commands to sudo systemctl start azire-up.service (now sudo), and added them as exceptions in visudo for my user name (I’m the only user anyway). New file in /etc/sudoers.d/ is better than modding sudoers directly with the content…`

myusername ALL=(root) NOPASSWD: /usr/bin/systemctl start azire-up.service, start azire-down.service

Now I can use the shortcut keys without having to authorise, nice and simple and quick, no more typing out longish root command in the terminal.

I started by wanting to add a root command that I frequently run in a terminal as a keyboard shortcut, and ended up here. There must be a reason why a simple command isn’t allowed as a shortcut, and why systemctl is?

I don’t know if this is the only solution, though hope it might be useful for others to know as can be modified for other commands.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.