Clementine Music Player and StreamZap Remote

The Clementine Player allows some types of remotes, but I use a StreamZap to control mythtv, mplayer, etc. I thought it would be easy to add another program, Clementine, to my lirc configuration, but it turned out to be somewhat convoluted. I suspect that the Clementine X window does not have a "name." With some searching I found this on Stack Exchange This pointed me to "xdotool" which I installed with yum. At this point, I should say something about my environment:

it's an HTPC, that I use in my living room

Gigabyte GA-965P-S3
Intel Core 2 Duo E6600
3 Gb RAM
Gigabyte GV-N220OC-1GI GeForce GT 220
Fedora 20 3.12.8-300.fc20.x86_64
xorg-x11-server 1.14.4-5.fc20
KDE 4.11.5
Clementine 1.2.1
xdotool version 2.20110530.1

The solution suggested by the StackExchange answer used xdotool like this

     xdotool key --windowid <window> <keystroke>

which didn't work for me. After some experimenting, I arrived at

     xdotool windowactivate --sync <window> key <keystroke>

Once, that seemed to be working, I defined some scripts and updated my .lircrc file as follows.

 

.lircrc


# Clementine Music Player Commands

# Play/Pause
begin
remote = *
prog = irexec
button = 2
repeat = 0
config = /usr/local/scripts/clementine.play.pause.toggle.sh &
end

# Previous Track
begin
remote = *
prog = irexec
button = 1
repeat = 0
config = /usr/local/scripts/clementine.previous.track.sh &
end

# Next Track
begin
remote = *
prog = irexec
button = 3
repeat = 0
config = /usr/local/scripts/clementine.next.track.sh &
end

scripts


::::::::::::::
clementine.play.pause.toggle.sh
::::::::::::::

WINDOWID=$(xdotool search --class Clementine | head -1)
xdotool windowactivate --sync $WINDOWID key F6

::::::::::::::
clementine.previous.track.sh
::::::::::::::

WINDOWID=$(xdotool search --class Clementine | head -1)
xdotool windowactivate --sync $WINDOWID key F5

::::::::::::::
clementine.next.track.sh
::::::::::::::

WINDOWID=$(xdotool search --class Clementine | head -1)
xdotool windowactivate --sync $WINDOWID key F8

I also have a couple of .lircrc configs to play and kill Clementine


# Green Button
begin
remote = *
prog = irexec
button = GREEN
repeat = 0
config = /usr/bin/clementine &
end

# Yellow Button
begin
remote = *
prog = irexec
button = YELLOW
repeat = 0
config = /usr/bin/killall -v clementine
end

I have seen others searching for a way to use lirc and Clementine. I hope this helps.

 

To contact me, please write to:   mike [at] PCfellow [dot] com  


 

Disclaimer. The information contained in this archive is provided 'as is' without warranty of any kind. The entire risk as to the results and the performance of the information is assumed by the user, and in no event shall PCfellow.com, the author or contributors, the owners, administrator and/or maintainers be liable for any consequential, incidental or direct damages suffered in the course of using the information in this archive. Use of the information contained in this archive are governed by their respective license agreements and may contain restrictions on use.