Since they don’t appear in that hardware info thing, if it helps, here are the mouse and the keyboard in question.
After installing EndeavourOS I have some very weird behavior with my multimedia controls both the special multimedia keys on the keyboard and the 3 extra buttons on the side of my mouse which in the windows software for the mouse I set to next track, play/pause and previous track.
In windows both of these would only affect my audio player no matter where I was or what I was doing!!
But in linux, if I start playing a youtube video for example the first click of the start/pause button will pause the music player, but any further clicks on any of the controls forget about the audio player and start affecting the video. Heck even if I click on the youtube button and go back to the youtube homepage(aka the video is no longer playing/on screen) the buttons still make the video start/stop somehow(I can hear it!!) and this behavior doesn’t stop untill I manually maximize the audio player and click play myself. Then the buttons will start to work for the audio player again.
Similarly if I start playing a video in vlc, only in this case if I close vlc it thankfully goes back to affecting the audio player by itself.
And sometimes these controls don’t work at all until I reboot.
So please what can I do to make both the keyboard multimeda buttons as well as those 3 predefined mouse buttons only affect whichever music player I am gonna settle on no matter where I am or what else I am doing?
@VIKINGS
A top-down approach could be using ydotool to generate keyboard and/or mouse events. /usr/include/linux/input-event-codes.h
The opposite one (phase #1): yay -S kdotool
#!/bin/sh
# skip to a launched app. for 5 seconds and return back
ACTWIN=$(kdotool getactivewindow)
WINAME=$(kdotool getwindowclassname $ACTWIN)
SKIPTO=$(yad --title="$WINAME" \
--entry --entry-label="Skip to" --entry-text="") #2 chars are enough
SWIN=$(kdotool search --class "$SKIPTO")
#yad --text="Dest: $SWIN"
kdotool windowactivate "$SWIN"
sleep 5
# kdotool windowminimize "$SWIN"
kdotool windowactivate "$ACTWIN"
I used in ~/au.sh (chmod +x ~/au.sh is needed)
I called by shortcut Ctrl+U asks for the (sound) player app. amarok/exaile/vlc 2 chars are
enough to skip to. You have 5 seconds to intervene and then returns to the original app.
Yes, this is a rudimentary approach of your dreams.
As far as I tested multimedia keys act on the last media application.
Hi, thank you so much for responding.
Ok, I installed kdotool using the command you gave me, but the next step I am screwing up, not sure I understood exactly what I am supposed to do.
If I try to edit the input-event-codes.h file and add your code block to the end of it I get these errors:
#!/bin/sh
# skip to a launched app. for 5 seconds and return back
until
kdotool windowactivate "$ACTWIN"
to kate and save as au.sh in your home directory chmod +x ~/au.sh
Super Shortcuts / Add New Command and scripts and Chose au.sh from your Home directory.
Click to Add Custom shortcut Press Ctrl+U
You are good to go.
The input_event_codes.h is not needed at the moment. It contains codes with those you can produce with ydotool mouse or key events. I send you an example later. It’s not so easy.
Edit: Here is a much ado about a tiny problem with ydotool
how to find codes:
copied until $actwin in Kate and saved in /home/vikings(was that good or was it supposed to be outside of the user folder, like next to lost+found?) with the name you said;
used that chmod command in the terminal, the terminal didn’t spit back anything, hopefully that was the intended result;
added everything to shortcuts tab in system settings, no problems there;
and lastly the ydotool thread you linked to, I am supposed to just read that to educate myself and not actually start inputing stuff from it, correct?
Yes. So when you are in your browser and some media payers work behind and you press
Ctr+U (if shortcut creation was done) a window pops up
and pressing enter Amarok comes up for 5 sec. In this period amaarok owns your keyboard and
mouse. Modify 5 to any other value you need.
At the end your browser will be active again. Of course these players were started earlier.
If you read kdotool -h applications may be hidden (not shown in taskbar)
Oh, yes, I see, the window does pop up.
Well I thank you very much for your help and I trully apologize for all the time you wasted, but I have to be honest, this is not was I was looking for at all…
I was hoping for a way to make the system understand that those keys are always for the audio player only without me having to do anything more after the initial setup.
And how to make ‘private’ a Play/Pause when you are watching a you-tube video?
With kdotool the app. can be selected behind the scenes and
with ydotool a script can push the Pause Next etc. buttons.
I enjoyed the learning process. Your question served only as a pretext.
Yaaaaaaaay I finally fixed it myself!!! At least for the strawberry player which I decided to settle on. Whether this will work for you as well depends on what options your music player has.
Ok, so here are the steps that worked for me/with my player, try to adapt them to your own situation:
open system settings, go to shortcuts
find the Media Controller entry, remove all the shortcuts from it
find the strawberry entry, add your keys to it(even if something might already be added, edit them and actually press your specific keys!)
when done hit apply and close system settings
now open strawberry itself, go to tools>settings>global shortcuts
make sure “Use KDE(KGlobalAccel) shortcuts when available” is ticked
then select a shortcut from the list and at the bottom click “custom” then press the key you want to use(obviously has the be the same key you set in system settings for that shortcut)
repeat for all the shortcuts you want, then apply and relaunch strawberry.
(Yes, you have to do step 7 even if it looks like the keys are already set up how you want, otherwise it won’t work!!)
Done, should now work just like in windows where those keys will only affect the music player no matter where you are or what you are doing!