mwolson.org Blog - /Tech

Mon, 23 Oct 2006

More remote control ideas

I've made a bit of progress on tweaking the interaction between gxine and the Apple Remote that came with my Mac Mini. For starters, I thought that the gxine events looked suspiciously like C code. It turns out that they are, in fact, JavaScript. You're even allowed to define JavaScript functions in your gxine settings file and then use them later on in the remote setup. *sigh* If only gxine has a "in_dvd_menu" flag or something similar, I could make buttons perform navigation while in the menus, and skip/slow/play/pause, etc. during playback. One hackish way of approximating this would be to see how long the current video is. If it's longer than 5 minutes, it's probably doing DVD playback, otherwise it is probably in the menus. I haven't tried doing this yet, though, because I came across the feature that I will describe next.

I found out that lirc is capable of treating multiple button clicks as one event, merely by specifying additional button lines in order. This is very exciting to me, because it allowed me to turn my MENU key into a "Meta" key of sorts. That is, hitting MENU and then another button does a different action than just hitting that button. So now, all of my playback-specific actions (play, pause, skip backwards 10 seconds, fast forward, etc.) are accessible by just hitting MENU first, while omitting the initial press of MENU gets the standard DVD menu navigation. As an example, hitting MENU, VOLUME_UP toggles both fullscreen and pausing, in case I need to switch desktops (gxine hogs the desktop while in full-screen mode). Happiness has been achieved on this front :^) .

The next step is to have some global-level remote bindings that allow me to switch between virtual desktops. Even Mac OS X can't do that! These global level keys would be accessed by hitting MENU twice, and then a different button. For example, sending a pause command to my MusicPD daemon would be achieved by hitting MENU, MENU, PLAY/PAUSE, while flipping one desktop to the left would be MENU, MENU, PREVIOUS. Hitting MENU three times would be handled on an application-specific basis, so that I can map it to "Go to DVD root/title menu" when in gxine.

Some other ideas follow.

Evince (PDF Viewer)
This would be perfect for presentations! Keystrokes can be sent directly to the application, I think.
  • Do scroll up/down, page up/down for directional pad.
  • MENU, VOLUME_UP zooms in.
  • MENU, VOLUME_DOWN zooms out.
Emacs
Perhaps I could send Emacs Lisp code through emacsclient.
  • PLAY/PAUSE toggles playing of music through Emms.
  • PREVIOUS and NEXT skip one song backwards or forwards, respectively.
  • VOLUME_UP and VOLUME_DOWN increase/decrease volume via the emms-volume interface.
  • MENU, PREVIOUS goes one window frame to the left; MENU, NEXT goes one window frame to the right.
  • MENU, VOLUME_UP or VOLUME_DOWN move up or down one window in the current frame.
Gnome Terminal
  • Switch between open tabs with NEXT and PREVIOUS.
  • Switch between open windows with VOLUME_UP and VOLUME_DOWN.
Kazehakase (Web browser)
  • NEXT/PREVIOUS switches tabs.
  • VOLUME_UP/DOWN pages through the current webpage.
  • MENU, NEXT/PREVIOUS switches between applications on the same virtual desktop, since the web browser likes to steal focus.
Liferea (RSS Reader)
  • Switch and page articles with NEXT/PREVIOUS and VOLUME_UP/DOWN, respectively.
  • MENU, VOLUME_UP/DOWN goes to next or previous feed,
  • MENU, MENU, MENU closes the reader.
  • MENU, NEXT/PREVIOUS switches between applications on the same virtual desktop, since the web browser likes to steal focus.