I'm using empcd in conjunction with IR remotes - I want to tie playlists to numpad hotkeys and allow programming from the remote itself, similar to old-school car radios. A user should be able to hold down a hotkey to save the current playlist to the hotkey with a long press. A single brief press to the hotkey would then load the saved playlist.
In empcd I've attempted to accomplish this using UP and REPEAT events. Numpad REPEAT will save the current playlist to that key. Numpad UP will play the playlist on that key.
The problem is empcd doesn't have any context awareness around Up/Down/Repeat - so the UP event is executed when the key is released after a REPEAT event. Ideally if REPEAT triggered an action then the UP should be ignored.
key KEY_1 UP mpd_plst_load 1
key KEY_1 REPEAT mpd_plst_save 1
Debug log below, filtered for relevant/unique items. The actual user action was just to hold down a button for second or so, then release.
# empcd -y 10 -f -x
[ info] empcd 2012.11.23 by Jeroen Massar <[email protected]>
[ debug] ReadConfig(/root/.empcd.conf) = error
[ debug] ReadConfig(/etc/empcd.conf) = ok
[ debug] /etc/empcd.conf@0019: mpd_port 6600
[ debug] Setting MPD_PORT to 6600
[ debug] /etc/empcd.conf@0022: eventdevice /dev/input/event0
[ debug] /etc/empcd.conf@0026: exclusive on
[ debug] /etc/empcd.conf@0057: key KEY_0 UP mpd_play
[ debug] Mapping Event KEY_0 (0/11) up (Key goes up again) to do mpd_play (MPD Start Playing) with arg <none>
[ debug] /etc/empcd.conf@0095: key KEY_1 UP mpd_plst_load 1
[ debug] Mapping Event KEY_1 (1/2) up (Key goes up again) to do mpd_plst_load (MPD Load Playlist) with arg 1
[ debug] /etc/empcd.conf@0099: key KEY_1 REPEAT mpd_plst_save 1
[ debug] Mapping Event KEY_1 (1/2) repeat (Key down and gets repeated) to do mpd_plst_save (MPD Save Playlist) with arg 1
[ debug] /etc/empcd.conf@0111: key KEY_CYCLEWINDOWS UP exec /usr/sbin/loadplaylist restore
[ debug] Mapping Event KEY_CYCLEWINDOWS (Window cycle/154) up (Key goes up again) to do exec (Execute a command) with arg /usr/sbin/loadplaylist restore
[ debug] /etc/empcd.conf@0113: key KEY_NUMERIC_POUND UP exec sima_d toggle
[ debug] Mapping Event KEY_NUMERIC_POUND (*/523) up (Key goes up again) to do exec (Execute a command) with arg sima_d toggle
[ debug] /etc/empcd.conf@0114: key KEY_NUMERIC_STAR UP exec /usr/bin/albumbler
[ debug] Mapping Event KEY_NUMERIC_STAR (#/522) up (Key goes up again) to do exec (Execute a command) with arg /usr/bin/albumbler
[ info] Running as PID 8357, processing your strokes
[ debug] Event: T1353732547.042511, type 4, code 4, value 2
[ debug] Event: T1353732547.042515, type 1, code 2, value 1: down, name: KEY_1, desc: 1
[ debug] Event: T1353732547.042515, type 0, code 0, value 0
[ debug] Event: T1353732547.292987, type 4, code 4, value 2
[ debug] Event: T1353732547.292990, type 1, code 2, value 2: repeat, name: KEY_1, desc: 1
[ debug] Event: T1353732547.292990, type 1, code 2, value 2: repeat, name: KEY_1, desc: 1, action: mpd_plst_save(1)
[ debug] Event: T1353732547.292990, type 1, code 2, value 2: repeat, name: KEY_1, desc: 1
[ debug] Event: T1353732548.818290, type 0, code 0, value 0
[ debug] Event: T1353732548.834393, type 4, code 4, value 2
[ debug] Event: T1353732548.834395, type 1, code 2, value 0: up, name: KEY_1, desc: 1
[ debug] Event: T1353732548.834395, type 1, code 2, value 0: up, name: KEY_1, desc: 1, action: mpd_plst_load(1)
[ debug] Event: T1353732548.834395, type 1, code 2, value 0: up, name: KEY_1, desc: 1
[ debug] Event: T1353732548.834396, type 0, code 0, value 0
[ debug] Event: T1353732550.802553, type 4, code 4, value 29