Merge branch 'master' of github.com:streetturtle/awesome-wm-widgets

This commit is contained in:
streetturtle 2019-02-24 09:24:49 -05:00
commit c671bb3dd3
12 changed files with 156 additions and 26 deletions

View File

@ -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:

View File

@ -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

View File

@ -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)

View File

@ -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.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -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

View File

@ -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

View File

Before

Width:  |  Height:  |  Size: 322 KiB

After

Width:  |  Height:  |  Size: 322 KiB

BIN
run-shell/pixelate.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

View File

@ -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 = {

View File

@ -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

View File

@ -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',