You are not logged in.

#1 2022-12-10 09:41:28

Epp
Member
Registered: 2022-07-11
Posts: 101

[SOLVED] Best way to maintain keyboard shortcuts using DWM

Yes, excuses, once again back with a really NB question.

Can you please give some advice about the best way for me to add custom keyboard shortcuts?

For launching applications I've edited the dwm .config.h file.
All working great.

But what's the best way for me (using dwm) to make shortcuts for terminal commands?
My terminal is the gnome-terminal.

First thing that came to my mind is placing more shortcuts in the dwm .config.h file.
I feel like the ~/.xprofile file would be the best option. But search pages are not really loaded with info about these options (perhaps it's me handling the seach engines).

More results are pointed to options like:

https://wiki.archlinux.org/title/Keyboard_shortcuts

"The universal way using Xorg utilities (e.g. xbindkeys) and eventually your desktop environment or window manager tools."

Enthousiastic about this, watching a video on YT about this:
https://www.youtube.com/watch?v=8cLRsYKoEdw
At 0:21: 

"I don't recommend this using a tiling window manager"

I tried autokey('s) from the aur, but it's not working great on my machine out of the box. Most likely more tweaking was needed. At this moment deleted the package.

For now it's only for 3 commands:
sudo systemctl start avahi-daemon.service (to start the service for my Samsung printer)
Also something like this to start my VPN service.
And a poweroff or shutdown command.

Advice is welcome, and once again sorry for such a low level question.

Greetings!

Last edited by Epp (2022-12-11 08:25:51)

Offline

#2 2022-12-10 13:42:48

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,421

Re: [SOLVED] Best way to maintain keyboard shortcuts using DWM

But what's the best way for me (using dwm) to make shortcuts for terminal commands?

What does that mean?

sudo systemctl start avahi-daemon.service (to start the service for my Samsung printer)

What does that have to do w/ a terminal?

Are you looking for a shortcut or an alias?
If it's a sortcut, why do you think you'd need a special way for "terminal commands"™?
Or do you want to run the command inside a terminal?

gnome-terminal -- sudo systemctl start avahi-daemon.service

Or is it only about issuing the sudo password?


Semi-OT, but

watching a video on YT about this

I've not seen it, but suggest that you simply forget everything you heard there.

Offline

#3 2022-12-10 14:11:14

Epp
Member
Registered: 2022-07-11
Posts: 101

Re: [SOLVED] Best way to maintain keyboard shortcuts using DWM

Haha, ok thanks, I can give xbindkeys another look (outside YT).

Once in a few months I need to paper print something.
Before I can use my printer I need to start the service.
For that I go to my own notes, copy this line and paste it in my (gnome-) terminal.
And yes, most likely there are way more smarter ways.

But yesterday I tried to automate the start of the service for my VPN connection (ExpressVPN). Got a little stuck, read on the website of ExpressVPN:

Important: The OpenVPN manual configuration does not offer the same security and privacy benefits as the ExpressVPN app. If you are located in a country with a high level of internet censorship, you are recommended to use the ExpressVPN app for a more stable VPN connection.

So thinking from little bubble I thought, why for only automating this command (all the fuzz):

sudo systemctl start expressvpn

And sharp, yes, it's more just a sort of keyboard string pasting, than really terminal related stuff.
More a workaround for avoiding the need for the really smart and good solutions.
Probably shell scripting etc.
Not saying I don't want to be good at that.

Offline

#4 2022-12-10 14:23:52

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] Best way to maintain keyboard shortcuts using DWM

Epp wrote:

Once in a few months I need to paper print something.
Before I can use my printer I need to start the service.

Do you have a good reason to not simply enable the service so that it's running all the time?


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#5 2022-12-10 14:32:13

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,480
Website

Re: [SOLVED] Best way to maintain keyboard shortcuts using DWM

It sounds like you just want shell aliases for these commands.

Last edited by Trilby (2022-12-10 14:32:29)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2022-12-10 14:33:53

Epp
Member
Registered: 2022-07-11
Posts: 101

Re: [SOLVED] Best way to maintain keyboard shortcuts using DWM

Do you have a good reason to not simply enable the service so that it's running all the time?

Again good question. No, probably only a little angst.
This OpenVPN adventure scared me off a little.
But probably automating a printer service is less complicated then automating a VPN service.

Offline

#7 2022-12-10 14:42:25

Epp
Member
Registered: 2022-07-11
Posts: 101

Re: [SOLVED] Best way to maintain keyboard shortcuts using DWM

It sounds like you just want shell aliases for these commands.

Uhm... yes and no.

Yes, off course I want the best and most practical solution (from which I could most likely learn).
But also no, because I am at level 0 with this. I don't want to aks questions that are a bit equal to "can you please give me perfect files for implementing dwm to fulfill my wishes?"

Offline

#8 2022-12-10 14:52:56

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,480
Website

Re: [SOLVED] Best way to maintain keyboard shortcuts using DWM

Epp wrote:

But also no, because I am at level 0 with this. I don't want to aks questions that are a bit equal to "can you please give me perfect files for implementing dwm to fulfill my wishes?"

What does this have to do with (not) using aliases?

Note that you keep referring to dwm, but your window manager is not relevant to this topic.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#9 2022-12-10 15:07:13

Epp
Member
Registered: 2022-07-11
Posts: 101

Re: [SOLVED] Best way to maintain keyboard shortcuts using DWM

What does this have to do with (not) using aliases?

Shell commands

Note that you keep referring to dwm, but your window manager is not relevant to this topic.

I think you're right when referring shell.
What I do know is that things that work on my gnome desktop (keyboard shortcuts) don't work with my tiling window active.
Also that  autokey is giving an error about a monitor. And that's it's behaving bad after a fix from from 2015.
https://askubuntu.com/questions/616752/ … nome-15-04
Probably I type too much.

Offline

#10 2022-12-10 15:12:53

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,480
Website

Re: [SOLVED] Best way to maintain keyboard shortcuts using DWM

I think there's a language barrier here.  I'm suggesting using shell aliases.  Your reason for not doing so is "shell commands"?  That doesn't make any sense at all.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#11 2022-12-11 08:25:19

Epp
Member
Registered: 2022-07-11
Posts: 101

Re: [SOLVED] Best way to maintain keyboard shortcuts using DWM

I think there's a language barrier here.  I'm suggesting using shell aliases.  Your reason for not doing so is "shell commands"?  That doesn't make any sense at all.

I think you have a point there.
And I must say it's a bit overwhelming.

After all the problem seemed not too complex.

I got xbindkeys to work for the two services. After that I realised I could also "enable" those services.
With some additions to my sudoers file I can for example run the services automatic at boot and make a keyboard shortcut through xbindkeys to shutdown my computer.
For shutdown there is also a dwm patch I saw.

Eventually things are working better than expected. A tool for autofill text in a terminal does not seem very handy for me at the moment.

Thank you!

Offline

Board footer

Powered by FluxBB