From b767be3ffd3e858c54951a67eacd5b5eadf8c7c6 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sat, 17 Dec 2016 17:48:35 +0100 Subject: updates --- Xresources | 4 ++-- config/awesome/battery.lua | 43 +++++++++++++++++++++++++++++------------ config/awesome/rc.lua | 33 +++++++++++++++++-------------- config/awesome/volume.lua | 9 ++++++--- config/awesome/weasel-rules.lua | 20 ++++++++++--------- 5 files changed, 68 insertions(+), 41 deletions(-) diff --git a/Xresources b/Xresources index 2ceb703..e3f913d 100644 --- a/Xresources +++ b/Xresources @@ -57,7 +57,7 @@ URxvt.url-launcher: /usr/bin/xdg-open URxvt.matcher.button: 3 ! We tell irssi to turn messages and hilights into bells -URxvt.urgentOnBell: true +! URxvt.urgentOnBell: true ! URxvt*matcher.button: 3 ! URxvt*matcher.pattern.1: \\b(mailto|http|https|ftp|file):[/]*[\\w-]\\.[\\w./?&@#-]*[\\w/-] @@ -68,4 +68,4 @@ URxvt.urgentOnBell: true ! URxvt.cutchars: "!\"$%'()*+,;.:<=>[\]^`{|}~@&#»­/" URxvt.pastableTabs: False -URxvt.cutchars: "!\`\"'$&()*,;<=>?@[]^{|}:/" +URxvt.cutchars: "!\`\"'$&()*,;<=>?@[]^{|}:/·»" diff --git a/config/awesome/battery.lua b/config/awesome/battery.lua index 988f9fa..a76ce29 100644 --- a/config/awesome/battery.lua +++ b/config/awesome/battery.lua @@ -1,3 +1,6 @@ +local naughty = require("naughty") +local beautiful = require("beautiful") + function batteryInfoUpdate(adapter, warn, widget) spacer = " " local fcap = io.open("/sys/class/power_supply/"..adapter.."/capacity") @@ -8,31 +11,44 @@ function batteryInfoUpdate(adapter, warn, widget) fsta:close() if sta:match("Charging") then - state = 1 icon = "▴" - else - state = -1 + elseif sta:match("Discharging") then icon = "▾" + else + icon = "‐" end if tonumber(cap) < 10 and warn then + local bg = beautiful.bg_focus + local fg = beautiful.fg_focus + if tonumber(cap) <= 5 then + bg = beautiful.bg_urgent + fg = beautiful.fg_urgent + end + naughty.notify({ title = "Battery Warning", text = "Battery "..adapter.." low at "..cap.."%!", timeout = 15, position = "top_right", - fg = beautiful.fg_focus, - bg = beautiful.bg_focus, + fg = fg, + bg = bg }) end - if tonumber(cap) < 10 then - color='red' - elseif tonumber(cap) < 25 then - color='orange' - else - color='green' + local color=nil + if warn then + if tonumber(cap) < 10 then + color='red' + elseif tonumber(cap) < 20 then + color='orange' + end + end + + local s = cap..'%'..icon + if color then + s = ""..s..'' end - widget:set_markup(spacer..""..icon..cap..'%'..spacer) + widget:set_markup(spacer..s..spacer) end local wibox = require("wibox") @@ -43,6 +59,9 @@ bat0_widget:set_align("right") bat1_widget = wibox.widget.textbox() bat1_widget:set_align("right") +batteryInfoUpdate("BAT0", true, bat0_widget) +batteryInfoUpdate("BAT1", false, bat1_widget) + battery_timer = timer({timeout = 20}) battery_timer:connect_signal("timeout", function() batteryInfoUpdate("BAT0", true, bat0_widget) diff --git a/config/awesome/rc.lua b/config/awesome/rc.lua index d10ada6..dfbc563 100644 --- a/config/awesome/rc.lua +++ b/config/awesome/rc.lua @@ -206,9 +206,9 @@ for s = 1, screen.count() do -- Widgets that are aligned to the right local right_layout = wibox.layout.fixed.horizontal() if s == 1 then right_layout:add(wibox.widget.systray()) end - right_layout:add(volume_widget) right_layout:add(bat0_widget) right_layout:add(bat1_widget) + right_layout:add(volume_widget) right_layout:add(mytextclock) right_layout:add(mylayoutbox[s]) @@ -257,9 +257,9 @@ globalkeys = awful.util.table.join( awful.key({ modkey, }, "Tab", function () awful.client.focus.history.previous() - -- if client.focus then - -- client.focus:raise() - -- end + if client.focus then + client.focus:raise() + end end), -- Standard program @@ -269,10 +269,11 @@ globalkeys = awful.util.table.join( awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end), awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end), - awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end), - awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end), - awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end), - awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end), + awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster(-1) end), + awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster( 1) end), + awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol(-1) end), + awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol( 1) end), + awful.key({ modkey, "Shift", "Control" }, "space", function () awful.tag.setncol(1) awful.tag.setnmaster(1) end), awful.key({ modkey, }, "space", function () if awful.util.table.hasitem(layouts, awful.layout.get() ) then awful.layout.inc(layouts, 1) @@ -305,12 +306,6 @@ globalkeys = awful.util.table.join( awful.key({ modkey }, "`", function () mypromptbox[mouse.screen]:run() end), awful.key({ "Ctrl", "Mod1" }, "BackSpace", awesome.quit), - awful.key({ modkey }, "x", function () awful.util.spawn_with_shell("urxvt") end), - awful.key({ modkey, "Shift" }, "x", function () awful.util.spawn_with_shell("urxvt -title FURxvt") end), - awful.key({ modkey }, "m", function () awful.util.spawn_with_shell("xterm-mail") end), - awful.key({ modkey, "Shift" }, "m", function () awful.util.spawn_with_shell("xterm-mail-cosy") end), - awful.key({ modkey }, "i", function () awful.util.spawn_with_shell("xterm-irc") end), - awful.key({ modkey, }, "F1", function () awful.layout.set(awful.layout.suit.floating) end), awful.key({ modkey, }, "F2", function () awful.layout.set(awful.layout.suit.tile) end), awful.key({ modkey, }, "F3", function () awful.layout.set(awful.layout.suit.tile.bottom) end), @@ -327,6 +322,13 @@ globalkeys = awful.util.table.join( awful.key({ }, "XF86AudioMute", function () awful.util.spawn("amixer -q -D default sset Master toggle", false) end), + awful.key({ modkey }, "x", function () awful.util.spawn_with_shell("urxvt") end), + awful.key({ modkey, "Shift" }, "x", function () awful.util.spawn_with_shell("urxvt -title FURxvt") end), + awful.key({ modkey }, "m", function () awful.util.spawn_with_shell("xterm-mail") end), + awful.key({ modkey, "Shift" }, "m", function () awful.util.spawn_with_shell("xterm-mail-cosy") end), + awful.key({ modkey }, "i", function () awful.util.spawn_with_shell("xterm-irc") end), + + -- awful.key({ "Control", "Mod1"}, "End", function () awful.util.spawn_with_shell("xscreensaver-command -lock; sleep 1; systemctl suspend") end), --awful.key({ "Control", "Mod1"}, "l", function () awful.util.spawn_with_shell("xscreensaver-command -lock") end), -- awful.key({ "Control", "Mod1"}, "l", function () awful.util.spawn("xdg-screensaver lock") end), @@ -408,7 +410,8 @@ clientkeys = awful.util.table.join( awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end), -- weasel - awful.key({ "Mod1" }, "q", function (c) + -- awful.key({ "Mod1" }, "q", function (c) + awful.key({ modkey }, "1", function (c) if c.sticky then local screen = mouse.screen -- local tags = awful.tag.selectedlist(screen) diff --git a/config/awesome/volume.lua b/config/awesome/volume.lua index bd1d1fb..4d491df 100644 --- a/config/awesome/volume.lua +++ b/config/awesome/volume.lua @@ -52,16 +52,19 @@ function update_volume(widget) -- local volume = tonumber(string.match(status, "(%d?%d?%d)%%")) / 100 local volume = string.match(status, "(%d?%d?%d)%%") - volume = string.format("% 3d", volume) + volume = string.format("%02d", volume) status = string.match(status, "%[(o[^%]]*)%]") if string.find(status, "on", 1, true) then -- For the volume numbers - volume = volume .. "%" + note = '♬' + volume = ' '.. note .. volume .. "%" .. " " else -- For the mute button - volume = "" .. volume .. "%" + -- rest = '𝄻' + rest = '♬' + volume = " ".. rest .. volume .. "%" .. " " end widget:set_markup(volume) end diff --git a/config/awesome/weasel-rules.lua b/config/awesome/weasel-rules.lua index ed659bf..46fa6f4 100644 --- a/config/awesome/weasel-rules.lua +++ b/config/awesome/weasel-rules.lua @@ -8,25 +8,27 @@ function get_weasel_rules() properties = { floating = true } }, { rule = { class = "Firefox" , name = "Mozilla Firefox" }, - properties = { tag = tags[browser_screen][6] } }, + properties = { tag = tags[browser_screen][7] } }, { rule = { class = "Firefox" }, - properties = { tag = tags[browser_screen][6] } }, - { rule = { class = "chromium" , name = "New Tab - Chromium" }, properties = { tag = tags[browser_screen][7] } }, + { rule = { class = "chromium" }, -- , name = "New Tab - Chromium" }, + properties = { tag = tags[browser_screen][8] } }, { rule = { class = "Tor Browser" , name = "Tor Browser" }, - properties = { tag = tags[browser_screen][8], floating = true } }, + properties = { tag = tags[browser_screen][12], floating = true } }, { rule = { class = "Tor Browser" }, - properties = { tag = tags[browser_screen][8], floating = true } }, + properties = { tag = tags[browser_screen][12], floating = true } }, { rule = { class = "URxvt" , name = "IRC" }, - properties = { tag = tags[im_screen][11] } }, + properties = { tag = tags[im_screen][1] } }, { rule = { class = "URxvt" , name = "Mail" }, - properties = { tag = tags[im_screen][12] } }, + properties = { tag = tags[im_screen][6] } }, { rule = { class = "URxvt" , name = "Mail COSY" }, - properties = { tag = tags[im_screen][12] } }, + properties = { tag = tags[im_screen][6] } }, { rule = { class = "chromium" , name = "Signal Private Messenger" }, - properties = { tag = tags[im_screen][13] } }, + properties = { tag = tags[im_screen][11] } }, + { rule = { class = "chromium" , name = "Signal" }, + properties = { tag = tags[im_screen][11] } }, --{ rule = { maximized_horizontal = true }, -- these two should remove window borders from maximized windows because they get in the way -- properties = { border_width = 0 } }, -- cgit v1.2.3