diff --git a/README.md b/README.md index f7f8b97..5160147 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # Awesome WM widgets - + +![stars](https://img.shields.io/github/stars/streetturtle/awesome-wm-widgets.svg) +![forks](https://img.shields.io/github/forks/streetturtle/awesome-wm-widgets.svg) + Set of super simple widgets compatible with Awesome Window Manager v.4+. ![screenshot](./screenshot.png) @@ -24,7 +27,8 @@ From left to right: - [battery-widget](https://github.com/streetturtle/AwesomeWM/tree/master/battery-widget) - [ram-widget](https://github.com/streetturtle/AwesomeWM/tree/master/ram-widget) - [translate-widget](https://github.com/streetturtle/AwesomeWM/tree/master/translate-widget) (not on the screenshot) -- [spotify-shell](https://github.com/streetturtle/AwesomeWM/tree/master/spotify-shell) +- [spotify-shell](https://github.com/streetturtle/AwesomeWM/tree/master/spotify-shell) (not on the screenshot) +- [run-shell](https://github.com/streetturtle/AwesomeWM/tree/master/run-shell) (not on the screenshot) Some of these widgets use [Arc icon theme](https://github.com/horst3180/arc-icon-theme) by default but it could be easily changed to any other icon theme or custom icons. If you want to have separators between widgets like on the screenshot create text widget with ` : ` and place it between widgets: diff --git a/brightness-widget/README.md b/brightness-widget/README.md index fa123c1..5d592b6 100644 --- a/brightness-widget/README.md +++ b/brightness-widget/README.md @@ -1,12 +1,10 @@ # Brightness widget -![Brightness widget](./br-wid-1.png) - -This widget represents current brightness level. +This widget represents current brightness level: ![Brightness widget](./br-wid-1.png) ## Installation -Firstly you need to get the current brightness level. There are two options: +First you need to get the current brightness level. There are two options: - using `xbacklight` command (depending on your video card (I guess) it may or may not work) @@ -30,19 +28,30 @@ Firstly you need to get the current brightness level. There are two options: light -G 49.18 ``` + Depending on the chosen option change `GET_BRIGHTNESS_CMD` variable in **brightness.lua**. -Then in **rc.lua** add the import on top of the file and then add widget to the wibox: +Then clone this repo under **~/.config/awesome/**: + +```bash +git clone https://github.com/streetturtle/awesome-wm-widgets.git ~/.config/awesome/ +``` + +Require widget at the beginning of **rc.lua**: ```lua -require("awesome-wm-widgets.brightness-widget.brightness") -... --- Add widgets to the wibox -s.mywibox:setup { -... -{ -- Right widgets -... -brightness_widget +local brightness_widget = require("awesome-wm-widgets.brightness-widget.brightness") +``` + +Add widget to the tasklist: + +```lua +s.mytasklist, -- Middle widget + { -- Right widgets + layout = wibox.layout.fixed.horizontal, + ... + brightness_widget, + ... ``` ## Controls diff --git a/brightness-widget/brightness.lua b/brightness-widget/brightness.lua index 1b2e8a6..075765c 100644 --- a/brightness-widget/brightness.lua +++ b/brightness-widget/brightness.lua @@ -14,8 +14,8 @@ local spawn = require("awful.spawn") local PATH_TO_ICON = "/usr/share/icons/Arc/status/symbolic/display-brightness-symbolic.svg" local GET_BRIGHTNESS_CMD = "light -G" -- "xbacklight -get" -local INC_BRIGHTNESS_CMD = "light -A 1" -- "xbacklight -inc 5" -local DEC_BRIGHTNESS_CMD = "light -U 1" -- "xbacklight -dec 5" +local INC_BRIGHTNESS_CMD = "light -A 5" -- "xbacklight -inc 5" +local DEC_BRIGHTNESS_CMD = "light -U 5" -- "xbacklight -dec 5" local brightness_text = wibox.widget.textbox() brightness_text:set_font('Play 9') @@ -45,10 +45,6 @@ brightness_widget:connect_signal("button::press", function(_,_,_,button) if (button == 4) then spawn(INC_BRIGHTNESS_CMD, false) elseif (button == 5) then spawn(DEC_BRIGHTNESS_CMD, false) end - - spawn.easy_async(GET_BRIGHTNESS_CMD, function(stdout, stderr, exitreason, exitcode) - update_widget(brightness_widget, stdout, stderr, exitreason, exitcode) - end) end) watch(GET_BRIGHTNESS_CMD, 1, update_widget, brightness_text) diff --git a/brightnessarc-widget/README.md b/brightnessarc-widget/README.md new file mode 100644 index 0000000..fa123c1 --- /dev/null +++ b/brightnessarc-widget/README.md @@ -0,0 +1,56 @@ +# Brightness widget + +![Brightness widget](./br-wid-1.png) + +This widget represents current brightness level. + +## Installation + +Firstly you need to get the current brightness level. There are two options: + + - using `xbacklight` command (depending on your video card (I guess) it may or may not work) + + To check if it works install xbackligth and check if it works: + + ```bash + sudo apt-get install xbacklight + xbacklight -get + ``` + + If there is no output it means that it doesn't work, but there is a second option: + + - using `light` command + + Install it from this git repo: [github.com/haikarainen/light](https://github.com/haikarainen/light) and check if it works but running + + ```bash + git clone https://github.com/haikarainen/light.git && \ + cd ./light && \ + sudo make && sudo make install \ + light -G + 49.18 + ``` +Depending on the chosen option change `GET_BRIGHTNESS_CMD` variable in **brightness.lua**. + +Then in **rc.lua** add the import on top of the file and then add widget to the wibox: + +```lua +require("awesome-wm-widgets.brightness-widget.brightness") +... +-- Add widgets to the wibox +s.mywibox:setup { +... +{ -- Right widgets +... +brightness_widget +``` + +## Controls + +In order to change brightness by shortcuts you can add them to the `globalkeys` table in the **rc.lua**: + +```lua +awful.key({ modkey }, ";", function () awful.spawn("light -A 5") end, {description = "increase brightness", group = "custom"}), +awful.key({ modkey, "Shift"}, ";", function () awful.spawn("light -U 5") end, {description = "decrease brightness", group = "custom"}), +``` +On laptop you can use `XF86MonBrightnessUp` and `XF86MonBrightnessDown` keys. diff --git a/brightnessarc-widget/br-wid-1.png b/brightnessarc-widget/br-wid-1.png new file mode 100644 index 0000000..f9200eb Binary files /dev/null and b/brightnessarc-widget/br-wid-1.png differ diff --git a/brightnessarc-widget/brightnessarc.lua b/brightnessarc-widget/brightnessarc.lua new file mode 100644 index 0000000..9bd2826 --- /dev/null +++ b/brightnessarc-widget/brightnessarc.lua @@ -0,0 +1,57 @@ +------------------------------------------------- +-- Brightness Widget for Awesome Window Manager +-- Shows the brightness level of the laptop display +-- More details could be found here: +-- https://github.com/streetturtle/awesome-wm-widgets/tree/master/brightness-widget + +-- @author Pavel Makhov +-- @copyright 2017 Pavel Makhov +------------------------------------------------- + +local wibox = require("wibox") +local watch = require("awful.widget.watch") +local spawn = require("awful.spawn") +local naughty = require("naughty") + +local PATH_TO_ICON = "/usr/share/icons/Arc/status/symbolic/display-brightness-symbolic.svg" +local GET_BRIGHTNESS_CMD = "light -G" -- "xbacklight -get" +local INC_BRIGHTNESS_CMD = "light -A 5" -- "xbacklight -inc 5" +local DEC_BRIGHTNESS_CMD = "light -U 5" -- "xbacklight -dec 5" + +local icon = { + id = "icon", + image = PATH_TO_ICON, + resize = true, + widget = wibox.widget.imagebox, +} + +local brightnessarc = wibox.widget { + icon, + max_value = 1, + thickness = 2, + start_angle = 4.71238898, -- 2pi*3/4 + forced_height = 18, + forced_width = 18, + bg = "#ffffff11", + paddings = 2, + widget = wibox.container.arcchart +} + +local brightnessarc_widget = wibox.container.mirror(brightnessarc, { horizontal = true }) + +local update_widget = function(widget, stdout, stderr, exitreason, exitcode) + local brightness_level = string.match(stdout, "(%d?%d?)") + brightness_level = tonumber(string.format("% 3d", brightness_level)) + + widget.value = brightness_level / 100; +end, + +brightnessarc:connect_signal("button::press", function(_,_,_,button) + if (button == 4) then spawn(INC_BRIGHTNESS_CMD, false) + elseif (button == 5) then spawn(DEC_BRIGHTNESS_CMD, false) + end +end) + +watch(GET_BRIGHTNESS_CMD, 1, update_widget, brightnessarc) + +return brightnessarc_widget diff --git a/run-shell/README.md b/run-shell/README.md index ca7b268..039a23c 100644 --- a/run-shell/README.md +++ b/run-shell/README.md @@ -1,11 +1,19 @@ # Run Shell -Blurs background and shows widget with run prompt: +Blurs / pixelates background and shows widget with run prompt: -![screenshot](./screenshot.png) +![screenshot](./blur.png) + +![screenshot](./pixelate.png) ## Installation +1. To blur / pixelate the background this widget used [ffmpeg](https://www.ffmpeg.org/) and [frei0r](https://frei0r.dyne.org/) plugins (if you want to pixelate the background), which you need to install. Installation of those depends on your distribution, for ffmpeg just follow the installation section of the site, for frei0r I was able to install it by simply running + + ``` + sudo apt-get install frei0r-plugins + ``` + 1. Clone this repo under **~/.config/awesome/**: ```bash diff --git a/run-shell/screenshot.png b/run-shell/blur.png similarity index 100% rename from run-shell/screenshot.png rename to run-shell/blur.png diff --git a/run-shell/pixelate.png b/run-shell/pixelate.png new file mode 100644 index 0000000..fedf320 Binary files /dev/null and b/run-shell/pixelate.png differ diff --git a/run-shell/run-shell.lua b/run-shell/run-shell.lua index a50400f..f661e53 100644 --- a/run-shell/run-shell.lua +++ b/run-shell/run-shell.lua @@ -4,7 +4,7 @@ -- https://github.com/streetturtle/awesome-wm-widgets/tree/master/run-shell -- @author Pavel Makhov --- @copyright 2018 Pavel Makhov +-- @copyright 2019 Pavel Makhov ------------------------------------------------- local capi = { diff --git a/volumebar-widget/README.md b/volumebar-widget/README.md index 2198f6d..d6b9117 100644 --- a/volumebar-widget/README.md +++ b/volumebar-widget/README.md @@ -14,7 +14,7 @@ Supports Clone repo, include widget and use it in **rc.lua**: ```lua - require("volumebar") +local volumebar_widget = require("awesome-wm-widgets.volumebar-widget.volumebar") ... s.mytasklist, -- Middle widget { -- Right widgets diff --git a/weather-widget/weather.lua b/weather-widget/weather.lua index 484c2c6..d5f07f8 100644 --- a/weather-widget/weather.lua +++ b/weather-widget/weather.lua @@ -97,7 +97,7 @@ weather_timer:connect_signal("timeout", function () .. secrets.weather_widget_city .. '&appid=' .. secrets.weather_widget_api_key .. '&units=' .. secrets.weather_widget_units) - if (status ~= 200) then + if (status ~= 200 and resp_json ~= nil) then local err_resp = json.decode(resp_json) naughty.notify{ title = 'Weather Widget Error',