pulse.widget 936 B

1234567891011121314151617181920212223242526272829
  1. module("pulsectl")
  2. define SoundState = Val(Pulse("sink-volume"))
  3. define muted = "audio-volume-muted"
  4. define low = "audio-volume-low"
  5. define medium = "audio-volume-medium"
  6. define high = "audio-volume-high"
  7. #define SoundIcon = If(Pulse("sink-mute")="1",muted,If(SoundState>100, high, If(SoundState>50, medium, If(SoundState>5, low, muted))))
  8. define SoundIcon = If(Pulse("sink-mute")="1",muted,
  9. Lookup(SoundState,
  10. 100, high,
  11. 50, medium,
  12. 5, low,
  13. muted))
  14. layout {
  15. image {
  16. value = SoundIcon
  17. trigger = "pulse"
  18. tooltip = If(Pulse("sink-mute")="1", " (Sound muted) ","Volume: " + Str(Pulse("sink-volume") * 2 / 3,0) + "%")
  19. action[1] = "sakura -x ncpamixer"
  20. action[2] = PulseCmd "sink-mute toggle"
  21. action[3] = "sakura -x ncpamixer"
  22. action[4] = PulseCmd "sink-volume +2"
  23. action[5] = PulseCmd "sink-volume -2"
  24. css = "* { min-height: 24px; min-width: 24px; padding: 4px; }"
  25. }
  26. }