diff options
-rw-r--r-- | .github/workflows/build.yml | 2 | ||||
-rwxr-xr-x | .github/workflows/update-site.yml | 43 | ||||
-rw-r--r-- | CODEOWNERS | 1 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | apt-widget/apt-widget.lua | 2 | ||||
-rw-r--r-- | battery-widget/README.md | 3 | ||||
-rw-r--r-- | battery-widget/battery.lua | 4 | ||||
-rw-r--r-- | batteryarc-widget/README.md | 1 | ||||
-rw-r--r-- | batteryarc-widget/batteryarc.lua | 4 | ||||
-rw-r--r-- | brightness-widget/README.md | 3 | ||||
-rw-r--r-- | brightness-widget/brightness.lua | 10 | ||||
-rw-r--r-- | calendar-widget/README.md | 6 | ||||
-rw-r--r-- | calendar-widget/calendar_start_sunday.png | bin | 0 -> 8410 bytes | |||
-rw-r--r-- | cmus-widget/README.md | 7 | ||||
-rw-r--r-- | cmus-widget/screenshots/cmus-widget.png (renamed from cmus-widget/cmus-widget.png) | bin | 6959 -> 6959 bytes | |||
-rw-r--r-- | logout-menu-widget/README.md | 2 | ||||
-rw-r--r-- | ram-widget/README.md | 2 | ||||
-rw-r--r-- | ram-widget/ram-widget.lua | 5 | ||||
-rwxr-xr-x | scripts/update_site.sh | 14 | ||||
-rw-r--r-- | spotify-widget/spotify.lua | 6 |
20 files changed, 100 insertions, 17 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1bfeee3..bdb08e1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,6 +8,8 @@ on: push: branches: - '*' + paths: + - '**.lua' pull_request: branches: [ master ] diff --git a/.github/workflows/update-site.yml b/.github/workflows/update-site.yml new file mode 100755 index 0000000..7415c2e --- /dev/null +++ b/.github/workflows/update-site.yml @@ -0,0 +1,43 @@ +name: update site + +on: + push: + branches: + - 'master' + paths: + - '**/README.md' + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Generate md + run: ./scripts/update_site.sh + + - name: Push to gh-pages branch + run: | + git config --global user.name 'GitHub Action' + git config --global user.email 'action@github.com' + git add ./_widgets + 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/widgets + ls -alF + echo "git stash pop" + git checkout stash -- ./_widgets + git checkout stash -- ./assets/img/widgets + git add ./_widgets + git add ./assets/img/widgets + git commit -m "update from master" + git push origin gh-pages + diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..0661fff --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1 @@ +* @streetturtle @@ -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/apt-widget/apt-widget.lua b/apt-widget/apt-widget.lua index 61aa3b5..c15c32f 100644 --- a/apt-widget/apt-widget.lua +++ b/apt-widget/apt-widget.lua @@ -19,7 +19,7 @@ local HOME_DIR = os.getenv("HOME") local WIDGET_DIR = HOME_DIR .. '/.config/awesome/awesome-wm-widgets/apt-widget' local ICONS_DIR = WIDGET_DIR .. '/icons/' -local LIST_PACKAGES = [[sh -c "apt list --upgradable 2>/dev/null"]] +local LIST_PACKAGES = [[sh -c "LC_ALL=c apt list --upgradable 2>/dev/null"]] --- Utility function to show warning messages local function show_warning(message) 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/battery-widget/battery.lua b/battery-widget/battery.lua index fc8c56f..452d7ef 100644 --- a/battery-widget/battery.lua +++ b/battery-widget/battery.lua @@ -125,7 +125,7 @@ local function worker(user_args) local battery_info = {} local capacities = {} for s in stdout:gmatch("[^\r\n]+") do - local status, charge_str, _ = string.match(s, '.+: (%a+), (%d?%d?%d)%%,?(.*)') + local status, charge_str, _ = string.match(s, '.+: ([%a%s]+), (%d?%d?%d)%%,?(.*)') if status ~= nil then table.insert(battery_info, {status = status, charge = tonumber(charge_str)}) else @@ -157,7 +157,7 @@ local function worker(user_args) level_widget.text = string.format('%d%%', charge) end - if (charge >= 0 and charge < 15) then + if (charge >= 1 and charge < 15) then batteryType = "battery-empty%s-symbolic" if enable_battery_warning and status ~= 'Charging' and os.difftime(os.time(), last_battery_check) > 300 then -- if 5 minutes have elapsed since the last warning diff --git a/batteryarc-widget/README.md b/batteryarc-widget/README.md index a257b2f..98a2956 100644 --- a/batteryarc-widget/README.md +++ b/batteryarc-widget/README.md @@ -39,6 +39,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/batteryarc-widget/spaceman.jpg | Icon of the warning popup | | `enable_battery_warning` | `true` | Display low battery warning | | `show_notification_mode` | `on_hover` | How to trigger a notification with the battery status: `on_hover`, `on_click` or `off` | +| `notification_position` | `top_left` | Where to show she notification when triggered. Values: `top_right`, `top_left`, `bottom_left`, `bottom_right`, `top_middle`, `bottom_middle`. (default `top_right`) | ## Requirements diff --git a/batteryarc-widget/batteryarc.lua b/batteryarc-widget/batteryarc.lua index 1b6752a..55a7694 100644 --- a/batteryarc-widget/batteryarc.lua +++ b/batteryarc-widget/batteryarc.lua @@ -29,6 +29,7 @@ local function worker(user_args) local size = args.size or 18 local timeout = args.timeout or 10 local show_notification_mode = args.show_notification_mode or 'on_hover' -- on_hover / on_click + local notification_position = args.notification_position or 'top_right' -- see naughty.notify position argument local main_color = args.main_color or beautiful.fg_color local bg_color = args.bg_color or '#ffffff11' @@ -89,7 +90,7 @@ local function worker(user_args) local charge = 0 local status for s in stdout:gmatch("[^\r\n]+") do - local cur_status, charge_str, _ = string.match(s, '.+: (%a+), (%d?%d?%d)%%,?(.*)') + local cur_status, charge_str, _ = string.match(s, '.+: ([%a%s]+), (%d?%d?%d)%%,?(.*)') if cur_status ~= nil and charge_str ~=nil then local cur_charge = tonumber(charge_str) if cur_charge > charge then @@ -146,6 +147,7 @@ local function worker(user_args) title = "Battery status", timeout = 5, width = 200, + position = notification_position, } end) end diff --git a/brightness-widget/README.md b/brightness-widget/README.md index cbf5b7e..0cdb774 100644 --- a/brightness-widget/README.md +++ b/brightness-widget/README.md @@ -13,9 +13,10 @@ It is possible to customize widget by providing a table with all or some of the | `step` | 5 | Step | | `base` | 20 | Base level to set brightness to on left click. | | `path_to_icon` | `/usr/share/icons/Arc/status/symbolic/display-brightness-symbolic.svg` | Path to the icon | -| `font` | `Play 9` | Font | +| `font` | `beautiful.font` | Font name and size, like `Play 12` | | `timeout` | 1 | How often in seconds the widget refreshes. Check the note below | | `tooltip` | false | Display brightness level in a tooltip when the mouse cursor hovers the widget | +| `percentage` | false | Display a '%' character after the brightness level | _Note:_ If brightness is controlled only by the widget (either by a mouse, or by a shortcut, then the `timeout` could be quite big, as there is no reason to synchronize the brightness level). diff --git a/brightness-widget/brightness.lua b/brightness-widget/brightness.lua index 306cc2b..3a77a44 100644 --- a/brightness-widget/brightness.lua +++ b/brightness-widget/brightness.lua @@ -13,6 +13,7 @@ local wibox = require("wibox") local watch = require("awful.widget.watch") local spawn = require("awful.spawn") local naughty = require("naughty") +local beautiful = require("beautiful") local ICON_DIR = os.getenv("HOME") .. '/.config/awesome/awesome-wm-widgets/brightness-widget/' local get_brightness_cmd @@ -35,7 +36,7 @@ local function worker(user_args) local type = args.type or 'arc' -- arc or icon_and_text local path_to_icon = args.path_to_icon or ICON_DIR .. 'brightness.svg' - local font = args.font or 'Play 9' + local font = args.font or beautiful.font local timeout = args.timeout or 100 local program = args.program or 'light' @@ -43,6 +44,7 @@ local function worker(user_args) local base = args.base or 20 local current_level = 0 -- current brightness value local tooltip = args.tooltip or false + local percentage = args.percentage or false if program == 'light' then get_brightness_cmd = 'light -G' set_brightness_cmd = 'light -S %d' -- <level> @@ -82,7 +84,11 @@ local function worker(user_args) spacing = 4, layout = wibox.layout.fixed.horizontal, set_value = function(self, level) - self:get_children_by_id('txt')[1]:set_text(level .. '%') + local display_level = level + if percentage then + display_level = display_level .. '%' + end + self:get_children_by_id('txt')[1]:set_text(display_level) end } elseif type == 'arc' then 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/calendar-widget/calendar_start_sunday.png b/calendar-widget/calendar_start_sunday.png Binary files differnew file mode 100644 index 0000000..126a218 --- /dev/null +++ b/calendar-widget/calendar_start_sunday.png diff --git a/cmus-widget/README.md b/cmus-widget/README.md index b1fecb9..eec5773 100644 --- a/cmus-widget/README.md +++ b/cmus-widget/README.md @@ -2,7 +2,7 @@ Cmus widget that shows the current playing track. -![widget](cmus-widget.png) +![widget](./screenshots/cmus-widget.png) Left click toggles playback. @@ -31,7 +31,10 @@ s.mytasklist, -- Middle widget 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"}), +awful.key({ modkey, "Shift" }, + "p", + function() cmus_widget:play_pause() end, + {description = "play/pause cmus", group = "custom"}), ``` ## Customization diff --git a/cmus-widget/cmus-widget.png b/cmus-widget/screenshots/cmus-widget.png Binary files differindex ba04401..ba04401 100644 --- a/cmus-widget/cmus-widget.png +++ b/cmus-widget/screenshots/cmus-widget.png 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/ram-widget/README.md b/ram-widget/README.md index 6e80976..568245b 100644 --- a/ram-widget/README.md +++ b/ram-widget/README.md @@ -15,6 +15,8 @@ It is possible to customize widget by providing a table with all or some of the | `color_used` | `beautiful.bg_urgent` | Color for used RAM | | `color_free` | `beautiful.fg_normal` | Color for free RAM | | `color_buf` | `beautiful.border_color_active` | Color for buffers/cache | +| `widget_height` | `25` | Height of the widget | +| `widget_width` | `25` | Width of the widget | | `widget_show_buf` | `false` | Whether to display buffers/cache separately in the tray widget. If `false`, buffers/cache are considered free RAM. | | `timeout` | 1 | How often (in seconds) the widget refreshes | diff --git a/ram-widget/ram-widget.lua b/ram-widget/ram-widget.lua index 1b5cdcf..867d28e 100644 --- a/ram-widget/ram-widget.lua +++ b/ram-widget/ram-widget.lua @@ -15,6 +15,8 @@ local function worker(user_args) local color_free = args.color_free or beautiful.fg_normal local color_buf = args.color_buf or beautiful.border_color_active local widget_show_buf = args.widget_show_buf or false + local widget_height = args.widget_height or 25 + local widget_width = args.widget_width or 25 --- Main ram widget shown on wibar ramgraph_widget = wibox.widget { @@ -25,7 +27,8 @@ local function worker(user_args) color_buf, }, display_labels = false, - forced_width = 25, + forced_height = widget_height, + forced_width = widget_width, widget = wibox.widget.piechart } diff --git a/scripts/update_site.sh b/scripts/update_site.sh new file mode 100755 index 0000000..35fc971 --- /dev/null +++ b/scripts/update_site.sh @@ -0,0 +1,14 @@ +mkdir ./_widgets +for D in *; do + if [[ -d "${D}" ]] && [[ ${D} == *"-widget"* ]]; then + echo "${D}" + cp ${D}/README.md ./_widgets/${D}.md + sed -i '1s/^/---\nlayout: page\n---\n/' ./_widgets/${D}.md + + mkdir -p ./assets/img/widgets/screenshots/${D} + + 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 diff --git a/spotify-widget/spotify.lua b/spotify-widget/spotify.lua index 0eb302a..f8df1ea 100644 --- a/spotify-widget/spotify.lua +++ b/spotify-widget/spotify.lua @@ -16,6 +16,10 @@ local GET_SPOTIFY_STATUS_CMD = 'sp status' local GET_CURRENT_SONG_CMD = 'sp current' local function ellipsize(text, length) + -- utf8 only available in Lua 5.3+ + if utf8 == nil then + return text:sub(0, length) + end return (utf8.len(text) > length and length > 0) and text:sub(0, utf8.offset(text, length - 2) - 1) .. '...' or text @@ -154,4 +158,4 @@ end return setmetatable(spotify_widget, { __call = function(_, ...) return worker(...) -end })
\ No newline at end of file +end }) |