diff options
Diffstat (limited to '.config/awesome/rc.lua')
-rw-r--r-- | .config/awesome/rc.lua | 171 |
1 files changed, 115 insertions, 56 deletions
diff --git a/.config/awesome/rc.lua b/.config/awesome/rc.lua index ea3eb70..045ed80 100644 --- a/.config/awesome/rc.lua +++ b/.config/awesome/rc.lua @@ -15,6 +15,9 @@ require("awful.hotkeys_popup.keys") -- Custom libraries local charitable = require("charitable") +local widget_battery = require("awesome-wm-widgets.batteryarc-widget.batteryarc") +local widget_brightness = require("awesome-wm-widgets.brightness-widget.brightness") +local widget_volume = require("awesome-wm-widgets.pactl-widget.volume") -- {{{ Error handling -- Check if awesome encountered an error during startup and fell back to @@ -43,23 +46,6 @@ do end -- }}} --- {{{ Background services -function run_once(cmd) - findme = cmd - firstspace = cmd:find(" ") - - if firstspace then - findme = cmd:sub(0, firstspace - 1) - end - - awful.util.spawn_with_shell("pgrep -u $USER -x " .. findme .. " > /dev/null || (" .. cmd .. ")") -end - -run_once("xcompmgr") -run_once("chwp") -run_once("redshift -l 51.50:4.59 -t 6500:2500") --- }}} - -- {{{ Variable definitions beautiful.init(awful.util.getdir("config") .. "/theme.lua") @@ -140,48 +126,90 @@ awful.screen.connect_for_each_screen(function(s) end end - -- Create an imagebox widget which will contain an icon indicating which layout we're using. - -- We need one layoutbox per screen. - s.mylayoutbox = awful.widget.layoutbox(s) - s.mylayoutbox:buttons(gears.table.join( - awful.button({ }, 1, function () awful.layout.inc( 1) end), - awful.button({ }, 3, function () awful.layout.inc(-1) end), - awful.button({ }, 4, function () awful.layout.inc( 1) end), - awful.button({ }, 5, function () awful.layout.inc(-1) end))) - - -- Create a taglist widget - s.mytaglist = awful.widget.taglist { + s.widgets = {} + s.bars = {} + + -- Create an imagebox widget which will contain an icon indicating which layout we're using. + -- We need one layoutbox per screen. + s.widgets.layout = awful.widget.layoutbox(s) + s.widgets.layout:buttons(gears.table.join( + awful.button({ }, 1, function () awful.layout.inc( 1) end), + awful.button({ }, 3, function () awful.layout.inc(-1) end), + awful.button({ }, 4, function () awful.layout.inc( 1) end), + awful.button({ }, 5, function () awful.layout.inc(-1) end)) + ) + + -- Create widgets + s.widgets.battery = widget_battery({ + show_current_level = false, + warning_msg_position = top_right, + }) + s.widgets.brightness = widget_brightness({ + program = "brightnessctl", + tooltip = true, + }) + s.widgets.clock = wibox.widget { + widget = wibox.widget.textclock, + format = "%F %H:%M", + } + s.widgets.systray = wibox.widget.systray() + s.widgets.tags = awful.widget.taglist { screen = s, filter = awful.widget.taglist.filter.all, buttons = taglist_buttons, source = function(screen, args) return tags end, } - - -- Create a tasklist widget - s.mytasklist = awful.widget.tasklist { + s.widgets.tasklist = awful.widget.tasklist { screen = s, filter = awful.widget.tasklist.filter.currenttags, buttons = tasklist_buttons, } + s.widgets.volume = widget_volume({ + tooltip = true, + widget_type = "arc", + }) - -- Create the wibox - s.mytaskbar = awful.wibar({ + -- Create the taskbar + s.bars.bottom = awful.wibar({ position = "bottom", screen = s, bg = beautiful.bg_normal .. "cc", }) -- Add widgets to the wibox - s.mytaskbar:setup { + s.bars.bottom:setup { layout = wibox.layout.align.horizontal, - spacing = 16, + s.widgets.tags, + s.widgets.tasklist, + s.widgets.layout, + } + + -- Create the statbar + s.bars.top = awful.wibar({ + position = "top", + screen = s, + bg = beautiful.bg_normal .. "cc", + }) + + s.bars.top:setup { + layout = wibox.layout.align.horizontal, + expand = "none", + { + layout = wibox.layout.fixed.horizontal, + s.widgets.layout, + }, + { + layout = wibox.layout.fixed.horizontal, + s.widgets.clock, + }, { layout = wibox.layout.fixed.horizontal, - spacing = 16, - s.mylayoutbox, - s.mytaglist, + spacing = 4, + s.widgets.systray, + s.widgets.brightness, + s.widgets.volume, + s.widgets.battery, }, - s.mytasklist, } end) -- }}} @@ -205,6 +233,18 @@ globalkeys = gears.table.join( awful.key({ modkey, }, "Escape", awful.tag.history.restore, {description = "go back", group = "tag"}), + awful.key({ modkey, }, "Down", + function () + awful.client.focus.byidx( 1) + end, + {description = "focus next by index", group = "client"} + ), + awful.key({ modkey, }, "Up", + function () + awful.client.focus.byidx(-1) + end, + {description = "focus previous by index", group = "client"} + ), awful.key({ modkey, }, "j", function () awful.client.focus.byidx( 1) @@ -222,6 +262,13 @@ globalkeys = gears.table.join( -- Layout manipulation + awful.key({ modkey, "Shift" }, "Down", function () awful.client.swap.byidx( 1) end, + {description = "swap with next client by index", group = "client"}), + awful.key({ modkey, "Shift" }, "Up", function () awful.client.swap.byidx( -1) end, + {description = "swap with previous client by index", group = "client"}), + awful.key({ modkey, "Control" }, "Right", function () awful.screen.focus_bydirection("right") end, + {description = "focus the next screen", group = "screen"}), + awful.key({ modkey, "Control" }, "Left", function () awful.screen.focus_bydirection("left") end, awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end, {description = "swap with next client by index", group = "client"}), awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end, @@ -247,7 +294,7 @@ globalkeys = gears.table.join( {description = "reload awesome", group = "awesome"} ), awful.key( - { modkey, "Shift" }, "q", awesome.quit, + { modkey, "Shift" }, "x", awesome.quit, {description = "quit awesome", group = "awesome"} ), @@ -417,7 +464,6 @@ awful.rules.rules = { buttons = clientbuttons, screen = awful.screen.preferred, placement = awful.placement.no_overlap+awful.placement.no_offscreen, - opacity = 0.8, }, }, @@ -462,6 +508,7 @@ awful.rules.rules = { { -- Remove borders from windows where it doesn't fit (housestyles ought to be banned, tho) rule_any = { class = { + "albert", "nextcloud", } }, @@ -470,11 +517,23 @@ awful.rules.rules = { }, }, + { -- Tag rules for social + rule_any = { + class = { + "irc", + }, + }, + properties = { + tag = "social", + }, + }, + { -- Tag rules for www rule_any = { class = { "chromium", "firefox", + "firefox-esr", "qutebrowser", }, }, @@ -486,6 +545,7 @@ awful.rules.rules = { { -- Tag rules for email rule_any = { class = { + "evolution", "thunderbird", "kmail", }, @@ -503,6 +563,7 @@ awful.rules.rules = { "tsmapplication.exe", "lutris", "pathofexile.exe", + "mumble" }, }, properties = { @@ -569,10 +630,6 @@ awful.rules.rules = { { rule_any = {type = { "normal", "dialog" } }, properties = { titlebars_enabled = false } }, - - -- Set Firefox to always map on the tag named "2" on screen 1. - -- { rule = { class = "Firefox" }, - -- properties = { screen = 1, tag = "2" } }, } -- }}} @@ -650,21 +707,23 @@ end) client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus - c.opacity = 1 - -- Mouse follows focus - if mouse.object_under_pointer() ~= c then - local geometry = c:geometry() - - mouse.coords({ - x = geometry.x + geometry.width/2, - y = geometry.y + geometry.height/2, - }, true) - end +-- -- Mouse follows focus +-- if mouse.object_under_pointer() ~= c then +-- local geometry = c:geometry() +-- +-- mouse.coords({ +-- x = geometry.x + geometry.width/2, +-- y = geometry.y + geometry.height/2, +-- }, true) +-- end end) client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal - c.opacity = 0.8 end) -- }}} + +awful.util.spawn("systemctl --user import-environment DISPLAY") +awful.util.spawn("systemctl --user import-environment XAUTHORITY") +awful.util.spawn("systemctl --user start awesome-session.target") |