diff --git a/bindings/global_buttons.lua b/bindings/global_buttons.lua index 770fe2c..8d4dc2f 100644 --- a/bindings/global_buttons.lua +++ b/bindings/global_buttons.lua @@ -4,7 +4,7 @@ local awful = require("awful") local _M = {} function _M.get() - root.buttons(gears.table.join(awful.button({}, 4, awful.tag.viewnext), awful.button({}, 5, awful.tag.viewprev))) + return gears.table.join(awful.button({}, 4, awful.tag.viewnext), awful.button({}, 5, awful.tag.viewprev)) end return setmetatable({}, { diff --git a/bindings/global_keys.lua b/bindings/global_keys.lua index aea9845..d3ad94d 100644 --- a/bindings/global_keys.lua +++ b/bindings/global_keys.lua @@ -6,7 +6,7 @@ local hotkeys_popup = require("awful.hotkeys_popup") local _M = {} function _M.get() - globalkeys = gears.table.join( + local globalkeys = gears.table.join( awful.key({ RC.vars.modkey }, "s", hotkeys_popup.show_help, { description = "show help", group = "awesome" }), awful.key({ RC.vars.modkey }, "Left", awful.tag.viewprev, { description = "view previous", group = "tag" }), awful.key({ RC.vars.modkey }, "Right", awful.tag.viewnext, { description = "view next", group = "tag" }), @@ -55,7 +55,6 @@ function _M.get() awesome.restart, { description = "reload awesome", group = "awesome" } ), - awful.key({ RC.vars.modkey, "Shift" }, "q", awesome.quit, { description = "quit awesome", group = "awesome" }), awful.key({ RC.vars.modkey }, "l", function() awful.tag.incmwfact(0.05) @@ -92,7 +91,7 @@ function _M.get() -- Prompt awful.key({ RC.vars.modkey }, "r", function() - awful.screen.focused().mypromptbox:run() + awful.spawn("rofi -show drun") end, { description = "run prompt", group = "launcher" }), awful.key({ RC.vars.modkey }, "x", function() diff --git a/deco/statusbar.lua b/deco/statusbar.lua index 8d39f36..4c9195c 100644 --- a/deco/statusbar.lua +++ b/deco/statusbar.lua @@ -7,35 +7,35 @@ local taglist = require("deco.taglist") local tasklist = require("deco.tasklist") local layoutbox = require("deco.layoutbox") -awful.screen.connect_for_each_screen(function(s) +return function(s) wallpaper(s) -- Create a promptbox for each screen - s.promptbox = awful.widget.prompt() + s.promptbox = awful.widget.prompt() - s.layoutbox = layoutbox(s) + s.layoutbox = layoutbox(s) s.taglist = taglist(s) - s.tasklist = tasklist(s) + s.tasklist = tasklist(s) -- Create the wibox - s.wibox = awful.wibar({ position = "bottom", screen = s }) + s.wibox = awful.wibar({ position = "bottom", screen = s }) -- Add widgets to the wibox - s.wibox:setup({ - layout = wibox.layout.align.horizontal, - { -- Left widgets - layout = wibox.layout.fixed.horizontal, - s.taglist, - s.promptbox, - }, - s.tasklist, -- Middle widget - { -- Right widgets - layout = wibox.layout.fixed.horizontal, - wibox.widget.systray(), - mytextclock, - s.layoutbox, - }, - }) -end) + s.wibox:setup({ + layout = wibox.layout.align.horizontal, + { -- Left widgets + layout = wibox.layout.fixed.horizontal, + s.taglist, + s.promptbox, + }, + s.tasklist, -- Middle widget + { -- Right widgets + layout = wibox.layout.fixed.horizontal, + wibox.widget.systray(), + wibox.widget.textclock(), + s.layoutbox, + }, + }) +end diff --git a/rc.lua b/rc.lua index cede023..9823d40 100644 --- a/rc.lua +++ b/rc.lua @@ -4,14 +4,13 @@ pcall(require, "luarocks.loader") local gears = require("gears") local awful = require("awful") -local wibox = require("wibox") local beautiful = require("beautiful") require("awful.autofocus") local main = require("main") local bindings = require("bindings") local theme = require("theme") -local deco = require("deco") +local statusbar = require("deco.statusbar") beautiful.init(theme) @@ -24,118 +23,7 @@ awful.spawn.with_shell("picom -b") awful.layout.layouts = RC.layouts --- {{{ Wibar --- Create a textclock widget -mytextclock = wibox.widget.textclock() - --- Create a wibox for each screen and add it -local taglist_buttons = gears.table.join( - awful.button({}, 1, function(t) - t:view_only() - end), - awful.button({ RC.vars.modkey }, 1, function(t) - if client.focus then - client.focus:move_to_tag(t) - end - end), - awful.button({}, 3, awful.tag.viewtoggle), - awful.button({ RC.vars.modkey }, 3, function(t) - if client.focus then - client.focus:toggle_tag(t) - end - end), - awful.button({}, 4, function(t) - awful.tag.viewnext(t.screen) - end), - awful.button({}, 5, function(t) - awful.tag.viewprev(t.screen) - end) -) - -local tasklist_buttons = gears.table.join( - awful.button({}, 1, function(c) - if c == client.focus then - c.minimized = true - else - c:emit_signal("request::activate", "tasklist", { raise = true }) - end - end), - awful.button({}, 3, function() - awful.menu.client_list({ theme = { width = 250 } }) - end), - awful.button({}, 4, function() - awful.client.focus.byidx(1) - end), - awful.button({}, 5, function() - awful.client.focus.byidx(-1) - end) -) - -local function set_wallpaper(s) - gears.wallpaper.maximized(RC.vars.wallpaper, s, true) -end - --- Re-set wallpaper when a screen's geometry changes (e.g. different resolution) -screen.connect_signal("property::geometry", set_wallpaper) - -awful.screen.connect_for_each_screen(function(s) - -- Wallpaper - set_wallpaper(s) - - -- Create a promptbox for each screen - s.mypromptbox = awful.widget.prompt() - -- 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({ - screen = s, - filter = awful.widget.taglist.filter.all, - buttons = taglist_buttons, - }) - - -- Create a tasklist widget - s.mytasklist = awful.widget.tasklist({ - screen = s, - filter = awful.widget.tasklist.filter.currenttags, - buttons = tasklist_buttons, - }) - - -- Create the wibox - s.mywibox = awful.wibar({ position = "top", screen = s }) - - -- Add widgets to the wibox - s.mywibox:setup({ - layout = wibox.layout.align.horizontal, - { -- Left widgets - layout = wibox.layout.fixed.horizontal, - s.mytaglist, - s.mypromptbox, - }, - s.mytasklist, -- Middle widget - { -- Right widgets - layout = wibox.layout.fixed.horizontal, - wibox.widget.systray(), - mytextclock, - s.mylayoutbox, - }, - }) -end) --- }}} +awful.screen.connect_for_each_screen(statusbar) -- Set keys root.buttons(bindings.global_buttons())