My configuration files for Debian/Ubuntu applications
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

alsabar.md 4.0 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. ## Usage
  2. [Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage)
  3. ### Description
  4. Shows ALSA volume with a progressbar; provides tooltips and notifications.
  5. ```lua
  6. local volume = lain.widget.alsabar()
  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 | integer | 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. `cmd` | ALSA mixer command | string | "amixer"
  24. `channel` | Mixer channel | string | "Master"
  25. `togglechannel` | Toggle channel | string | `nil`
  26. `tick` | The character usef for ticks in the notification | string | "|"
  27. `colors` | Bar colors | table | see [Default colors](https://github.com/lcpz/lain/wiki/alsabar#default-colors)
  28. `notification_preset` | Notification preset | table | See [default `notification_preset`](https://github.com/lcpz/lain/wiki/alsabar#default-notification_preset)
  29. `followtag` | Display the notification on currently focused screen | boolean | false
  30. `cmd` is useful if you need to pass additional arguments to `amixer`. For instance, you may want to define `cmd = "amixer -c X"` in order to set amixer with card `X`.
  31. In case mute toggling can't be mapped to master channel (this happens, for instance, when you are using an HDMI output), define `togglechannel` as your S/PDIF device. Read [`alsa`](https://github.com/lcpz/lain/wiki/alsa#toggle-channel) page to know how.
  32. To set the maximum number of ticks to display in the notification, define `max_ticks` (integer) in `notification_preset`.
  33. `settings` can use the following variables:
  34. Variable | Meaning | Type | Values
  35. --- | --- | --- | ---
  36. `volume_now.level` | Volume level | integer | 0-100
  37. `volume_now.status` | Device status | string | "on", "off"
  38. 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.
  39. ### Default colors
  40. Variable | Meaning | Type | Default
  41. --- | --- | --- | ---
  42. `background` | Bar backgrund color | string | "#000000"
  43. `mute` | Bar mute color | string | "#EB8F8F"
  44. `unmute` | Bar unmute color | string | "#A4CE8A"
  45. ### Default `notification_preset`
  46. ```lua
  47. notification_preset = {
  48. font = "Monospace 10"
  49. }
  50. ```
  51. ## Output table
  52. Variable | Meaning | Type
  53. --- | --- | ---
  54. `bar` | The widget | `wibox.widget.progressbar`
  55. `channel` | ALSA channel | string
  56. `notify` | The notification | function
  57. `update` | Update `bar` | function
  58. `tooltip` | The tooltip | `awful.tooltip`
  59. ## Buttons
  60. If you want buttons, just add the following after your widget in `rc.lua`.
  61. ```lua
  62. volume.bar:buttons(awful.util.table.join(
  63. awful.button({}, 1, function() -- left click
  64. awful.spawn(string.format("%s -e alsamixer", terminal))
  65. end),
  66. awful.button({}, 2, function() -- middle click
  67. os.execute(string.format("%s set %s 100%%", volume.cmd, volume.channel))
  68. volume.update()
  69. end),
  70. awful.button({}, 3, function() -- right click
  71. os.execute(string.format("%s set %s toggle", volume.cmd, volume.togglechannel or volume.channel))
  72. volume.update()
  73. end),
  74. awful.button({}, 4, function() -- scroll up
  75. os.execute(string.format("%s set %s 1%%+", volume.cmd, volume.channel))
  76. volume.update()
  77. end),
  78. awful.button({}, 5, function() -- scroll down
  79. os.execute(string.format("%s set %s 1%%-", volume.cmd, volume.channel))
  80. volume.update()
  81. end)
  82. ))
  83. ```
  84. ## Keybindings
  85. Read [here](https://github.com/lcpz/lain/wiki/alsa#keybindings). If you want notifications, use `volume.notify()` instead of `volume.update()`.