diff --git a/main/layouts.lua b/main/layouts.lua new file mode 100644 index 0000000..086438c --- /dev/null +++ b/main/layouts.lua @@ -0,0 +1,12 @@ +local awful = require("awful") + +local _L = {} + +_L = { + awful.layout.suit.tile, + awful.layout.suit.fair, + awful.layout.suit.max, + awful.layout.suit.floating, +} + +return _L diff --git a/main/taglist.lua b/main/taglist.lua new file mode 100644 index 0000000..46459ea --- /dev/null +++ b/main/taglist.lua @@ -0,0 +1,27 @@ +local awful = require("awful") + +local _T = {} + +local tags = { + "󰎤 Terminal", + "󰎧 Web", + "󰎪 Code", + "󰎭 Junk", + "󰎱 Music", + "󰎳 Chat", +} + +local layouts = { + RC.layouts[0], + RC.layouts[1], + RC.layouts[2], + RC.layouts[3], + RC.layouts[3], + RC.layouts[3], +} + +awful.screen.connect_for_each_screen(function(s) + _T[s] = awful.tag(tags, s, layouts) +end) + +return _T diff --git a/main/user_vars.lua b/main/user_vars.lua index 7de5a87..f1aa497 100644 --- a/main/user_vars.lua +++ b/main/user_vars.lua @@ -3,9 +3,9 @@ local _V = {} _V = { terminal = "alacritty", editor = os.getenv("EDITOR") or "nvim", - editor_cmd = _V.terminal .. " -e " .. _V.editor, modkey = "Mod4", wallpaper = os.getenv("HOME") .. "/.config/awesome/theme/background.jpg", } +_V.editor_cmd = _V.terminal .. " -e " .. _V.editor return _V diff --git a/rc.lua b/rc.lua index 84dc82f..82d45ee 100644 --- a/rc.lua +++ b/rc.lua @@ -15,14 +15,11 @@ beautiful.init(require("theme")) RC = {} RC.vars = require("main.user_vars") +RC.layouts = require("main.layouts") +RC.taglist = require("main.taglist") -- Table of layouts to cover with awful.layout.inc, order matters. -awful.layout.layouts = { - awful.layout.suit.tile, - awful.layout.suit.fair, - awful.layout.suit.floating, -} - +awful.layout.layouts = RC.layouts -- {{{ Menu -- Create a launcher widget and a main menu myawesomemenu = { @@ -68,13 +65,13 @@ local taglist_buttons = gears.table.join( awful.button({}, 1, function(t) t:view_only() end), - awful.button({ RC.vars.modky }, 1, function(t) + 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.modky }, 3, function(t) + awful.button({ RC.vars.modkey }, 3, function(t) if client.focus then client.focus:toggle_tag(t) end @@ -108,15 +105,6 @@ local tasklist_buttons = gears.table.join( local function set_wallpaper(s) gears.wallpaper.maximized(RC.vars.wallpaper, s, true) - -- Wallpaper - -- if beautiful.wallpaper then - -- local wallpaper = beautiful.wallpaper - -- -- If wallpaper is a function, call it with the screen - -- if type(wallpaper) == "function" then - -- wallpaper = wallpaper(s) - -- end - -- gears.wallpaper.maximized(wallpaper, s, true) - -- end end -- Re-set wallpaper when a screen's geometry changes (e.g. different resolution) @@ -126,9 +114,6 @@ awful.screen.connect_for_each_screen(function(s) -- Wallpaper set_wallpaper(s) - -- Each screen has its own tag table. - awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1]) - -- 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. @@ -198,41 +183,41 @@ root.buttons(gears.table.join( -- {{{ Key bindings globalkeys = gears.table.join( - awful.key({ RC.vars.modky }, "s", hotkeys_popup.show_help, { description = "show help", group = "awesome" }), - awful.key({ RC.vars.modky }, "Left", awful.tag.viewprev, { description = "view previous", group = "tag" }), - awful.key({ RC.vars.modky }, "Right", awful.tag.viewnext, { description = "view next", group = "tag" }), - awful.key({ RC.vars.modky }, "Escape", awful.tag.history.restore, { description = "go back", group = "tag" }), + 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" }), + awful.key({ RC.vars.modkey }, "Escape", awful.tag.history.restore, { description = "go back", group = "tag" }), - awful.key({ RC.vars.modky }, "j", function() + awful.key({ RC.vars.modkey }, "j", function() awful.client.focus.byidx(1) end, { description = "focus next by index", group = "client" }), - awful.key({ RC.vars.modky }, "k", function() + awful.key({ RC.vars.modkey }, "k", function() awful.client.focus.byidx(-1) end, { description = "focus previous by index", group = "client" }), - awful.key({ RC.vars.modky }, "w", function() + awful.key({ RC.vars.modkey }, "w", function() mymainmenu:show() end, { description = "show main menu", group = "awesome" }), -- Layout manipulation - awful.key({ RC.vars.modky, "Shift" }, "j", function() + awful.key({ RC.vars.modkey, "Shift" }, "j", function() awful.client.swap.byidx(1) end, { description = "swap with next client by index", group = "client" }), - awful.key({ RC.vars.modky, "Shift" }, "k", function() + awful.key({ RC.vars.modkey, "Shift" }, "k", function() awful.client.swap.byidx(-1) end, { description = "swap with previous client by index", group = "client" }), - awful.key({ RC.vars.modky, "Control" }, "j", function() + awful.key({ RC.vars.modkey, "Control" }, "j", function() awful.screen.focus_relative(1) end, { description = "focus the next screen", group = "screen" }), - awful.key({ RC.vars.modky, "Control" }, "k", function() + awful.key({ RC.vars.modkey, "Control" }, "k", function() awful.screen.focus_relative(-1) end, { description = "focus the previous screen", group = "screen" }), awful.key( - { RC.vars.modky }, + { RC.vars.modkey }, "u", awful.client.urgent.jumpto, { description = "jump to urgent client", group = "client" } ), - awful.key({ RC.vars.modky }, "Tab", function() + awful.key({ RC.vars.modkey }, "Tab", function() awful.client.focus.history.previous() if client.focus then client.focus:raise() @@ -240,38 +225,38 @@ globalkeys = gears.table.join( end, { description = "go back", group = "client" }), -- Standard program - awful.key({ RC.vars.modky }, "Return", function() + awful.key({ RC.vars.modkey }, "Return", function() awful.spawn(RC.vars.terminal) end, { description = "open a terminal", group = "launcher" }), - awful.key({ RC.vars.modky, "Control" }, "r", awesome.restart, { description = "reload awesome", group = "awesome" }), - awful.key({ RC.vars.modky, "Shift" }, "q", awesome.quit, { description = "quit awesome", group = "awesome" }), + awful.key({ RC.vars.modkey, "Control" }, "r", 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.modky }, "l", function() + awful.key({ RC.vars.modkey }, "l", function() awful.tag.incmwfact(0.05) end, { description = "increase master width factor", group = "layout" }), - awful.key({ RC.vars.modky }, "h", function() + awful.key({ RC.vars.modkey }, "h", function() awful.tag.incmwfact(-0.05) end, { description = "decrease master width factor", group = "layout" }), - awful.key({ RC.vars.modky, "Shift" }, "h", function() + awful.key({ RC.vars.modkey, "Shift" }, "h", function() awful.tag.incnmaster(1, nil, true) end, { description = "increase the number of master clients", group = "layout" }), - awful.key({ RC.vars.modky, "Shift" }, "l", function() + awful.key({ RC.vars.modkey, "Shift" }, "l", function() awful.tag.incnmaster(-1, nil, true) end, { description = "decrease the number of master clients", group = "layout" }), - awful.key({ RC.vars.modky, "Control" }, "h", function() + awful.key({ RC.vars.modkey, "Control" }, "h", function() awful.tag.incncol(1, nil, true) end, { description = "increase the number of columns", group = "layout" }), - awful.key({ RC.vars.modky, "Control" }, "l", function() + awful.key({ RC.vars.modkey, "Control" }, "l", function() awful.tag.incncol(-1, nil, true) end, { description = "decrease the number of columns", group = "layout" }), - awful.key({ RC.vars.modky }, "space", function() + awful.key({ RC.vars.modkey }, "space", function() awful.layout.inc(1) end, { description = "select next", group = "layout" }), - awful.key({ RC.vars.modky, "Shift" }, "space", function() + awful.key({ RC.vars.modkey, "Shift" }, "space", function() awful.layout.inc(-1) end, { description = "select previous", group = "layout" }), - awful.key({ RC.vars.modky, "Control" }, "n", function() + awful.key({ RC.vars.modkey, "Control" }, "n", function() local c = awful.client.restore() -- Focus restored client if c then @@ -280,11 +265,11 @@ globalkeys = gears.table.join( end, { description = "restore minimized", group = "client" }), -- Prompt - awful.key({ RC.vars.modky }, "r", function() + awful.key({ RC.vars.modkey }, "r", function() awful.screen.focused().mypromptbox:run() end, { description = "run prompt", group = "launcher" }), - awful.key({ RC.vars.modky }, "x", function() + awful.key({ RC.vars.modkey }, "x", function() awful.prompt.run({ prompt = "Run Lua code: ", textbox = awful.screen.focused().mypromptbox.widget, @@ -293,48 +278,48 @@ globalkeys = gears.table.join( }) end, { description = "lua execute prompt", group = "awesome" }), -- Menubar - awful.key({ RC.vars.modky }, "p", function() + awful.key({ RC.vars.modkey }, "p", function() menubar.show() end, { description = "show the menubar", group = "launcher" }) ) clientkeys = gears.table.join( - awful.key({ RC.vars.modky }, "f", function(c) + awful.key({ RC.vars.modkey }, "f", function(c) c.fullscreen = not c.fullscreen c:raise() end, { description = "toggle fullscreen", group = "client" }), - awful.key({ RC.vars.modky, "Shift" }, "c", function(c) + awful.key({ RC.vars.modkey, "Shift" }, "c", function(c) c:kill() end, { description = "close", group = "client" }), awful.key( - { RC.vars.modky, "Control" }, + { RC.vars.modkey, "Control" }, "space", awful.client.floating.toggle, { description = "toggle floating", group = "client" } ), - awful.key({ RC.vars.modky, "Control" }, "Return", function(c) + awful.key({ RC.vars.modkey, "Control" }, "Return", function(c) c:swap(awful.client.getmaster()) end, { description = "move to master", group = "client" }), - awful.key({ RC.vars.modky }, "o", function(c) + awful.key({ RC.vars.modkey }, "o", function(c) c:move_to_screen() end, { description = "move to screen", group = "client" }), - awful.key({ RC.vars.modky }, "t", function(c) + awful.key({ RC.vars.modkey }, "t", function(c) c.ontop = not c.ontop end, { description = "toggle keep on top", group = "client" }), - awful.key({ RC.vars.modky }, "n", function(c) + awful.key({ RC.vars.modkey }, "n", function(c) -- The client currently has the input focus, so it cannot be -- minimized, since minimized clients can't have the focus. c.minimized = true end, { description = "minimize", group = "client" }), - awful.key({ RC.vars.modky }, "m", function(c) + awful.key({ RC.vars.modkey }, "m", function(c) c.maximized = not c.maximized c:raise() end, { description = "(un)maximize", group = "client" }), - awful.key({ RC.vars.modky, "Control" }, "m", function(c) + awful.key({ RC.vars.modkey, "Control" }, "m", function(c) c.maximized_vertical = not c.maximized_vertical c:raise() end, { description = "(un)maximize vertically", group = "client" }), - awful.key({ RC.vars.modky, "Shift" }, "m", function(c) + awful.key({ RC.vars.modkey, "Shift" }, "m", function(c) c.maximized_horizontal = not c.maximized_horizontal c:raise() end, { description = "(un)maximize horizontally", group = "client" }) @@ -347,7 +332,7 @@ for i = 1, 9 do globalkeys = gears.table.join( globalkeys, -- View tag only. - awful.key({ RC.vars.modky }, "#" .. i + 9, function() + awful.key({ RC.vars.modkey }, "#" .. i + 9, function() local screen = awful.screen.focused() local tag = screen.tags[i] if tag then @@ -355,7 +340,7 @@ for i = 1, 9 do end end, { description = "view tag #" .. i, group = "tag" }), -- Toggle tag display. - awful.key({ RC.vars.modky, "Control" }, "#" .. i + 9, function() + awful.key({ RC.vars.modkey, "Control" }, "#" .. i + 9, function() local screen = awful.screen.focused() local tag = screen.tags[i] if tag then @@ -363,7 +348,7 @@ for i = 1, 9 do end end, { description = "toggle tag #" .. i, group = "tag" }), -- Move client to tag. - awful.key({ RC.vars.modky, "Shift" }, "#" .. i + 9, function() + awful.key({ RC.vars.modkey, "Shift" }, "#" .. i + 9, function() if client.focus then local tag = client.focus.screen.tags[i] if tag then @@ -372,7 +357,7 @@ for i = 1, 9 do end end, { description = "move focused client to tag #" .. i, group = "tag" }), -- Toggle tag on focused client. - awful.key({ RC.vars.modky, "Control", "Shift" }, "#" .. i + 9, function() + awful.key({ RC.vars.modkey, "Control", "Shift" }, "#" .. i + 9, function() if client.focus then local tag = client.focus.screen.tags[i] if tag then @@ -387,11 +372,11 @@ clientbuttons = gears.table.join( awful.button({}, 1, function(c) c:emit_signal("request::activate", "mouse_click", { raise = true }) end), - awful.button({ RC.vars.modky }, 1, function(c) + awful.button({ RC.vars.modkey }, 1, function(c) c:emit_signal("request::activate", "mouse_click", { raise = true }) awful.mouse.client.move(c) end), - awful.button({ RC.vars.modky }, 3, function(c) + awful.button({ RC.vars.modkey }, 3, function(c) c:emit_signal("request::activate", "mouse_click", { raise = true }) awful.mouse.client.resize(c) end)