summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstreetturtle <streetturtle@users.noreply.github.com>2022-04-15 17:30:55 -0400
committerGitHub <noreply@github.com>2022-04-15 17:30:55 -0400
commit8439ca7930e73e17746a1d6f0610417e8a42865f (patch)
treebe092ec7b77da02775fb1b3f3d4feb44ced83289
parentdc80558d9d656ddeb3c51107d9ea85ac97c08de9 (diff)
parent14a91eb44e8f93a01d8e70b48b56463956967ea9 (diff)
Merge pull request #332 from augustogunsch/cmus
Cmus widget - fix unused "spacing" option
-rw-r--r--cmus-widget/README.md2
-rw-r--r--cmus-widget/cmus.lua19
2 files changed, 7 insertions, 14 deletions
diff --git a/cmus-widget/README.md b/cmus-widget/README.md
index 7e7fb9e..eec5773 100644
--- a/cmus-widget/README.md
+++ b/cmus-widget/README.md
@@ -45,7 +45,7 @@ It is possible to customize the widget by providing a table with all or some of
| Name | Default | Description |
|---|---|---|
-| `font` | `Play 9` | Font used for the track title |
+| `font` | `beautiful.font` | Font name and size, like `Play 12` |
| `path_to_icons` | `/usr/share/icons/Arc/actions/symbolic/` | Alternative path for the icons |
| `timeout`| `10` | Refresh cooldown |
| `space` | `3` | Space between icon and track title |
diff --git a/cmus-widget/cmus.lua b/cmus-widget/cmus.lua
index 51daa89..2ffa872 100644
--- a/cmus-widget/cmus.lua
+++ b/cmus-widget/cmus.lua
@@ -10,21 +10,14 @@ local awful = require("awful")
local wibox = require("wibox")
local watch = require("awful.widget.watch")
local spawn = require("awful.spawn")
-local naughty = require("naughty")
+local beautiful = require('beautiful')
local cmus_widget = {}
-local function show_warning(message)
- naughty.notify{
- preset = naughty.config.presets.critical,
- title = "Cmus Widget",
- text = message}
-end
-
local function worker(user_args)
local args = user_args or {}
- local font = args.font or "Play 9"
+ local font = args.font or beautiful.font
local path_to_icons = args.path_to_icons or "/usr/share/icons/Arc/actions/symbolic/"
local timeout = args.timeout or 10
@@ -44,6 +37,7 @@ local function worker(user_args)
font = font,
widget = wibox.widget.textbox
},
+ spacing = space,
layout = wibox.layout.fixed.horizontal,
update_icon = function(self, name)
self:get_children_by_id("playback_icon")[1]:set_image(path_to_icons .. name)
@@ -53,7 +47,7 @@ local function worker(user_args)
end
}
- function update_widget(widget, stdout, _, _, code)
+ local function update_widget(widget, stdout, _, _, code)
if code == 0 then
local cmus_info = {}
@@ -63,12 +57,12 @@ local function worker(user_args)
if key and val then
cmus_info[key] = val
else
- local key, val = string.match(s, "^set (%a+) (.+)$")
+ key, val = string.match(s, "^set (%a+) (.+)$")
if key and val then
cmus_info[key] = val
else
- local key, val = string.match(s, "^(%a+) (.+)$")
+ key, val = string.match(s, "^(%a+) (.+)$")
if key and val then
cmus_info[key] = val
end
@@ -96,7 +90,6 @@ local function worker(user_args)
widget.visible = true
else
widget.visible = false
- widget.width = 0
end
else
widget.visible = false