LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Num pad shortcuts and media commands (https://www.linuxquestions.org/questions/linux-newbie-8/num-pad-shortcuts-and-media-commands-4175648496/)

Pasc 02-17-2019 10:45 AM

Num pad shortcuts and media commands
 
Hello,

I'm currently in Neon 5.15 and I have a keyboard with numpad. I want to use certain keys (2,4,5,6,8) for multimedia control and volume adjustments. I can easily define them in KDE settings->shortcuts so that when numlock is off I have 1=end 2=vol decrease, 3=pgdn, 4=prev song, 5=play/pause, 6=next song, 7=home 8=vol increase, 9=pgup. But when I do this when numlock is on I can only insert 1,3,7,9 meaning the keys I have not specified in the shortcut menu. The others do nothing. I also get some random numlock on/offs but this is for another post I guess...
I decided to use xbindkeys to try a workaround. But, I don't know the correct commands to assign to them. For Vol up/down I found "amixer sset Master 5%" but this does not have the exact same functionality as the Fn+left/right arrows which apart from adjusting the vol also gives a visual feedback (the bar with the vol percentage). For the prev, play/pause, next I found "qdbus org.kde.amarok /Player org.freedesktop.MediaPlayer.COMMAND" but this is only for Amarok and not for the other players and of course, doesn't provide the same functionality as the Settings->shortcuts with (I believe it uses Media Player which controls also firefox) which can choose the most recent player to apply the command.

So, can you please help me? The truth is I would prefer a solution for the first way (through KDE shortcuts). It's cleaner and easier to manage, without adding new daemons in the pipeline. But of course, a solution via xbindkeys or maybe another workaround would be appreciated as well.

P.S. do you think that creating events for acpi would be more efficient for the system?

ondoho 02-17-2019 11:04 AM

i'm a little confused; are you asking for a solution for your "random" numlocks or something more?
there is a small X app called numlockx that will switch it off for sure; just add that to your startup applications.

Pasc 02-17-2019 12:14 PM

I am sorry for confusing you but in my defense I said that this "random behavior" is for another post.
I am looking for a way to use numpad arrow-keys(2,4,6,8) and num-clear(5) for media control. As stated above when I do it from the KDE settings->shortcuts I have the expected functionality concerning the media control but I lose the ability to use those keys for inserting numbers (when I toggle numlock to number mode).

BW-userx 02-19-2019 07:39 AM

Keyboard shortcuts (KBSC) are desktop / Window Manager dependent, if it works in KDE in how you've setup your KBSC, then in the desktop/WM you're presently using they too have their respective KBSC conf files, (some WM do not posses such control). You are going to have to give more tech specs, what DT/WM are you talking about?

2: some are not so giving in providing such diversity if [ true ] then ; else for KBSC.. not to my knowledge, but anything is possible with Linux/GNU.

Pasc 02-23-2019 06:12 AM

I am running KDE Neon 5.15, kwin --version = 5.15.1. how to find those configuration files?

BW-userx 02-23-2019 07:49 AM

Code:

$ whereis kwin
kwin: /usr/bin/kwin
userx@slackcurdvd.net:~
$ whereis kde
kde: /etc/kde

then just 'ls' into them to see what you see. You should already know what /usr/bin is for. For user config files they are kept in the home dir of the user as hidden files. Either in ~/.config or there own dir outside of that dir. You can use 'find' on your own home using wildcards to see what you come up with. Open a file manager and select 'show hidden file'.

Pasc 03-04-2019 12:39 PM

But I don't understand how finding these config files would help me solve the problem. I don't think I can find the terminal command for play/pause or next/prev. Nor I believe there is a way to change the keys not working.
Is there something I m missing?

BW-userx 03-04-2019 01:04 PM

you have to find a means to tie the keyboard keys to the device / application you are wanting to control. Not all keyboard that already have dedicated volume keys on the keyboard work in Linux, but that is not to say it cannot be done. I use mpv video player in their config I have keyboard shortcuts for volume and seek set to my liking.
Code:

MOUSE_BTN3 add volume 2
MOUSE_BTN4 add volume -2
#keyboard arrow keys
UP add volume 2
DOWN add volume -2

perhaps you might want to try the app that is using the sound to see if you can manipulate it there instead.


All times are GMT -5. The time now is 04:03 AM.