2022-01-24 02:15:02 +01:00
|
|
|
---
|
|
|
|
layout: page
|
|
|
|
---
|
|
|
|
# Cmus widget
|
|
|
|
|
|
|
|
Cmus widget that shows the current playing track.
|
|
|
|
|
2022-01-24 03:05:55 +01:00
|
|
|
![widget](../awesome-wm-widgets/assets/img/widgets/screenshots/cmus-widget/cmus-widget.png)
|
2022-01-24 02:15:02 +01:00
|
|
|
|
|
|
|
Left click toggles playback.
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
|
|
|
Clone the repo under **~/.config/awesome/** and add widget in **rc.lua**:
|
|
|
|
|
|
|
|
```lua
|
|
|
|
local cmus_widget = require('awesome-wm-widgets.cmus-widget.cmus')
|
|
|
|
...
|
|
|
|
s.mytasklist, -- Middle widget
|
|
|
|
{ -- Right widgets
|
|
|
|
layout = wibox.layout.fixed.horizontal,
|
|
|
|
...
|
|
|
|
-- default
|
|
|
|
cmus_widget(),
|
|
|
|
-- customized
|
|
|
|
cmus_widget{
|
|
|
|
space = 5,
|
|
|
|
timeout = 5
|
|
|
|
},
|
|
|
|
```
|
|
|
|
|
|
|
|
### Shortcuts
|
|
|
|
|
|
|
|
To improve responsiveness of the widget when playback is changed by a shortcut use corresponding methods of the widget:
|
|
|
|
|
|
|
|
```lua
|
2022-07-17 02:48:22 +02:00
|
|
|
awful.key({ modkey, "Shift" }, "p", function () cmus_widget:play_pause() end, {description = "toggle track", group = "cmus"}),
|
|
|
|
awful.key({ }, "XF86AudioPlay", function () cmus_widget:play() end, {description = "play track", group = "cmus"}),
|
|
|
|
awful.key({ }, "XF86AudioPause", function () cmus_widget:play() end, {description = "pause track", group = "cmus"}),
|
|
|
|
awful.key({ }, "XF86AudioNext", function () cmus_widget:next_track() end, {description = "next track", group = "cmus"}),
|
|
|
|
awful.key({ }, "XF86AudioPrev", function () cmus_widget:prev_track() end, {description = "previous track", group = "cmus"}),
|
2023-03-06 19:49:24 +01:00
|
|
|
awful.key({ }, "XF86AudioStop", function () cmus_widget:stop() end, {description = "stop track", group = "cmus"}),
|
2022-01-24 02:15:02 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
## Customization
|
|
|
|
|
|
|
|
It is possible to customize the widget by providing a table with all or some of the following config parameters:
|
|
|
|
|
|
|
|
### Generic parameter
|
|
|
|
|
|
|
|
| Name | Default | Description |
|
|
|
|
|---|---|---|
|
2022-04-15 23:31:11 +02:00
|
|
|
| `font` | `beautiful.font` | Font name and size, like `Play 12` |
|
2022-01-24 02:15:02 +01:00
|
|
|
| `path_to_icons` | `/usr/share/icons/Arc/actions/symbolic/` | Alternative path for the icons |
|
|
|
|
| `timeout`| `10` | Refresh cooldown |
|
2023-03-06 19:49:24 +01:00
|
|
|
| `max_length` | `30` | Maximum lentgh of title. Text will be ellipsized if longer. |
|
2022-01-24 02:15:02 +01:00
|
|
|
| `space` | `3` | Space between icon and track title |
|