From: Dylan Lloyd Date: Tue, 13 Mar 2012 17:25:13 +0000 (-0400) Subject: added `back` for mpd, and fixed non-display problem X-Git-Url: https://disinclined.org/git/?a=commitdiff_plain;h=080cee31584ef0ab4133fea80520422c11f68ae5;p=powermate.git added `back` for mpd, and fixed non-display problem --- diff --git a/powermate.1 b/powermate.1 index 725adea..8d680c9 100644 --- a/powermate.1 +++ b/powermate.1 @@ -9,6 +9,7 @@ Skips to next MPD/Pianobar track with a press and twist (turn right immediately Mutes with a long press (> 1 second). .SH NOTES This program needs read and write access to /dev/input/event*. It acquires this with a udev rule matching all /dev/input/event* files and assigning them to group input with 660 permissions. To use the program you must be a member of group input. Use `sudo gpasswd -a $(whoami) input` to add yourself to this group, and cycle your login for this to take affect. +This program also does not require alsa, mpd, mpc, pianobar or notify-send although it ceases to have much point without their existence. All events are controlled through easily editable shell scripts and can be adapted to any sound or music program that you use. .SH EXAMPLE This program can be easily called with `powermate`, and is recommended to be launched with your login or X start. .SH FILES @@ -22,6 +23,11 @@ This executable file controls your powermate. This udev rule sets all /dev/input/event* files to group input and 660 permissions. .RE +.I /usr/lib/{volume-up,volume-down,volume-toggle,back,next} +.RS +These shell scripts are called by powermate when an event occurs. +.RE + .I /usr/share/man/man1/powermate.1.gz .RS This man page. diff --git a/powermate.hs b/powermate.hs index c0858f6..8cf996c 100755 --- a/powermate.hs +++ b/powermate.hs @@ -25,7 +25,7 @@ processEvent state (Button True) = do processEvent state (Button False) = do time <- getCurrentTime if (diffUTCTime (time) (stLastPress state) > 0.8) - then ( do runCommand "volume-toggle"; return () ) + then ( do createProcess(proc "volume-toggle" []); return () ) else ( do runCommand "music-toggle"; return () ) state <- updateButton state False return state @@ -44,6 +44,7 @@ processEvent state (Rotate dir) = do then volumeDown else return) state when ((stPressed state) == True && dir < 2) ( do runCommand "next"; return () ) + when ((stPressed state) == True && dir > 2) ( do runCommand "back"; return () ) state <- updatePrevState state (if dir < 2 then 1 else 0) updateBrightness state state <- updatePrevAction state (if (stPrevAction state) == 1 then 0 else 1)