Ceci est une ancienne révision du document !
Les fichiers de configuration de LIRC
C'est quoi ?
Les fichiers de configuration de lirc sont des fichiers cachés à la racine du profil. Le fichier principal de configuration est .lircrc.
Principe
Le principe de ce fichier est le suivant:
# ici démarre les actions pour le logiciel TOTEM begin totem # ici on défini la première action : begin #Le programme concerné ici TOTEM prog = Totem #Le bouton de la télécommande concerné par cette action #Il peut être modifié en fonction du modèle de télécommande #Pour tester le nom affecté à chaque touche de la télécommande #utilisez la commande irw button = power #L'action qui va être déclanchée lors de l'appui sur le bouton config = quit end # ici on défini la deuxième action : begin prog = Totem button = max-window config = fullscreen #L'action ne sera répétée qu'une seule fois repeat = 1 end # ici termine les actions pour le logiciel TOTEM end totem
Exemples
Voici quelques exemples pour la télécommande ATI REMOTE WONDER. Ils peuvent être facilement modifié pour l'adapter à votre télécommande.
Le fichier principal
Pour éviter d'allourdir les fichiers ils ont été scindé en plusieurs morceaux. La commande include permet d'inserer d'autres fichier en fonction des logiciels pris en charge.
begin prog = irexec button = tv config = if [ $(ps -eo cmd | grep -c ^tvtime$) -eq 0 ]; then (tvtime &); fi mode = tvtime & end begin prog = irexec button = web config = if [ $(ps -eo cmd | grep -c ^vlc) -eq 0 ]; then (vlc "http://mafreebox.freebox.fr/freeboxtv/playlist.m3u" &); fi mode = vlc & end begin prog = irexec button = dvd config = if [ $(ps -eo cmd | grep -c ^mplayer$) -eq 0 ]; then (mplayer -playlist /media/LACIE/Video/playlist.txt &); fi mode = mplayer & end begin prog = irexec button = drag config = if [ $(ps -eo cmd | grep -c ^kaffeine$) -eq 0 ]; then (kaffeine &); fi mode = kaffeine & end include ~/.lircrc.vlc include ~/.lircrc.totem include ~/.lircrc.tvtime include ~/.lircrc.kaffeine include ~/.lircrc.amarok include ~/.lircrc.mplayer include ~/.lircrc.elisa
irexec -d
VLC
.lircrc.vlc
Pour l'activer : vlc → Settings → Interface → Control Interfaces et cocher Infrared remote control interface
## VLC ## begin prog = vlc button = play config = key-play repeat=32 end begin prog = vlc button = pause config = key-play-pause end begin prog = vlc button = stop config = key-stop end begin prog = vlc button = power config = key-quit repeat=1 end begin prog = vlc button = chan-up config = key-next end begin prog = vlc button = chan-down config = key-prev end begin prog = vlc button = max_window config = key-fullscreen end begin prog = vlc button = rewind config = key-slower end begin prog = vlc button = forward config = key-faster end #Audio controls begin prog = vlc button = vol-down config = key-vol-down repeat=0 end begin prog = vlc button = vol-up config = key-vol-up repeat=0 end begin prog = vlc button = mute config = key-vol-mute end #For dvd navigation begin prog = vlc button = 4 config = key-nav-left end begin prog = vlc button = 8 config = key-nav-down end begin prog = vlc button = 2 config = key-nav-up end begin prog = vlc button = 6 config = key-nav-right end begin prog = vlc button = 5 config = key-nav-activate end begin prog = vlc button = source config = key-disc-menu end
Pour avoir la liste complète des fonctions que peut utiliser une télécommande avec VLC, lancer la commande suivante :
vlc -H --advanced 2>&1 |sed -n '/--key/ {s/^\ *--//; s/^\(.*\) <[^>]*>\ *\(.*\)$/\2 -> \1/; h}; /^.*[^ ].*-> key/ p; /^ -> key/ { n; s/^[ \t\n]*//M; G; s/\n//; p}'
Totem
.lircrc.totem
## Totem ## begin totem begin prog = Totem button = power config = quit end begin prog = Totem button = play config = play end begin prog = Totem button = pause repeat = 0 config = pause end begin prog = Totem button = stop config = pause repeat = 0 end begin prog = Totem button = chan-up config = next repeat = 1 end begin prog = Totem button = chan-down config = previous repeat = 1 end begin prog = Totem button = forward config = seek_forward repeat = 1 end begin prog = Totem button = rewind config = seek_backward repeat = 1 end begin prog = Totem button = vol-up config = volume_up repeat = 1 end begin prog = Totem button = vol-down config = volume_down repeat = 1 end begin prog = Totem button = max-window config = fullscreen repeat = 1 end end totem
Tvtime
.lircrc.tvtime
## TVTIME ## begin prog = irexec button = POWER config = tvtime-command QUIT end begin prog = irexec button = E config = tvtime-command TOGGLE_INPUT end begin prog = irexec button = launch_setup config = tvtime-command DISPLAY_INFO end begin prog = irexec button = MAXIMIZE config = tvtime-command TOGGLE_FULLSCREEN end begin prog = irexec button = MUTE config = tvtime-command TOGGLE_MUTE end begin prog = irexec button = UP config = tvtime-command UP end begin prog = irexec button = DOWN config = tvtime-command DOWN end begin prog = irexec button = RIGHT config = tvtime-command RIGHT end begin prog = irexec button = LEFT config = tvtime-command LEFT end begin prog = irexec button = vol-up config = tvtime-command MIXER_UP repeat = 1 end begin prog = irexec button = vol-down config = tvtime-command MIXER_DOWN repeat = 1 end begin prog = irexec button = chan-up config = tvtime-command CHANNEL_UP end begin prog = irexec button = chan-down config = tvtime-command CHANNEL_DOWN end begin prog = irexec button = dvd-root_menu config = tvtime-command CHANNEL_JUMP end begin prog = irexec button = 1 config = tvtime-command CHANNEL_1 end begin prog = irexec button = 2 config = tvtime-command CHANNEL_2 end begin prog = irexec button = 3 config = tvtime-command CHANNEL_3 end begin prog = irexec button = 4 config = tvtime-command CHANNEL_4 end begin prog = irexec button = 5 config = tvtime-command CHANNEL_5 end begin prog = irexec button = 6 config = tvtime-command CHANNEL_6 end begin prog = irexec button = 7 config = tvtime-command CHANNEL_7 end begin prog = irexec button = 8 config = tvtime-command CHANNEL_8 end begin prog = irexec button = 9 config = tvtime-command CHANNEL_9 end begin prog = irexec button = 0 config = tvtime-command CHANNEL_0 end begin prog = irexec button = OK config = tvtime-command ENTER end
Kaffeine
.lircrc.kaffeine
## KAFFEINE ## begin prog = irexec button = play config = dcop kaffeine KaffeineIface playDvb end begin prog = irexec button = pause config = dcop kaffeine KaffeineIface pause end begin prog = irexec button = ok config = dcop kaffeine KaffeineIface dvbOSD end begin prog = irexec button = stop config = dcop kaffeine KaffeineIface stop end begin prog = irexec button = forward config = dcop kaffeine KaffeineIface posPlus end begin prog = irexec button = rewind config = dcop kaffeine KaffeineIface posMinus end begin prog = irexec button = chan-up config = dcop kaffeine KaffeineIface next end begin prog = irexec button = chan-down config = dcop kaffeine KaffeineIface previous end begin prog = irexec button = power config = dcop kaffeine KaffeineIface quit end begin prog = irexec button = vol-up config = dcop kaffeine KaffeineIface volUp end begin prog = irexec button = mute config = dcop kaffeine KaffeineIface mute end begin prog = irexec button = vol-down config = dcop kaffeine KaffeineIface volDown end begin prog = irexec button = max_window config = dcop kaffeine KaffeineIface fullscreen end begin prog = irexec button = up config = dcop kaffeine KaffeineIface zoomIn end begin prog = irexec button = down config = dcop kaffeine KaffeineIface zoomOut end begin prog = irexec button = 1 config = dcop kaffeine KaffeineIface setNumber 1 repeat = 0 end begin prog = irexec button = 2 config = dcop kaffeine KaffeineIface setNumber 2 repeat = 0 end begin prog = irexec button = 3 config = dcop kaffeine KaffeineIface setNumber 3 repeat = 0 end begin prog = irexec button = 4 config = dcop kaffeine KaffeineIface setNumber 4 repeat = 0 end begin prog = irexec button = 5 config = dcop kaffeine KaffeineIface setNumber 5 repeat = 0 end begin prog = irexec button = 6 config = dcop kaffeine KaffeineIface setNumber 6 repeat = 0 end begin prog = irexec button = 7 config = dcop kaffeine KaffeineIface setNumber 7 repeat = 0 end begin prog = irexec button = 8 config = dcop kaffeine KaffeineIface setNumber 8 repeat = 0 end begin prog = irexec button = 9 config = dcop kaffeine KaffeineIface setNumber 9 repeat = 0 end begin prog = irexec button = 0 config = dcop kaffeine KaffeineIface setNumber 0 repeat = 0 end
Amarok
.lircrc.amarok
#amarok begin prog = irexec button = menu config = amarok end begin prog = irexec button = power config = dcop amarok MainApplication-Interface quit end begin prog = irexec button = play config = dcop amarok player play end begin prog = irexec button = forward config = dcop amarok player seekRelative 10 end begin prog = irexec button = rewind config = dcop amarok player seekRelative -5 end begin prog = irexec button = pause config = dcop amarok player pause end begin prog = irexec button = stop config = dcop amarok player stop end begin prog = irexec button = next config = dcop amarok player next end begin prog = irexec button = last config = dcop amarok player prev end begin prog = irexec button = chup config = dcop amarok player next end begin prog = irexec button = chdown config = dcop amarok player prev end begin prog = irexec button = volup config = dcop amarok player volumeUp end begin prog = irexec button = mute config = dcop amarok player mute end begin prog = irexec button = voldown config = dcop amarok player volumeDown end begin prog = irexec button = epg config = dcop amarok playlist togglePlaylist end begin prog = irexec button = chrtn config = toggleRandomAmarok end begin prog = irexec button = max_window config = dcop amarok player showOSD end
Mplayer
.lircrc.mplayer
# Mplayer begin button = vol-up prog = mplayer config = volume 10 repeat = 5 end begin button = vol-down prog = mplayer config = volume -10 repeat = 5 end begin button = mute prog = mplayer config = mute end begin button = pause prog = mplayer config = pause end begin button = play prog = mplayer config = pause end begin button = stop prog = mplayer config = seek 0 1\npause end begin button = power prog = mplayer config = quit end begin button = max_window prog = mplayer config = vo_fullscreen end begin button = record prog = mplayer config = osd end begin button = forward prog = mplayer config = seek 5 end begin button = rewind prog = mplayer config = seek -5 end begin button = right prog = mplayer config = seek 60 end begin button = left prog = mplayer config = seek -60 end begin button = up prog = mplayer config = seek 600 end begin button = down prog = mplayer config = seek -600 end begin button = chan-up prog = mplayer config = pt_step 1 end begin button = chan-down prog = mplayer config = pt_step -1 end
Elisa
(pour que cette configuration soit reconnue par elisa, rajoutez un lien symbolique dans ~/.elisa:
ln -s ~/.elisa/lircrc ~/.lircrc.elisa
Puis dans le fichier ~/.elisa/elisa.conf cherchez lirc_rc et remplacer par
'lirc_rc = 'lircrc'
.lircrc.elisa
# Elisa begin prog = elisa button = power config = close_key end begin prog = elisa button = up config = move_up_key repeat = 1 end begin prog = elisa button = down config = move_down_key repeat = 1 end begin prog = elisa button = left config = move_left_key repeat = 1 end begin prog = elisa button = right config = move_right_key repeat = 1 end begin prog = elisa button = ok config = activate_key end begin prog = elisa button = tv_on_demand config = toggle_menu_key end begin prog = elisa button = play config = toggle_play_pause_key end begin prog = elisa button = PAUSE config = pause_key end begin prog = elisa button = stop config = stop_key end begin prog = elisa button = forward config = increment_playback_speed_key repeat = 1 end begin prog = elisa button = rewind config = decrement_playback_speed_key repeat = 1 end begin prog = elisa button = f config = seek_forward_key end begin prog = elisa button = e config = seek_backward_key end begin prog = elisa button = max_window config = toggle_fullscreen_key end begin prog = elisa button = mute config = toggle_mute_key end begin prog = elisa button = vol-up config = increment_volume_key repeat = 1 end begin prog = elisa button = vol-down config = decrement_volume_key repeat = 1 end
Astuces d'intégration avec Gnome
Il est possible d'obtenir une réponse visuelle de vos actions télécommandées. À titre d'exemple, cette section vous illustre comment interagir avec le mixer de Gnome et d'obtenir le visuel OSD du volume, tel qu'illustré à la figure ci-contre.
Un OSD est une interface utilisateur qui apparaît à l'écran d'un téléviseur ou d'un ordinateur et qui permet d'effectuer des réglages de cet écran ou bien d'un autre appareil qui lui est relié (lecteur DVD, démodulateur…) (extrait de Wikipedia)
D'abords, vous devez installer le paquet xmacro.
sudo apt-get install xmacro
Somme toute, xmacro permet d'enregistrer ou de simuler des évènements provenant du clavier ou la souris sous un serveur X.
Ensuite, éditez votre fichier ~/.lircrc afin d'associer les évènements de contrôle de volume. Dans l'exemple suivant, les évènements de la télécommande VOLUP, VOLDOWN et MUTE ont été associé :
begin prog = irexec button = MUTE repeat = 0 # ici se trouve l'interaction avec xmacro, lequel simule les touches du clavier config = echo KeyStrPress XF86AudioMute KeyStrRelease XF86AudioMute | xmacroplay $DISPLAY end begin prog = irexec button = VOLUP repeat = 1 delay = 5 config = echo KeyStrPress XF86AudioRaiseVolume KeyStrRelease XF86AudioRaiseVolume | xmacroplay $DISPLAY end begin prog = irexec button = VOLDOWN repeat = 1 delay = 5 config = echo KeyStrPress XF86AudioLowerVolume KeyStrRelease XF86AudioLowerVolume | xmacroplay $DISPLAY end