monitors, brightness, battery widget

This commit is contained in:
Simonas Narbutas
2018-08-02 15:58:24 +02:00
parent fd56f2ca1c
commit 3a64720df4
4 changed files with 40 additions and 10 deletions

View File

@@ -10,6 +10,9 @@ local beautiful = require("beautiful")
local naughty = require("naughty")
local menubar = require("menubar")
local hotkeys_popup = require("awful.hotkeys_popup").widget
-- Battery notif
local battery = require("battery")
-- Enable hotkeys help widget for VIM and other apps
-- when client with a matching name is opened:
require("awful.hotkeys_popup.keys")
@@ -57,10 +60,10 @@ modkey = "Mod4"
-- Table of layouts to cover with awful.layout.inc, order matters.
awful.layout.layouts = {
awful.layout.suit.fair,
awful.layout.suit.fair.horizontal,
awful.layout.suit.tile,
awful.layout.suit.tile.left,
awful.layout.suit.fair,
awful.layout.suit.fair.horizontal,
awful.layout.suit.tile.bottom,
awful.layout.suit.tile.top,
awful.layout.suit.spiral,
@@ -116,6 +119,8 @@ menubar.utils.terminal = terminal -- Set the terminal for applications that requ
-- Keyboard map indicator and switcher
mykeyboardlayout = awful.widget.keyboardlayout()
-- Battery
batterywidget = wibox.widget.textbox()
-- {{{ Wibar
-- Create a textclock widget
mytextclock = wibox.widget.textclock()
@@ -125,7 +130,7 @@ local cal_notification
mytextclock:connect_signal("button::release",
function()
if cal_notification == nil then
awful.spawn.easy_async([[zsh -c "cal -3 -m --color=always |sed 's#\x1B\[7m\([0-9]\+\)\x1B\[27m#<span foreground=\"red\"><b>\1</b></span>#'"]],
awful.spawn.easy_async([[zsh -c "cal -3 -m --color=always |sed 's#\x1B\[7m\([ 0-9]\+\)\x1B\[27m#<span foreground=\"red\"><b>\1</b></span>#'"]],
function(stdout, stderr, reason, exit_code)
cal_notification = naughty.notify{
text = stdout,
@@ -257,6 +262,7 @@ awful.screen.connect_for_each_screen(function(s)
mykeyboardlayout,
wibox.widget.systray(),
mytextclock,
batterywidget,
s.mylayoutbox,
},
}
@@ -343,8 +349,18 @@ globalkeys = gears.table.join(
{description = "select previous", group = "layout"}),
-- Display Brightness
awful.key({}, "XF86MonBrightnessUp", function () awful.util.spawn("/home/snarbutas/.bin/brightness +15", false) end),
awful.key({}, "XF86MonBrightnessDown",function () awful.util.spawn("/home/snarbutas/.bin/brightness -15", false) end),
awful.key({}, "XF86MonBrightnessUp",
function ()
awful.spawn.easy_async("/home/snarbutas/.bin/brightness +750", function(stdout, stderr, reason, exit_code)
naughty.notify {title = "💡", text = stdout, timeout = 0.5}
end)
end),
awful.key({}, "XF86MonBrightnessDown",
function ()
awful.spawn.easy_async("/home/snarbutas/.bin/brightness -750", function(stdout, stderr, reason, exit_code)
naughty.notify {title = "💡", text = stdout, timeout = 0.5}
end)
end),
-- Extend monitor
awful.key({ "Control", "Mod4" }, "e", function () awful.util.spawn("/home/snarbutas/.bin/multimonitor", false) end),
-- Lock computer
@@ -656,4 +672,11 @@ end)
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
-- Automatically check battery
batterywidget_timer = timer({timeout = 1})
batterywidget_timer:connect_signal("timeout", function()
batterywidget:set_text(batteryInfo("BAT0"))
end)
batterywidget_timer:start()
-- }}}