summaryrefslogtreecommitdiff
path: root/VolumeWidget
diff options
context:
space:
mode:
authorstreetturtle <streetturtle@gmail.com>2015-07-13 23:07:30 +0200
committerstreetturtle <streetturtle@gmail.com>2015-07-13 23:07:30 +0200
commit99d8fdc9b3627d526e500be2fac972b4c5069220 (patch)
treecbee96530a002f962440eeb5fa0f51badfa4921e /VolumeWidget
parent2bb629502934e394642e4861e0ad2abd6f44e249 (diff)
Readme
Diffstat (limited to 'VolumeWidget')
-rw-r--r--VolumeWidget/README.md15
-rw-r--r--VolumeWidget/volWid.pngbin0 -> 301 bytes
-rw-r--r--VolumeWidget/volume.lua11
3 files changed, 20 insertions, 6 deletions
diff --git a/VolumeWidget/README.md b/VolumeWidget/README.md
new file mode 100644
index 0000000..2c4a717
--- /dev/null
+++ b/VolumeWidget/README.md
@@ -0,0 +1,15 @@
+## Volume widget
+Simple and easy-to-install widget for Awesome Window Manager.
+
+This widget represents the sound level: ![Volume Wiget](./volWid.png)
+
+## Installation
+
+- clone/copy volume.lua file and volume-icons folder to your `~/home/username/.config/awesome/` folder;
+
+- include `volume.lua` and add volume widget to your wibox in rc.lua:
+```
+require("volume")
+...
+right_layout:add(volumeWidget)
+```
diff --git a/VolumeWidget/volWid.png b/VolumeWidget/volWid.png
new file mode 100644
index 0000000..fdfdd20
--- /dev/null
+++ b/VolumeWidget/volWid.png
Binary files differ
diff --git a/VolumeWidget/volume.lua b/VolumeWidget/volume.lua
index e800c32..34c12f5 100644
--- a/VolumeWidget/volume.lua
+++ b/VolumeWidget/volume.lua
@@ -1,10 +1,9 @@
local wibox = require("wibox")
local awful = require("awful")
-volume_widget = wibox.widget.textbox()
-volume_icon = wibox.widget.imagebox()
+volume_widget = wibox.widget.imagebox()
-function update_volume(widget, icon)
+function update_volume(widget)
local fd = io.popen("amixer -D pulse sget Master")
local status = fd:read("*all")
fd:close()
@@ -25,11 +24,11 @@ function update_volume(widget, icon)
elseif (volume >= 80 and volume <= 100) then volumeLevel=9
end
- icon:set_image("/home/pashik/.config/awesome/volume-icons/" .. volumeLevel .. ".png")
+ widget:set_image("/home/pashik/.config/awesome/volume-icons/" .. volumeLevel .. ".png")
end
-update_volume(volume_widget, volume_icon)
+update_volume(volume_widget)
mytimer = timer({ timeout = 0.2 })
-mytimer:connect_signal("timeout", function () update_volume(volume_widget, volume_icon) end)
+mytimer:connect_signal("timeout", function () update_volume(volume_widget) end)
mytimer:start() \ No newline at end of file