From 8b4ce671896c592fee2062d3bf77782da8fa791e Mon Sep 17 00:00:00 2001 From: caandt Date: Fri, 23 Aug 2024 18:55:31 -0500 Subject: [PATCH] init .config files --- config/alacritty/alacritty.toml | 97 +++ config/awesome/rc.lua | 602 ++++++++++++++++++ config/awesome/theme.lua | 132 ++++ config/bash/aliases | 75 +++ config/bash/bashrc | 28 + config/bash/custom | 74 +++ config/bash/history | 14 + config/bash/startup | 16 + config/bash/xdg | 42 ++ config/fontconfig/conf.d/10-no-sub-pixel.conf | 15 + .../conf.d/15-no-ligature-monospace.conf | 18 + .../fontconfig/conf.d/99-japanese-fonts.conf | 268 ++++++++ config/fontconfig/fonts.conf | 50 ++ config/lsd/config.yaml | 137 ++++ config/picom/picom.conf | 13 + config/python/startup.py | 37 ++ config/qt5ct/qt5ct.conf | 24 + config/readline/inputrc | 6 + config/starship.toml | 57 ++ config/sx/sxrc | 50 ++ config/tmux/tmux.conf | 109 ++++ configuration.nix | 2 + home.nix | 20 + 23 files changed, 1886 insertions(+) create mode 100644 config/alacritty/alacritty.toml create mode 100644 config/awesome/rc.lua create mode 100644 config/awesome/theme.lua create mode 100644 config/bash/aliases create mode 100644 config/bash/bashrc create mode 100644 config/bash/custom create mode 100644 config/bash/history create mode 100644 config/bash/startup create mode 100644 config/bash/xdg create mode 100644 config/fontconfig/conf.d/10-no-sub-pixel.conf create mode 100644 config/fontconfig/conf.d/15-no-ligature-monospace.conf create mode 100644 config/fontconfig/conf.d/99-japanese-fonts.conf create mode 100644 config/fontconfig/fonts.conf create mode 100644 config/lsd/config.yaml create mode 100644 config/picom/picom.conf create mode 100644 config/python/startup.py create mode 100644 config/qt5ct/qt5ct.conf create mode 100644 config/readline/inputrc create mode 100644 config/starship.toml create mode 100755 config/sx/sxrc create mode 100644 config/tmux/tmux.conf diff --git a/config/alacritty/alacritty.toml b/config/alacritty/alacritty.toml new file mode 100644 index 0000000..972cec2 --- /dev/null +++ b/config/alacritty/alacritty.toml @@ -0,0 +1,97 @@ +[bell.command] +program = "bell" + +[colors.bright] +black = "#666666" +blue = "#7aa6da" +cyan = "#70c0b1" +green = "#b9ca4a" +magenta = "#c397d8" +red = "#d54e53" +white = "#eaeaea" +yellow = "#e7c547" + +[colors.cursor] +cursor = "CellForeground" +text = "CellBackground" + +[colors.normal] +black = "#6e6c7e" +blue = "#96cdfb" +cyan = "#89dceb" +green = "#abe9b3" +magenta = "#f5c2e7" +red = "#f28fad" +white = "#d9e0ee" +yellow = "#fae3b0" + +[colors.primary] +background = "#1E1E2E" +foreground = "#D9E0EE" + +[colors.vi_mode_cursor] +cursor = "#AFAFFF" +text = "#202020" + +[cursor] +vi_mode_style = "Block" + +[cursor.style] +shape = "Block" + +[env] +TERM = "xterm-256color" + +[font] +builtin_box_drawing = true +size = 14.0 + +[font.bold] +style = "ExtraBold" + +[font.bold_italic] +style = "ExtraBold Italic" + +[font.italic] +style = "Medium Italic" + +[font.normal] +family = "JetBrainsMono Nerd Font" +style = "Medium" + +[font.offset] +x = 0 +y = 0 + +[[keyboard.bindings]] +chars = "\u001B[105;5u" +key = "I" +mods = "Control" + +[[keyboard.bindings]] +chars = "\u001B[13;5u" +key = "Return" +mods = "Control" + +[[keyboard.bindings]] +chars = "\u001B[13;5u" +key = "Back" +mods = "Control" + +[[keyboard.bindings]] +chars = "" +key = "B" +mods = "Control|Shift" +[[keyboard.bindings]] +chars = "" +key = "F" +mods = "Control|Shift" + +[window] +dynamic_padding = true +opacity = 0.8 + +[window.padding] +x = 10 +y = 10 + diff --git a/config/awesome/rc.lua b/config/awesome/rc.lua new file mode 100644 index 0000000..b2a09fe --- /dev/null +++ b/config/awesome/rc.lua @@ -0,0 +1,602 @@ +-- 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") +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) +if awesome.startup_errors then + naughty.notify({ preset = naughty.config.presets.critical, + title = "Oops, there were errors during startup!", + text = awesome.startup_errors }) +end + +-- Handle runtime errors after startup +do + local in_error = false + awesome.connect_signal("debug::error", function (err) + -- Make sure we don't go into an endless error loop + if in_error then return end + in_error = true + + naughty.notify({ preset = naughty.config.presets.critical, + title = "Oops, an error happened!", + text = tostring(err) }) + in_error = false + end) +end +-- }}} + +-- {{{ Variable definitions +-- Themes define colours, icons, font and wallpapers. +theme = require('theme') +beautiful.init(theme) + +-- This is used later as the default terminal and editor to run. +terminal = "alacritty" +run = "rofi -show drun" +browser = "firefox" +file_manager = "dolphin" +editor = "nvim" +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" + +-- Table of layouts to cover with awful.layout.inc, order matters. +awful.layout.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, + -- awful.layout.suit.corner.ne, + -- awful.layout.suit.corner.sw, + -- awful.layout.suit.corner.se, +} +-- }}} + +-- {{{ 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 }, + { "open browser", browser }, + { "open file manager", file_manager }, + } + }) + +mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, + menu = mymainmenu }) + +-- Menubar configuration +menubar.utils.terminal = terminal -- Set the terminal for applications that require it +menubar.menu_gen.all_categories = {} +-- }}} + +-- Keyboard map indicator and switcher +mykeyboardlayout = awful.widget.keyboardlayout() + +-- {{{ 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({ 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.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({ }, 2, function (c) c:kill() 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) + -- 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) + + -- 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(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, + 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 +local function change_layout() + awful.layout.inc(1) + if client.focus then client.focus:raise() end +end +local function global_bydirection(d) + awful.client.focus.global_bydirection(d) + if client.focus then client.focus:raise() end +end +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 () global_bydirection("down") + end, {description = "focus downwards", group = "client"}), + awful.key({ modkey }, "k", function () global_bydirection("up") + end, {description = "focus upwards", group = "client"}), + awful.key({ modkey }, "h", function () global_bydirection("left") + end, {description = "focus leftwards", group = "layout"}), + awful.key({ modkey }, "l", function () global_bydirection("right") + end, {description = "focus rightwards", group = "layout"}), + + -- Layout manipulation + awful.key({ modkey, "Shift" }, "h", function () awful.client.swap.global_bydirection("left") end, + {description = "swap leftwards", group = "client"}), + awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.global_bydirection("down") end, + {description = "swap downwards", group = "client"}), + awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.global_bydirection("up") end, + {description = "swap upwards", group = "client"}), + awful.key({ modkey, "Shift" }, "l", function () awful.client.swap.global_bydirection("right") end, + {description = "swap rightwards", 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.byidx(1) + if client.focus then + client.focus:raise() + end + end, + {description = "focus next", group = "client"}), + awful.key({ modkey, "Shift" }, "Tab", + function () + awful.client.focus.byidx(-1) + if client.focus then + client.focus:raise() + end + end, + {description = "focus prev", group = "client"}), + + -- Standard program + awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end, + {description = "open a terminal", group = "launcher"}), + 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, }, "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 () change_layout() end, + {description = "select next", group = "layout"}), + awful.key({ modkey, "Shift" }, "space", function () change_layout() 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 }, "e", function () awful.screen.focused().mypromptbox:run() end, + {description = "run command", 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 }, "r", function() awful.spawn(run) end, {description = "run prompt"}), + awful.key({ modkey }, "b", function() awful.spawn(browser) end, {description = "open browser"}), + awful.key({ modkey }, "t", function() awful.spawn(file_manager) end, {description = "open file manager"}), + awful.key({ modkey, "Shift" }, "s", function() awful.spawn("screenshot") end, {description = "screenshot"}), + awful.key({ modkey }, "v", function() awful.spawn("pavucontrol") end, {description = "audio settings"}) +) + +clientkeys = gears.table.join( + awful.key({ modkey, "Shift" }, "f", + function (c) + c.fullscreen = not c.fullscreen + c:raise() + end, + {description = "toggle fullscreen", group = "client"}), + awful.key({ modkey, }, "w", function (c) c:kill() end, + {description = "close", group = "client"}), + awful.key({ modkey, "Control", "Shift" }, "w", function (c) awesome.kill(c.pid, 9) end, + {description = "force close", group = "client"}), + awful.key({ modkey }, "f", function (c) awful.client.floating.toggle(c) c:raise() end, + {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"}) +) + +-- Bind all key numbers to tags. +-- Be careful: we use keycodes to make it work on any keyboard layout. +-- This should map on the top row of your keyboard, usually 1 to 9. +for i = 1, 9 do + globalkeys = gears.table.join(globalkeys, + -- View tag only. + awful.key({ modkey }, "#" .. i + 9, + function () + local screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + tag:view_only() + end + end, + {description = "view tag #"..i, group = "tag"}), + -- Toggle tag display. + awful.key({ modkey, "Control" }, "#" .. i + 9, + function () + local screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + awful.tag.viewtoggle(tag) + end + end, + {description = "toggle tag #" .. i, group = "tag"}), + -- Move client to tag. + awful.key({ modkey, "Shift" }, "#" .. i + 9, + function () + if client.focus then + local tag = client.focus.screen.tags[i] + if tag then + client.focus:move_to_tag(tag) + end + end + end, + {description = "move focused client to tag #"..i, group = "tag"}), + -- Toggle tag on focused client. + awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9, + function () + if client.focus then + local tag = client.focus.screen.tags[i] + if tag then + client.focus:toggle_tag(tag) + end + end + end, + {description = "toggle focused client on tag #" .. i, group = "tag"}) + ) +end + +clientbuttons = gears.table.join( + awful.button({ }, 1, function (c) + c:emit_signal("request::activate", "mouse_click", {raise = true}) + end), + awful.button({ modkey }, 1, function (c) + c:emit_signal("request::activate", "mouse_click", {raise = true}) + awful.mouse.client.move(c) + end), + awful.button({ modkey }, 3, function (c) + c:emit_signal("request::activate", "mouse_click", {raise = true}) + awful.mouse.client.resize(c) + end), + awful.button({ modkey, "Shift" }, 1, function (c) c:kill() end) +) + +-- 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. + { rule = { }, + properties = { border_width = beautiful.border_width, + border_color = beautiful.border_normal, + focus = awful.client.focus.filter, + raise = true, + keys = clientkeys, + buttons = clientbuttons, + screen = awful.screen.preferred, + placement = awful.placement.no_overlap+awful.placement.no_offscreen + } + }, + + -- Floating clients. + { rule_any = { + instance = { + "DTA", -- Firefox addon DownThemAll. + "copyq", -- Includes session name in class. + "pinentry", + }, + class = { + "Arandr", + "Blueman-manager", + "Gpick", + "Kruler", + "MessageWin", -- kalarm. + "Sxiv", + "Tor Browser", -- Needs a fixed window size to avoid fingerprinting by screen size. + "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 + { rule_any = {type = { "normal", "dialog" } + }, properties = { titlebars_enabled = true } + }, + + -- Set Firefox to always map on the tag named "2" on screen 1. + -- { rule = { class = "Firefox" }, + -- properties = { screen = 1, tag = "2" } }, +} +-- }}} + +-- {{{ Signals +-- Signal function to execute when a new client appears. +client.connect_signal("manage", function (c) + -- Set the windows at the slave, + -- i.e. put it at the end of others instead of setting it master. + if not awesome.startup then awful.client.setslave(c) end + + -- make .exe programs floating + if c.class and string.sub(c.class, -4) == ".exe" then + c.floating = true + end + + if awesome.startup + and not c.size_hints.user_position + and not c.size_hints.program_position then + -- Prevent clients from being unreachable after screen count changes. + awful.placement.no_offscreen(c) + end +end) + +-- 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 = gears.table.join( + awful.button({ }, 1, function() + c:emit_signal("request::activate", "titlebar", {raise = true}) + awful.mouse.client.move(c) + end), + awful.button({ }, 3, function() + c:emit_signal("request::activate", "titlebar", {raise = true}) + awful.mouse.client.resize(c) + end) + ) + + awful.titlebar(c) : setup { + { -- Left + awful.titlebar.widget.iconwidget (c), + awful.titlebar.widget.floatingbutton (c), + awful.titlebar.widget.stickybutton (c), + awful.titlebar.widget.ontopbutton (c), + layout = wibox.layout.fixed.horizontal + }, + { -- Middle + { -- Title + align = "center", + widget = awful.titlebar.widget.titlewidget(c) + }, + buttons = buttons, + layout = wibox.layout.flex.horizontal + }, + { -- Right + awful.titlebar.widget.minimizebutton (c), + awful.titlebar.widget.maximizedbutton(c), + awful.titlebar.widget.closebutton (c), + layout = wibox.layout.fixed.horizontal() + }, + layout = wibox.layout.align.horizontal + } +end) + +-- Enable sloppy focus, so that focus follows mouse. +client.connect_signal("mouse::enter", function(c) + c:emit_signal("request::activate", "mouse_enter", {raise = false}) +end) + +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/awesome/theme.lua b/config/awesome/theme.lua new file mode 100644 index 0000000..8e9cb31 --- /dev/null +++ b/config/awesome/theme.lua @@ -0,0 +1,132 @@ +--------------------------- +-- Default awesome theme -- +--------------------------- + +local theme_assets = require("beautiful.theme_assets") +local xresources = require("beautiful.xresources") +local dpi = xresources.apply_dpi + +local gfs = require("gears.filesystem") +local themes_path = gfs.get_themes_dir() + +local theme = {} + +theme.font = "sans 8" + +theme.bg_normal = "#222222" +theme.bg_focus = "#9B95CB" +theme.bg_urgent = "#ff0000" +theme.bg_minimize = "#444444" +theme.bg_systray = theme.bg_normal + +theme.fg_normal = "#aaaaaa" +theme.fg_focus = "#ffffff" +theme.fg_urgent = "#ffffff" +theme.fg_minimize = "#ffffff" + +theme.useless_gap = dpi(5) +theme.border_width = dpi(3) +theme.border_normal = "#000000" +theme.border_focus = "#4949ff" +theme.border_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] +-- mouse_finder_[color|timeout|animate_timeout|radius|factor] +-- 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 = "~/.local/share/wallpaper.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 + +return theme + +-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 + diff --git a/config/bash/aliases b/config/bash/aliases new file mode 100644 index 0000000..973717c --- /dev/null +++ b/config/bash/aliases @@ -0,0 +1,75 @@ +#!/usr/bin/env bash +# Sets aliases + +# prev dir +alias ...='cd ../..' +alias ....='cd ../../..' + +# color output +alias grep='grep --color=auto' +alias diff='diff --color=auto' + +# replace ls with lsd +if _exists lsd; then + if [[ $TERM == 'linux' ]]; then + alias ls='lsd --icon=never' + else + alias ls='lsd' + fi + alias tree='ll --tree' +fi +alias ll='ls -la' +alias la='ls -la' +alias l='ls' + +# replace cat with bat +_exists bat && alias cat='bat' + +# nvim aliases +alias v='vim' +alias vi='vim' +_exists nvim && alias vim='nvim' +alias :q='exit' + +# human readable file sizes +alias df='df -h' +alias du='du -h' + +# file confirmation +alias mv='mv -i' +alias rm='rm -i' +alias cp='cp -i' + +# git aliases +alias gl='git log --oneline --graph --all' +alias gds='git diff --staged' +alias gd='git diff' +alias gs='git status' +alias ga='git add' +alias gr='git reset' + +# pacman aliases +if _exists pacman; then + alias p='pacman' + alias pq='pacman -Q | fzf' + alias aur='pacman -Qm' + alias qo='pacman -Qo' + alias ql='pacman -Ql' + alias qi='pacman -Qii' +fi + +# for using aliases with sudo +_exists doas && alias sudo='doas ' || alias sudo='sudo ' +alias doas='doas ' + +alias py='python' +alias s='systemctl' +alias x='sx ~/.config/sx/sxrc' +alias xo='xdg-open' +alias log='sudo journalctl -b' +alias shutdown='shutdown now' +alias clipboard-image='xclip -o -sel clip | nsxiv-pipe' +alias path='sed "s/:/\n/g" <<< $PATH' +alias utc='date -u +"%Y-%m-%d %H:%M:%S UTC"' +alias fonts='fc-list | awk -F: "{ print \$2 }" | sort | uniq | fzf' +alias hz='xrandr --output DisplayPort-1 --mode 1920x1080 --rate' diff --git a/config/bash/bashrc b/config/bash/bashrc new file mode 100644 index 0000000..fa10b57 --- /dev/null +++ b/config/bash/bashrc @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# .bashrc + +# If not running interactively, don't do anything +[[ $- != *i* ]] && return + +function _bashrc_main { + local BASH_CONFIG_DIR=~/.config/bash + # source a file in $BASH_CONFIG_DIR + function _load { + if [ -f "$BASH_CONFIG_DIR/$1" ]; then + source "$BASH_CONFIG_DIR/$1" + else + echo "Missing bash config file: $1" >&2 + fi + } + function _exists { + type $1 &> /dev/null + } + # load custom settings + _load custom + unset -f _load + unset -f _exists +} + +_bashrc_main +unset -f _bashrc_main +# ========== diff --git a/config/bash/custom b/config/bash/custom new file mode 100644 index 0000000..5de3c8f --- /dev/null +++ b/config/bash/custom @@ -0,0 +1,74 @@ +#!/usr/bin/env bash +# Custom bash settings + +# get parent process name +local parent="$(ps -o command= -p "$PPID" | cut -f1 -d' ')" +if [[ "$parent" == *alacritty ]]; then + if [[ -z "$TMUX" && -z "$NOTMUX" ]]; then + if [[ "$PWD" == "$HOME" ]]; then + exec sh-tmux + else + exec sh-tmux -n + fi + fi +# set shell level +elif [[ "$parent" == "tmux" ]]; then + export SHLVL=2 +fi + +# default prompt command sets window title +unset PROMPT_COMMAND +# save command history to ~/.cache/bash_history, no limit +_load history +# aliases +_load aliases +# set xdg env vars to keep home directory clean +_load xdg + +if _exists fzf; then + export FZF_DEFAULT_OPTS="--bind=ctrl-u:page-up,ctrl-d:page-down" + eval "$(fzf --bash)" +fi +_exists zoxide && eval "$(zoxide init bash)" + +# use starship prompt, unless in linux terminal +if [[ "$TERM" != "linux" ]]; then + function _set_win_title { + # check if still in .bashrc + if declare -F _bashrc_main > /dev/null; then + return + elif [[ "$@" != @("starship_precmd"|""|"__fzf_history__"|"history -a"|"__zoxide_hook") ]]; then + printf "\e]0;%s | %s | %s\a" "$(dirs +0)" "$@" "$(date +"%H:%M:%S")" + fi + } + _exists starship && eval "$(starship init bash)" + # set window title after running command + trap "$(trap -p DEBUG | awk -F"'" '{print $2 ";"}')_set_win_title \"\${BASH_COMMAND}\"" DEBUG +else + # [username pwd] green $ reset + PS1="[\u \W] \[\e[32;1m\]\$\[\e[0m\] " + # set shell level + if [[ "$parent" == "login" ]]; then + export SHLVL=0 + fi +fi + + +# set vi mode +set -o vi +_exists nvim && export EDITOR=nvim || export EDITOR=vim +export BROWSER=firefox + +# disable xon/xoff flow control (ctrl-s, ctrl-q) +stty -ixon +# do not need to use cd to change directories +shopt -s autocd +# do not overwrite files when redirecting +set -o noclobber +# glob hidden files +shopt -s dotglob + +# startup script for choosing environment +if [[ -z $DISPLAY && "$(tty)" == "/dev/tty1" ]]; then + _load startup +fi diff --git a/config/bash/history b/config/bash/history new file mode 100644 index 0000000..3ddee4f --- /dev/null +++ b/config/bash/history @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# history file settings + +# don't add duplicate lines, lines starting with space to history +HISTCONTROL=ignoreboth + +# append to the history file, don't overwrite it +shopt -s histappend +# eternal bash history +HISTFILESIZE= +HISTSIZE= +HISTTIMEFORMAT="[%F %T] " +HISTFILE=~/.cache/bash_history +PROMPT_COMMAND="history -a; $PROMPT_COMMAND" diff --git a/config/bash/startup b/config/bash/startup new file mode 100644 index 0000000..169b11d --- /dev/null +++ b/config/bash/startup @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# Startup script to run when logging in on tty1 + +SXRC=~/.config/sx/sxrc +printf "\e[31mSelect environment:\n\e[0m" +SELECTIONS=( "sx $SXRC awesome" "sx $SXRC qtile" "sway" ) +SELECTION_NAMES=( "awesome" "qtile" "Sway" "tty" ) +for (( i=0; i<${#SELECTION_NAMES[@]}; i++ )); do + echo " "$((i + 1)) - ${SELECTION_NAMES[$i]} +done +read -sn1 WM_SELECTION +echo $WM_SELECTION | grep "^[0-9]$" > /dev/null +if [ $? -eq 0 ]; then + ${SELECTIONS[$(($WM_SELECTION - 1))]} +fi + diff --git a/config/bash/xdg b/config/bash/xdg new file mode 100644 index 0000000..c20f1c5 --- /dev/null +++ b/config/bash/xdg @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +# set xdg variables and other variables to clean up $HOME + +export XDG_DATA_HOME="$HOME/.local/share" +export XDG_CONFIG_HOME="$HOME/.config" +export XDG_STATE_HOME="$HOME/.local/state" +export XDG_CACHE_HOME="$HOME/.cache" + +# do not make .lesshst +export LESSHISTFILE=- +# set python startup file (to avoid creating ~/.python_history) +export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/startup.py" +# .node_repl_history location +export NODE_REPL_HISTORY="$XDG_CACHE_HOME/node_repl_history" +# .Xauthority location +export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" +# .inputrc location +export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc" +# .rustup location +export RUSTUP_HOME="$XDG_DATA_HOME/rustup" +# .cargo location +export CARGO_HOME="$XDG_DATA_HOME/cargo" +# .npmrc location +export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc" +# .xinitrc location +export XINITRC="$XDG_CONFIG_HOME/X11/xinitrc" +# .gtkrc-2.0 location +export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc" +# .wine location +export WINEPREFIX="$XDG_DATA_HOME/wine" +# cursor +export XCURSOR_PATH=/usr/share/icons:${XDG_DATA_HOME}/icons +# .gnupg location +export GNUPGHOME="$XDG_DATA_HOME/gnupg" +# .nuget location +export NUGET_PACKAGES="$XDG_CACHE_HOME/NuGetPackages" +# java +export _JAVA_OPTIONS=-Djava.util.prefs.userRoot="$XDG_CONFIG_HOME"/java +export ANDROID_HOME="$XDG_DATA_HOME"/android +# gdb +export GDBHISTFILE="$XDG_CACHE_HOME/gdb_history" +export PYENV_ROOT="$XDG_DATA_HOME/pyenv" diff --git a/config/fontconfig/conf.d/10-no-sub-pixel.conf b/config/fontconfig/conf.d/10-no-sub-pixel.conf new file mode 100644 index 0000000..3782c3e --- /dev/null +++ b/config/fontconfig/conf.d/10-no-sub-pixel.conf @@ -0,0 +1,15 @@ + + + + Disable sub-pixel rendering + + + + none + + diff --git a/config/fontconfig/conf.d/15-no-ligature-monospace.conf b/config/fontconfig/conf.d/15-no-ligature-monospace.conf new file mode 100644 index 0000000..979e950 --- /dev/null +++ b/config/fontconfig/conf.d/15-no-ligature-monospace.conf @@ -0,0 +1,18 @@ + + + + Disable ligatures for monospaced fonts to avoid ff, fi, ffi, etc. becoming only one character wide + + + Nimbus Mono + + + liga off + dlig off + + + + Nimbus Mono + Noto Sans Mono + + diff --git a/config/fontconfig/conf.d/99-japanese-fonts.conf b/config/fontconfig/conf.d/99-japanese-fonts.conf new file mode 100644 index 0000000..3bee774 --- /dev/null +++ b/config/fontconfig/conf.d/99-japanese-fonts.conf @@ -0,0 +1,268 @@ + + + + + + + + + true + + + + + + + Noto Sans CJK JP + + + Noto Sans + + + + + + + ja + + + Noto Sans CJK JP + + + + + + + serif + + + Noto Serif + + + Noto Serif CJK JP + + + IPAPMincho + + + HanaMinA + + + HanaMinB + + + + + + + sans-serif + + + Noto Sans + + + Noto Sans CJK JP + + + IPAPGothic + + + + + + + monospace + + + Noto Sans Mono + + + Noto Sans Mono CJK JP + + + + + + + ja + + + serif + + + Noto Serif CJK JP + + + + + ja + + + sans-serif + + + Noto Sans CJK JP + + + + + ja + + + monospace + + + Noto Sans Mono CJK JP + + + + + + + zh + + + serif + + + Noto Serif CJK SC + + + + + zh + + + sans-serif + + + Noto Sans CJK SC + + + + + zh + + + monospace + + + Noto Sans Mono CJK SC + + + + + + + WenQuanYi Zen Hei + + + WenQuanYi Micro Hei + + + + + WenQuanYi Zen Hei Lite + + + WenQuanYi Micro Hei Lite + + + + + WenQuanYi Zen Hei Mono + + + WenQuanYi Micro Hei Mono + + + + + + + Microsoft YaHei + + + WenQuanYi Micro Hei + + + + + SimHei + + + WenQuanYi Micro Hei + + + + + SimSun + + + WenQuanYi Micro Hei + + + + + SimSun-18030 + + + WenQuanYi Micro Hei + + + + + + sans-serif + + Noto Sans + Noto Sans CJK JP + Open Sans + Droid Sans + Ubuntu + Roboto + Source Han Sans JP + IPAPGothic + VL PGothic + Koruri + + + + + serif + + Noto Serif + Noto Serif CJK JP + Droid Serif + Roboto Slab + IPAPMincho + HanaMinA + HanaMinB + + + + + monospace + + Noto Sans Mono + Noto Sans Mono CJK JP + Inconsolatazi4 + Ubuntu Mono + Droid Sans Mono + Roboto Mono + IPAPGothic + + + diff --git a/config/fontconfig/fonts.conf b/config/fontconfig/fonts.conf new file mode 100644 index 0000000..0644732 --- /dev/null +++ b/config/fontconfig/fonts.conf @@ -0,0 +1,50 @@ + + + + + + + monospace + Noto Sans Mono + Inconsolatazi4 + IPAGothic + + + + + sans-serif + + Noto Sans + Open Sans + Droid Sans + Ubuntu + Roboto + NotoSansCJK + Source Han Sans JP + IPAPGothic + VL PGothic + Koruri + + + + serif + + Noto Serif + Droid Serif + Roboto Slab + IPAPMincho + + + + monospace + + Noto Sans Mono + Inconsolatazi4 + Ubuntu Mono + Droid Sans Mono + Roboto Mono + IPAGothic + + + + diff --git a/config/lsd/config.yaml b/config/lsd/config.yaml new file mode 100644 index 0000000..557ff1c --- /dev/null +++ b/config/lsd/config.yaml @@ -0,0 +1,137 @@ +# == Classic == +# This is a shorthand to override some of the options to be backwards compatible +# with `ls`. It affects the "color"->"when", "sorting"->"dir-grouping", "date" +# and "icons"->"when" options. +# Possible values: false, true +classic: false + +# == Blocks == +# This specifies the columns and their order when using the long and the tree +# layout. +# Possible values: permission, user, group, size, size_value, date, name, inode +blocks: + - permission + - name + - size + - date + - user + - group + - links + +# == Color == +# This has various color options. (Will be expanded in the future.) +color: + # When to colorize the output. + # When "classic" is set, this is set to "never". + # Possible values: never, auto, always + when: auto + # How to colorize the output. + # When "classic" is set, this is set to "no-color". + # Possible values: default, + # when specifying , lsd will look up theme file + # XDG Base Directory if relative, e.g. ~/.config/lsd/themes/.yaml, + # The file path if absolute + theme: default + +# == Date == +# This specifies the date format for the date column. The freeform format +# accepts an strftime like string. +# When "classic" is set, this is set to "date". +# Possible values: date, relative, '+' +# `date_format` will be a `strftime` formatted value. e.g. `date: '+%d %b %y %X'` will give you a date like this: 17 Jun 21 20:14:55 +date: +%y/%m/%d %H:%M + +# == Dereference == +# Whether to dereference symbolic links. +# Possible values: false, true +dereference: false + +# == Display == +# What items to display. Do not specify this for the default behavior. +# Possible values: all, almost-all, directory-only +# display: all + +# == Icons == +icons: + # When to use icons. + # When "classic" is set, this is set to "never". + # Possible values: always, auto, never + when: auto + # Which icon theme to use. + # Possible values: fancy, unicode + theme: fancy + # Separator between icon and the name + # Default to 1 space + separator: " " + +# == Ignore Globs == +# A list of globs to ignore when listing. +# ignore-globs: +# - .git + +# == Indicators == +# Whether to add indicator characters to certain listed files. +# Possible values: false, true +indicators: true + +# == Layout == +# Which layout to use. "oneline" might be a bit confusing here and should be +# called "one-per-line". It might be changed in the future. +# Possible values: grid, tree, oneline +layout: grid + +# == Recursion == +recursion: + # Whether to enable recursion. + # Possible values: false, true + enabled: false + # How deep the recursion should go. This has to be a positive integer. Leave + # it unspecified for (virtually) infinite. + # depth: 3 + +# == Size == +# Specifies the format of the size column. +# Possible values: default, short, bytes +size: short + +# == Permission == +# Specify the format of the permission column +# Possible value: rwx, octal +permission: rwx + +# == Sorting == +sorting: + # Specify what to sort by. + # Possible values: extension, name, time, size, version + column: name + # Whether to reverse the sorting. + # Possible values: false, true + reverse: false + # Whether to group directories together and where. + # When "classic" is set, this is set to "none". + # Possible values: first, last, none + dir-grouping: none + +# == No Symlink == +# Whether to omit showing symlink targets +# Possible values: false, true +no-symlink: false + +# == Total size == +# Whether to display the total size of directories. +# Possible values: false, true +total-size: false + +# == Hyperlink == +# Attach hyperlink to filenames +# Possible values: always, auto, never +hyperlink: never + +# == Symlink arrow == +# Specifies how the symlink arrow display, chars in both ascii and utf8 +symlink-arrow: ⇒ + +# == Header == +# Whether to display block headers. +# Possible values: false, true +header: true diff --git a/config/picom/picom.conf b/config/picom/picom.conf new file mode 100644 index 0000000..e8f0d98 --- /dev/null +++ b/config/picom/picom.conf @@ -0,0 +1,13 @@ +backend = "glx"; +opacity-rule = [ +# "90:class_g = 'kitty'", +]; +blur: { + method = "dual_kawase", + strength = 5, +} +blur-background-exclude = [ + "fullscreen", + "class_g = 'firefox'", # for autoscroll mouse +]; +fading = true; diff --git a/config/python/startup.py b/config/python/startup.py new file mode 100644 index 0000000..dba8bd0 --- /dev/null +++ b/config/python/startup.py @@ -0,0 +1,37 @@ +# Enable custom ~/.python_history location on Python interactive console +# Set PYTHONSTARTUP to this file on ~/.profile or similar for this to work +# https://docs.python.org/3/using/cmdline.html#envvar-PYTHONSTARTUP +# https://docs.python.org/3/library/readline.html#example +# https://github.com/python/cpython/blob/main/Lib/site.py @ enablerlcompleter() +# https://unix.stackexchange.com/a/675631/4919 + +import atexit +import os +import readline +import time + + +def write_history(path): + import os + import readline + try: + os.makedirs(os.path.dirname(path), mode=0o700, exist_ok=True) + readline.write_history_file(path) + except OSError: + pass + + +history = os.path.join(os.environ.get('XDG_CACHE_HOME') or + os.path.expanduser('~/.cache'), + 'python_history') +try: + readline.read_history_file(history) +except FileNotFoundError: + pass + +# Prevents creation of default history if custom is empty +if readline.get_current_history_length() == 0: + readline.add_history(f'# History created at {time.asctime()}') + +atexit.register(write_history, history) +del (atexit, os, readline, time, history, write_history) diff --git a/config/qt5ct/qt5ct.conf b/config/qt5ct/qt5ct.conf new file mode 100644 index 0000000..749fa2e --- /dev/null +++ b/config/qt5ct/qt5ct.conf @@ -0,0 +1,24 @@ +[Appearance] +custom_palette=false +icon_theme=Papirus +standard_dialogs=kde +style=Breeze + +[Fonts] +fixed="Noto Sans,10,-1,5,50,0,0,0,0,0" +general="Noto Sans,10,-1,5,50,0,0,0,0,0" + +[Interface] +activate_item_on_single_click=1 +buttonbox_layout=0 +cursor_flash_time=1000 +dialog_buttons_have_icons=1 +double_click_interval=400 +gui_effects=@Invalid() +keyboard_scheme=2 +menus_have_icons=true +show_shortcuts_in_context_menus=true +stylesheets=@Invalid() +toolbutton_style=4 +underline_shortcut=1 +wheel_scroll_lines=3 diff --git a/config/readline/inputrc b/config/readline/inputrc new file mode 100644 index 0000000..bb14971 --- /dev/null +++ b/config/readline/inputrc @@ -0,0 +1,6 @@ +set show-mode-in-prompt on +set vi-ins-mode-string \1\e[34;1m\e[6 q\2I \1\e[0m\2 +set vi-cmd-mode-string \1\e[30;1m\e[2 q\2C \1\e[0m\2 +set keyseq-timeout 20 +set editing-mode vi +Control-d: kill-whole-line diff --git a/config/starship.toml b/config/starship.toml new file mode 100644 index 0000000..f92b5f4 --- /dev/null +++ b/config/starship.toml @@ -0,0 +1,57 @@ +format = """ +[ ](bg:#E34F7C)\ +$sudo\ +$username\ +$directory\ +$git_branch\ +$git_commit\ +$git_state\ +$git_metrics\ +$git_status\ +$cmd_duration\ +$line_break\ +$jobs\ +$shlvl\ +$status\ +$shell\ +$character""" + +[status] +disabled = false +symbol = "x" + +[character] +#vicmd_symbol = "[❮](bold bg:red)" + +[shell] +disabled = false +bash_indicator = "[bsh](yellow italic)" +zsh_indicator = "[zsh](blue italic)" +fish_indicator = "[fsh](green italic)" + +[fill] +symbol = " " + +#[time] +#format = "[█]($style)[$time]($style inverted)" +#style = "#838d99" +#disabled = false + +[sudo] +format = "[ ](bg:#E34F7C blue)" +disabled = false + +[username] +show_always = true +format = "[$user ]($style inverted)[ ]($style bg:#443f59)" +style_user = "#E34F7C" +style_root = "#4571a2 bg:red" + +[directory] +format = "[ $path [$read_only]($style bg:red inverted)]($style bg:white inverted)[ ]($style)" +style = "#443f59" +read_only =" " + +[shlvl] +disabled = false +symbol = "↕️" diff --git a/config/sx/sxrc b/config/sx/sxrc new file mode 100755 index 0000000..4e172f8 --- /dev/null +++ b/config/sx/sxrc @@ -0,0 +1,50 @@ +#!/bin/sh + +# set keyboard repeat rate +xset r rate 200 30 + +# monitor settings +xrandr --output DisplayPort-1 --mode 1920x1080 --rate 144 + +# tablet settings +xsetwacom set "Wacom One by Wacom S Pen stylus" MapToOutput DisplayPort-0 + +# set color temperature +sct 4500 + +# compositor +picom & + +LIBEXEC=/run/current-system/sw/libexec +[ -d "$LIBEXEC" ] || LIBEXEC=/usr/lib +# session manager +"$LIBEXEC"/polkit-kde-authentication-agent-1 & +# desktop portal +"$LIBEXEC"/xdg-desktop-portal-kde & +kded5 & + +# ime +export GTK_IM_MODULE=fctix +export QT_IM_MODULE=fcitx +export XMODIFIERS=@im=fcitx +fcitx5 & + +# file manager daemon +#thunar --daemon & +dolphin --daemon & + +# qt setting +export QT_QPA_PLATFORMTHEME="qt6ct" +# same dpi for multi monitor +export WINIT_X11_SCALE_FACTOR=1 + +# high resolution scrolling on firefox +export MOZ_USE_XINPUT2=1 + +safeeyes & + +mpd & + +anki & + +exec "${1:-awesome}" diff --git a/config/tmux/tmux.conf b/config/tmux/tmux.conf new file mode 100644 index 0000000..4429572 --- /dev/null +++ b/config/tmux/tmux.conf @@ -0,0 +1,109 @@ +### styling +# status left [session name] +set -g status-left-style fg=black,bg=white +# red bg when multiple clients attached to session +set -g status-left "#{?session_many_attached,#[bg=red] [#S]:#{session_attached} , [#S] }" + +# window status bar +set -g status-style bg=black,fg=white +# + flag when zoomed in +set -g window-status-format ' #I:#W#{?window_zoomed_flag,+ , }' +# blue bg on current window +set -g window-status-current-format '#[bg=blue,fg=black] #I:#W#{?window_zoomed_flag,+ , }' +set -g window-status-separator '' + +# status right user@host | date, time +set -g status-right "#{?window_bigger,[#{window_offset_x}#,#{window_offset_y}] ,}#{client_user}@#H | %a %b %d, %H:%M" + +# dark blue message bg +set -g message-style bg=#4571a2,fg=white + +set -g set-titles on +set -g set-titles-string "tmux: [#S#{?session_many_attached,+,}] #I-#W" + +# borders +set -g pane-border-lines heavy +set -g pane-border-status top +set -g pane-border-indicators off +# show pane title (- if default name) +# blue bg on active pane, red if prefix active +# brackets on title when zoomed +set -g pane-border-format "#{?pane_active,#{?client_prefix,#[bg=red#,fg=black],#[bg=blue#,fg=black]},#[fg=blue]}#{?window_zoomed_flag, [ , }#{?#{==:#T,#H},-,#T}#{?window_zoomed_flag, ] , }" +set -g pane-border-style default +set -g pane-active-border-style fg=#4571a2 + +set -g mode-style bg=#4571a2 + + +### bindings +# split window +unbind v +unbind h +bind v split-window -h -c "#{pane_current_path}" +bind h split-window -v -c "#{pane_current_path}" + +# reload config +unbind r +bind r source-file ~/.config/tmux/tmux.conf \; display 'Config reloaded' + +# pane selection +bind -T root C-h select-pane -L +bind -T root C-j select-pane -D +bind -T root C-k select-pane -U +bind -T root C-l select-pane -R + +# resize pane +bind -r H resize-pane -L 5 +bind -r J resize-pane -D 2 +bind -r K resize-pane -U 2 +bind -r L resize-pane -R 5 +bind m resize-pane -Z + +# detach (sends signal to parent process to exec shell) +unbind d +bind d run 'sh-tmux -d' +set -g update-environment SH_TMUX_PID + + +### settings +set -g default-terminal "xterm-256color" +set -ga terminal-overrides ",*256col*:Tc" +set -sg escape-time 0 +set -g history-limit 50000 +set -g display-time 4000 +set -g status-interval 1 +setw -g aggressive-resize on + +set -g mouse on +setw -g mode-keys vi +setw -g status-keys emacs + +# start indices at 1 +set -g base-index 1 +set -g pane-base-index 1 +set -g renumber-windows on + +# copy mode +bind -T copy-mode-vi v send -X begin-selection +bind -T copy-mode-vi y send -X copy-selection +unbind -T copy-mode-vi MouseDragEnd1Pane + +# use arrow keys when scrolling on certain commands +tmux_commands_with_legacy_scroll="nano less more man git" +bind -T root WheelUpPane \ + if-shell -Ft= '#{?mouse_any_flag,1,#{pane_in_mode}}' \ + 'send -Mt=' \ + 'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \ + "send -t= Up Up Up" "copy-mode -et="' +bind -T root WheelDownPane \ + if-shell -Ft = '#{?pane_in_mode,1,#{mouse_any_flag}}' \ + 'send -Mt=' \ + 'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \ + "send -t= Down Down Down" "send -Mt="' + +### plugins +#set -g @plugin 'tmux-plugins/tpm' +#set -g @plugin 'christoomey/vim-tmux-navigator' +#set -g @plugin 'tmux-plugins/tmux-sessionist' + +#run '~/.config/tmux/plugins/tpm/tpm' diff --git a/configuration.nix b/configuration.nix index c0c7183..5d24ab4 100644 --- a/configuration.nix +++ b/configuration.nix @@ -16,6 +16,8 @@ efi.canTouchEfiVariables = true; }; + environment.pathsToLink = [ "/libexec" ]; + boot.tmp.useTmpfs = true; networking.hostName = "nixos"; diff --git a/home.nix b/home.nix index 76498d4..737f22a 100644 --- a/home.nix +++ b/home.nix @@ -3,6 +3,7 @@ let username = "ahnwuoa"; homeDirectory = "/home/${username}"; + mkln = x: config.lib.file.mkOutOfStoreSymlink "${homeDirectory}/.local/nixos/${x}"; in { home.username = username; @@ -41,7 +42,26 @@ in python3 gnumake + + tmuxPlugins.vim-tmux-navigator + tmuxPlugins.sessionist ]; + xdg.configFile.alacritty.source = mkln "config/alacritty"; + xdg.configFile.awesome.source = mkln "config/awesome"; + xdg.configFile.bash.source = mkln "config/bash"; + xdg.configFile.fontconfig.source = config/fontconfig; + xdg.configFile.lsd.source = config/lsd; + xdg.configFile.picom.source = config/picom; + xdg.configFile.python.source = config/python; + xdg.configFile.qt5ct.source = config/qt5ct; + xdg.configFile.readline.source = config/readline; + xdg.configFile."starship.toml".source = config/starship.toml; + xdg.configFile.sx.source = mkln "config/sx"; + xdg.configFile."tmux/tmux.conf".text = (builtins.readFile config/tmux/tmux.conf) + '' + run ${pkgs.tmuxPlugins.vim-tmux-navigator.rtp} + run ${pkgs.tmuxPlugins.sessionist.rtp} + ''; + fonts.fontconfig.enable = false; qt = { enable = true; platformTheme.name = "qtct";