new widgets added
|
@ -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)
|
|
||||||
```
|
|
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 8.3 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
|
@ -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()
|
|
|
@ -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.
|
|
|
@ -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()
|
|
Before Width: | Height: | Size: 875 B |
Before Width: | Height: | Size: 62 KiB |
|
@ -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()
|
|
||||||
|
|
|
@ -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)
|
|
Before Width: | Height: | Size: 7.3 KiB |
|
@ -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()
|
|
|
@ -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")
|
|
Before Width: | Height: | Size: 972 B |
128
README.md
|
@ -1,129 +1,5 @@
|
||||||
# AwesomeWM
|
# 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)
|
Coming soon
|
||||||
- [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/<username>/.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)
|
|
||||||
```
|
|
||||||
|
|
Before Width: | Height: | Size: 19 KiB |
|
@ -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)
|
|
|
@ -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"]
|
|
|
@ -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
|
|
|
@ -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/
|
|
Before Width: | Height: | Size: 2.2 KiB |
|
@ -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")
|
|
|
@ -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/<username>/.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)
|
|
||||||
```
|
|
Before Width: | Height: | Size: 301 B |
Before Width: | Height: | Size: 233 B |
Before Width: | Height: | Size: 242 B |
Before Width: | Height: | Size: 248 B |
Before Width: | Height: | Size: 255 B |
Before Width: | Height: | Size: 260 B |
Before Width: | Height: | Size: 270 B |
Before Width: | Height: | Size: 273 B |
Before Width: | Height: | Size: 282 B |
Before Width: | Height: | Size: 286 B |
|
@ -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()
|
|
|
@ -3,16 +3,19 @@ local awful = require("awful")
|
||||||
local naughty = require("naughty")
|
local naughty = require("naughty")
|
||||||
local watch = require("awful.widget.watch")
|
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: Discharging, 75%, 01:51:38 remaining
|
||||||
-- Battery 0: Charging, 53%, 00:57:43 until charged
|
-- 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(
|
watch(
|
||||||
"acpi", 10,
|
"acpi", 10,
|
||||||
function(widget, stdout, stderr, exitreason, exitcode)
|
function(widget, stdout, stderr, exitreason, exitcode)
|
||||||
local batteryType
|
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)
|
charge = tonumber(charge)
|
||||||
if (charge >= 0 and charge < 20) then
|
if (charge >= 0 and charge < 20) then
|
||||||
batteryType="battery-empty"
|
batteryType="battery-empty"
|
||||||
|
@ -25,7 +28,7 @@ watch(
|
||||||
if status == 'Charging' then
|
if status == 'Charging' then
|
||||||
batteryType = batteryType .. '-charging'
|
batteryType = batteryType .. '-charging'
|
||||||
end
|
end
|
||||||
batteryIcon.image = "/usr/share/icons/Arc-Icons/panel/22/" .. batteryType .. ".svg"
|
batteryIcon.image = path_to_icons .. batteryType .. ".svg"
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -55,4 +58,4 @@ function show_battery_warning()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- popup with battery info
|
-- popup with battery info
|
||||||
batteryIcon:connect_signal("mouse::enter", function() show_battery_status() end)
|
batteryIcon:connect_signal("mouse::enter", function() show_battery_status() end)
|
|
@ -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
|
||||||
|
)
|
|
@ -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)
|
|
@ -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/<username>/.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/<username>/.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)
|
|
@ -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()
|
|
@ -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
|
||||||
|
)
|
|
@ -7,11 +7,11 @@ spotify_widget:set_font('Play 9')
|
||||||
|
|
||||||
-- optional icon, could be replaced by spotfiy logo (https://developer.spotify.com/design/)
|
-- optional icon, could be replaced by spotfiy logo (https://developer.spotify.com/design/)
|
||||||
spotify_icon = wibox.widget.imagebox()
|
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(
|
watch(
|
||||||
"sp current-oneline", 1,
|
"sp current-oneline", 1,
|
||||||
function(widget, stdout, stderr, exitreason, exitcode)
|
function(widget, stdout, stderr, exitreason, exitcode)
|
||||||
spotify_widget:set_text(stdout)
|
spotify_widget:set_text(stdout)
|
||||||
end
|
end
|
||||||
)
|
)
|