diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2022-12-29 05:00:11 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2022-12-29 05:00:11 +0100 |
| commit | 894529077ae4b401abde3ae52e3bd31dcbeaf2dd (patch) | |
| tree | 09348dc6a7d5fbdac20293f2e4dad1244c29131c | |
| parent | 94379cfaa8e26d908122754ae61a133379993fca (diff) | |
| download | dotfiles-894529077ae4b401abde3ae52e3bd31dcbeaf2dd.tar.gz dotfiles-894529077ae4b401abde3ae52e3bd31dcbeaf2dd.tar.bz2 dotfiles-894529077ae4b401abde3ae52e3bd31dcbeaf2dd.zip | |
Updated awesome config to look and feel like current xmonad config
| -rw-r--r-- | config/awesome/rc.lua | 284 | ||||
| -rwxr-xr-x | config/x11/xinitrc | 1 | ||||
| -rw-r--r-- | config/xmonad/xmonad.hs | 6 |
3 files changed, 90 insertions, 201 deletions
diff --git a/config/awesome/rc.lua b/config/awesome/rc.lua index 1899e9c..083343c 100644 --- a/config/awesome/rc.lua +++ b/config/awesome/rc.lua @@ -46,34 +46,38 @@ end -- {{{ Variable definitions -- Themes define colours, icons, font and wallpapers. beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua") +beautiful.useless_gap = 3 +beautiful.border_width = 2 +beautiful.border_normal = "#1c1c1c" +beautiful.border_focus = "#8a8a8a" -- This is used later as the default terminal and editor to run. -terminal = "st" -editor = os.getenv("EDITOR") or "vim" -editor_cmd = terminal .. " -e " .. editor +local terminal = "alacritty" +local editor = os.getenv("EDITOR") or "vim" +local editor_cmd = terminal .. " -e " .. editor -- Default modkey. -- Usually, Mod4 is the key with a logo between Control and Alt. -- If you do not like this or do not have such a key, -- I suggest you to remap Mod4 to another key using xmodmap or other tools. -- However, you can use another modifier like Mod1, but it may interact with others. -modkey = "Mod4" +local modkey = "Mod4" -- Table of layouts to cover with awful.layout.inc, order matters. awful.layout.layouts = { - awful.layout.suit.floating, + -- awful.layout.suit.floating, awful.layout.suit.tile, - awful.layout.suit.tile.left, - awful.layout.suit.tile.bottom, - awful.layout.suit.tile.top, + -- awful.layout.suit.tile.left, + -- awful.layout.suit.tile.bottom, + -- awful.layout.suit.tile.top, awful.layout.suit.fair, - awful.layout.suit.fair.horizontal, - awful.layout.suit.spiral, - awful.layout.suit.spiral.dwindle, - awful.layout.suit.max, + -- awful.layout.suit.fair.horizontal, + -- awful.layout.suit.spiral, + -- awful.layout.suit.spiral.dwindle, + -- awful.layout.suit.max, awful.layout.suit.max.fullscreen, - awful.layout.suit.magnifier, - awful.layout.suit.corner.nw, + -- awful.layout.suit.magnifier, + -- awful.layout.suit.corner.nw, -- awful.layout.suit.corner.ne, -- awful.layout.suit.corner.sw, -- awful.layout.suit.corner.se, @@ -82,32 +86,32 @@ awful.layout.layouts = { -- {{{ Menu -- Create a launcher widget and a main menu -myawesomemenu = { - { "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end }, - { "manual", terminal .. " -e man awesome" }, - { "edit config", editor_cmd .. " " .. awesome.conffile }, - { "restart", awesome.restart }, - { "quit", function() awesome.quit() end }, -} - -mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon }, - { "open terminal", terminal } - } - }) - -mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, - menu = mymainmenu }) +-- local myawesomemenu = { +-- { "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end }, +-- { "manual", terminal .. " -e man awesome" }, +-- { "edit config", editor_cmd .. " " .. awesome.conffile }, +-- { "restart", awesome.restart }, +-- { "quit", function() awesome.quit() end }, +-- } +-- +-- local mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon }, +-- { "open terminal", terminal } +-- } +-- }) +-- +-- local mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, +-- menu = mymainmenu }) -- Menubar configuration menubar.utils.terminal = terminal -- Set the terminal for applications that require it -- }}} -- Keyboard map indicator and switcher -mykeyboardlayout = awful.widget.keyboardlayout() +-- local mykeyboardlayout = awful.widget.keyboardlayout() -- {{{ Wibar -- Create a textclock widget -mytextclock = wibox.widget.textclock() +-- local mytextclock = wibox.widget.textclock() -- Create a wibox for each screen and add it local taglist_buttons = gears.table.join( @@ -149,24 +153,10 @@ local tasklist_buttons = gears.table.join( awful.client.focus.byidx(-1) end)) -local function set_wallpaper(s) - -- 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) -screen.connect_signal("property::geometry", set_wallpaper) awful.screen.connect_for_each_screen(function(s) -- Wallpaper - set_wallpaper(s) + -- 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]) @@ -195,141 +185,77 @@ awful.screen.connect_for_each_screen(function(s) 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, - mylauncher, - s.mytaglist, - s.mypromptbox, - }, - s.mytasklist, -- Middle widget - { -- Right widgets - layout = wibox.layout.fixed.horizontal, - mykeyboardlayout, - wibox.widget.systray(), - mytextclock, - s.mylayoutbox, - }, - } end) -- }}} --- {{{ Mouse bindings -root.buttons(gears.table.join( - awful.button({ }, 3, function () mymainmenu:toggle() end), - awful.button({ }, 4, awful.tag.viewnext), - awful.button({ }, 5, awful.tag.viewprev) -)) --- }}} --- {{{ Key bindings -globalkeys = gears.table.join( - awful.key({ modkey, }, "s", hotkeys_popup.show_help, +local globalkeys = gears.table.join( + awful.key({ modkey }, "s", hotkeys_popup.show_help, {description="show help", group="awesome"}), - awful.key({ modkey, }, "Left", awful.tag.viewprev, - {description = "view previous", group = "tag"}), - awful.key({ modkey, }, "Right", awful.tag.viewnext, - {description = "view next", group = "tag"}), - awful.key({ modkey, }, "Escape", awful.tag.history.restore, - {description = "go back", group = "tag"}), - - awful.key({ modkey, }, "j", - function () - awful.client.focus.byidx( 1) - end, + -- awful.key({ modkey }, "Left", awful.tag.viewprev, + -- {description = "view previous", group = "tag"}), + -- awful.key({ modkey }, "Right", awful.tag.viewnext, + -- {description = "view next", group = "tag"}), + -- awful.key({ modkey }, "Escape", awful.tag.history.restore, + -- {description = "go back", group = "tag"}), + + awful.key({ modkey }, "j", + function () awful.client.focus.byidx( 1) end, {description = "focus next by index", group = "client"} ), - awful.key({ modkey, }, "k", - function () - awful.client.focus.byidx(-1) - end, + awful.key({ modkey }, "k", + function () awful.client.focus.byidx(-1) end, {description = "focus previous by index", group = "client"} ), - awful.key({ modkey, }, "w", function () mymainmenu:show() end, - {description = "show main menu", group = "awesome"}), -- Layout manipulation - awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) 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, + awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end, {description = "swap with previous client by index", group = "client"}), - awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end, - {description = "focus the next screen", group = "screen"}), - awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end, - {description = "focus the previous screen", group = "screen"}), - awful.key({ modkey, }, "u", awful.client.urgent.jumpto, - {description = "jump to urgent client", group = "client"}), - awful.key({ modkey, }, "Tab", - function () - awful.client.focus.history.previous() - if client.focus then - client.focus:raise() - end - end, - {description = "go back", group = "client"}), + + awful.key({ modkey }, "w", function () awful.screen.focus(1) end, + {description = "focus screen 1", group = "screen"}), + awful.key({ modkey }, "e", function () awful.screen.focus(2) end, + {description = "focus screen 2", group = "screen"}), + awful.key({ modkey }, "r", function () awful.screen.focus(3) end, + {description = "focus screen 3", group = "screen"}), + + -- awful.key({ modkey }, "u", awful.client.urgent.jumpto, + -- {description = "jump to urgent client", group = "client"}), + -- awful.key({ modkey }, "Tab", + -- function () + -- awful.client.focus.history.previous() + -- if client.focus then + -- client.focus:raise() + -- end + -- end, + -- {description = "go back", group = "client"}), -- Standard program - awful.key({ modkey, "Shift" }, "Return", function () awful.spawn(terminal) end, + awful.key({ modkey, "Shift" }, "Return", function () awful.spawn(terminal) end, {description = "open a terminal", group = "launcher"}), - awful.key({ modkey, }, "q", awesome.restart, + awful.key({ modkey }, "q", awesome.restart, {description = "reload awesome", group = "awesome"}), - awful.key({ modkey, "Shift" }, "q", awesome.quit, + awful.key({ modkey, "Shift" }, "q", awesome.quit, {description = "quit awesome", group = "awesome"}), - awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end, - {description = "increase master width factor", group = "layout"}), - awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end, - {description = "decrease master width factor", group = "layout"}), - awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end, - {description = "increase the number of master clients", group = "layout"}), - awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end, - {description = "decrease the number of master clients", group = "layout"}), - awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end, - {description = "increase the number of columns", group = "layout"}), - awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end, - {description = "decrease the number of columns", group = "layout"}), awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end, {description = "select next", group = "layout"}), awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end, {description = "select previous", group = "layout"}), - awful.key({ modkey, "Control" }, "n", - function () - local c = awful.client.restore() - -- Focus restored client - if c then - c:emit_signal( - "request::activate", "key.unminimize", {raise = true} - ) - end - end, - {description = "restore minimized", group = "client"}), - - -- Prompt - awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end, - {description = "run prompt", group = "launcher"}), - - awful.key({ modkey }, "x", - function () - awful.prompt.run { - prompt = "Run Lua code: ", - textbox = awful.screen.focused().mypromptbox.widget, - exe_callback = awful.util.eval, - history_path = awful.util.get_cache_dir() .. "/history_eval" - } - end, - {description = "lua execute prompt", group = "awesome"}), - -- Menubar - awful.key({ modkey }, "p", function() menubar.show() end, - {description = "show the menubar", group = "launcher"}) + awful.key({ modkey }, "-", function() awful.util.spawn("pulseaudio-ctl down") end, + {description = "Lower volume", group = "launcher"}), + awful.key({ modkey }, "=", function() awful.util.spawn("pulseaudio-ctl down") end, + {description = "Increase volume", group = "launcher"}), + awful.key({ modkey }, "p", function() awful.util.spawn("dmenu_run") end, + {description = "Run a command", group = "launcher"}), + awful.key({ modkey }, "o", function() awful.util.spawn("project-open") end, + {description = "Open project", group = "launcher"}) ) -clientkeys = gears.table.join( +local clientkeys = gears.table.join( awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen @@ -340,37 +266,8 @@ clientkeys = gears.table.join( {description = "close", group = "client"}), awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle , {description = "toggle floating", group = "client"}), - awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end, - {description = "move to master", group = "client"}), - awful.key({ modkey, }, "o", function (c) c:move_to_screen() end, - {description = "move to screen", group = "client"}), - awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end, - {description = "toggle keep on top", group = "client"}), - awful.key({ 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({ modkey, }, "m", - function (c) - c.maximized = not c.maximized - c:raise() - end , - {description = "(un)maximize", group = "client"}), - awful.key({ modkey, "Control" }, "m", - function (c) - c.maximized_vertical = not c.maximized_vertical - c:raise() - end , - {description = "(un)maximize vertically", group = "client"}), - awful.key({ modkey, "Shift" }, "m", - function (c) - c.maximized_horizontal = not c.maximized_horizontal - c:raise() - end , - {description = "(un)maximize horizontally", group = "client"}) + awful.key({ modkey }, "Return", function (c) c:swap(awful.client.getmaster()) end, + {description = "move to master", group = "client"}) ) -- Bind all key numbers to tags. @@ -439,9 +336,7 @@ clientbuttons = gears.table.join( -- Set keys root.keys(globalkeys) --- }}} --- {{{ Rules -- Rules to apply to new clients (through the "manage" signal). awful.rules.rules = { -- All clients will match this rule. @@ -456,14 +351,7 @@ awful.rules.rules = { placement = awful.placement.no_overlap+awful.placement.no_offscreen } }, - - - -- { 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" } }, } --- }}} + +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) diff --git a/config/x11/xinitrc b/config/x11/xinitrc index 64e2689..8cdd9d7 100755 --- a/config/x11/xinitrc +++ b/config/x11/xinitrc @@ -28,4 +28,5 @@ case "$(cat /etc/hostname)" in ;; esac +# awesome xmonad || { xmonad --recompile; xmonad; } diff --git a/config/xmonad/xmonad.hs b/config/xmonad/xmonad.hs index fac4ef3..9337c46 100644 --- a/config/xmonad/xmonad.hs +++ b/config/xmonad/xmonad.hs @@ -38,7 +38,7 @@ main = xmonad $ desktopConfig , borderWidth = 2 , focusFollowsMouse = False -- don't change window based on mouse position (need to click) , workspaces = ["code", "web"] ++ map show [3..9] - , handleEventHook = handleEventHook' + -- , handleEventHook = handleEventHook' -- , startupHook = startupHook' } `additionalKeysP` keys' @@ -78,7 +78,7 @@ keys' = [ ("<XF86AudioLowerVolume>", spawn "pulseaudio-ctl down") "--hint=int:value:\"$(cat /sys/class/power_supply/BAT0/capacity)\" " ++ "\"Battery: $(cat /sys/class/power_supply/BAT0/status)\"") , ("M-q", spawn "notify-send 'Restarting xmonad'" >> spawn restartCmd) - , ("M-S-q", confirm "Are you sure you want to shutdown?" $ io (exitWith ExitSuccess)) + , ("M-S-q", confirm "Are you sure you want to shutdown?" $ io exitSuccess) ] -- startupHook' :: X () @@ -98,4 +98,4 @@ restartCmd = intercalate "; " [ "if type xmonad" , "fi" ] -handleEventHook' = swallowEventHook (className =? "Alacritty" <||> className =? "Termite") (return True) +-- handleEventHook' = swallowEventHook (className =? "Alacritty" <||> className =? "Termite") (return True) |
