My configuration files for Debian/Ubuntu applications
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

pulsebar.md 3.6 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. ## Usage
  2. [Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage)
  3. ### Description
  4. Shows PulseAudio volume with a progressbar; provides tooltips and notifications.
  5. ```lua
  6. local volume = lain.widget.pulsebar()
  7. ```
  8. ## Input table
  9. Variable | Meaning | Type | Default
  10. --- | --- | --- | ---
  11. `timeout` | Refresh timeout (in seconds) | integer | 5
  12. `settings` | User settings | function | empty function
  13. `width` | Bar width | number | 63
  14. `height` | Bar height | number | 1
  15. `margins` | Bar margins | number | 1
  16. `paddings` | Bar paddings | number | 1
  17. `ticks` | Set bar ticks on | boolean | false
  18. `ticks_size` | Ticks size | number | 7
  19. `tick` | String for a notification tick | string | "|"
  20. `tick_pre` | String for the left notification delimeter | string | "["
  21. `tick_post` | String for the right notification delimeter | string | "]"
  22. `tick_none` | String for an empty notification tick | string | " "
  23. `scallback` | [PulseAudio sink callback](https://github.com/lcpz/lain/wiki/pulseaudio/) | function | `nil`
  24. `sink` | Mixer sink | number | 0
  25. `colors` | Bar colors | table | see [Default colors](https://github.com/lcpz/lain/wiki/pulsebar#default-colors)
  26. `notification_preset` | Notification preset | table | See [default `notification_preset`](https://github.com/lcpz/lain/wiki/pulsebar#default-notification_preset)
  27. `followtag` | Display the notification on currently focused screen | boolean | false
  28. `notification_preset` | Notification preset | table | See [default `notification_preset`](https://github.com/lcpz/lain/wiki/pulsebar#default-notification_preset)
  29. `devicetype` | PulseAudio device type | string ("sink", "source") | "sink"
  30. `cmd` | PulseAudio command | string or function | see [here](https://github.com/lcpz/lain/blob/master/widget/pulsebar.lua#L48)
  31. Read [pulse](https://github.com/lcpz/lain/wiki/pulse) page for `cmd` settings.
  32. `settings` can use [these variables](https://github.com/lcpz/lain/wiki/pulse#settings-variables).
  33. With multiple screens, the default behaviour is to show a visual notification pop-up window on the first screen. By setting `followtag` to `true` it will be shown on the currently focused tag screen.
  34. ### Default colors
  35. Variable | Meaning | Type | Default
  36. --- | --- | --- | ---
  37. `background` | Bar backgrund color | string | "#000000"
  38. `mute` | Bar mute color | string | "#EB8F8F"
  39. `unmute` | Bar unmute color | string | "#A4CE8A"
  40. ### Default `notification_preset`
  41. ```lua
  42. notification_preset = {
  43. font = "Monospace 10"
  44. }
  45. ```
  46. ## Output table
  47. Variable | Meaning | Type
  48. --- | --- | ---
  49. `bar` | The widget | `wibox.widget.progressbar`
  50. `device` | PulseAudio device | string
  51. `notify` | The notification | function
  52. `update` | Update state | function
  53. `tooltip` | The tooltip | `awful.tooltip`
  54. ## Buttons
  55. ```lua
  56. volume.bar:buttons(awful.util.table.join(
  57. awful.button({}, 1, function() -- left click
  58. awful.spawn("pavucontrol")
  59. end),
  60. awful.button({}, 2, function() -- middle click
  61. os.execute(string.format("pactl set-sink-volume %d 100%%", volume.device))
  62. volume.update()
  63. end),
  64. awful.button({}, 3, function() -- right click
  65. os.execute(string.format("pactl set-sink-mute %d toggle", volume.device))
  66. volume.update()
  67. end),
  68. awful.button({}, 4, function() -- scroll up
  69. os.execute(string.format("pactl set-sink-volume %d +1%%", volume.device))
  70. volume.update()
  71. end),
  72. awful.button({}, 5, function() -- scroll down
  73. os.execute(string.format("pactl set-sink-volume %d -1%%", volume.device))
  74. volume.update()
  75. end)
  76. ))
  77. ```
  78. ## Keybindings
  79. Same as [here](https://github.com/lcpz/lain/wiki/pulse#keybindings). If you want notifications, use `volume.notify()` instead of `volume.update()`.