;;-*-lisp-*-
(begin
;; some debug stuffs that list also the available indentifiers
;; unknown identifier are set/get over the current sink parameters
(print "Sink event, dumping state:")
(print service-name)
(print program-name)
(print application-name)
(print class-name)
(print state)
(print focus)
(print volume-level)
;; these are class settings, loaded to the corresponding gconf path
;; or set manually if not available in gconf
;; gconf is convenient, because it is synchronized with other apps
;; (configuration UI) and persistent
;; a class is described by:
;; - foreground volume level
;; - background volume level
;; - slide time (time of volume adjustments)
;; - a class policy
;; - "LIF" Last In Foreground
;; - "FIF" First In Foreground
;; - "AIF" All In Foreground
;; - "NA" No Adjustments (nothing will be done automatically)
(if (not (class-load "Default"))
(class-settings "Default" 0.7 0.6 1.0 "LIF" "playing" "paused"))
(if (not (class-load "Voice"))
(begin
(class-settings "Voice" 0.9 0.3 1.0 "FIF" "playing" "playing")
(class-exclusion "Voice" "Music" "Movie")))
(if (not (class-load "Event"))
(class-settings "Event" 0.3 0.3 1.0 "AIF" "playing" "playing"))
(if (not (class-load "Alarm"))
(class-settings "Alarm" 1.0 0.6 1.0 "AIF" "playing" "playing"))
(if (not (class-load "Music"))
(begin
(class-settings "Music" 1.0 0.6 1.0 "LIF" "playing" "paused")
(class-exclusion "Music" "Movie")))
(if (not (class-load "Movie"))
(begin
(class-settings "Movie" 1.0 0.6 1.0 "NA" "playing" "paused")
(class-exclusion "Movie" "Music")))
;; this is the way an application can have a default class
;; if it is not set by the application itself
(if (is class-name "Default")
(begin
(if (is program-name "rhythmbox")
(set class-name "Music"))
(if (is program-name "totem")
(set class-name "Movie"))
(if (is program-name "listen")
(set class-name "Music"))
(if (is program-name "sound-juicer")
(set class-name "Music"))
(if (is program-name "ekiga")
(set class-name "Voice"))
(if (is program-name "tapioca")
(set class-name "Voice"))
(if (is program-name "countdowntimer")
(set class-name "Alarm"))
(if (is program-name "Gaim")
(set class-name "Event"))))
;; I don't like the class the application provide, let me override it
(if (is class-name "Chat")
(begin
(set class-name "Voice")))
;; this rule is common to every class
(if (is changed-property "state")
(begin
(if (is state "playing") (foreground))
(if (is state "ready") (background))))
;; let the class make adjustments: change volume, and state
(class-adjustments)
;; this is an application rule
(if (is program-name "rhythmbox")
(begin
(if (is changed-property "focus")
(if focus (force-foreground) else (background)))))
;; all the commands are compiled so far, let's bump up the orders
(apply)
;; further developpments might include
;; - priority (the queues have priority)
;; - metadata, meta.BuddyName, meta.Group, meta.EventName...
;; - ?
)