Skip to content

Commit 8439ca7

Browse files
authored
Merge pull request #332 from augustogunsch/cmus
Cmus widget - fix unused "spacing" option
2 parents dc80558 + 14a91eb commit 8439ca7

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

cmus-widget/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ It is possible to customize the widget by providing a table with all or some of
4545

4646
| Name | Default | Description |
4747
|---|---|---|
48-
| `font` | `Play 9` | Font used for the track title |
48+
| `font` | `beautiful.font` | Font name and size, like `Play 12` |
4949
| `path_to_icons` | `/usr/share/icons/Arc/actions/symbolic/` | Alternative path for the icons |
5050
| `timeout`| `10` | Refresh cooldown |
5151
| `space` | `3` | Space between icon and track title |

cmus-widget/cmus.lua

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,14 @@ local awful = require("awful")
1010
local wibox = require("wibox")
1111
local watch = require("awful.widget.watch")
1212
local spawn = require("awful.spawn")
13-
local naughty = require("naughty")
13+
local beautiful = require('beautiful')
1414

1515
local cmus_widget = {}
1616

17-
local function show_warning(message)
18-
naughty.notify{
19-
preset = naughty.config.presets.critical,
20-
title = "Cmus Widget",
21-
text = message}
22-
end
23-
2417
local function worker(user_args)
2518

2619
local args = user_args or {}
27-
local font = args.font or "Play 9"
20+
local font = args.font or beautiful.font
2821

2922
local path_to_icons = args.path_to_icons or "/usr/share/icons/Arc/actions/symbolic/"
3023
local timeout = args.timeout or 10
@@ -44,6 +37,7 @@ local function worker(user_args)
4437
font = font,
4538
widget = wibox.widget.textbox
4639
},
40+
spacing = space,
4741
layout = wibox.layout.fixed.horizontal,
4842
update_icon = function(self, name)
4943
self:get_children_by_id("playback_icon")[1]:set_image(path_to_icons .. name)
@@ -53,7 +47,7 @@ local function worker(user_args)
5347
end
5448
}
5549

56-
function update_widget(widget, stdout, _, _, code)
50+
local function update_widget(widget, stdout, _, _, code)
5751
if code == 0 then
5852
local cmus_info = {}
5953

@@ -63,12 +57,12 @@ local function worker(user_args)
6357
if key and val then
6458
cmus_info[key] = val
6559
else
66-
local key, val = string.match(s, "^set (%a+) (.+)$")
60+
key, val = string.match(s, "^set (%a+) (.+)$")
6761

6862
if key and val then
6963
cmus_info[key] = val
7064
else
71-
local key, val = string.match(s, "^(%a+) (.+)$")
65+
key, val = string.match(s, "^(%a+) (.+)$")
7266
if key and val then
7367
cmus_info[key] = val
7468
end
@@ -96,7 +90,6 @@ local function worker(user_args)
9690
widget.visible = true
9791
else
9892
widget.visible = false
99-
widget.width = 0
10093
end
10194
else
10295
widget.visible = false

0 commit comments

Comments
 (0)