You are not logged in.

#1 2007-05-11 17:00:24

abhidg
Member
From: City of Kol
Registered: 2006-07-01
Posts: 184
Website

multimedia keys control depending on application

Many applications do not natively support play/pause and stop keys; but they do support control from the command line. What I did was to create a script which would be called everytime the multimedia button would be pressed; and according to which application is active, that action would be applicable to that app.

#!/bin/bash
# Program to toggle playing in whichever application
# is the focussed one.

# Abhishek Dasgupta <abhidg@gmail.com>

focus=`xdpyinfo | grep focus | cut -c 16-24`

info=`xprop -id $focus | grep WM_CLASS | cut -c 20-`

if [[ "$info" =~ .*Audacious.* ]]
then
  audacious --play-pause
elif [[ "$info" =~ .*Totem.* ]]
then
  totem --play-pause
else
  mpc toggle
fi

Hope it will be useful to some of you smile

Offline

Board footer

Powered by FluxBB