mirror of
https://github.com/streetturtle/awesome-wm-widgets.git
synced 2024-11-17 07:49:09 +01:00
Add mouse battery widget
This commit is contained in:
parent
8c3395a4f6
commit
c6089636e9
3 changed files with 55 additions and 2 deletions
33
MouseBatteryWidget/mouse-battery.lua
Normal file
33
MouseBatteryWidget/mouse-battery.lua
Normal file
|
@ -0,0 +1,33 @@
|
|||
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")
|
BIN
MouseBatteryWidget/mouse-battery.png
Normal file
BIN
MouseBatteryWidget/mouse-battery.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 972 B |
24
README.md
24
README.md
|
@ -4,10 +4,13 @@ Set of simple widgets for Awesome Window Manager consists of following widgets:
|
|||
|
||||
- [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 widget works with Awesome WM 3.5 version. I'm currently migrating them to 4.0.
|
||||
|
||||
## Battery widget
|
||||
|
||||
This widget consists of
|
||||
|
@ -58,7 +61,7 @@ right_layout:add(emailWidget_counter)
|
|||
|
||||
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
|
||||
```bash
|
||||
python ~/.config/awesome/email/countUnreadEmails.py
|
||||
python ~/.config/awesome/email/readEmails.py
|
||||
```
|
||||
|
@ -67,6 +70,23 @@ Note that getting number of unread emails could take some time, so instead of `p
|
|||
|
||||
---
|
||||
|
||||
## 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.
|
||||
|
@ -81,7 +101,7 @@ More about this widget in this two posts:
|
|||
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).
|
||||
You can read more about spotify integration in this blog [post](http://pavelmakhov.com/2016/02/awesome-wm-spotify).
|
||||
|
||||
---
|
||||
|
||||
|
|
Loading…
Reference in a new issue