From a02279a9f2e18b0a60add45669000749d38a3020 Mon Sep 17 00:00:00 2001 From: streetturtle Date: Mon, 13 Jul 2015 18:26:39 +0200 Subject: Moved to special folder --- BatteryWidget/battery-icons/100.png | Bin 0 -> 1250 bytes BatteryWidget/battery-icons/20.png | Bin 0 -> 1161 bytes BatteryWidget/battery-icons/40.png | Bin 0 -> 1191 bytes BatteryWidget/battery-icons/60.png | Bin 0 -> 1222 bytes BatteryWidget/battery-icons/80.png | Bin 0 -> 1235 bytes BatteryWidget/battery.lua | 45 ++++++++++++++++++++++++++++++++++++ battery-icons/100.png | Bin 1250 -> 0 bytes battery-icons/20.png | Bin 1161 -> 0 bytes battery-icons/40.png | Bin 1191 -> 0 bytes battery-icons/60.png | Bin 1222 -> 0 bytes battery-icons/80.png | Bin 1235 -> 0 bytes battery.lua | 45 ------------------------------------ 12 files changed, 45 insertions(+), 45 deletions(-) create mode 100644 BatteryWidget/battery-icons/100.png create mode 100644 BatteryWidget/battery-icons/20.png create mode 100644 BatteryWidget/battery-icons/40.png create mode 100644 BatteryWidget/battery-icons/60.png create mode 100644 BatteryWidget/battery-icons/80.png create mode 100644 BatteryWidget/battery.lua delete mode 100644 battery-icons/100.png delete mode 100644 battery-icons/20.png delete mode 100644 battery-icons/40.png delete mode 100644 battery-icons/60.png delete mode 100644 battery-icons/80.png delete mode 100644 battery.lua diff --git a/BatteryWidget/battery-icons/100.png b/BatteryWidget/battery-icons/100.png new file mode 100644 index 0000000..48cc412 Binary files /dev/null and b/BatteryWidget/battery-icons/100.png differ diff --git a/BatteryWidget/battery-icons/20.png b/BatteryWidget/battery-icons/20.png new file mode 100644 index 0000000..e3b455b Binary files /dev/null and b/BatteryWidget/battery-icons/20.png differ diff --git a/BatteryWidget/battery-icons/40.png b/BatteryWidget/battery-icons/40.png new file mode 100644 index 0000000..5de8a1d Binary files /dev/null and b/BatteryWidget/battery-icons/40.png differ diff --git a/BatteryWidget/battery-icons/60.png b/BatteryWidget/battery-icons/60.png new file mode 100644 index 0000000..483506f Binary files /dev/null and b/BatteryWidget/battery-icons/60.png differ diff --git a/BatteryWidget/battery-icons/80.png b/BatteryWidget/battery-icons/80.png new file mode 100644 index 0000000..11dc029 Binary files /dev/null and b/BatteryWidget/battery-icons/80.png differ diff --git a/BatteryWidget/battery.lua b/BatteryWidget/battery.lua new file mode 100644 index 0000000..09e0ed6 --- /dev/null +++ b/BatteryWidget/battery.lua @@ -0,0 +1,45 @@ +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 = 2, hover_timeout = 0.5, + width = 160, + }) +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/pashik/.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() \ No newline at end of file diff --git a/battery-icons/100.png b/battery-icons/100.png deleted file mode 100644 index 48cc412..0000000 Binary files a/battery-icons/100.png and /dev/null differ diff --git a/battery-icons/20.png b/battery-icons/20.png deleted file mode 100644 index e3b455b..0000000 Binary files a/battery-icons/20.png and /dev/null differ diff --git a/battery-icons/40.png b/battery-icons/40.png deleted file mode 100644 index 5de8a1d..0000000 Binary files a/battery-icons/40.png and /dev/null differ diff --git a/battery-icons/60.png b/battery-icons/60.png deleted file mode 100644 index 483506f..0000000 Binary files a/battery-icons/60.png and /dev/null differ diff --git a/battery-icons/80.png b/battery-icons/80.png deleted file mode 100644 index 11dc029..0000000 Binary files a/battery-icons/80.png and /dev/null differ diff --git a/battery.lua b/battery.lua deleted file mode 100644 index 09e0ed6..0000000 --- a/battery.lua +++ /dev/null @@ -1,45 +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 = 2, hover_timeout = 0.5, - width = 160, - }) -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/pashik/.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() \ No newline at end of file -- cgit v1.2.3