summaryrefslogtreecommitdiff
path: root/brightness-widget
diff options
context:
space:
mode:
authorstreetturtle <streetturtle@gmail.com>2019-02-24 09:24:49 -0500
committerstreetturtle <streetturtle@gmail.com>2019-02-24 09:24:49 -0500
commitc671bb3dd3e7c44c75e4b8faaf8559c4495dd421 (patch)
treea3ff4e81fe127500393e49394039badd5a88d5dc /brightness-widget
parent2400807c896aa035da3138864f2fb3ad173a2734 (diff)
parent98bcfd09d3dd894fbfb0f5c005aeb3cba67e8a59 (diff)
Merge branch 'master' of github.com:streetturtle/awesome-wm-widgets
Diffstat (limited to 'brightness-widget')
-rw-r--r--brightness-widget/README.md35
-rw-r--r--brightness-widget/brightness.lua8
2 files changed, 24 insertions, 19 deletions
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
+local brightness_widget = require("awesome-wm-widgets.brightness-widget.brightness")
+```
+
+Add widget to the tasklist:
```lua
-require("awesome-wm-widgets.brightness-widget.brightness")
-...
--- Add widgets to the wibox
-s.mywibox:setup {
-...
-{ -- Right widgets
-...
-brightness_widget
+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)