diff --git a/config/awesome/rc.lua b/config/awesome/rc.lua new file mode 100644 index 0000000..00b6b4d --- /dev/null +++ b/config/awesome/rc.lua @@ -0,0 +1,563 @@ +-- awesome_mode: api-level=4:screen=on +-- If LuaRocks is installed, make sure that packages installed through it are +-- found (e.g. lgi). If LuaRocks is not installed, do nothing. +pcall(require, "luarocks.loader") + +-- Standard awesome library +local gears = require("gears") +local awful = require("awful") +require("awful.autofocus") +-- Widget and layout library +local wibox = require("wibox") +-- Theme handling library +local beautiful = require("beautiful") +-- Notification library +local naughty = require("naughty") +-- Declarative object management +local ruled = require("ruled") +local menubar = require("menubar") +local hotkeys_popup = require("awful.hotkeys_popup") +-- Enable hotkeys help widget for VIM and other apps +-- when client with a matching name is opened: +require("awful.hotkeys_popup.keys") + +-- {{{ Error handling +-- Check if awesome encountered an error during startup and fell back to +-- another config (This code will only ever execute for the fallback config) +naughty.connect_signal("request::display_error", function(message, startup) + naughty.notification { + urgency = "critical", + title = "Oops, an error happened"..(startup and " during startup!" or "!"), + message = message + } +end) +-- }}} + +-- {{{ Variable definitions +-- Themes define colours, icons, font and wallpapers. +beautiful.init("/home/sajenim/.config/awesome/theme/theme.lua") + +-- This is used later as the default terminal and editor to run. +terminal = "wezterm" +editor = os.getenv("EDITOR") or "nano" +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" +-- }}} + +-- {{{ 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 }) + +-- Menubar configuration +menubar.utils.terminal = terminal -- Set the terminal for applications that require it +-- }}} + +-- {{{ Tag layout +-- Table of layouts to cover with awful.layout.inc, order matters. +tag.connect_signal("request::default_layouts", function() + awful.layout.append_default_layouts({ + -- 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.fair, + -- 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, + }) +end) +-- }}} + +-- {{{ Wallpaper +screen.connect_signal("request::wallpaper", function(s) + awful.wallpaper { + screen = s, + widget = { + { + image = beautiful.wallpaper, + upscale = true, + downscale = true, + widget = wibox.widget.imagebox, + }, + valign = "center", + halign = "center", + tiled = false, + widget = wibox.container.tile, + } + } +end) +-- }}} + +-- {{{ Wibar + +-- Keyboard map indicator and switcher +mykeyboardlayout = awful.widget.keyboardlayout() + +-- Create a textclock widget +mytextclock = wibox.widget.textclock() + +screen.connect_signal("request::desktop_decoration", function(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. + -- We need one layoutbox per screen. + s.mylayoutbox = awful.widget.layoutbox { + screen = s, + buttons = { + 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 = { + awful.button({ }, 1, function(t) t:view_only() end), + awful.button({ modkey }, 1, function(t) + if client.focus then + client.focus:move_to_tag(t) + end + end), + awful.button({ }, 3, awful.tag.viewtoggle), + awful.button({ modkey }, 3, function(t) + if client.focus then + client.focus:toggle_tag(t) + end + end), + awful.button({ }, 4, function(t) awful.tag.viewprev(t.screen) end), + awful.button({ }, 5, function(t) awful.tag.viewnext(t.screen) end), + } + } + + -- Create a tasklist widget + s.mytasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + buttons = { + awful.button({ }, 1, function (c) + c:activate { context = "tasklist", action = "toggle_minimization" } + 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), + } + } + + -- Create the wibox + s.mywibox = awful.wibar { + position = "top", + screen = s, + widget = { + 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 +awful.mouse.append_global_mousebindings({ + awful.button({ }, 3, function () mymainmenu:toggle() end), + awful.button({ }, 4, awful.tag.viewprev), + awful.button({ }, 5, awful.tag.viewnext), +}) +-- }}} + +-- {{{ Key bindings + +-- General Awesome keys +awful.keyboard.append_global_keybindings({ + awful.key({ modkey, }, "s", hotkeys_popup.show_help, + {description="show help", group="awesome"}), + awful.key({ modkey, }, "w", function () mymainmenu:show() end, + {description = "show main menu", group = "awesome"}), + awful.key({ modkey, "Control" }, "r", awesome.restart, + {description = "reload awesome", group = "awesome"}), + awful.key({ modkey, "Shift" }, "q", awesome.quit, + {description = "quit awesome", group = "awesome"}), + 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"}), + awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end, + {description = "open a terminal", group = "launcher"}), + awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end, + {description = "run prompt", group = "launcher"}), + awful.key({ modkey }, "p", function() menubar.show() end, + {description = "show the menubar", group = "launcher"}), +}) + +-- Tags related keybindings +awful.keyboard.append_global_keybindings({ + 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"}), +}) + +-- Focus related keybindings +awful.keyboard.append_global_keybindings({ + 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, }, "Tab", + function () + awful.client.focus.history.previous() + if client.focus then + client.focus:raise() + end + end, + {description = "go back", group = "client"}), + awful.key({ modkey, }, "End", function () awful.screen.focus_relative( 1) end, + {description = "focus the next screen", group = "screen"}), + awful.key({ modkey, }, "Home", function () awful.screen.focus_relative(-1) end, + {description = "focus the previous screen", group = "screen"}), + awful.key({ modkey, "Control" }, "n", + function () + local c = awful.client.restore() + -- Focus restored client + if c then + c:activate { raise = true, context = "key.unminimize" } + end + end, + {description = "restore minimized", group = "client"}), +}) + +-- Layout related keybindings +awful.keyboard.append_global_keybindings({ + 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, }, "u", awful.client.urgent.jumpto, + {description = "jump to urgent client", group = "client"}), + awful.key({ modkey, }, "Prior", function () awful.tag.incmwfact( 0.05) end, + {description = "increase master width factor", group = "layout"}), + awful.key({ modkey, }, "Next", function () awful.tag.incmwfact(-0.05) end, + {description = "decrease master width factor", group = "layout"}), + awful.key({ modkey, "Shift" }, "Prior", function () awful.tag.incnmaster( 1, nil, true) end, + {description = "increase the number of master clients", group = "layout"}), + awful.key({ modkey, "Shift" }, "Next", function () awful.tag.incnmaster(-1, nil, true) end, + {description = "decrease the number of master clients", group = "layout"}), + awful.key({ modkey, "Control" }, "Prior", function () awful.tag.incncol( 1, nil, true) end, + {description = "increase the number of columns", group = "layout"}), + awful.key({ modkey, "Control" }, "Next", 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.keyboard.append_global_keybindings({ + awful.key { + modifiers = { modkey }, + keygroup = "numrow", + description = "only view tag", + group = "tag", + on_press = function (index) + local screen = awful.screen.focused() + local tag = screen.tags[index] + if tag then + tag:view_only() + end + end, + }, + awful.key { + modifiers = { modkey, "Control" }, + keygroup = "numrow", + description = "toggle tag", + group = "tag", + on_press = function (index) + local screen = awful.screen.focused() + local tag = screen.tags[index] + if tag then + awful.tag.viewtoggle(tag) + end + end, + }, + awful.key { + modifiers = { modkey, "Shift" }, + keygroup = "numrow", + description = "move focused client to tag", + group = "tag", + on_press = function (index) + if client.focus then + local tag = client.focus.screen.tags[index] + if tag then + client.focus:move_to_tag(tag) + end + end + end, + }, + awful.key { + modifiers = { modkey, "Control", "Shift" }, + keygroup = "numrow", + description = "toggle focused client on tag", + group = "tag", + on_press = function (index) + if client.focus then + local tag = client.focus.screen.tags[index] + if tag then + client.focus:toggle_tag(tag) + end + end + end, + }, + awful.key { + modifiers = { modkey }, + keygroup = "numpad", + description = "select layout directly", + group = "layout", + on_press = function (index) + local t = awful.screen.focused().selected_tag + if t then + t.layout = t.layouts[index] or t.layout + end + end, + } +}) + +client.connect_signal("request::default_mousebindings", function() + awful.mouse.append_client_mousebindings({ + awful.button({ }, 1, function (c) + c:activate { context = "mouse_click" } + end), + awful.button({ modkey }, 1, function (c) + c:activate { context = "mouse_click", action = "mouse_move" } + end), + awful.button({ modkey }, 3, function (c) + c:activate { context = "mouse_click", action = "mouse_resize"} + end), + }) +end) + +client.connect_signal("request::default_keybindings", function() + awful.keyboard.append_client_keybindings({ + awful.key({ modkey, }, "f", + function (c) + c.fullscreen = not c.fullscreen + c:raise() + end, + {description = "toggle fullscreen", group = "client"}), + awful.key({ modkey, "Control" }, "w", function (c) c:kill() end, + {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"}), + }) +end) + +-- }}} + +-- {{{ Rules +-- Rules to apply to new clients. +ruled.client.connect_signal("request::rules", function() + -- All clients will match this rule. + ruled.client.append_rule { + id = "global", + rule = { }, + properties = { + focus = awful.client.focus.filter, + raise = true, + screen = awful.screen.preferred, + placement = awful.placement.no_overlap+awful.placement.no_offscreen + } + } + + -- Floating clients. + ruled.client.append_rule { + id = "floating", + rule_any = { + instance = { "copyq", "pinentry" }, + class = { + "Arandr", "Blueman-manager", "Gpick", "Kruler", "Sxiv", + "Tor Browser", "Wpa_gui", "veromix", "xtightvncviewer" + }, + -- Note that the name property shown in xprop might be set slightly after creation of the client + -- and the name shown there might not match defined rules here. + name = { + "Event Tester", -- xev. + }, + role = { + "AlarmWindow", -- Thunderbird's calendar. + "ConfigManager", -- Thunderbird's about:config. + "pop-up", -- e.g. Google Chrome's (detached) Developer Tools. + } + }, + properties = { floating = true } + } + + -- Add titlebars to normal clients and dialogs + ruled.client.append_rule { + id = "titlebars", + rule_any = { type = { "normal", "dialog" } }, + properties = { titlebars_enabled = true } + } + + -- Set Firefox to always map on the tag named "2" on screen 1. + -- ruled.client.append_rule { + -- rule = { class = "Firefox" }, + -- properties = { screen = 1, tag = "2" } + -- } +end) +-- }}} + +-- {{{ Titlebars +-- Add a titlebar if titlebars_enabled is set to true in the rules. +client.connect_signal("request::titlebars", function(c) + -- buttons for the titlebar + local buttons = { + awful.button({ }, 1, function() + c:activate { context = "titlebar", action = "mouse_move" } + end), + awful.button({ }, 3, function() + c:activate { context = "titlebar", action = "mouse_resize"} + end), + } + + awful.titlebar(c).widget = { + { -- Left + awful.titlebar.widget.iconwidget(c), + buttons = buttons, + layout = wibox.layout.fixed.horizontal + }, + { -- Middle + { -- Title + halign = "center", + widget = awful.titlebar.widget.titlewidget(c) + }, + buttons = buttons, + layout = wibox.layout.flex.horizontal + }, + { -- Right + awful.titlebar.widget.floatingbutton (c), + awful.titlebar.widget.maximizedbutton(c), + awful.titlebar.widget.stickybutton (c), + awful.titlebar.widget.ontopbutton (c), + awful.titlebar.widget.closebutton (c), + layout = wibox.layout.fixed.horizontal() + }, + layout = wibox.layout.align.horizontal + } +end) +-- }}} + +-- {{{ Notifications + +ruled.notification.connect_signal('request::rules', function() + -- All notifications will match this rule. + ruled.notification.append_rule { + rule = { }, + properties = { + screen = awful.screen.preferred, + implicit_timeout = 5, + } + } +end) + +naughty.connect_signal("request::display", function(n) + naughty.layout.box { notification = n } +end) + +-- }}} + +-- Enable sloppy focus, so that focus follows mouse. +client.connect_signal("mouse::enter", function(c) + c:activate { context = "mouse_enter", raise = false } +end) diff --git a/config/awesome/theme/assets/chinatown.png b/config/awesome/theme/assets/chinatown.png new file mode 100644 index 0000000..20ce431 Binary files /dev/null and b/config/awesome/theme/assets/chinatown.png differ diff --git a/config/awesome/theme/theme.lua b/config/awesome/theme/theme.lua new file mode 100644 index 0000000..27390ac --- /dev/null +++ b/config/awesome/theme/theme.lua @@ -0,0 +1,139 @@ +--------------------------- +-- Default awesome theme -- +--------------------------- + +local theme_assets = require("beautiful.theme_assets") +local xresources = require("beautiful.xresources") +local rnotification = require("ruled.notification") +local dpi = xresources.apply_dpi + +local gfs = require("gears.filesystem") +local themes_path = gfs.get_themes_dir() + +local theme = {} + +theme.font = "Fisa Code, 10" + +theme.bg_normal = "#282828" +theme.bg_focus = "#282828" +theme.bg_urgent = "#ff0000" +theme.bg_minimize = "#444444" +theme.bg_systray = theme.bg_normal + +theme.fg_normal = "#7c6f64" +theme.fg_focus = "#d4be98" +theme.fg_urgent = "#ffffff" +theme.fg_minimize = "#ffffff" + +theme.useless_gap = dpi(10) +theme.border_width = dpi(5) +theme.border_color_normal = "#282828" +theme.border_color_active = "#282828" +theme.border_color_marked = "#91231c" + +-- There are other variable sets +-- overriding the default one when +-- defined, the sets are: +-- taglist_[bg|fg]_[focus|urgent|occupied|empty|volatile] +-- tasklist_[bg|fg]_[focus|urgent] +-- titlebar_[bg|fg]_[normal|focus] +-- tooltip_[font|opacity|fg_color|bg_color|border_width|border_color] +-- prompt_[fg|bg|fg_cursor|bg_cursor|font] +-- hotkeys_[bg|fg|border_width|border_color|shape|opacity|modifiers_fg|label_bg|label_fg|group_margin|font|description_font] +-- Example: +--theme.taglist_bg_focus = "#ff0000" + +-- Generate taglist squares: +local taglist_square_size = dpi(4) +theme.taglist_squares_sel = theme_assets.taglist_squares_sel( + taglist_square_size, theme.fg_normal +) +theme.taglist_squares_unsel = theme_assets.taglist_squares_unsel( + taglist_square_size, theme.fg_normal +) + +-- Variables set for theming notifications: +-- notification_font +-- notification_[bg|fg] +-- notification_[width|height|margin] +-- notification_[border_color|border_width|shape|opacity] + +-- Variables set for theming the menu: +-- menu_[bg|fg]_[normal|focus] +-- menu_[border_color|border_width] +theme.menu_submenu_icon = themes_path.."default/submenu.png" +theme.menu_height = dpi(15) +theme.menu_width = dpi(100) + +-- You can add as many variables as +-- you wish and access them by using +-- beautiful.variable in your rc.lua +--theme.bg_widget = "#cc0000" + +-- Define the image to load +theme.titlebar_close_button_normal = themes_path.."default/titlebar/close_normal.png" +theme.titlebar_close_button_focus = themes_path.."default/titlebar/close_focus.png" + +theme.titlebar_minimize_button_normal = themes_path.."default/titlebar/minimize_normal.png" +theme.titlebar_minimize_button_focus = themes_path.."default/titlebar/minimize_focus.png" + +theme.titlebar_ontop_button_normal_inactive = themes_path.."default/titlebar/ontop_normal_inactive.png" +theme.titlebar_ontop_button_focus_inactive = themes_path.."default/titlebar/ontop_focus_inactive.png" +theme.titlebar_ontop_button_normal_active = themes_path.."default/titlebar/ontop_normal_active.png" +theme.titlebar_ontop_button_focus_active = themes_path.."default/titlebar/ontop_focus_active.png" + +theme.titlebar_sticky_button_normal_inactive = themes_path.."default/titlebar/sticky_normal_inactive.png" +theme.titlebar_sticky_button_focus_inactive = themes_path.."default/titlebar/sticky_focus_inactive.png" +theme.titlebar_sticky_button_normal_active = themes_path.."default/titlebar/sticky_normal_active.png" +theme.titlebar_sticky_button_focus_active = themes_path.."default/titlebar/sticky_focus_active.png" + +theme.titlebar_floating_button_normal_inactive = themes_path.."default/titlebar/floating_normal_inactive.png" +theme.titlebar_floating_button_focus_inactive = themes_path.."default/titlebar/floating_focus_inactive.png" +theme.titlebar_floating_button_normal_active = themes_path.."default/titlebar/floating_normal_active.png" +theme.titlebar_floating_button_focus_active = themes_path.."default/titlebar/floating_focus_active.png" + +theme.titlebar_maximized_button_normal_inactive = themes_path.."default/titlebar/maximized_normal_inactive.png" +theme.titlebar_maximized_button_focus_inactive = themes_path.."default/titlebar/maximized_focus_inactive.png" +theme.titlebar_maximized_button_normal_active = themes_path.."default/titlebar/maximized_normal_active.png" +theme.titlebar_maximized_button_focus_active = themes_path.."default/titlebar/maximized_focus_active.png" + +theme.wallpaper = "/home/sajenim/.config/awesome/theme/assets/chinatown.png" + +-- You can use your own layout icons like this: +theme.layout_fairh = themes_path.."default/layouts/fairhw.png" +theme.layout_fairv = themes_path.."default/layouts/fairvw.png" +theme.layout_floating = themes_path.."default/layouts/floatingw.png" +theme.layout_magnifier = themes_path.."default/layouts/magnifierw.png" +theme.layout_max = themes_path.."default/layouts/maxw.png" +theme.layout_fullscreen = themes_path.."default/layouts/fullscreenw.png" +theme.layout_tilebottom = themes_path.."default/layouts/tilebottomw.png" +theme.layout_tileleft = themes_path.."default/layouts/tileleftw.png" +theme.layout_tile = themes_path.."default/layouts/tilew.png" +theme.layout_tiletop = themes_path.."default/layouts/tiletopw.png" +theme.layout_spiral = themes_path.."default/layouts/spiralw.png" +theme.layout_dwindle = themes_path.."default/layouts/dwindlew.png" +theme.layout_cornernw = themes_path.."default/layouts/cornernww.png" +theme.layout_cornerne = themes_path.."default/layouts/cornernew.png" +theme.layout_cornersw = themes_path.."default/layouts/cornersww.png" +theme.layout_cornerse = themes_path.."default/layouts/cornersew.png" + +-- Generate Awesome icon: +theme.awesome_icon = theme_assets.awesome_icon( + theme.menu_height, theme.bg_focus, theme.fg_focus +) + +-- Define the icon theme for application icons. If not set then the icons +-- from /usr/share/icons and /usr/share/icons/hicolor will be used. +theme.icon_theme = nil + +-- Set different colors for urgent notifications. +rnotification.connect_signal('request::rules', function() + rnotification.append_rule { + rule = { urgency = 'critical' }, + properties = { bg = '#ff0000', fg = '#ffffff' } + } +end) + +return theme + +-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/config/discocss/custom.css b/config/discocss/custom.css new file mode 100644 index 0000000..c1df42c --- /dev/null +++ b/config/discocss/custom.css @@ -0,0 +1,67 @@ +:root { + --font-primary: Fisa Code; + + /* Gruvbox Material Dark Hard */ + --fg0: #d4be98; + --bg0: #1d2021; + --bg1: #282828; + + --grey0: #7c6f64; + --grey1: #928374; + --grey2: #a89984; + + /* Midpoints between bg0 + bg1 */ + --bg0_33: #212323; + --bg0_66: #242526; +} + +.theme-dark { + --text-normal: var(--fg0); + + --channels-default: var(--grey2); + --interactive-normal: var(--grey0); + --interactive-active: var(--grey0); + --channel-icon: var(--grey0); + + --scrollbar-auto-thumb: var(--grey0); + --scrollbar-auto-track: var(--bg1); + + --header-primary: var(--grey0); + --header-secondary: var(--grey2); + + --background-primary: var(--bg0); + --background-secondary: var(--bg0_66); + --background-secondary-alt: var(--bg0_33); + --background-tertiary: var(--bg1); + --background-message-hover: var(--bg1); + --background-mentioned: var(--bg1); + --bg-overlay-selected: var(--bg1); +} + +/* Message Box */ +.scrollableContainer-15eg7h { + background-color: var(--bg1); +} +.slateTextArea-27tjG0 { + color: var(--grey0); +} + +/* Search Box */ +.search-39IXmY { + display: none; +} + +/* Add a Server + Explore Public Servers */ +.circleIconButton-1VxDrg { + color: var(--grey0); +} +/* Remove: Nitro, Gif, Stickers, Emoji buttons */ +.buttons-uaqb-5 { + display: none; +} + +/* Remove: New Message Bar */ +.newMessagesBar-1hF-9G { + display: none; +} + diff --git a/config/nvim/init.lua b/config/nvim/init.lua new file mode 100644 index 0000000..28d60f5 --- /dev/null +++ b/config/nvim/init.lua @@ -0,0 +1,86 @@ +-- +-- Vim Options +-- + +-- Disable vim's built in file explorer +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 + +-- {{{ General Configuration +vim.opt.termguicolors = true -- set termguicolors to enable highlight groups +vim.opt.number = true -- print line numbers +vim.opt.showmode = false -- if in insert, replace or visual mode put a message on the last line +vim.opt.swapfile = false -- disable swap file +vim.opt.clipboard = 'unnamedplus' -- use the system clipboard as the default register +-- }}} + +-- {{{ Spaces & Tabs +vim.opt.tabstop = 2 -- number of visual spaces per TAB +vim.opt.softtabstop = 2 -- number of spaces in tab when editing +vim.opt.shiftwidth = 2 -- number of spaces to use for autoindent +vim.opt.expandtab = true -- tabs are space +vim.opt.autoindent = true +vim.opt.copyindent = true -- copy indent from the previous line +-- }}} + +-- {{{ Keybinds +vim.g.mapleader = ' ' + +local opts = { noremap = true, silent = true } +local map = vim.api.nvim_set_keymap + + +map('n', 't', ':NvimTreeToggle', opts) +-- }}} + +-- +-- Gruvbox Material +-- + +-- For dark version +vim.opt.background = 'dark' + +-- Set contrast +vim.g.gruvbox_material_background = 'hard' + +-- For better performance +vim.g.gruvbox_material_better_performance = 0 + +-- To disable italic in `Comment`, set this option to `1` +vim.g.gruvbox_material_disable_italic_comment = 0 + +-- To enable bold in function name just like the original gruvbox, set this option to `1` +vim.g.gruvbox_material_enable_bold = 0 + +-- To enable italic in this color scheme, set this option to `1` +vim.g.gruvbox_material_enable_italic = 1 + +-- Set the colorscheme +vim.cmd [[colorscheme gruvbox-material]] + + +-- +-- Load and run our libraries +-- + +-- load defaults +require('nvim-tree').setup() +require('Comment').setup() +require('gitsigns').setup() + +-- user +require('user.lspconfig') +require('user.nvim-cmp') +require('user.lualine') + +-- user.config +require('user.config.server_configurations') + + +-- Enable syntax highlighting +require('nvim-treesitter.configs').setup { + highlight = { + enable = true, + } +} + diff --git a/config/nvim/lua/user/config/server_configurations.lua b/config/nvim/lua/user/config/server_configurations.lua new file mode 100644 index 0000000..0934e64 --- /dev/null +++ b/config/nvim/lua/user/config/server_configurations.lua @@ -0,0 +1,28 @@ +-- Setup language servers +require'lspconfig'.clangd.setup{} +require'lspconfig'.nil_ls.setup{} + +-- lua-language-server +require'lspconfig'.lua_ls.setup { + settings = { + Lua = { + runtime = { + -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) + version = 'LuaJIT', + }, + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = {'vim'}, + }, + workspace = { + -- Make the server aware of Neovim runtime files + library = vim.api.nvim_get_runtime_file("", true), + checkThirdParty = false, + }, + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { + enable = false, + }, + }, + }, +} diff --git a/config/nvim/lua/user/lspconfig.lua b/config/nvim/lua/user/lspconfig.lua new file mode 100644 index 0000000..5b3f025 --- /dev/null +++ b/config/nvim/lua/user/lspconfig.lua @@ -0,0 +1,38 @@ +-- Global mappings. +-- See `:help vim.diagnostic.*` for documentation on any of the below functions +vim.keymap.set('n', 'e', vim.diagnostic.open_float) +vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) +vim.keymap.set('n', ']d', vim.diagnostic.goto_next) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist) + +-- Use LspAttach autocommand to only map the following keys +-- after the language server attaches to the current buffer +vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('UserLspConfig', {}), + callback = function(ev) + -- Enable completion triggered by + vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' + + -- Buffer local mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + local opts = { buffer = ev.buf } + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) + vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts) + vim.keymap.set('n', '', vim.lsp.buf.signature_help, opts) + vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) + vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) + vim.keymap.set('n', 'wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, opts) + vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, opts) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) + vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, opts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) + vim.keymap.set('n', 'f', function() + vim.lsp.buf.format { async = true } + end, opts) + end, +}) + diff --git a/config/nvim/lua/user/lualine.lua b/config/nvim/lua/user/lualine.lua new file mode 100644 index 0000000..f7a8817 --- /dev/null +++ b/config/nvim/lua/user/lualine.lua @@ -0,0 +1,87 @@ +-- Use external source for diff +local function diff_source() + local gitsigns = vim.b.gitsigns_status_dict + if gitsigns then + return { + added = gitsigns.added, + modified = gitsigns.changed, + removed = gitsigns.removed + } + end +end + +-- Configure the statusline +require('lualine').setup { + options = { + -- Set our theme and icon status + icons_enabled = true, + theme = 'gruvbox-material', + + -- Define our seperators + component_separators = { left = '', right = ''}, + section_separators = { left = '', right = ''}, + + -- Disable some filetypes + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + + -- If current filetype in in this list it'll + -- always be drawn as inactive statusline + ignore_focus = {}, + + -- When set to true, left sections i.e. 'a','b' and 'c' + -- can't take over the entire statusline even + -- if neither of 'x', 'y' or 'z' are present. + always_divide_middle = true, + + -- enable global statusline (have a single statusline + -- at bottom of neovim instead of one for every window). + globalstatus = true, + + -- sets how often lualine should refreash it's contents (in ms) + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + } + }, + + -- Setup our active statusline components + sections = { + lualine_a = {'mode'}, + lualine_b = { {'FugitiveHead', icon = ''}, {'diff', source = diff_source}, 'diagnostics'}, + lualine_c = {'filename'}, + lualine_x = {'encoding', 'fileformat', 'filetype'}, + lualine_y = {'progress'}, + lualine_z = {'location'} + }, + + -- Setup our inactive statusline components + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = {'filename'}, + lualine_x = {'location'}, + lualine_y = {}, + lualine_z = {} + }, + + -- Setup our tabline components + tabline = { + lualine_a = {'buffers'}, + lualine_b = {'searchcount'}, + lualine_c = {}, + lualine_x = {}, + lualine_y = {}, + lualine_z = {'tabs'} + }, + + -- Setup our winbar components + winbar = {}, + inactive_winbar = {}, + + -- Load our extensions + extensions = {'fugitive', 'nvim-tree'} +} diff --git a/config/nvim/lua/user/nvim-cmp.lua b/config/nvim/lua/user/nvim-cmp.lua new file mode 100644 index 0000000..9510e46 --- /dev/null +++ b/config/nvim/lua/user/nvim-cmp.lua @@ -0,0 +1,59 @@ +-- Add additional capabilities supported by nvim-cmp +local capabilities = require("cmp_nvim_lsp").default_capabilities() + +local lspconfig = require('lspconfig') + +-- Enable some language servers with the additional completion capabilities offered by nvim-cmp +local servers = { 'clangd', 'lua_ls', 'nil_ls' } +for _, lsp in ipairs(servers) do + lspconfig[lsp].setup { + -- on_attach = my_custom_on_attach, + capabilities = capabilities, + } +end + +-- luasnip setup +local luasnip = require 'luasnip' + +-- nvim-cmp setup +local cmp = require 'cmp' +cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), -- Up + [''] = cmp.mapping.scroll_docs(4), -- Down + -- C-b (back) C-f (forward) for snippet placeholder navigation. + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = false, + }, + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { 'i', 's' }), + }), + sources = { + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + }, +} + diff --git a/config/wezterm/colors/gruvbox_material_dark_hard.toml b/config/wezterm/colors/gruvbox_material_dark_hard.toml new file mode 100644 index 0000000..5867496 --- /dev/null +++ b/config/wezterm/colors/gruvbox_material_dark_hard.toml @@ -0,0 +1,36 @@ +[colors] +background = '#1d2021' +foreground = '#d4be98' +selection_bg = '#d4be98' +selection_fg = '#3c3836' +cursor_bg = '#d4be98' +cursor_fg = '#1d2021' +cursor_border = '#d4be98' + +ansi = [ + '#1d2021', + '#ea6962', + '#a9b665', + '#d8a657', + '#7daea3', + '#d3869b', + '#89b482', + '#d4be98', +] + +brights = [ + '#7c6f64', + '#ea6962', + '#a9b665', + '#d8a657', + '#7daea3', + '#d3869b', + '#89b482', + '#d4be98', +] + +[colors.indexed] + +[metadata] +name = 'gruvbox_material_dark_hard' +origin_url = 'https://gist.github.com/theoriginalstove/89aa16316a756721816886398080dbd6' diff --git a/config/wezterm/wezterm.lua b/config/wezterm/wezterm.lua new file mode 100644 index 0000000..c149bf5 --- /dev/null +++ b/config/wezterm/wezterm.lua @@ -0,0 +1,153 @@ +-- Pull in the wezterm API +local wezterm = require 'wezterm' +local act = wezterm.action + +-- This table will hold the configuration. +local config = {} + +-- In newer versions of wezterm, use the config_builder which will +-- help provide clearer error messages +if wezterm.config_builder then + config = wezterm.config_builder() +end + +-- Font +config.font = wezterm.font 'Fisa Code' +config.font_size = 10.0 + +-- Color scheme +config.color_scheme = 'gruvbox_material_dark_hard' + +-- Tab bar appearance +config.use_fancy_tab_bar = false +config.enable_tab_bar = true +config.hide_tab_bar_if_only_one_tab = false +config.tab_bar_at_bottom = true +config.tab_max_width = 24 + +-- Colors +config.colors = { + tab_bar = { + background = '#1d2021', + + active_tab = { + bg_color = '#1d2021', + fg_color = '#d4be98', + intensity = 'Normal', + }, + + inactive_tab = { + bg_color = '#1d2021', + fg_color = '#7c6f64', + intensity = 'Half', + }, + + new_tab = { + bg_color = '#1d2021', + fg_color = '#7c6f64', + intensity = 'Half', + } + } +} + +-- Key Assignments +config.disable_default_key_bindings = true +config.keys = { + { + key = 'v', + mods = 'ALT', + action = wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' }, + }, + + { + key = 'h', + mods = 'ALT', + action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' }, + }, + + { + key = 'Tab', + mods = 'ALT', + action = wezterm.action.SplitPane { + direction = 'Down', + size = { Percent = 20 }, + }, + }, + + { + key = 'Backspace', + mods = 'ALT', + action = wezterm.action.CloseCurrentPane { confirm = false }, + }, + + { key = 'LeftArrow', + mods = 'ALT', + action = act.ActivatePaneDirection 'Left', + }, + + { + key = 'RightArrow', + mods = 'ALT', + action = act.ActivatePaneDirection 'Right', + }, + + { + key = 'UpArrow', + mods = 'ALT', + action = act.ActivatePaneDirection 'Up', + }, + + { + key = 'DownArrow', + mods = 'ALT', + action = act.ActivatePaneDirection 'Down', + }, + + { + key = 't', + mods = 'ALT', + action = act.SpawnTab 'CurrentPaneDomain', + }, + + { + key = 'w', + mods = "ALT|CTRL", + action = wezterm.action.CloseCurrentTab { confirm = false }, + }, + + { + key = 'X', + mods = 'CTRL', + action = wezterm.action.ActivateCopyMode, + }, + + { + key = 'C', + mods = 'CTRL', + action = wezterm.action.CopyTo 'ClipboardAndPrimarySelection', + }, + + { + key = 'V', + mods = 'CTRL', + action = act.PasteFrom 'Clipboard', + }, +} +for i = 1, 5 do + table.insert(config.keys, { + key = tostring(i), + mods = 'ALT', + action = act.ActivateTab(i - 1), + }) +end + +-- Padding +config.window_padding = { + left = 20, + right = 20, + top = 20, + bottom = 0, +} + +return config +