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 deleted file mode 100644 index d1d4e5b..0000000 Binary files a/BatteryWidget/batWid1.png and /dev/null differ diff --git a/BatteryWidget/batWid2.png b/BatteryWidget/batWid2.png deleted file mode 100644 index 66485cd..0000000 Binary files a/BatteryWidget/batWid2.png and /dev/null differ diff --git a/BatteryWidget/batWid3.png b/BatteryWidget/batWid3.png deleted file mode 100644 index 67d5fd4..0000000 Binary files a/BatteryWidget/batWid3.png and /dev/null differ diff --git a/BatteryWidget/battery-icons/100.png b/BatteryWidget/battery-icons/100.png deleted file mode 100644 index 48cc412..0000000 Binary files a/BatteryWidget/battery-icons/100.png and /dev/null differ diff --git a/BatteryWidget/battery-icons/20.png b/BatteryWidget/battery-icons/20.png deleted file mode 100644 index e3b455b..0000000 Binary files a/BatteryWidget/battery-icons/20.png and /dev/null differ diff --git a/BatteryWidget/battery-icons/40.png b/BatteryWidget/battery-icons/40.png deleted file mode 100644 index 5de8a1d..0000000 Binary files a/BatteryWidget/battery-icons/40.png and /dev/null differ diff --git a/BatteryWidget/battery-icons/60.png b/BatteryWidget/battery-icons/60.png deleted file mode 100644 index 483506f..0000000 Binary files a/BatteryWidget/battery-icons/60.png and /dev/null differ diff --git a/BatteryWidget/battery-icons/80.png b/BatteryWidget/battery-icons/80.png deleted file mode 100644 index 11dc029..0000000 Binary files a/BatteryWidget/battery-icons/80.png and /dev/null differ 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() diff --git a/EmailWidget/README.md b/EmailWidget/README.md deleted file mode 100644 index 6f204ca..0000000 --- a/EmailWidget/README.md +++ /dev/null @@ -1,26 +0,0 @@ -This widget consists of an icon with counter which shows number of unread emails: ![email icon](./emailWidgetScrnsht.png) -and a popup message which appears when mouse hovers over an icon: ![email popup](./emailWidgetScrnsht2.png) - -## Installation - -To install it either clone [EmailWidget](https://github.com/streetturtle/AwesomeWM/tree/master/EmailWidget) project under `~/.config/awesome/` or download a .zip archive and unzip it there. - -After provide your credentials in python scripts so that they could connect to server and add following lines in your **rc.lua** file: - -```lua -require("email") -... -right_layout:add(emailWidget_icon) -right_layout:add(emailWidget_counter) -``` - -## How it works - -This widget uses the output of two python scripts, first is called every 5 seconds - it returns number of unread emails and second is called when mouse hovers over an icon and displays content of those emails. For both of them you'll need to provide your credentials and imap server. For testing they can simply be called from console: - -``` bash -python ~/.config/awesome/email/countUnreadEmails.py -python ~/.config/awesome/email/readEmails.py -``` - -Note that getting number of unread emails could take some time, so instead of `pread` or `spawn_with_shell` functions I use DBus, you can read more about it in [this]({{site.url}}/2015/09/fix-awesome-freezes) post. diff --git a/EmailWidget/email.lua b/EmailWidget/email.lua deleted file mode 100644 index 3f486cf..0000000 --- a/EmailWidget/email.lua +++ /dev/null @@ -1,40 +0,0 @@ -local wibox = require("wibox") -local awful = require("awful") -local naughty = require("naughty") - -function showEmailWidgetPopup() - local save_offset = offset - local popuptext = "test" - naughty.notify({ - title = "Unread emails", - text = awful.util.pread("python /home/username/.config/awesome/getUnreadEmails.py"), - timeout = 10, - width = 300, - fg = "#ffffff", - bg = "#333333aa", - }) -end - --- Icon which shows unread emails when hover -emailIcon = wibox.widget.imagebox() -emailIcon:set_image("/home/username/.config/awesome/mail.png") -emailIcon:connect_signal("mouse::enter", function() showEmailWidgetPopup() end) - -dbus.request_name("session", "ru.console.df") -dbus.add_match("session", "interface='ru.console.df', member='fsValue' " ) -dbus.connect_signal("ru.console.df", - function (...) - local data = {...} - local dbustext = data[2] - emailCount:set_text(dbustext) - end) - --- Counter which shows number of unread emails -emailCount = wibox.widget.textbox() - -emailCountTimer = timer ({timeout = 5}) -emailCountTimer:connect_signal ("timeout", - function () - awful.util.spawn_with_shell("dbus-send --session --dest=org.naquadah.awesome.awful /ru/console/df ru.console.df.fsValue string:$(python /home/username/.config/awesome/getUnreadEmailsNum.py)" ) - end) -emailCountTimer:start() diff --git a/EmailWidget/emailWidgetScrnsht.png b/EmailWidget/emailWidgetScrnsht.png deleted file mode 100644 index 07b69ce..0000000 Binary files a/EmailWidget/emailWidgetScrnsht.png and /dev/null differ diff --git a/EmailWidget/emailWidgetScrnsht2.png b/EmailWidget/emailWidgetScrnsht2.png deleted file mode 100644 index e2acc0c..0000000 Binary files a/EmailWidget/emailWidgetScrnsht2.png and /dev/null differ diff --git a/EmailWidget/getUnreadEmails.py b/EmailWidget/getUnreadEmails.py deleted file mode 100644 index 8b4714a..0000000 --- a/EmailWidget/getUnreadEmails.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/python - -import imaplib -import email -import datetime - -def process_mailbox(M): - rv, data = M.search(None, "UNSEEN") - if rv != 'OK': - print "No messages found!" - return - - for num in data[0].split(): - # rv, data = M.fetch(num, '(RFC822)') # mark us read - rv, data = M.fetch(num, '(BODY.PEEK[])') # don't mark us read - if rv != 'OK': - print "ERROR getting message", num - return - - msg = email.message_from_string(data[0][1]) - print 'From:', msg['From'] - print 'Subject: %s' % (msg['Subject']) - date_tuple = email.utils.parsedate_tz(msg['Date']) - if date_tuple: - local_date = datetime.datetime.fromtimestamp( - email.utils.mktime_tz(date_tuple)) - print "Local Date:", local_date.strftime("%a, %d %b %Y %H:%M:%S") - print - -M=imaplib.IMAP4_SSL("imap.whatever.com", 993) -M.login("username","password") - -rv, data = M.select("INBOX") -if rv == 'OK': - process_mailbox(M) - M.close() - -M.logout() - diff --git a/EmailWidget/getUnreadEmailsNum.py b/EmailWidget/getUnreadEmailsNum.py deleted file mode 100644 index 5599f2e..0000000 --- a/EmailWidget/getUnreadEmailsNum.py +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/python - -import imaplib -import email - -M=imaplib.IMAP4_SSL("imap.whatever.com", 993) -M.login("username","password") - -status, counts = M.status("INBOX","(MESSAGES UNSEEN)") - -if status == "OK": - unread = int(counts[0].split()[4][:-1]) -else: - unread = "N/A" - -print(unread) diff --git a/EmailWidget/mail.png b/EmailWidget/mail.png deleted file mode 100644 index 1df6fae..0000000 Binary files a/EmailWidget/mail.png and /dev/null differ diff --git a/EmailWidget/mailWathcer.py b/EmailWidget/mailWathcer.py deleted file mode 100644 index b116521..0000000 --- a/EmailWidget/mailWathcer.py +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/python - -import imaplib -import email -import datetime - -def process_mailbox(M): - rv, data = M.search(None, "UNSEEN") - if rv != 'OK': - print "No messages found!" - return - - for num in data[0].split(): - # rv, data = M.fetch(num, '(RFC822)') - rv, data = M.fetch(num, '(BODY.PEEK[])') - if rv != 'OK': - print "ERROR getting message", num - return - - msg = email.message_from_string(data[0][1]) - print 'From:', msg['From'] - print 'Subject: %s' % (msg['Subject']) - print 'Raw Date:', msg['Date'] - date_tuple = email.utils.parsedate_tz(msg['Date']) - if date_tuple: - local_date = datetime.datetime.fromtimestamp( - email.utils.mktime_tz(date_tuple)) - print "Local Date:", \ - local_date.strftime("%a, %d %b %Y %H:%M:%S") - - -M=imaplib.IMAP4_SSL("imap.cern.ch", 993) -M.login("pavel.makhov@cern.ch","cB#h8g!2n") - -# status, counts = M.status("INBOX","(MESSAGES UNSEEN)") -# # status, counts = M.status("INBOX/!Edh-team","(MESSAGES UNSEEN)") - -# unread = counts[0].split()[4][:-1] - -# # print(status) -# print(unread) -rv, data = M.select("INBOX") -if rv == 'OK': - print "Processing mailbox...\n" - process_mailbox(M) # ... do something with emails, see below ... - M.close() -M.logout() - - -# M.select("INBOX") -# status, response = M.search('INBOX', '(UNSEEN)') - -# unread_msg_nums = response[0].split() - -# # Print the count of all unread messages -# print len(unread_msg_nums) - -# print 'HEADER:' -# typ, msg_data = M.fetch('1', '(BODY.PEEK[HEADER])') -# for response_part in msg_data: -# if isinstance(response_part, tuple): -# print response_part[1] - - - - -# da = [] -# # for e_id in unread_msg_nums: -# _, response = M.fetch(1, '(BODY.PEEK[TEXT])') -# # _, response = M.fetch(e_id, '(UID BODY[TEXT])') -# da.append(response[0][1]) -# print da - - - -# typ, data = M.select ("INBOX/!Edh-team") - -# status, response = imap.search('INBOX', '(UNSEEN)') - -# unread_msg_num = response[0].split() - -# Print the count of all unread messages - -#print typ -#print data - -# for num in data[0].split(): -# typ, data = M.fetch(num, '(RFC822)') -# print 'Message %s\n%s\n' % (num, data[0][1]) - -# for response_part in data: -# if isinstance(response_part, tuple): -# msg = email.message_from_string(response_part[1]) -# for header in [ 'subject', 'to', 'from' ]: -# print '%-8s: %s' % (header.upper(), msg[header]) - - - -# M.close() -# M.logout() diff --git a/MouseBatteryWidget/mouse-battery.lua b/MouseBatteryWidget/mouse-battery.lua deleted file mode 100644 index 7b3fd4c..0000000 --- a/MouseBatteryWidget/mouse-battery.lua +++ /dev/null @@ -1,33 +0,0 @@ -local wibox = require("wibox") -local awful = require("awful") - --- text widget -mouse_widget = wibox.widget.textbox() -mouse_widget:set_font('Play 9') - -function update_mouse_widget(widget) - local current = awful.util.pread( - "upower -i /org/freedesktop/UPower/devices/mouse_0003o046Do101Ax0006 " .. - "| grep percentage | grep -E -o '[0-9]+'") - widget:set_text(current) -end - -mouse_timer = timer({ timeout = 3600 }) -mouse_timer:connect_signal("timeout", function () update_mouse_widget(mouse_widget) end) -mouse_timer:start() -mouse_timer:emit_signal("timeout") - --- icon widget -mouse_battery_icon = wibox.widget.imagebox() - -function update_mouse_battery_icon(icon) - local iconName = awful.util.pread("upower -i /org/freedesktop/UPower/devices/mouse_0003o046Do101Ax0006 " .. - "| grep icon-name | grep -oP \"(?<=').*(?=')\"") - icon:set_image("/usr/share/icons/gnome/scalable/status/" .. string.gsub(iconName, "\n", "") .. ".svg") -end - -mouse_battery_timer = timer({ timeout = 60 }) -mouse_battery_timer:connect_signal("timeout", function() update_mouse_battery_icon(mouse_battery_icon) end) -mouse_battery_timer:start() - -mouse_battery_timer:emit_signal("timeout") diff --git a/MouseBatteryWidget/mouse-battery.png b/MouseBatteryWidget/mouse-battery.png deleted file mode 100644 index 70a721a..0000000 Binary files a/MouseBatteryWidget/mouse-battery.png and /dev/null differ diff --git a/README.md b/README.md index c57f643..81824e9 100644 --- a/README.md +++ b/README.md @@ -1,129 +1,5 @@ # AwesomeWM -Set of simple widgets for Awesome Window Manager consists of following widgets: +Set of simple widgets compatible with Awesome Window Manager v.4. - - [Battery Widget](https://github.com/streetturtle/AwesomeWM#battery-widget) - - [Email Widget](https://github.com/streetturtle/AwesomeWM#email-widget) - - [Mouse Battery Widget](https://github.com/streetturtle/AwesomeWM#mouse-battery-widget) - - [Rates Widget](https://github.com/streetturtle/AwesomeWM#rates-widget) - - [Spotify Widget](https://github.com/streetturtle/AwesomeWM#spotify-widget) - - [Volume Control Widget](https://github.com/streetturtle/AwesomeWM#volume-control-widget) - -Note that these widgets work with Awesome WM 3.5 version. I'm currently migrating them to 4.0. - -## Battery widget - -This widget consists of - - - an icon which shows the battery status: ![Battery Widget](https://raw.githubusercontent.com/streetturtle/AwesomeWM/master/BatteryWidget/batWid1.png) - - a pop-up window, which shows up when you hover over it: ![Battery Widget](https://raw.githubusercontent.com/streetturtle/AwesomeWM/master/BatteryWidget/batWid2.png) - - a pop-up warning message which appears when battery level is less that 15%: ![Battery Widget](https://raw.githubusercontent.com/streetturtle/AwesomeWM/master/BatteryWidget/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) -``` - ---- - -## Email widget - -This widget consists of an icon with counter which shows number of unread emails: ![email icon](https://raw.githubusercontent.com/streetturtle/AwesomeWM/master/EmailWidget/emailWidgetScrnsht.png) -and a popup message which appears when mouse hovers over an icon: ![email popup](https://raw.githubusercontent.com/streetturtle/AwesomeWM/master/EmailWidget/emailWidgetScrnsht2.png) - -**Installation** - -To install it either clone [EmailWidget](https://github.com/streetturtle/AwesomeWM/tree/master/EmailWidget) project under `~/.config/awesome/` or download a .zip archive and unzip it there. - -After provide your credentials in python scripts so that they could connect to server and add following lines in your **rc.lua** file: - -```lua -require("email") -... -right_layout:add(emailWidget_icon) -right_layout:add(emailWidget_counter) -``` - -**How it works** - -This widget uses the output of two python scripts, first is called every 5 seconds - it returns number of unread emails and second is called when mouse hovers over an icon and displays content of those emails. For both of them you'll need to provide your credentials and imap server. For testing they can simply be called from console: - -```bash -python ~/.config/awesome/email/countUnreadEmails.py -python ~/.config/awesome/email/readEmails.py -``` - -Note that getting number of unread emails could take some time, so instead of `pread` or `spawn_with_shell` functions I use DBus, you can read more about it in [this](http://pavelmakhov.com/2015/09/fix-awesome-freezes) post. - ---- - -## Mouse Battery Widget - -This widget shows the battery status of wireless mouse: ![screenshot](https://raw.githubusercontent.com/streetturtle/AwesomeWM/master/MouseBatteryWidget/mouse-battery.png) - - Include `mouse-battery` and add battery widget to your wibox in rc.lua (you can use both icon and text, or any of them separately): - -```lua -require("mouse-battery") -... -right_layout:add(mouse_battery_icon) -- icon -right_layout:add(mouse_widget) -- text -``` - -Read more about how it works here: [Mouse Battery status widget for Awesome WM](http://pavelmakhov.com/2017/01/awesome-wm-mouse-battery) - ---- - -## Rates widget - -Rates widget showing currency rate for chosen currencies with pop-up appearing when mouse hovers over it. -More about this widget in this two posts: - - http://pavelmakhov.com/2016/01/how-to-create-widget - - http://pavelmakhov.com/2016/01/how-to-create-widget-part-2 - ---- - -## Spotify widget - -Widget displaying currently playing song by Spotify application: -![screenshot](https://raw.githubusercontent.com/streetturtle/AwesomeWM/master/Spotify/screenshot.png) - -You can read more about spotify integration in this blog [post](http://pavelmakhov.com/2016/02/awesome-wm-spotify). - ---- - -## Volume control widget - -Simple and easy-to-install widget for Awesome Window Manager. -This widget represents the sound level: ![Volume Wiget](https://github.com/streetturtle/AwesomeWM/raw/master/VolumeWidget/volWid.png) - -**Installation** - -- clone/copy volume.lua file and volume-icons folder to your `~/home/username/.config/awesome/` folder; - -- change path to the icons in `volume.lua`: - -``` -widget:set_image("/home//.config/awesome/volume-icons/" .. volumeLevel .. ".png") -``` - -- include `volume.lua` and add volume widget to your wibox in rc.lua: - -``` -require("volume") -... -right_layout:add(volumeWidget) -``` +Coming soon diff --git a/RatesWidget/currency.png b/RatesWidget/currency.png deleted file mode 100644 index 4c7dbce..0000000 Binary files a/RatesWidget/currency.png and /dev/null differ diff --git a/RatesWidget/rates.lua b/RatesWidget/rates.lua deleted file mode 100644 index 6fa2e47..0000000 --- a/RatesWidget/rates.lua +++ /dev/null @@ -1,39 +0,0 @@ -local wibox = require("wibox") -local awful = require("awful") - -rateWidget = wibox.widget.textbox() - --- DBus (Command are sent to Dbus, which prevents Awesome from freezŅƒ) -sleepTimerDbus = timer ({timeout = 1800}) -sleepTimerDbus:connect_signal ("timeout", - function () - awful.util.spawn_with_shell("dbus-send --session --dest=org.naquadah.awesome.awful /com/console/rate com.console.rate.rateWidget string:$(python ~/.config/awesome/rates/rates.py)" ) - end) -sleepTimerDbus:start() -sleepTimerDbus:emit_signal("timeout") - -dbus.request_name("session", "com.console.rate") -dbus.add_match("session", "interface='com.console.rate', member='rateWidget' " ) -dbus.connect_signal("com.console.rate", - function (...) - local data = {...} - local dbustext = data[2] - rateWidget:set_text(dbustext) - end) - --- The notification popup which shows rates for other currencies -function showRatesPopup() - naughty.notify({ - title = "Rates", - text = awful.util.pread("python ~/.config/awesome/rates/ratesPopup.py"), - icon = "/home/username/.config/awesome/rates/currency.png", - icon_size = 100, - timeout = 10, - width = 300, - padding = 100, - fg = "#ffffff", - bg = "#333333aa", - }) -end - -rateWidget:connect_signal("mouse::enter", function() showRatesPopup() end) \ No newline at end of file diff --git a/RatesWidget/rates.py b/RatesWidget/rates.py deleted file mode 100644 index 9a12462..0000000 --- a/RatesWidget/rates.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/python - -import requests -import json - -r = requests.get("http://api.fixer.io/latest?symbols=CHF,EUR") -resp = json.loads(r.content) - -print resp["rates"]["CHF"] \ No newline at end of file diff --git a/RatesWidget/ratesPopup.py b/RatesWidget/ratesPopup.py deleted file mode 100644 index 4ac6cce..0000000 --- a/RatesWidget/ratesPopup.py +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/python - -import requests -import json - -r = requests.get("http://api.fixer.io/latest?symbols=USD,EUR,JPY,GBP,CHF,CAD,RUB") -resp = json.loads(r.content) -rates = resp["rates"] - -for currency, rate in rates.items(): - print currency, rate diff --git a/RatesWidget/readme.md b/RatesWidget/readme.md deleted file mode 100644 index d13bae1..0000000 --- a/RatesWidget/readme.md +++ /dev/null @@ -1,8 +0,0 @@ -# Rates Widget - -Widget for Awesome WM which displays the currency rate between Swiss Frank and Euro. For the rate API it uses [fixer.io](http://fixer.io/) - JSON API for foreign exchange rates and currency conversion. And a python script which calls this API. - -You can read more about it in these posts: - - - http://pavelmakhov.com/2016/01/how-to-create-widget/ - - http://pavelmakhov.com/2016/01/how-to-create-widget-part-2/ diff --git a/Spotify/screenshot.png b/Spotify/screenshot.png deleted file mode 100644 index 9893a92..0000000 Binary files a/Spotify/screenshot.png and /dev/null differ diff --git a/Spotify/spotify.lua b/Spotify/spotify.lua deleted file mode 100644 index 828d3e6..0000000 --- a/Spotify/spotify.lua +++ /dev/null @@ -1,15 +0,0 @@ -local wibox = require("wibox") -local awful = require("awful") - -spotify_widget = wibox.widget.textbox() - -function updateSpotifyWidget(widget) - local current = awful.util.pread('sp current-oneline') - widget:set_text(current) -end - -spotify_timer = timer ({timeout = 10}) -spotify_timer:connect_signal ("timeout", function() updateSpotifyWidget(spotify_widget) end) -spotify_timer:start() - -spotify_timer:emit_signal("timeout") \ No newline at end of file diff --git a/VolumeWidget/README.md b/VolumeWidget/README.md deleted file mode 100644 index 312fa4d..0000000 --- a/VolumeWidget/README.md +++ /dev/null @@ -1,21 +0,0 @@ -## 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; - -- change path to the icons in `volume.lua`: - -``` -widget:set_image("/home//.config/awesome/volume-icons/" .. volumeLevel .. ".png") -``` - -- 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 deleted file mode 100644 index fdfdd20..0000000 Binary files a/VolumeWidget/volWid.png and /dev/null differ diff --git a/VolumeWidget/volume-icons/1.png b/VolumeWidget/volume-icons/1.png deleted file mode 100644 index 3f4e6b4..0000000 Binary files a/VolumeWidget/volume-icons/1.png and /dev/null differ diff --git a/VolumeWidget/volume-icons/2.png b/VolumeWidget/volume-icons/2.png deleted file mode 100644 index 9a488c7..0000000 Binary files a/VolumeWidget/volume-icons/2.png and /dev/null differ diff --git a/VolumeWidget/volume-icons/3.png b/VolumeWidget/volume-icons/3.png deleted file mode 100644 index a1bfb30..0000000 Binary files a/VolumeWidget/volume-icons/3.png and /dev/null differ diff --git a/VolumeWidget/volume-icons/4.png b/VolumeWidget/volume-icons/4.png deleted file mode 100644 index 8f11110..0000000 Binary files a/VolumeWidget/volume-icons/4.png and /dev/null differ diff --git a/VolumeWidget/volume-icons/5.png b/VolumeWidget/volume-icons/5.png deleted file mode 100644 index 613cb4a..0000000 Binary files a/VolumeWidget/volume-icons/5.png and /dev/null differ diff --git a/VolumeWidget/volume-icons/6.png b/VolumeWidget/volume-icons/6.png deleted file mode 100644 index 1defc8a..0000000 Binary files a/VolumeWidget/volume-icons/6.png and /dev/null differ diff --git a/VolumeWidget/volume-icons/7.png b/VolumeWidget/volume-icons/7.png deleted file mode 100644 index 8207899..0000000 Binary files a/VolumeWidget/volume-icons/7.png and /dev/null differ diff --git a/VolumeWidget/volume-icons/8.png b/VolumeWidget/volume-icons/8.png deleted file mode 100644 index 423f213..0000000 Binary files a/VolumeWidget/volume-icons/8.png and /dev/null differ diff --git a/VolumeWidget/volume-icons/9.png b/VolumeWidget/volume-icons/9.png deleted file mode 100644 index e7c40df..0000000 Binary files a/VolumeWidget/volume-icons/9.png and /dev/null differ diff --git a/VolumeWidget/volume.lua b/VolumeWidget/volume.lua deleted file mode 100644 index 34c12f5..0000000 --- a/VolumeWidget/volume.lua +++ /dev/null @@ -1,34 +0,0 @@ -local wibox = require("wibox") -local awful = require("awful") - -volume_widget = wibox.widget.imagebox() - -function update_volume(widget) - local fd = io.popen("amixer -D pulse sget Master") - local status = fd:read("*all") - fd:close() - - local volume = string.match(status, "(%d?%d?%d)%%") - volume = tonumber(string.format("% 3d", volume)) - - status = string.match(status, "%[(o[^%]]*)%]") - - if (volume >= 0 and volume < 10) then volumeLevel=1 - elseif (volume >= 10 and volume < 20) then volumeLevel=2 - elseif (volume >= 20 and volume < 30) then volumeLevel=3 - elseif (volume >= 30 and volume < 40) then volumeLevel=4 - elseif (volume >= 40 and volume < 50) then volumeLevel=5 - elseif (volume >= 50 and volume < 60) then volumeLevel=6 - elseif (volume >= 60 and volume < 70) then volumeLevel=7 - elseif (volume >= 70 and volume < 80) then volumeLevel=8 - elseif (volume >= 80 and volume <= 100) then volumeLevel=9 - end - - widget:set_image("/home/pashik/.config/awesome/volume-icons/" .. volumeLevel .. ".png") -end - -update_volume(volume_widget) - -mytimer = timer({ timeout = 0.2 }) -mytimer:connect_signal("timeout", function () update_volume(volume_widget) end) -mytimer:start() \ No newline at end of file diff --git a/battery-widget-v4/battery.lua b/battery-widget/battery.lua similarity index 86% rename from battery-widget-v4/battery.lua rename to battery-widget/battery.lua index b391b2c..14fef67 100644 --- a/battery-widget-v4/battery.lua +++ b/battery-widget/battery.lua @@ -3,16 +3,19 @@ local awful = require("awful") local naughty = require("naughty") local watch = require("awful.widget.watch") +batteryIcon = wibox.widget { widget = wibox.widget.imagebox } + +-- acpi sample outputs -- Battery 0: Discharging, 75%, 01:51:38 remaining -- Battery 0: Charging, 53%, 00:57:43 until charged -batteryIcon = wibox.widget { widget = wibox.widget.imagebox } +local path_to_icons = "/usr/share/icons/Arc-Icons/panel/22/" watch( "acpi", 10, function(widget, stdout, stderr, exitreason, exitcode) local batteryType - local bar, status, charge, time = string.match(stdout, '(.+): (%a+), (%d%d)%%, (.+)') + local _, status, charge, time = string.match(stdout, '(.+): (%a+), (%d%d)%%, (.+)') charge = tonumber(charge) if (charge >= 0 and charge < 20) then batteryType="battery-empty" @@ -25,7 +28,7 @@ watch( if status == 'Charging' then batteryType = batteryType .. '-charging' end - batteryIcon.image = "/usr/share/icons/Arc-Icons/panel/22/" .. batteryType .. ".svg" + batteryIcon.image = path_to_icons .. batteryType .. ".svg" end ) @@ -55,4 +58,4 @@ function show_battery_warning() end -- popup with battery info -batteryIcon:connect_signal("mouse::enter", function() show_battery_status() end) +batteryIcon:connect_signal("mouse::enter", function() show_battery_status() end) \ No newline at end of file diff --git a/brightness-widget/brightness.lua b/brightness-widget/brightness.lua new file mode 100644 index 0000000..78e4916 --- /dev/null +++ b/brightness-widget/brightness.lua @@ -0,0 +1,17 @@ +local wibox = require("wibox") +local awful = require("awful") +local watch = require("awful.widget.watch") + +brightness_widget = wibox.widget.textbox() +brightness_widget:set_font('Play 9') + +brightness_icon = wibox.widget.imagebox() +brightness_icon:set_image("/usr/share/icons/Arc-Icons/actions/22/object-inverse.png") + +watch( + "xbacklight -get", 1, + function(widget, stdout, stderr, exitreason, exitcode) + local brightness_level = tonumber(string.format("%.0f", stdout)) + brightness_widget:set_text(brightness_level) + end +) \ No newline at end of file diff --git a/email-widget/count_unread_emails.py b/email-widget/count_unread_emails.py new file mode 100644 index 0000000..f4d2b86 --- /dev/null +++ b/email-widget/count_unread_emails.py @@ -0,0 +1,16 @@ +#!/usr/bin/python + +import imaplib +import email + +M=imaplib.IMAP4_SSL("mail.teenagemutantninjaturtles.com", 993) +M.login("mickey@tmnt.com","cowabunga") + +status, counts = M.status("INBOX","(MESSAGES UNSEEN)") + +if status == "OK": + unread = counts[0].split()[4][:-1] +else: + unread = "N/A" + +print(unread) \ No newline at end of file diff --git a/email-widget/email.lua b/email-widget/email.lua new file mode 100644 index 0000000..22a7b6d --- /dev/null +++ b/email-widget/email.lua @@ -0,0 +1,42 @@ +local wibox = require("wibox") +local awful = require("awful") +local naughty = require("naughty") +local watch = require("awful.widget.watch") + +local path_to_icons = "/usr/share/icons/Arc-Icons/actions/22/" + +email_widget = wibox.widget.textbox() +email_widget:set_font('Play 9') + +email_icon = wibox.widget.imagebox() +email_icon:set_image(path_to_icons .. "/mail-mark-new.png") + +watch( + "python /home//.config/awesome/email/count_unread_emails.py", 20, + function(widget, stdout, stderr, exitreason, exitcode) + local unread_emails_num = tonumber(stdout) + if (unread_emails_num > 0) then + email_icon:set_image(path_to_icons .. "/mail-mark-unread.png") + email_widget:set_text(stdout) + elseif (unread_emails_num == 0) then + email_icon:set_image(path_to_icons .. "/mail-message-new.png") + email_widget:set_text("") + end + end +) + + +function show_emails() + awful.spawn.easy_async([[bash -c 'python /home//.config/awesome/email/read_unread_emails.py']], + function(stdout, stderr, reason, exit_code) + naughty.notify{ + text = stdout, + title = "Unread Emails", + timeout = 5, hover_timeout = 0.5, + width = 400, + } + end + ) +end + +email_icon:connect_signal("mouse::enter", function() show_emails() end) \ No newline at end of file diff --git a/email-widget/read_unread_emails.py b/email-widget/read_unread_emails.py new file mode 100644 index 0000000..343fe66 --- /dev/null +++ b/email-widget/read_unread_emails.py @@ -0,0 +1,42 @@ +#!/usr/bin/python + +import imaplib +import email +import datetime + +def process_mailbox(M): + rv, data = M.search(None, "(UNSEEN)") + if rv != 'OK': + print "No messages found!" + return + + for num in data[0].split(): + rv, data = M.fetch(num, '(BODY.PEEK[])') + if rv != 'OK': + print "ERROR getting message", num + return + + msg = email.message_from_string(data[0][1]) + print 'From:', msg['From'] + print 'Subject: %s' % (msg['Subject']) + date_tuple = email.utils.parsedate_tz(msg['Date']) + if date_tuple: + local_date = datetime.datetime.fromtimestamp(email.utils.mktime_tz(date_tuple)) + print "Local Date:", local_date.strftime("%a, %d %b %Y %H:%M:%S") + # with code below you can process text of email + # if msg.is_multipart(): + # for payload in msg.get_payload(): + # if payload.get_content_maintype() == 'text': + # print payload.get_payload() + # else: + # print msg.get_payload() + + +M=imaplib.IMAP4_SSL("mail.teenagemutantninjaturtles.com", 993) +M.login("mickey@tmnt.com","cowabunga") + +rv, data = M.select("INBOX") +if rv == 'OK': + process_mailbox(M) +M.close() +M.logout() \ No newline at end of file diff --git a/rhythmbox-widget/rhythmbox.lua b/rhythmbox-widget/rhythmbox.lua new file mode 100644 index 0000000..4a54d4b --- /dev/null +++ b/rhythmbox-widget/rhythmbox.lua @@ -0,0 +1,16 @@ +local wibox = require("wibox") +local awful = require("awful") +local watch = require("awful.widget.watch") + +rhythmbox_widget = wibox.widget.textbox() +rhythmbox_widget:set_font('Play 9') + +rhythmbox_icon = wibox.widget.imagebox() +rhythmbox_icon:set_image("/usr/share/icons/Arc-Icons/devices/22/audio-speakers.png") + +watch( + "rhythmbox-client --no-start --print-playing", 1, + function(widget, stdout, stderr, exitreason, exitcode) + rhythmbox_widget:set_text(stdout) + end +) \ No newline at end of file diff --git a/spotify-widget-v4/spotify.lua b/spotify-widget/spotify.lua similarity index 82% rename from spotify-widget-v4/spotify.lua rename to spotify-widget/spotify.lua index f61c249..c9b3789 100644 --- a/spotify-widget-v4/spotify.lua +++ b/spotify-widget/spotify.lua @@ -7,11 +7,11 @@ spotify_widget:set_font('Play 9') -- optional icon, could be replaced by spotfiy logo (https://developer.spotify.com/design/) spotify_icon = wibox.widget.imagebox() -spotify_icon:set_image("/usr/share/icons/Arc-Icons/places/symbolic/folder-music-symbolic.svg") +spotify_icon:set_image("/usr/share/icons/Arc-Icons/devices/22/audio-headphones.png") watch( "sp current-oneline", 1, function(widget, stdout, stderr, exitreason, exitcode) spotify_widget:set_text(stdout) end -) +) \ No newline at end of file diff --git a/volume-widget-v4/volume.lua b/volume-widget/volume.lua similarity index 100% rename from volume-widget-v4/volume.lua rename to volume-widget/volume.lua