diff options
author | streetturtle <streetturtle@gmail.com> | 2017-01-30 21:38:50 -0500 |
---|---|---|
committer | streetturtle <streetturtle@gmail.com> | 2017-01-30 21:40:01 -0500 |
commit | c4826fd21340d34e3592b0c8ca24fc068e52c6ef (patch) | |
tree | dbbc8fd3df693cfc57cbc1ff5246164f8fc41c01 /BatteryWidget | |
parent | a079c79ab81a4bc2f7cf7971db6373fefe1e6110 (diff) |
new widgets added
Diffstat (limited to 'BatteryWidget')
-rw-r--r-- | BatteryWidget/README.md | 26 | ||||
-rw-r--r-- | BatteryWidget/batWid1.png | bin | 1108 -> 0 bytes | |||
-rw-r--r-- | BatteryWidget/batWid2.png | bin | 4606 -> 0 bytes | |||
-rw-r--r-- | BatteryWidget/batWid3.png | bin | 8484 -> 0 bytes | |||
-rw-r--r-- | BatteryWidget/battery-icons/100.png | bin | 1250 -> 0 bytes | |||
-rw-r--r-- | BatteryWidget/battery-icons/20.png | bin | 1161 -> 0 bytes | |||
-rw-r--r-- | BatteryWidget/battery-icons/40.png | bin | 1191 -> 0 bytes | |||
-rw-r--r-- | BatteryWidget/battery-icons/60.png | bin | 1222 -> 0 bytes | |||
-rw-r--r-- | BatteryWidget/battery-icons/80.png | bin | 1235 -> 0 bytes | |||
-rw-r--r-- | BatteryWidget/battery.lua | 56 |
10 files changed, 0 insertions, 82 deletions
diff --git a/BatteryWidget/README.md b/BatteryWidget/README.md deleted file mode 100644 index 531a15c..0000000 --- a/BatteryWidget/README.md +++ /dev/null @@ -1,26 +0,0 @@ -## Battery widget -Simple and easy-to-install widget for Awesome Window Manager. - -This widget consists of - - - an icon which shows the battery status: ![Battery Widget](./batWid1.png) - - a pop-up window, which shows up when you hover over it: ![Battery Widget](./batWid2.png) - - a pop-up warning message which appears when battery level is less that 15%: ![Battery Widget](./batWid3.png) - -## Installation - -This widget uses the output of acpi tool. -- install `acpi` tool: -``` -sudo apt-get install acpi -``` -- clone/copy battery.lua file and battery-icons folder to your ~/home/username/.config/awesome/ folder; - -- change path to the icons in `battery.lua`; - -- include `battery.lua` and add battery widget to your wibox in rc.lua: -``` -require("battery") -... -right_layout:add(batteryIcon) -``` diff --git a/BatteryWidget/batWid1.png b/BatteryWidget/batWid1.png Binary files differdeleted file mode 100644 index d1d4e5b..0000000 --- a/BatteryWidget/batWid1.png +++ /dev/null diff --git a/BatteryWidget/batWid2.png b/BatteryWidget/batWid2.png Binary files differdeleted file mode 100644 index 66485cd..0000000 --- a/BatteryWidget/batWid2.png +++ /dev/null diff --git a/BatteryWidget/batWid3.png b/BatteryWidget/batWid3.png Binary files differdeleted file mode 100644 index 67d5fd4..0000000 --- a/BatteryWidget/batWid3.png +++ /dev/null diff --git a/BatteryWidget/battery-icons/100.png b/BatteryWidget/battery-icons/100.png Binary files differdeleted file mode 100644 index 48cc412..0000000 --- a/BatteryWidget/battery-icons/100.png +++ /dev/null diff --git a/BatteryWidget/battery-icons/20.png b/BatteryWidget/battery-icons/20.png Binary files differdeleted file mode 100644 index e3b455b..0000000 --- a/BatteryWidget/battery-icons/20.png +++ /dev/null diff --git a/BatteryWidget/battery-icons/40.png b/BatteryWidget/battery-icons/40.png Binary files differdeleted file mode 100644 index 5de8a1d..0000000 --- a/BatteryWidget/battery-icons/40.png +++ /dev/null diff --git a/BatteryWidget/battery-icons/60.png b/BatteryWidget/battery-icons/60.png Binary files differdeleted file mode 100644 index 483506f..0000000 --- a/BatteryWidget/battery-icons/60.png +++ /dev/null diff --git a/BatteryWidget/battery-icons/80.png b/BatteryWidget/battery-icons/80.png Binary files differdeleted file mode 100644 index 11dc029..0000000 --- a/BatteryWidget/battery-icons/80.png +++ /dev/null diff --git a/BatteryWidget/battery.lua b/BatteryWidget/battery.lua deleted file mode 100644 index 4b2d069..0000000 --- a/BatteryWidget/battery.lua +++ /dev/null @@ -1,56 +0,0 @@ -local wibox = require("wibox") -local awful = require("awful") -local naughty = require("naughty") - -function showBatteryWidgetPopup() - local save_offset = offset - naughty.notify({ - text = awful.util.pread("acpi | cut -d, -f 2,3"), - title = "Battery status", - timeout = 5, hover_timeout = 0.5, - width = 160, - }) -end - -function showWarningWidgetPopup() - local charge = tonumber(awful.util.pread("acpi | cut -d, -f 2 | egrep -o '[0-9]{1,3}'")) - if (charge < 15) then - naughty.notify({ - text = "Huston, we have a problem", - title = "Battery dying", - timeout = 5, hover_timeout = 0.5, - position = "bottom_right", - bg = "#F06060", - fg = "#EEE9EF", - width = 200, - }) - end -end - -function showBatteryWidgetIcon() - local charge = tonumber(awful.util.pread("acpi | cut -d, -f 2 | egrep -o '[0-9]{1,3}'")) - local batteryType - - if (charge >= 0 and charge < 20) then batteryType=20 - elseif (charge >= 20 and charge < 40) then batteryType=40 - elseif (charge >= 40 and charge < 60) then batteryType=60 - elseif (charge >= 60 and charge < 80) then batteryType=80 - elseif (charge >= 80 and charge <= 100) then batteryType=100 - end - - batteryIcon:set_image("/home/username/.config/awesome/battery-icons/" .. batteryType .. ".png") -end - -batteryIcon = wibox.widget.imagebox() -showBatteryWidgetIcon() -batteryIcon:connect_signal("mouse::enter", function() showBatteryWidgetPopup() end) - --- timer to refresh battery icon -batteryWidgetTimer = timer({ timeout = 5 }) -batteryWidgetTimer:connect_signal("timeout", function() showBatteryWidgetIcon() end) -batteryWidgetTimer:start() - --- timer to refresh battery warning -batteryWarningTimer = timer({ timeout = 50 }) -batteryWarningTimer:connect_signal("timeout", function() showWarningWidgetPopup() end) -batteryWarningTimer:start() |