summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.github/workflows/update-site.yml18
-rw-r--r--README.md2
-rw-r--r--battery-widget/README.md3
-rw-r--r--calendar-widget/README.md6
-rw-r--r--cmus-widget/README.md51
-rw-r--r--cmus-widget/cmus.lua127
-rw-r--r--cmus-widget/screenshots/cmus-widget.pngbin0 -> 6959 bytes
-rw-r--r--logout-menu-widget/README.md2
-rwxr-xr-xscripts/update_site.sh7
9 files changed, 202 insertions, 14 deletions
diff --git a/.github/workflows/update-site.yml b/.github/workflows/update-site.yml
index 5cb4ae3..7415c2e 100755
--- a/.github/workflows/update-site.yml
+++ b/.github/workflows/update-site.yml
@@ -1,6 +1,14 @@
name: update site
-on: workflow_dispatch
+on:
+ push:
+ branches:
+ - 'master'
+ paths:
+ - '**/README.md'
+
+ # Allows you to run this workflow manually from the Actions tab
+ workflow_dispatch:
jobs:
build:
@@ -17,19 +25,19 @@ jobs:
git config --global user.name 'GitHub Action'
git config --global user.email 'action@github.com'
git add ./_widgets
- git add ./assets/img
+ git add ./assets/img/widgets
git stash
git fetch
echo "git checkout gh-pages"
git checkout gh-pages
rm -rf ./_widgets
- rm -rf ./assets/img
+ rm -rf ./assets/img/widgets
ls -alF
echo "git stash pop"
git checkout stash -- ./_widgets
- git checkout stash -- ./assets
+ git checkout stash -- ./assets/img/widgets
git add ./_widgets
- git add ./assets/img
+ git add ./assets/img/widgets
git commit -m "update from master"
git push origin gh-pages
diff --git a/README.md b/README.md
index 1521a63..1617fae 100644
--- a/README.md
+++ b/README.md
@@ -46,7 +46,7 @@ Clone the repo under **~/.config/awesome/**, then follow an Installation section
In case of any doubts/questions/problems:
- create an [issue](https://github.com/streetturtle/awesome-wm-widgets/issues/new/choose)
- raise a question on [Discussions](https://github.com/streetturtle/awesome-wm-widgets/discussions)!
- - ping me on AwesomeWM's discord, here's an [invite](https://discord.gg/XYvn8R5)
+ - ping me on AwesomeWM's discord, here's an [invite](https://discord.gg/BPat4F87dg)
# Support
diff --git a/battery-widget/README.md b/battery-widget/README.md
index 9af7a4c..b15aac6 100644
--- a/battery-widget/README.md
+++ b/battery-widget/README.md
@@ -35,7 +35,7 @@ It is possible to customize widget by providing a table with all or some of the
| `warning_msg_icon` | ~/.config/awesome/awesome-wm-widgets/battery-widget/spaceman.jpg | Icon of the warning popup |
| `enable_battery_warning` | `true` | Display low battery warning |
-*Note: the widget expects following icons be present in the folder:
+*Note: the widget expects following icons to be present in the folder:
- battery-caution-charging-symbolic.svg
- battery-empty-charging-symbolic.svg
@@ -53,6 +53,7 @@ It is possible to customize widget by providing a table with all or some of the
## Installation
This widget reads the output of acpi tool.
+
- install `acpi` and check the output:
```bash
diff --git a/calendar-widget/README.md b/calendar-widget/README.md
index e354c07..b663a18 100644
--- a/calendar-widget/README.md
+++ b/calendar-widget/README.md
@@ -9,9 +9,9 @@ Calendar widget for Awesome WM - slightly improved version of the `wibox.widget.
| Name | Default | Description |
|---|---|---|
-| theme | `naughty` | The theme to use |
-| placement | `top` | The position of the popup |
-| radius | 8 | The popup radius |
+| theme | `naughty` | The theme to use |
+| placement | `top` | The position of the popup |
+| radius | 8 | The popup radius |
| start_sunday | false | Start the week on Sunday |
- themes:
diff --git a/cmus-widget/README.md b/cmus-widget/README.md
new file mode 100644
index 0000000..7e7fb9e
--- /dev/null
+++ b/cmus-widget/README.md
@@ -0,0 +1,51 @@
+# Cmus widget
+
+Cmus widget that shows the current playing track.
+
+![widget](./screenshots/cmus-widget.png)
+
+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
+awful.key({ modkey, "Shift" },
+ "p",
+ function() cmus_widget:play_pause() end,
+ {description = "play/pause cmus", group = "custom"}),
+```
+
+## 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 |
+|---|---|---|
+| `font` | `Play 9` | Font used for the track title |
+| `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
new file mode 100644
index 0000000..51daa89
--- /dev/null
+++ b/cmus-widget/cmus.lua
@@ -0,0 +1,127 @@
+-------------------------------------------------
+-- Cmus Widget for Awesome Window Manager
+-- Show what's playing, play/pause, etc
+
+-- @author Augusto Gunsch
+-- @copyright 2022 Augusto Gunsch
+-------------------------------------------------
+
+local awful = require("awful")
+local wibox = require("wibox")
+local watch = require("awful.widget.watch")
+local spawn = require("awful.spawn")
+local naughty = require("naughty")
+
+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 path_to_icons = args.path_to_icons or "/usr/share/icons/Arc/actions/symbolic/"
+ local timeout = args.timeout or 10
+ local space = args.space or 3
+
+ cmus_widget.widget = wibox.widget {
+ {
+ {
+ id = "playback_icon",
+ resize = false,
+ widget = wibox.widget.imagebox,
+ },
+ layout = wibox.container.place
+ },
+ {
+ id = "text",
+ font = font,
+ widget = wibox.widget.textbox
+ },
+ layout = wibox.layout.fixed.horizontal,
+ update_icon = function(self, name)
+ self:get_children_by_id("playback_icon")[1]:set_image(path_to_icons .. name)
+ end,
+ set_title = function(self, title)
+ self:get_children_by_id("text")[1]:set_text(title)
+ end
+ }
+
+ function update_widget(widget, stdout, _, _, code)
+ if code == 0 then
+ local cmus_info = {}
+
+ for s in stdout:gmatch("[^\r\n]+") do
+ local key, val = string.match(s, "^tag (%a+) (.+)$")
+
+ if key and val then
+ cmus_info[key] = val
+ else
+ local key, val = string.match(s, "^set (%a+) (.+)$")
+
+ if key and val then
+ cmus_info[key] = val
+ else
+ local key, val = string.match(s, "^(%a+) (.+)$")
+ if key and val then
+ cmus_info[key] = val
+ end
+ end
+ end
+ end
+
+ local title = cmus_info.title
+
+ if not title and cmus_info.file then
+ title = cmus_info.file:gsub("%..-$", "")
+ title = title:gsub("^.+/", "")
+ end
+
+ if title then
+ if cmus_info["status"] == "playing" then
+ widget:update_icon("media-playback-start-symbolic.svg")
+ elseif cmus_info["status"] == "paused" then
+ widget:update_icon("media-playback-pause-symbolic.svg")
+ else
+ widget:update_icon("media-playback-stop-symbolic.svg")
+ end
+
+ widget:set_title(title)
+ widget.visible = true
+ else
+ widget.visible = false
+ widget.width = 0
+ end
+ else
+ widget.visible = false
+ end
+ end
+
+ function cmus_widget:play_pause()
+ spawn("cmus-remote -u")
+ spawn.easy_async("cmus-remote -Q",
+ function(stdout, _, _, code)
+ update_widget(cmus_widget.widget, stdout, _, _, code)
+ end)
+ end
+
+ cmus_widget.widget:buttons(
+ awful.util.table.join(
+ awful.button({}, 1, function() cmus_widget:play_pause() end)
+ )
+ )
+
+ watch("cmus-remote -Q", timeout, update_widget, cmus_widget.widget)
+
+ return cmus_widget.widget
+end
+
+return setmetatable(cmus_widget, { __call = function(_, ...)
+ return worker(...)
+end })
diff --git a/cmus-widget/screenshots/cmus-widget.png b/cmus-widget/screenshots/cmus-widget.png
new file mode 100644
index 0000000..ba04401
--- /dev/null
+++ b/cmus-widget/screenshots/cmus-widget.png
Binary files differ
diff --git a/logout-menu-widget/README.md b/logout-menu-widget/README.md
index d47dcb2..6f8ca27 100644
--- a/logout-menu-widget/README.md
+++ b/logout-menu-widget/README.md
@@ -6,7 +6,7 @@ This widget shows a menu with options to log out from the current session, lock,
## Installation
-Clone this repo (if not cloned yet) **./.config/awesome/**
+Clone this repo (if not cloned yet) under **./.config/awesome/**
```bash
cd ./.config/awesome/
diff --git a/scripts/update_site.sh b/scripts/update_site.sh
index 411069f..35fc971 100755
--- a/scripts/update_site.sh
+++ b/scripts/update_site.sh
@@ -4,10 +4,11 @@ for D in *; do
echo "${D}"
cp ${D}/README.md ./_widgets/${D}.md
sed -i '1s/^/---\nlayout: page\n---\n/' ./_widgets/${D}.md
- mkdir -p ./assets/img/screenshots/${D}
- find ${D}/ \( -name '*.jpg' -o -name '*.png' -o -name '*.gif' \) -exec cp '{}' ./assets/img/screenshots/${D} \;
+ mkdir -p ./assets/img/widgets/screenshots/${D}
- sed -i "s/](\.\(\/screenshots\)\{0,1\}/](..\/awesome-wm-widgets\/assets\/img\/screenshots\/$D/g" ./_widgets/${D}.md
+ find ${D}/ \( -name '*.jpg' -o -name '*.png' -o -name '*.gif' \) -exec cp '{}' ./assets/img/widgets/screenshots/${D} \;
+
+ sed -i "s/](\.\(\/screenshots\)\{0,1\}/](..\/awesome-wm-widgets\/assets\/img\/widgets\/screenshots\/$D/g" ./_widgets/${D}.md
fi
done