Keyboard shortcuts when using Linux and wine possible?

Get answers about using MediaMonkey 4 for Windows.

Moderator: Gurus

Kenny_Dave
Posts: 5
Joined: Tue Feb 04, 2014 2:44 pm

Keyboard shortcuts when using Linux and wine possible?

Post by Kenny_Dave »

I'm on linux, it's working fine apart from some shenanigans with the window size and the media keys aren't integrated. Which isn't that surprising. I can use keyboard shortcuts as long as the program has focus, but not if it doesn't. Which also isn't that surprising.

My approach to solving this has been two headed, but both attempted paths have thus far failed. Option one:

I can open the program with a script:

Code: Select all

wine '/home/mint/.wine/drive_c/Program Files (x86)/MediaMonkey/MediaMonkey.exe
And assign this to a key. Investigation tells me that some programs enable functions like this:

Code: Select all

wine ~/.foobar2000/foobar2000.exe /playpause
Is this a possibility with mediamonkey? I have tried searching and guessing, but no success.

Option 2:

Using a send keys program with a script. And assigning the relevant hot key within mediamonkey. This fails because, I think, MediaMonkey will not accept send keys if the program is not focused.

I can probably do it with a script to give it focus, send the key then put the focus back where it came from. But that will make the screen flicker if I'm also in game or whatever.

Is there an option to enable mediamonkey to accept sendkey events when not focused? More on that here.

Any help with the above, or other methods to get it it to work in linux much appreciated.

I'm in Mint Victoria Cinnamon if that matters.
Peke
Posts: 17498
Joined: Tue Jun 10, 2003 7:21 pm
Location: Earth
Contact:

Re: Keyboard shortcuts when using Linux and wine possible?

Post by Peke »

Hi,
It is possible to start MM using Command line See This post

EDIT: You can also use app https://www.nirsoft.net/utils/nircmd.html and send Virtual Key commands like:
PLAY/PAUSE: "nircmd.exe sendkeypress 0xB3"
NEXT: "nircmd.exe sendkeypress 0xB0"
PREV: "nircmd.exe sendkeypress 0xB1"
STOP: "nircmd.exe sendkeypress 0xB2"
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
Image
How to attach PICTURE/SCREENSHOTS to forum posts
Kenny_Dave
Posts: 5
Joined: Tue Feb 04, 2014 2:44 pm

Re: Keyboard shortcuts when using Linux and wine possible?

Post by Kenny_Dave »

I appreciate the response, thank you.

Did you notice that I'm trying to do this from Linux though? I've already worked out how to send it keys, I'm trying to work out how I can get it to respond. I guess if it will work as you've said from within MSwindows, my issue might be with wine not accepting key events when not focused, so that does help as I might be able to work around that.

the command line things work, I can start it and make it play from the command line. It doesn't do anything when MM is already running though. No commands for this? I'm looking for play, next, previous, randomise play order.

The media keys listed don't work on MM even when focused, as they are locked and integrated to media programs within linux.
Peke
Posts: 17498
Joined: Tue Jun 10, 2003 7:21 pm
Location: Earth
Contact:

Re: Keyboard shortcuts when using Linux and wine possible?

Post by Peke »

Hi,
I am not on Linux, but I used Key detection to send NirCMD to Remote PC and to WMWARE virtual windows installation on same PC.

What you ask needs to be handled within Wine Settings, check their forums how to parse Media Keys Specifically

Code: Select all

VK_VOLUME_MUTE 	0xAD 	Volume Mute key
VK_VOLUME_DOWN 	0xAE 	Volume Down key
VK_VOLUME_UP 	0xAF 	Volume Up key
VK_MEDIA_NEXT_TRACK 	0xB0 	Next Track key
VK_MEDIA_PREV_TRACK 	0xB1 	Previous Track key
VK_MEDIA_STOP 	0xB2 	Stop Media key
VK_MEDIA_PLAY_PAUSE 	0xB3 	Play/Pause Media key
VK_LAUNCH_MAIL 	0xB4 	Start Mail key
VK_LAUNCH_MEDIA_SELECT 	0xB5 	Select Media key
VK_LAUNCH_APP1 	0xB6 	Start Application 1 key
VK_LAUNCH_APP2 	0xB7 	Start Application 2 key
Where you can use APP1, APP2 to Assign MM hotkeys for Randomize ON/OFF and other things you want.
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
Image
How to attach PICTURE/SCREENSHOTS to forum posts
Kenny_Dave
Posts: 5
Joined: Tue Feb 04, 2014 2:44 pm

Re: Keyboard shortcuts when using Linux and wine possible? [SOLVED]

Post by Kenny_Dave »

So if anyone else is trying to do the same, this is the script:

Code: Select all

#!/bin/bash
 
case $1 in
   "play")
       key="ctrl+p"
       ;;
   "next")
       key='ctrl+n'
       ;;
   "prev")
       key='ctrl+b'
       ;;
   "rand")
        key='ctrl+shift+l'
       ;;
   *)
       echo "Usage: $0 play|next|prev|rand"
       exit 1
        ;;
esac

Win_ret=$(xdotool getactivewindow)

xdotool search --name "MediaMonkey" windowactivate #--sync
sleep 0.1
xdotool key $key
sleep 0.1

#echo "$Win_ret"

xdotool windowactivate "$Win_ret"

exit 0
Which can then be assigned to a key press on the keyboard. Lots of different ways to do that.
Hotkeys in MM must match what you list in the script given there of course.
Take care with capitals in the key string, as I spend 30 minutes discovering. xdotools does some odd things with capitals. Script needs to be set to executable.

I haven't been able to work out how to get the wine window to take key events without focus, so there is a little flicker. This will be more noticeable with full screen apps like games. I've got an outstanding post on the wine forums so it may become possible for me in the future.
Post Reply