From a623fed63460d6d810605ce1ce858a58a5b222f7 Mon Sep 17 00:00:00 2001 From: Sakamoto Date: Tue, 12 May 2026 18:31:15 -0500 Subject: init --- dot_config/nvim/init.lua | 63 ++++ dot_config/nvim/lazy-lock.json | 22 ++ dot_config/nvim/lua/plugins/blink.lua | 63 ++++ dot_config/nvim/lua/plugins/dap.lua | 150 +++++++++ dot_config/nvim/lua/plugins/diffview.lua | 3 + dot_config/nvim/lua/plugins/fidget.lua | 6 + dot_config/nvim/lua/plugins/flash.lua | 14 + dot_config/nvim/lua/plugins/fzf.lua | 13 + dot_config/nvim/lua/plugins/lsp.lua | 61 ++++ dot_config/nvim/lua/plugins/markdown.lua | 7 + dot_config/nvim/lua/plugins/oil.lua | 20 ++ dot_config/nvim/lua/plugins/rustaceanvim.lua | 30 ++ dot_config/nvim/lua/plugins/theme.lua | 12 + dot_config/nvim/lua/plugins/trash/autopairs.luaa | 7 + dot_config/nvim/lua/plugins/trash/crates.luaa | 17 + dot_config/nvim/lua/plugins/trash/grapple.luaa | 14 + dot_config/nvim/lua/plugins/trash/leetcode.luaa | 12 + dot_config/nvim/lua/plugins/trash/mini-pairs.luaa | 1 + dot_config/nvim/lua/plugins/trash/neck.luaa | 1 + dot_config/nvim/lua/plugins/trash/neogit.luaa | 9 + dot_config/nvim/lua/plugins/trash/neorg.luaa | 24 ++ dot_config/nvim/lua/plugins/trash/neorg.luaaa | 24 ++ dot_config/nvim/lua/plugins/trash/neotest.luaa | 82 +++++ dot_config/nvim/lua/plugins/trash/noice.luaa | 23 ++ .../nvim/lua/plugins/trash/nvim-surround.luaa | 10 + dot_config/nvim/lua/plugins/trash/orgmode.luaa | 19 ++ dot_config/nvim/lua/plugins/trash/persistence.luaa | 8 + dot_config/nvim/lua/plugins/trash/scroll.luaa | 38 +++ dot_config/nvim/lua/plugins/trash/tabout.luaa | 31 ++ dot_config/nvim/lua/plugins/treesitter.lua | 22 ++ dot_config/nvim/lua/plugins/vim-tmux-navigator.lua | 17 + dot_config/sway/executable_config | 244 ++++++++++++++ dot_config/sway/executable_launcher.sh | 350 +++++++++++++++++++++ dot_config/waybar/config | 188 +++++++++++ .../custom_modules/executable_cpugovernor.sh | 7 + .../waybar/custom_modules/executable_custom-gpu.sh | 14 + dot_config/waybar/style.css | 308 ++++++++++++++++++ 37 files changed, 1934 insertions(+) create mode 100644 dot_config/nvim/init.lua create mode 100644 dot_config/nvim/lazy-lock.json create mode 100644 dot_config/nvim/lua/plugins/blink.lua create mode 100644 dot_config/nvim/lua/plugins/dap.lua create mode 100644 dot_config/nvim/lua/plugins/diffview.lua create mode 100644 dot_config/nvim/lua/plugins/fidget.lua create mode 100644 dot_config/nvim/lua/plugins/flash.lua create mode 100644 dot_config/nvim/lua/plugins/fzf.lua create mode 100644 dot_config/nvim/lua/plugins/lsp.lua create mode 100644 dot_config/nvim/lua/plugins/markdown.lua create mode 100644 dot_config/nvim/lua/plugins/oil.lua create mode 100644 dot_config/nvim/lua/plugins/rustaceanvim.lua create mode 100644 dot_config/nvim/lua/plugins/theme.lua create mode 100644 dot_config/nvim/lua/plugins/trash/autopairs.luaa create mode 100644 dot_config/nvim/lua/plugins/trash/crates.luaa create mode 100644 dot_config/nvim/lua/plugins/trash/grapple.luaa create mode 100644 dot_config/nvim/lua/plugins/trash/leetcode.luaa create mode 100644 dot_config/nvim/lua/plugins/trash/mini-pairs.luaa create mode 100644 dot_config/nvim/lua/plugins/trash/neck.luaa create mode 100644 dot_config/nvim/lua/plugins/trash/neogit.luaa create mode 100644 dot_config/nvim/lua/plugins/trash/neorg.luaa create mode 100644 dot_config/nvim/lua/plugins/trash/neorg.luaaa create mode 100644 dot_config/nvim/lua/plugins/trash/neotest.luaa create mode 100644 dot_config/nvim/lua/plugins/trash/noice.luaa create mode 100644 dot_config/nvim/lua/plugins/trash/nvim-surround.luaa create mode 100644 dot_config/nvim/lua/plugins/trash/orgmode.luaa create mode 100644 dot_config/nvim/lua/plugins/trash/persistence.luaa create mode 100644 dot_config/nvim/lua/plugins/trash/scroll.luaa create mode 100644 dot_config/nvim/lua/plugins/trash/tabout.luaa create mode 100644 dot_config/nvim/lua/plugins/treesitter.lua create mode 100644 dot_config/nvim/lua/plugins/vim-tmux-navigator.lua create mode 100644 dot_config/sway/executable_config create mode 100644 dot_config/sway/executable_launcher.sh create mode 100644 dot_config/waybar/config create mode 100644 dot_config/waybar/custom_modules/executable_cpugovernor.sh create mode 100644 dot_config/waybar/custom_modules/executable_custom-gpu.sh create mode 100644 dot_config/waybar/style.css (limited to 'dot_config') diff --git a/dot_config/nvim/init.lua b/dot_config/nvim/init.lua new file mode 100644 index 0000000..724348a --- /dev/null +++ b/dot_config/nvim/init.lua @@ -0,0 +1,63 @@ +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.confirm = true +vim.opt.clipboard = "unnamedplus" +vim.opt.splitbelow = true +vim.opt.splitright = true +vim.opt.showmode = false +vim.opt.tabstop = 2 +vim.opt.softtabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.expandtab = true +vim.opt.smartindent = true +vim.opt.swapfile = false +vim.opt.termguicolors = true +vim.g.mapleader = " " +vim.g.maplocalleader = "," +vim.opt.fillchars:append({ eob = " " }) +vim.opt.laststatus = 3 +vim.opt.signcolumn = "number" +vim.opt.linebreak = true +vim.opt.updatetime = 50 +vim.opt.ignorecase = true +vim.opt.mouse = "nvi" + +vim.api.nvim_create_autocmd("TextYankPost", { callback = function() vim.highlight.on_yank() end }) + +vim.keymap.set("n", "", "h") +vim.keymap.set("n", "", "j") +vim.keymap.set("n", "", "k") +vim.keymap.set("n", "", "l") + +vim.keymap.set("n", "", "zz", { silent = true }) +vim.keymap.set("n", "", "zz", { silent = true }) + +vim.keymap.set("n", "-", "vsp", { silent = true }) +vim.keymap.set("n", "'", "sp", { silent = true }) + +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +require("lazy").setup({ + spec = { + { + { import = "plugins" }, + }, + }, +}) + +vim.keymap.set("t", "", "") diff --git a/dot_config/nvim/lazy-lock.json b/dot_config/nvim/lazy-lock.json new file mode 100644 index 0000000..23855dc --- /dev/null +++ b/dot_config/nvim/lazy-lock.json @@ -0,0 +1,22 @@ +{ + "blink.cmp": { "branch": "main", "commit": "78336bc89ee5365633bcf754d93df01678b5c08f" }, + "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, + "fidget.nvim": { "branch": "main", "commit": "889e2e96edef4e144965571d46f7a77bcc4d0ddf" }, + "flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" }, + "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, + "fzf-lua": { "branch": "main", "commit": "7b3a7390d01db93d422a4d6d6cf3771038577858" }, + "gruvbox-material": { "branch": "master", "commit": "11d779b26a9ab2b3db8c22c6ac9fb6e8ed4fea79" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, + "nvim-dap": { "branch": "master", "commit": "45a69eba683a2c448dd9ecfc4de89511f0646b5f" }, + "nvim-dap-view": { "branch": "main", "commit": "dd43736f30ed70571a02e8c560ab69746ad7a1ed" }, + "nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" }, + "nvim-lspconfig": { "branch": "master", "commit": "e146efacbafed3789ac568abcc5a981c5decaa58" }, + "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, + "nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" }, + "nvim-treesitter-context": { "branch": "master", "commit": "b0c45cefe2c8f7b55fc46f34e563bc428ef99636" }, + "nvim-web-devicons": { "branch": "master", "commit": "c72328a5494b4502947a022fe69c0c47e53b6aa6" }, + "oil.nvim": { "branch": "master", "commit": "0fcc83805ad11cf714a949c98c605ed717e0b83e" }, + "render-markdown.nvim": { "branch": "main", "commit": "d67113f11384c0dad96fced2f7b91f1fc811e97f" }, + "rustaceanvim": { "branch": "master", "commit": "e9c5aaba16fead831379d5f44617547a90b913c7" }, + "vim-tmux-navigator": { "branch": "master", "commit": "e41c431a0c7b7388ae7ba341f01a0d217eb3a432" } +} diff --git a/dot_config/nvim/lua/plugins/blink.lua b/dot_config/nvim/lua/plugins/blink.lua new file mode 100644 index 0000000..3a03cde --- /dev/null +++ b/dot_config/nvim/lua/plugins/blink.lua @@ -0,0 +1,63 @@ +return { + "saghen/blink.cmp", + -- optional: provides snippets for the snippet source + dependencies = { "rafamadriz/friendly-snippets" }, + + -- use a release tag to download pre-built binaries + version = "*", + -- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust + -- build = 'cargo build --release', + -- If you use nix, you can build from source using latest nightly rust with: + -- build = 'nix run .#build-plugin', + + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) + -- 'super-tab' for mappings similar to vscode (tab to accept) + -- 'enter' for enter to accept + -- 'none' for no mappings + -- + -- All presets have the following mappings: + -- C-space: Open menu or open docs if already open + -- C-n/C-p or Up/Down: Select next/previous item + -- C-e: Hide menu + -- C-k: Toggle signature help (if signature.enabled = true) + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + keymap = { + preset = "super-tab", + }, + signature = { + enabled = true, + }, + appearance = { + -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = "mono", + }, + completion = { + documentation = { + auto_show = true, + auto_show_delay_ms = 200, + }, + accept = { + auto_brackets = {enabled = true} + }, + }, + + -- Default list of enabled providers defined so that you can extend it + -- elsewhere in your config, without redefining it, due to `opts_extend` + sources = { + default = { "lsp", "path", "snippets", "buffer" }, + }, + + -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance + -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, + -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` + -- + -- See the fuzzy documentation for more information + fuzzy = { implementation = "prefer_rust_with_warning" }, + }, + opts_extend = { "sources.default" }, +} diff --git a/dot_config/nvim/lua/plugins/dap.lua b/dot_config/nvim/lua/plugins/dap.lua new file mode 100644 index 0000000..0299847 --- /dev/null +++ b/dot_config/nvim/lua/plugins/dap.lua @@ -0,0 +1,150 @@ +return { + -- "rcarriga/nvim-dap-ui", + "igorlfs/nvim-dap-view", + dependencies = { + "mfussenegger/nvim-dap", + "nvim-neotest/nvim-nio", + { "theHamsta/nvim-dap-virtual-text", opts = {} }, + }, + keys = { + { + "dB", + function() + require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: ")) + end, + desc = "Breakpoint Condition", + }, + { + "db", + function() + require("dap").toggle_breakpoint() + end, + desc = "Toggle Breakpoint", + }, + { + "dc", + function() + require("dap").continue() + end, + desc = "Run/Continue", + }, + { + "da", + function() + require("dap").continue({ before = get_args }) + end, + desc = "Run with Args", + }, + { + "dC", + function() + require("dap").run_to_cursor() + end, + desc = "Run to Cursor", + }, + { + "dg", + function() + require("dap").goto_() + end, + desc = "Go to Line (No Execute)", + }, + { + "di", + function() + require("dap").step_into() + end, + desc = "Step Into", + }, + { + "dj", + function() + require("dap").down() + end, + desc = "Down", + }, + { + "dk", + function() + require("dap").up() + end, + desc = "Up", + }, + { + "dl", + function() + require("dap").run_last() + end, + desc = "Run Last", + }, + { + "do", + function() + require("dap").step_out() + end, + desc = "Step Out", + }, + { + "dO", + function() + require("dap").step_over() + end, + desc = "Step Over", + }, + { + "dP", + function() + require("dap").pause() + end, + desc = "Pause", + }, + { + "dr", + function() + require("dap").repl.toggle() + end, + desc = "Toggle REPL", + }, + { + "ds", + function() + require("dap").session() + end, + desc = "Session", + }, + { + "dt", + function() + require("dap").terminate() + end, + desc = "Terminate", + }, + { + "dw", + function() + require("dap.ui.widgets").hover() + end, + desc = "Widgets", + }, + }, + config = function() + local dap = require("dap") + -- local dapui = require("dapui") + local dapui = require("dap-view") + + dapui.setup() + + dap.listeners.before.attach.dapui_config = function() + dapui.open() + end + dap.listeners.before.launch.dapui_config = function() + dapui.open() + end + dap.listeners.before.event_terminated.dapui_config = function() + dapui.close() + end + dap.listeners.before.event_exited.dapui_config = function() + dapui.close() + end + end, +} diff --git a/dot_config/nvim/lua/plugins/diffview.lua b/dot_config/nvim/lua/plugins/diffview.lua new file mode 100644 index 0000000..aab3fd3 --- /dev/null +++ b/dot_config/nvim/lua/plugins/diffview.lua @@ -0,0 +1,3 @@ +return { + "sindrets/diffview.nvim" +} diff --git a/dot_config/nvim/lua/plugins/fidget.lua b/dot_config/nvim/lua/plugins/fidget.lua new file mode 100644 index 0000000..2d70394 --- /dev/null +++ b/dot_config/nvim/lua/plugins/fidget.lua @@ -0,0 +1,6 @@ +return { + "j-hui/fidget.nvim", + opts = { + -- options + }, +} diff --git a/dot_config/nvim/lua/plugins/flash.lua b/dot_config/nvim/lua/plugins/flash.lua new file mode 100644 index 0000000..c3d267a --- /dev/null +++ b/dot_config/nvim/lua/plugins/flash.lua @@ -0,0 +1,14 @@ +return { + "folke/flash.nvim", + event = "VeryLazy", + ---@type Flash.Config + config = {}, + -- stylua: ignore + keys = { + { "", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, + { "", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" }, + { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, + { "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, + { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, + }, +} diff --git a/dot_config/nvim/lua/plugins/fzf.lua b/dot_config/nvim/lua/plugins/fzf.lua new file mode 100644 index 0000000..78039d8 --- /dev/null +++ b/dot_config/nvim/lua/plugins/fzf.lua @@ -0,0 +1,13 @@ +return { + "ibhagwan/fzf-lua", + lazy = false, + dependencies = { "nvim-tree/nvim-web-devicons" }, + keys = { + { "", "FzfLua files" }, + { "", "FzfLua buffers" }, + { "f", "FzfLua live_grep" }, + }, + config = function() + require("fzf-lua").register_ui_select() + end, +} diff --git a/dot_config/nvim/lua/plugins/lsp.lua b/dot_config/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..cd9ff77 --- /dev/null +++ b/dot_config/nvim/lua/plugins/lsp.lua @@ -0,0 +1,61 @@ +return { + "neovim/nvim-lspconfig", + config = function() + -- auto format + vim.cmd([[autocmd BufWritePre * lua vim.lsp.buf.format()]]) + + -- Global mappings. + -- See `:help vim.diagnostic.*` for documentation on any of the below functions + vim.keymap.set("n", "gm", 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.setqflist) + vim.lsp.enable('clangd') + + -- 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", "", 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, + vim.keymap.set("n", "i", function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ 0 }), { 0 }) + end, opts), + }) + + vim.diagnostic.config({ + -- Use the default configuration + virtual_lines = true, + + -- Alternatively, customize specific options + virtual_lines = { + -- Only show virtual line diagnostics for the current cursor line + current_line = true, + }, + }) + end, + + vim.lsp.enable('tinymist'), +} diff --git a/dot_config/nvim/lua/plugins/markdown.lua b/dot_config/nvim/lua/plugins/markdown.lua new file mode 100644 index 0000000..0dadc46 --- /dev/null +++ b/dot_config/nvim/lua/plugins/markdown.lua @@ -0,0 +1,7 @@ +return { + "MeanderingProgrammer/render-markdown.nvim", + dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons" }, -- if you prefer nvim-web-devicons + ---@module 'render-markdown' + ---@type render.md.UserConfig + opts = {}, +} diff --git a/dot_config/nvim/lua/plugins/oil.lua b/dot_config/nvim/lua/plugins/oil.lua new file mode 100644 index 0000000..cd3a83d --- /dev/null +++ b/dot_config/nvim/lua/plugins/oil.lua @@ -0,0 +1,20 @@ +return { + "stevearc/oil.nvim", + dependencies = { + "nvim-tree/nvim-web-devicons", + }, +keys = { + { "e", "Oil"}, + { "df", "Oil ~/.config/nvim/"}, +}, + opts = { + win_options = { + signcolumn = "yes:2", + }, + view_options = { + -- Show files and directories that start with "." + show_hidden = true, + }, + delete_to_trash = true, + } +} diff --git a/dot_config/nvim/lua/plugins/rustaceanvim.lua b/dot_config/nvim/lua/plugins/rustaceanvim.lua new file mode 100644 index 0000000..72f1de5 --- /dev/null +++ b/dot_config/nvim/lua/plugins/rustaceanvim.lua @@ -0,0 +1,30 @@ +return { + "mrcjkb/rustaceanvim", + version = "^5", -- Recommended + lazy = false, -- This plugin is already lazy + config = function() + vim.g.rustaceanvim = function() + -- Update this path + local extension_path = "/usr/lib/codelldb/" + local codelldb_path = extension_path .. "adapter/codelldb" + local liblldb_path = extension_path .. "lldb/lib/liblldb" + local this_os = vim.uv.os_uname().sysname + + -- The path is different on Windows + if this_os:find("Windows") then + codelldb_path = extension_path .. "adapter\\codelldb.exe" + liblldb_path = extension_path .. "lldb\\bin\\liblldb.dll" + else + -- The liblldb extension is .so for Linux and .dylib for MacOS + liblldb_path = liblldb_path .. (this_os == "Linux" and ".so" or ".dylib") + end + + local cfg = require("rustaceanvim.config") + return { + dap = { + adapter = cfg.get_codelldb_adapter(codelldb_path, liblldb_path), + }, + } + end + end, +} diff --git a/dot_config/nvim/lua/plugins/theme.lua b/dot_config/nvim/lua/plugins/theme.lua new file mode 100644 index 0000000..d682e12 --- /dev/null +++ b/dot_config/nvim/lua/plugins/theme.lua @@ -0,0 +1,12 @@ +return { + "sainnhe/gruvbox-material", + lazy = false, + priority = 1000, + config = function() + -- Optionally configure and load the colorscheme + -- directly inside the plugin declaration. + vim.g.gruvbox_material_enable_italic = true + vim.g.gruvbox_material_transparent_background = 2 + vim.cmd.colorscheme("gruvbox-material") + end, +} diff --git a/dot_config/nvim/lua/plugins/trash/autopairs.luaa b/dot_config/nvim/lua/plugins/trash/autopairs.luaa new file mode 100644 index 0000000..2db00d8 --- /dev/null +++ b/dot_config/nvim/lua/plugins/trash/autopairs.luaa @@ -0,0 +1,7 @@ +return { + 'windwp/nvim-autopairs', + event = "InsertEnter", + config = true + -- use opts = {} for passing setup options + -- this is equivalent to setup({}) function +} diff --git a/dot_config/nvim/lua/plugins/trash/crates.luaa b/dot_config/nvim/lua/plugins/trash/crates.luaa new file mode 100644 index 0000000..f72a23f --- /dev/null +++ b/dot_config/nvim/lua/plugins/trash/crates.luaa @@ -0,0 +1,17 @@ +return { + "saecki/crates.nvim", + tag = "stable", + config = function() + require("crates").setup({ + lsp = { + enabled = true, + on_attach = function(client, bufnr) + -- the same on_attach function as for your other lsp's + end, + actions = true, + completion = true, + hover = true, + }, + }) + end, +} diff --git a/dot_config/nvim/lua/plugins/trash/grapple.luaa b/dot_config/nvim/lua/plugins/trash/grapple.luaa new file mode 100644 index 0000000..2d80958 --- /dev/null +++ b/dot_config/nvim/lua/plugins/trash/grapple.luaa @@ -0,0 +1,14 @@ +return { + "cbochs/grapple.nvim", + opts = { + scope = "git", -- also try out "git_branch" + }, + event = { "BufReadPost", "BufNewFile" }, + cmd = "Grapple", + keys = { + { "m", "Grapple toggle", desc = "Grapple tag" }, + { "M", "Grapple toggle_tags", desc = "Grapple open tags window" }, + { "n", "Grapple cycle_tags next", desc = "Grapple cycle next tag" }, + { "p", "Grapple cycle_tags prev", desc = "Grapple cycle previous tag" }, + }, +} diff --git a/dot_config/nvim/lua/plugins/trash/leetcode.luaa b/dot_config/nvim/lua/plugins/trash/leetcode.luaa new file mode 100644 index 0000000..a057b2d --- /dev/null +++ b/dot_config/nvim/lua/plugins/trash/leetcode.luaa @@ -0,0 +1,12 @@ +return { + "kawre/leetcode.nvim", + build = ":TSUpdate html", -- if you have `nvim-treesitter` installed + dependencies = { + -- include a picker of your choice, see picker section for more details + "nvim-lua/plenary.nvim", + "MunifTanjim/nui.nvim", + }, + opts = { + -- configuration goes here + }, +} diff --git a/dot_config/nvim/lua/plugins/trash/mini-pairs.luaa b/dot_config/nvim/lua/plugins/trash/mini-pairs.luaa new file mode 100644 index 0000000..ed48bfc --- /dev/null +++ b/dot_config/nvim/lua/plugins/trash/mini-pairs.luaa @@ -0,0 +1 @@ +return { 'echasnovski/mini.pairs', version = '*' , opts = {}} diff --git a/dot_config/nvim/lua/plugins/trash/neck.luaa b/dot_config/nvim/lua/plugins/trash/neck.luaa new file mode 100644 index 0000000..4b1eaf7 --- /dev/null +++ b/dot_config/nvim/lua/plugins/trash/neck.luaa @@ -0,0 +1 @@ +return {"shortcuts/no-neck-pain.nvim", version = "*"} diff --git a/dot_config/nvim/lua/plugins/trash/neogit.luaa b/dot_config/nvim/lua/plugins/trash/neogit.luaa new file mode 100644 index 0000000..b44d866 --- /dev/null +++ b/dot_config/nvim/lua/plugins/trash/neogit.luaa @@ -0,0 +1,9 @@ +return { + "NeogitOrg/neogit", + dependencies = { + "nvim-lua/plenary.nvim", -- required + "sindrets/diffview.nvim", -- optional - Diff integration + "ibhagwan/fzf-lua", + }, + config = true, +} diff --git a/dot_config/nvim/lua/plugins/trash/neorg.luaa b/dot_config/nvim/lua/plugins/trash/neorg.luaa new file mode 100644 index 0000000..abe7685 --- /dev/null +++ b/dot_config/nvim/lua/plugins/trash/neorg.luaa @@ -0,0 +1,24 @@ +return { + "nvim-neorg/neorg", + lazy = false, + version = "*", + config = function() + require("neorg").setup { + load = { + ["core.defaults"] = {}, + ["core.concealer"] = {}, + ["core.dirman"] = { + config = { + workspaces = { + notes = "~/notes", + }, + default_workspace = "notes", + }, + }, + }, + } + + vim.wo.foldlevel = 99 + vim.wo.conceallevel = 2 + end, + } diff --git a/dot_config/nvim/lua/plugins/trash/neorg.luaaa b/dot_config/nvim/lua/plugins/trash/neorg.luaaa new file mode 100644 index 0000000..abe7685 --- /dev/null +++ b/dot_config/nvim/lua/plugins/trash/neorg.luaaa @@ -0,0 +1,24 @@ +return { + "nvim-neorg/neorg", + lazy = false, + version = "*", + config = function() + require("neorg").setup { + load = { + ["core.defaults"] = {}, + ["core.concealer"] = {}, + ["core.dirman"] = { + config = { + workspaces = { + notes = "~/notes", + }, + default_workspace = "notes", + }, + }, + }, + } + + vim.wo.foldlevel = 99 + vim.wo.conceallevel = 2 + end, + } diff --git a/dot_config/nvim/lua/plugins/trash/neotest.luaa b/dot_config/nvim/lua/plugins/trash/neotest.luaa new file mode 100644 index 0000000..4b75efb --- /dev/null +++ b/dot_config/nvim/lua/plugins/trash/neotest.luaa @@ -0,0 +1,82 @@ +return { + "nvim-neotest/neotest", + dependencies = { + "nvim-neotest/nvim-nio", + "nvim-lua/plenary.nvim", + "antoinemadec/FixCursorHold.nvim", + "nvim-treesitter/nvim-treesitter", + }, + keys = { + { "t", "", desc = "+test" }, + { + "tt", + function() + require("neotest").run.run(vim.fn.expand("%")) + end, + desc = "Run File (Neotest)", + }, + { + "tT", + function() + require("neotest").run.run(vim.uv.cwd()) + end, + desc = "Run All Test Files (Neotest)", + }, + { + "tr", + function() + require("neotest").run.run() + end, + desc = "Run Nearest (Neotest)", + }, + { + "tl", + function() + require("neotest").run.run_last() + end, + desc = "Run Last (Neotest)", + }, + { + "ts", + function() + require("neotest").summary.toggle() + end, + desc = "Toggle Summary (Neotest)", + }, + { + "to", + function() + require("neotest").output.open({ enter = true, auto_close = true }) + end, + desc = "Show Output (Neotest)", + }, + { + "tO", + function() + require("neotest").output_panel.toggle() + end, + desc = "Toggle Output Panel (Neotest)", + }, + { + "tS", + function() + require("neotest").run.stop() + end, + desc = "Stop (Neotest)", + }, + { + "tw", + function() + require("neotest").watch.toggle(vim.fn.expand("%")) + end, + desc = "Toggle Watch (Neotest)", + }, + }, + config = function() + require("neotest").setup({ + adapters = { + require("rustaceanvim.neotest"), + }, + }) + end, +} diff --git a/dot_config/nvim/lua/plugins/trash/noice.luaa b/dot_config/nvim/lua/plugins/trash/noice.luaa new file mode 100644 index 0000000..99ad716 --- /dev/null +++ b/dot_config/nvim/lua/plugins/trash/noice.luaa @@ -0,0 +1,23 @@ +return { + 'folke/noice.nvim', + dependencies = {'MunifTanjim/nui.nvim'}, + event = "BufReadPost", + opts = { + lsp = { + progress = { + enabled = false, + }, + override = { + ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + ["vim.lsp.util.stylize_markdown"] = true, + ["cmp.entry.get_documentation"] = true, + }, + }, + presets = { + bottom_search = true, + command_palette = true, + long_message_to_split = false, + inc_rename = true, + }, + }, +} diff --git a/dot_config/nvim/lua/plugins/trash/nvim-surround.luaa b/dot_config/nvim/lua/plugins/trash/nvim-surround.luaa new file mode 100644 index 0000000..c9bd7a2 --- /dev/null +++ b/dot_config/nvim/lua/plugins/trash/nvim-surround.luaa @@ -0,0 +1,10 @@ +return { + 'kylechui/nvim-surround', + version = '*', + opts = { + keymaps = { + visual = "gS", + visual_line = "gS", + }, + } +} diff --git a/dot_config/nvim/lua/plugins/trash/orgmode.luaa b/dot_config/nvim/lua/plugins/trash/orgmode.luaa new file mode 100644 index 0000000..ff383ff --- /dev/null +++ b/dot_config/nvim/lua/plugins/trash/orgmode.luaa @@ -0,0 +1,19 @@ +return { + 'nvim-orgmode/orgmode', + event = 'VeryLazy', + ft = { 'org' }, + config = function() + -- Setup orgmode + require('orgmode').setup({ + org_agenda_files = '~/orgfiles/**/*', + org_default_notes_file = '~/orgfiles/refile.org', + }) + + -- NOTE: If you are using nvim-treesitter with ~ensure_installed = "all"~ option + -- add ~org~ to ignore_install + -- require('nvim-treesitter.configs').setup({ + -- ensure_installed = 'all', + -- ignore_install = { 'org' }, + -- }) + end, +} diff --git a/dot_config/nvim/lua/plugins/trash/persistence.luaa b/dot_config/nvim/lua/plugins/trash/persistence.luaa new file mode 100644 index 0000000..e3b73fd --- /dev/null +++ b/dot_config/nvim/lua/plugins/trash/persistence.luaa @@ -0,0 +1,8 @@ +-- Lua +return { + "folke/persistence.nvim", + event = "BufReadPre", -- this will only start session saving when an actual file was opened + opts = { + -- add any custom options here + } +} diff --git a/dot_config/nvim/lua/plugins/trash/scroll.luaa b/dot_config/nvim/lua/plugins/trash/scroll.luaa new file mode 100644 index 0000000..120d141 --- /dev/null +++ b/dot_config/nvim/lua/plugins/trash/scroll.luaa @@ -0,0 +1,38 @@ +return { + "declancm/cinnamon.nvim", + version = "*", -- use latest release + config = function() + local cinnamon = require("cinnamon") + + cinnamon.setup() + + -- Centered scrolling: + vim.keymap.set("n", "", function() + cinnamon.scroll("zz") + end) + vim.keymap.set("n", "", function() + cinnamon.scroll("zz") + end) + + -- LSP: + vim.keymap.set("n", "gd", function() + cinnamon.scroll(vim.lsp.buf.definition) + end) + vim.keymap.set("n", "gD", function() + cinnamon.scroll(vim.lsp.buf.declaration) + end) + + -- Flash.nvim integration: + local flash = require("flash") + local jump = require("flash.jump") + + flash.setup({ + action = function(match, state) + cinnamon.scroll(function() + jump.jump(match, state) + jump.on_jump(state) + end) + end, + }) + end, +} diff --git a/dot_config/nvim/lua/plugins/trash/tabout.luaa b/dot_config/nvim/lua/plugins/trash/tabout.luaa new file mode 100644 index 0000000..cbc469a --- /dev/null +++ b/dot_config/nvim/lua/plugins/trash/tabout.luaa @@ -0,0 +1,31 @@ +return { + { + 'abecodes/tabout.nvim', + lazy = false, + config = function() + require('tabout').setup { + tabkey = '', -- key to trigger tabout, set to an empty string to disable + backwards_tabkey = '', -- key to trigger backwards tabout, set to an empty string to disable + act_as_tab = true, -- shift content if tab out is not possible + act_as_shift_tab = false, -- reverse shift content if tab out is not possible (if your keyboard/terminal supports ) + default_tab = '', -- shift default action (only at the beginning of a line, otherwise is used) + default_shift_tab = '', -- reverse shift default action, + enable_backwards = true, -- well ... + completion = false, -- if the tabkey is used in a completion pum + tabouts = { + { open = "'", close = "'" }, + { open = '"', close = '"' }, + { open = '`', close = '`' }, + { open = '(', close = ')' }, + { open = '[', close = ']' }, + { open = '{', close = '}' } + }, + ignore_beginning = true, --[[ if the cursor is at the beginning of a filled element it will rather tab out than shift the content ]] + exclude = {} -- tabout will ignore these filetypes + } + end, + opt = true, -- Set this to true if the plugin is optional + event = 'InsertCharPre', -- Set the event to 'InsertCharPre' for better compatibility + priority = 1000, + }, +} diff --git a/dot_config/nvim/lua/plugins/treesitter.lua b/dot_config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..c8f8919 --- /dev/null +++ b/dot_config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,22 @@ +return { -- Highlight, edit, and navigate code + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', + branch = "main", + dependencies = { + "nvim-treesitter/nvim-treesitter-context" + }, + opts = { + ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc', 'markdown_inline', 'rust' }, + auto_install = true, + highlight = { + enable = true, + -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. + -- If you are experiencing weird indenting issues, add the language to + -- the list of additional_vim_regex_highlighting and disabled languages for indent. + additional_vim_regex_highlighting = { 'ruby', 'markdown' }, + }, + indent = { enable = true, disable = { 'ruby' } }, + }, + config = function(_, opts) + end, +} diff --git a/dot_config/nvim/lua/plugins/vim-tmux-navigator.lua b/dot_config/nvim/lua/plugins/vim-tmux-navigator.lua new file mode 100644 index 0000000..ea628b1 --- /dev/null +++ b/dot_config/nvim/lua/plugins/vim-tmux-navigator.lua @@ -0,0 +1,17 @@ +return { + "christoomey/vim-tmux-navigator", + cmd = { + "TmuxNavigateLeft", + "TmuxNavigateDown", + "TmuxNavigateUp", + "TmuxNavigateRight", + "TmuxNavigatePrevious", + }, + keys = { + { "", "TmuxNavigateLeft" }, + { "", "TmuxNavigateDown" }, + { "", "TmuxNavigateUp" }, + { "", "TmuxNavigateRight" }, + { "", "TmuxNavigatePrevious" }, + }, +} diff --git a/dot_config/sway/executable_config b/dot_config/sway/executable_config new file mode 100644 index 0000000..7b75619 --- /dev/null +++ b/dot_config/sway/executable_config @@ -0,0 +1,244 @@ +# Default config for sway +# +# Copy this to ~/.config/sway/config and edit it to your liking. +# +# Read `man 5 sway` for a complete reference. + +### Variables +# +# Logo key. Use Mod1 for Alt. +set $mod Mod1 +# Home row direction keys, like vim +set $left h +set $down j +set $up k +set $right l +# Your preferred terminal emulator +set $term wezterm +# Your preferred application launcher +# Note: pass the final command to swaymsg so that the resulting window can be opened +# on the original workspace that the command was run on. +set $menu exec rofi -show drun -theme android_notification + +### Output configuration +# +# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/) +output * bg ~/Pictures/thumbnail.png center +# +# Example configuration: +# +# output HDMI-A-1 resolution 1920x1080 position 1920,0 +# +# You can get the names of your outputs by running: swaymsg -t get_outputs + +### Idle configuration +# +# Example configuration: +# +# exec swayidle -w \ +# timeout 300 'swaylock -f -c 000000' \ +# timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \ +# before-sleep 'swaylock -f -c 000000' +# +# This will lock your screen after 300 seconds of inactivity, then turn off +# your displays after another 300 seconds, and turn your screens back on when +# resumed. It will also lock your screen before your computer goes to sleep. + +### Input configuration +# +# Example configuration: +# +# input "2:14:SynPS/2_Synaptics_TouchPad" { +# dwt enabled +# tap enabled +# natural_scroll enabled +# middle_emulation enabled +# } +# +# You can get the names of your inputs by running: swaymsg -t get_inputs +# Read `man 5 sway-input` for more information about this section. + +### Key bindings +# +# Basics: +# + # Start a terminal + bindsym $mod+Shift+Return exec $term + + # Kill focused window + bindsym $mod+Shift+q kill + + # Start your launcher + bindsym $mod+d exec $menu + + # Drag floating windows by holding down $mod and left mouse button. + # Resize them with right mouse button + $mod. + # Despite the name, also works for non-floating windows. + # Change normal to inverse to use left mouse button for resizing and right + # mouse button for dragging. + floating_modifier $mod normal + + # Reload the configuration file + bindsym $mod+Shift+c reload + + # Exit sway (logs you out of your Wayland session) + bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit' + # Lock screen + bindsym $mod+Shift+m exec lock +# +# Moving around: +# + # Move your focus around + bindsym $mod+$left focus left + bindsym $mod+$down focus down + bindsym $mod+$up focus up + bindsym $mod+$right focus right + # Or use $mod+[up|down|left|right] + bindsym $mod+Left focus left + bindsym $mod+Down focus down + bindsym $mod+Up focus up + bindsym $mod+Right focus right + + # Move the focused window with the same, but add Shift + bindsym $mod+Shift+$left move left + bindsym $mod+Shift+$down move down + bindsym $mod+Shift+$up move up + bindsym $mod+Shift+$right move right + # Ditto, with arrow keys + bindsym $mod+Shift+Left move left + bindsym $mod+Shift+Down move down + bindsym $mod+Shift+Up move up + bindsym $mod+Shift+Right move right +# +# Workspaces: +# + # Switch to workspace + bindsym $mod+1 workspace number 1 + bindsym $mod+2 workspace number 2 + bindsym $mod+3 workspace number 3 + bindsym $mod+4 workspace number 4 + bindsym $mod+5 workspace number 5 + bindsym $mod+6 workspace number 6 + bindsym $mod+7 workspace number 7 + bindsym $mod+8 workspace number 8 + bindsym $mod+9 workspace number 9 + bindsym $mod+0 workspace number 10 + # Move focused container to workspace + bindsym $mod+Shift+1 move container to workspace number 1 + bindsym $mod+Shift+2 move container to workspace number 2 + bindsym $mod+Shift+3 move container to workspace number 3 + bindsym $mod+Shift+4 move container to workspace number 4 + bindsym $mod+Shift+5 move container to workspace number 5 + bindsym $mod+Shift+6 move container to workspace number 6 + bindsym $mod+Shift+7 move container to workspace number 7 + bindsym $mod+Shift+8 move container to workspace number 8 + bindsym $mod+Shift+9 move container to workspace number 9 + bindsym $mod+Shift+0 move container to workspace number 10 + # Note: workspaces can have any name you want, not just numbers. + # We just use 1-10 as the default. +# +# Layout stuff: +# + # You can "split" the current object of your focus with + # $mod+b or $mod+v, for horizontal and vertical splits + # respectively. + bindsym $mod+b splith + bindsym $mod+v splitv + + # Switch the current container between different layout styles + bindsym $mod+s layout stacking + bindsym $mod+w layout tabbed + bindsym $mod+e layout toggle split + + # Make the current focus fullscreen + bindsym $mod+f fullscreen + + # Toggle the current focus between tiling and floating mode + bindsym $mod+Shift+space floating toggle + + # Swap focus between the tiling area and the floating area + bindsym $mod+space focus mode_toggle + + # Move focus to the parent container + # bindsym $mod+a focus parent +# +# Scratchpad: +# + # Sway has a "scratchpad", which is a bag of holding for windows. + # You can send windows there and get them back later. + + # Move the currently focused window to the scratchpad + # bindsym $mod+Shift+minus move scratchpad + + # Show the next scratchpad window or hide the focused scratchpad window. + # If there are multiple scratchpad windows, this command cycles through them. + # bindsym $mod+minus scratchpad show +# +# Resizing containers: +# +mode "resize" { + # left will shrink the containers width + # right will grow the containers width + # up will shrink the containers height + # down will grow the containers height + bindsym $left resize shrink width 10px + bindsym $down resize grow height 10px + bindsym $up resize shrink height 10px + bindsym $right resize grow width 10px + + # Ditto, with arrow keys + bindsym Left resize shrink width 10px + bindsym Down resize grow height 10px + bindsym Up resize shrink height 10px + bindsym Right resize grow width 10px + + # Return to default mode + bindsym Return mode "default" + bindsym Escape mode "default" +} +bindsym $mod+r mode "resize" + +bar swaybar_command waybar + +default_border pixel +default_floating_border pixel +gaps inner 10 + +bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% +bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% +bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle +bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle +bindsym XF86MonBrightnessDown exec brightnessctl set 5%- +bindsym XF86MonBrightnessUp exec brightnessctl set 5%+ +bindsym XF86AudioPlay exec playerctl play-pause +bindsym XF86AudioNext exec playerctl next +bindsym XF86AudioPrev exec playerctl previous +bindsym XF86Search exec $menu + +# exec mpd-mpris +# exec easyeffects --gapplication-service +exec mako +# exec mpc clear && mpc add / +# exec fcitx5 -D +exec gammastep +exec kanshi +exec kdeconnectd +exec udiskie +exec keepassxc --minimized +exec /usr/lib/hyprpolkitagent/hyprpolkitagent + +bindsym $mod+Shift+y exec 'swaylock -f -c 000000' + +bindsym $mod+tab workspace next + +# # capture all screens to clipboard +bindsym Shift+Print exec flameshot gui -r | rpaste | wl-copy + +# capture the specified screen area to clipboard +bindsym Print exec flameshot gui + +seat * hide_cursor 4000 + +exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway + +include /etc/sway/config.d/* diff --git a/dot_config/sway/executable_launcher.sh b/dot_config/sway/executable_launcher.sh new file mode 100644 index 0000000..2034ed3 --- /dev/null +++ b/dot_config/sway/executable_launcher.sh @@ -0,0 +1,350 @@ +#!/usr/bin/env bash +# terminal application launcher for sway, using fzf +# Based on: https://gitlab.com/FlyingWombat/my-scripts/blob/master/sway-launcher +# https://gist.github.com/Biont/40ef59652acf3673520c7a03c9f22d2a +shopt -s nullglob globstar +set -o pipefail +if ! { exec 0>&3; } 1>/dev/null 2>&1; then + exec 3>/dev/null # If file descriptor 3 is unused in parent shell, output to /dev/null +fi +# shellcheck disable=SC2154 +trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR +IFS=$'\n\t' +DEL=$'\34' + +TERMINAL_COMMAND="foot" +GLYPH_COMMAND="${GLYPH_COMMAND- }" +GLYPH_DESKTOP="${GLYPH_DESKTOP- }" +CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/sway-launcher-desktop" +PROVIDERS_FILE="${PROVIDERS_FILE:=providers.conf}" +if [[ "${PROVIDERS_FILE#/}" == "${PROVIDERS_FILE}" ]]; then + # $PROVIDERS_FILE is a relative path, prepend $CONFIG_DIR + PROVIDERS_FILE="${CONFIG_DIR}/${PROVIDERS_FILE}" +fi + +# Provider config entries are separated by the field separator \034 and have the following structure: +# list_cmd,preview_cmd,launch_cmd,purge_cmd +declare -A PROVIDERS +if [ -f "${PROVIDERS_FILE}" ]; then + eval "$(awk -F= ' + BEGINFILE{ provider=""; } + /^\[.*\]/{sub("^\\[", "");sub("\\]$", "");provider=$0} + /^(launch|list|preview|purge)_cmd/{st = index($0,"=");providers[provider][$1] = substr($0,st+1)} + ENDFILE{ + for (key in providers){ + if(!("list_cmd" in providers[key])){continue;} + if(!("launch_cmd" in providers[key])){continue;} + if(!("preview_cmd" in providers[key])){continue;} + if(!("purge_cmd" in providers[key])){providers[key]["purge_cmd"] = "exit 0";} + for (entry in providers[key]){ + gsub(/[\x27,\047]/,"\x27\"\x27\"\x27", providers[key][entry]) + } + print "PROVIDERS[\x27" key "\x27]=\x27" providers[key]["list_cmd"] "\034" providers[key]["preview_cmd"] "\034" providers[key]["launch_cmd"] "\034" providers[key]["purge_cmd"] "\x27\n" + } + }' "${PROVIDERS_FILE}")" + if [[ ! -v HIST_FILE ]]; then + HIST_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/${0##*/}-${PROVIDERS_FILE##*/}-history.txt" + fi +else + PROVIDERS['desktop']="${0} list-entries${DEL}${0} describe-desktop \"{1}\"${DEL}${0} run-desktop '{1}' {2}${DEL}test -f '{1}' || exit 43" + PROVIDERS['command']="${0} list-commands${DEL}${0} describe-command \"{1}\"${DEL}${TERMINAL_COMMAND} {1}${DEL}command -v '{1}' || exit 43" + if [[ ! -v HIST_FILE ]]; then + HIST_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/${0##*/}-history.txt" + fi +fi +PROVIDERS['user']="exit${DEL}exit${DEL}{1}" # Fallback provider that simply executes the exact command if there were no matches + +if [[ -n "${HIST_FILE}" ]]; then + mkdir -p "${HIST_FILE%/*}" && touch "$HIST_FILE" + readarray HIST_LINES <"$HIST_FILE" +fi + +function describe() { + # shellcheck disable=SC2086 + readarray -d ${DEL} -t PROVIDER_ARGS <<<${PROVIDERS[${1}]} + # shellcheck disable=SC2086 + [ -n "${PROVIDER_ARGS[1]}" ] && eval "${PROVIDER_ARGS[1]//\{1\}/${2}}" +} +function describe-desktop() { + description=$(sed -ne '/^Comment=/{s/^Comment=//;p;q}' "$1") + echo -e "\033[33m$(sed -ne '/^Name=/{s/^Name=//;p;q}' "$1")\033[0m" + echo "${description:-No description}" +} +function describe-command() { + readarray arr < <(whatis -l "$1" 2>/dev/null) + description="${arr[0]}" + description="${description#* - }" + echo -e "\033[33m${1}\033[0m" + echo "${description:-No description}" +} + +function provide() { + # shellcheck disable=SC2086 + readarray -d ${DEL} -t PROVIDER_ARGS <<<${PROVIDERS[$1]} + eval "${PROVIDER_ARGS[0]}" +} +function list-commands() { + IFS=: read -ra path <<<"$PATH" + for dir in "${path[@]}"; do + printf '%s\n' "$dir/"* | + awk -F / -v pre="$GLYPH_COMMAND" '{print $NF "\034command\034\033[31m" pre "\033[0m" $NF;}' + done | sort -u +} +function list-entries() { + # Get locations of desktop application folders according to spec + # https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html + IFS=':' read -ra DIRS <<<"${XDG_DATA_HOME-${HOME}/.local/share}:${XDG_DATA_DIRS-/usr/local/share:/usr/share}" + for i in "${!DIRS[@]}"; do + if [[ ! -d "${DIRS[i]}" ]]; then + unset -v 'DIRS[$i]' + else + DIRS[$i]="${DIRS[i]}/applications/**/*.desktop" + fi + done + # shellcheck disable=SC2068 + entries ${DIRS[@]} +} +function entries() { + # shellcheck disable=SC2068 + awk -v pre="$GLYPH_DESKTOP" -F= ' + function desktopFileID(filename){ + sub("^.*applications/", "", filename); + sub("/", "-", filename); + return filename + } + BEGINFILE{ + application=0; + hidden=0; + block=""; + a=0 + + id=desktopFileID(FILENAME) + if(id in fileIds){ + nextfile; + }else{ + fileIds[id]=0 + } + } + /^\[Desktop Entry\]/{block="entry"} + /^Type=Application/{application=1} + /^\[Desktop Action/{ + sub("^\\[Desktop Action ", ""); + sub("\\]$", ""); + block="action"; + a++; + actions[a,"key"]=$0 + } + /^\[X-/{ + sub("^\\[X-", ""); + sub("\\]$", ""); + block="action"; + a++; + actions[a,"key"]=$0 + } + /^Name=/{ (block=="action")? actions[a,"name"]=$2 : name=$2 } + /^NoDisplay=true/{ (block=="action")? actions[a,"hidden"]=1 : hidden=1 } + ENDFILE{ + if (application){ + if (!hidden) + print FILENAME "\034desktop\034\033[33m" pre name "\033[0m"; + if (a>0) + for (i=1; i<=a; i++) + if (!actions[i, "hidden"]) + print FILENAME "\034desktop\034\033[33m" pre name "\033[0m (" actions[i, "name"] ")\034" actions[i, "key"] + } + }' \ + $@ &3)" + echo "Generated Launch command from .desktop file: ${CMD}" >&3 + eval "${CMD}" +} +function generate-command() { + # Define the search pattern that specifies the block to search for within the .desktop file + PATTERN="^\\\\[Desktop Entry\\\\]" + if [[ -n $2 ]]; then + PATTERN="^\\\\[Desktop Action ${2}\\\\]" + fi + echo "Searching for pattern: ${PATTERN}" >&3 + # 1. We see a line starting [Desktop, but we're already searching: deactivate search again + # 2. We see the specified pattern: start search + # 3. We see an Exec= line during search: remove field codes and set variable + # 3. We see a Path= line during search: set variable + # 4. Finally, build command line + awk -v pattern="${PATTERN}" -v terminal_cmd="${TERMINAL_COMMAND}" -F= ' + BEGIN{a=0;exec=0;path=0} + /^\[Desktop/{ + if(a){ a=0 } + } + $0 ~ pattern{ a=1 } + /^Terminal=/{ + sub("^Terminal=", ""); + if ($0 == "true") { terminal=1 } + } + /^Exec=/{ + if(a && !exec){ + sub("^Exec=", ""); + gsub(" ?%[cDdFfikmNnUuv]", ""); + exec=$0; + } + } + /^Path=/{ + if(a && !path){ path=$2 } + } + END{ + if(path){ printf "cd " path " && " } + printf "exec " + if (terminal){ printf terminal_cmd " " } + print exec + }' "$1" +} + +function autostart() { + for application in $(list-autostart); do + (exec setsid /bin/sh -c "$(run-desktop "${application}")" &>/dev/null &) + done +} + +function list-autostart() { + # Get locations of desktop application folders according to spec + # https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html + IFS=':' read -ra DIRS <<<"${XDG_CONFIG_HOME-${HOME}/.config}:${XDG_CONFIG_DIRS-/etc/xdg}" + for i in "${!DIRS[@]}"; do + if [[ ! -d "${DIRS[i]}" ]]; then + unset -v 'DIRS[$i]' + else + DIRS[$i]="${DIRS[i]}/autostart/*.desktop" + fi + done + + # shellcheck disable=SC2068 + awk -v pre="$GLYPH_DESKTOP" -F= ' + function desktopFileID(filename){ + sub("^.*autostart/", "", filename); + sub("/", "-", filename); + return filename + } + BEGINFILE{ + application=0; + block=""; + disabled=0; + a=0 + + id=desktopFileID(FILENAME) + if(id in fileIds){ + nextfile; + }else{ + fileIds[id]=0 + } + } + /^\[Desktop Entry\]/{block="entry"} + /^Type=Application/{application=1} + /^Name=/{ iname=$2 } + /^Hidden=true/{disabled=1} + ENDFILE{ + if (application && !disabled){ + print FILENAME; + } + }' \ + ${DIRS[@]} "${HIST_FILE}" + declare -A PURGE_CMDS + for PROVIDER_NAME in "${!PROVIDERS[@]}"; do + readarray -td ${DEL} PROVIDER_ARGS <<<${PROVIDERS[${PROVIDER_NAME}]} + PURGE_CMD=${PROVIDER_ARGS[3]} + [ -z "${PURGE_CMD}" ] && PURGE_CMD='test -f "{1}" || exit 43' + PURGE_CMDS[$PROVIDER_NAME]="${PURGE_CMD%$'\n'}" + done + for HIST_LINE in "${HIST_LINES[@]#*' '}"; do + readarray -td $'\034' HIST_ENTRY <<<${HIST_LINE} + ENTRY=${HIST_ENTRY[1]} + readarray -td ' ' FILTER <<<${PURGE_CMDS[$ENTRY]//\{1\}/${HIST_ENTRY[0]}} + (eval "${FILTER[@]}" 1>/dev/null) # Run filter command discarding output. We only want the exit status + if [[ $? -ne 43 ]]; then + echo "1 ${HIST_LINE[@]%$'\n'}" >> "${HIST_FILE}" + fi + done +} + +case "$1" in +describe | describe-desktop | describe-command | entries | list-entries | list-commands | list-autostart | generate-command | autostart | run-desktop | provide | purge) + "$@" + exit + ;; +esac +echo "Starting launcher instance with the following providers:" "${!PROVIDERS[@]}" >&3 + +FZFPIPE=$(mktemp -u) +mkfifo "$FZFPIPE" +trap 'rm "$FZFPIPE"' EXIT INT + +# Append Launcher History, removing usage count +(printf '%s' "${HIST_LINES[@]#* }" >>"$FZFPIPE") & + +# Iterate over providers and run their list-command +for PROVIDER_NAME in "${!PROVIDERS[@]}"; do + (bash -c "${0} provide ${PROVIDER_NAME}" >>"$FZFPIPE") & +done + +readarray -t COMMAND_STR <<<$( + fzf --ansi +s -x -d '\034' --nth ..3 --with-nth 3 \ + --print-query \ + --preview "$0 describe {2} {1}" \ + --preview-window=up:2:noborder \ + --no-multi --cycle \ + --prompt="${GLYPH_PROMPT-# }" \ + --header='' --no-info --margin='1,2' \ + --color='16,gutter:-1' \ + <"$FZFPIPE" +) || exit 1 +# Get the last line of the fzf output. If there were no matches, it contains the query which we'll treat as a custom command +# If there were matches, it contains the selected item +COMMAND_STR=$(printf '%s\n' "${COMMAND_STR[@]: -1}") +# We still need to format the query to conform to our fallback provider. +# We check for the presence of field separator character to determine if we're dealing with a custom command +if [[ $COMMAND_STR != *$'\034'* ]]; then + COMMAND_STR="${COMMAND_STR}"$'\034user\034'"${COMMAND_STR}"$'\034' + SKIP_HIST=1 # I chose not to include custom commands in the history. If this is a bad idea, open an issue please +fi + +[ -z "$COMMAND_STR" ] && exit 1 + +if [[ -n "${HIST_FILE}" && ! "$SKIP_HIST" ]]; then + # update history + for i in "${!HIST_LINES[@]}"; do + if [[ "${HIST_LINES[i]}" == *" $COMMAND_STR"$'\n' ]]; then + HIST_COUNT=${HIST_LINES[i]%% *} + HIST_LINES[$i]="$((HIST_COUNT + 1)) $COMMAND_STR"$'\n' + match=1 + break + fi + done + if ! ((match)); then + HIST_LINES+=("1 $COMMAND_STR"$'\n') + fi + + printf '%s' "${HIST_LINES[@]}" | sort -nr >"$HIST_FILE" +fi + +# shellcheck disable=SC2086 +readarray -d $'\034' -t PARAMS <<<${COMMAND_STR} +# shellcheck disable=SC2086 +readarray -d ${DEL} -t PROVIDER_ARGS <<<${PROVIDERS[${PARAMS[1]}]} +# Substitute {1}, {2} etc with the correct values +COMMAND=${PROVIDER_ARGS[2]//\{1\}/${PARAMS[0]}} +COMMAND=${COMMAND//\{2\}/${PARAMS[3]}} +COMMAND=${COMMAND%%[[:space:]]} + +if [ -t 1 ]; then + echo "Launching command: ${COMMAND}" >&3 + setsid /bin/sh -c "${COMMAND}" >&/dev/null {}" + }, + "sway/window": { + "format": "{}", + "max-length": 50, + "tooltip": false + }, + "bluetooth": { + "interval": 30, + "format": "{icon}", + // "format-alt": "{status}", + "format-icons": { + "enabled": "", + "disabled": "" + }, + "on-click": "blueberry" + }, + "sway/language": { + "format": " {}", + // "max-length": 5, + "min-length": 5, + }, + "idle_inhibitor": { + "format": "{icon}", + "format-icons": { + "activated": "", + "deactivated": "" + }, + "tooltip": "true" + }, + "tray": { + //"icon-size": 11, + "spacing": 5 + }, + "custom/vpn": { + "format": "VPN ", + "exec": "echo '{\"class\": \"connected\"}'", + "exec-if": "test -d /proc/sys/net/ipv4/conf/wg0-mullvad", + "return-type": "json", + "interval": 5, + + }, + "clock": { + "format": " {:%I:%M %p  %b %e}", + "tooltip-format": "{:%Y %B}\n{calendar}", + "today-format": "{}", + "on-click": "gnome-calendar" + }, + "cpu": { + "interval": "1", + "format": " {max_frequency}GHz | {usage}%", + //"max-length": 13, + "min-length": 13, + "on-click": "wezterm -e htop --sort-key PERCENT_CPU", + "tooltip": false + }, + "temperature": { + //"thermal-zone": 1, + "interval": "4", + "hwmon-path": "/sys/class/hwmon/hwmon3/temp1_input", + "critical-threshold": 74, + "format-critical": " {temperatureC}°C", + "format": "{icon} {temperatureC}°C", + "format-icons": ["", "", ""], + "max-length": 7, + "min-length": 7 + }, + "network": { + // "interface": "wlan0", // (Optional) To force the use of this interface, + "format-wifi": " ", + "format-ethernet": "{ifname}: {ipaddr}/{cidr} 󰈀", + "format-linked": "{ifname} (No IP) 󰈀", + "format-disconnected": "", + "format-alt": "{ifname}: {ipaddr}/{cidr}", + "family": "ipv4", + "tooltip-format-wifi": " {ifname} @ {essid}\nIP: {ipaddr}\nStrength: {signalStrength}%\nFreq: {frequency}MHz\n {bandwidthUpBits}  {bandwidthDownBits}", + "tooltip-format-ethernet": "󰈀 {ifname}\nIP: {ipaddr}\n {bandwidthUpBits}  {bandwidthDownBits}" + }, + "pulseaudio": { + "scroll-step": 3, // %, can be a float + "format": "{icon} {volume}% {format_source}", + "format-bluetooth": "{volume}% {icon} {format_source}", + "format-bluetooth-muted": " {icon} {format_source}", + "format-muted": " {format_source}", + //"format-source": "{volume}% ", + //"format-source-muted": "", + "format-source": "", + "format-source-muted": "", + "format-icons": { + "headphone": "", + "hands-free": "", + "headset": "", + "phone": "", + "portable": "", + "car": "", + "default": ["", "", ""] + }, + "on-click": "pavucontrol", + "on-click-right": "pactl set-source-mute @DEFAULT_SOURCE@ toggle" + }, + "custom/pacman": { + "format": " {}", + "interval": 3600, // every hour + "exec": "checkupdates | wc -l", // # of updates + "exec-if": "exit 0", // always run; consider advanced run conditions + "on-click": "wezterm -e 'paru'; pkill -SIGRTMIN+8 waybar", // update system + "signal": 8, + // "max-length": 5, + "min-length": 3 + }, + "custom/weather": { + "exec": "curl 'https://wttr.in/?format=1'", + "interval": 3600 + }, + "custom/gpu": { + "exec": "$HOME/.config/waybar/custom_modules/custom-gpu.sh", + "return-type": "json", + "format": "{}", + "interval": 2, + "tooltip": "{tooltip}", + // "max-length": 19, + "on-click": "powerupp" + + }, + "custom/cpugovernor": { + "format": "{icon}", + "interval": "30", + "return-type": "json", + "exec": "$HOME/.config/waybar/custom_modules/cpugovernor.sh", + "min-length": 2, + "max-length": 2, + "format-icons": { + "perf": "", + "sched": "" + }, + }, + "custom/media": { + "format": "{icon} {}", + "return-type": "json", + "max-length": 40, + "format-icons": { + "spotify": "", + "default": "🎜" + }, + "escape": true, + "exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder + // "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name + }, + "custom/scratchpad-indicator": { + "interval": 3, + "return-type": "json", + "exec": "swaymsg -t get_tree | jq --unbuffered --compact-output '( select(.name == \"root\") | .nodes[] | select(.name == \"__i3\") | .nodes[] | select(.name == \"__i3_scratch\") | .focus) as $scratch_ids | [.. | (.nodes? + .floating_nodes?) // empty | .[] | select(.id |IN($scratch_ids[]))] as $scratch_nodes | { text: \"\\($scratch_nodes | length)\", tooltip: $scratch_nodes | map(\"\\(.app_id // .window_properties.class) (\\(.id)): \\(.name)\") | join(\"\\n\") }'", + "format": "{} 􏠜", + "on-click": "exec swaymsg 'scratchpad show'", + "on-click-right": "exec swaymsg 'move scratchpad'" + }, + "custom/pomodoro": { + "format": "{}", + "return-type": "json", + "exec": "waybar-module-pomodoro -w 30 -l 20", + "on-click": "waybar-module-pomodoro toggle", + "on-click-right": "waybar-module-pomodoro reset", + }, + "custom/crypto": { + "format": "{}", + "interval": 600, + "return-type": "json", + "exec": "waybar-crypto", // change this if you installed manually + "exec-if": "ping pro-api.coinmarketcap.com -c1" + }, +} diff --git a/dot_config/waybar/custom_modules/executable_cpugovernor.sh b/dot_config/waybar/custom_modules/executable_cpugovernor.sh new file mode 100644 index 0000000..bdd0b00 --- /dev/null +++ b/dot_config/waybar/custom_modules/executable_cpugovernor.sh @@ -0,0 +1,7 @@ +#!/bin/bash +if [ `cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor`="performance" ]; then + echo '{"text": "perf", "alt": "perf", "class": "performance", "tooltip": "Governor Performance"}' + #echo '' +elif [ `cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor`="schedutil" ]; then + echo '{"text": "sched", "class": "schedutil", "tooltip": "Governor Schedutil"}' +fi \ No newline at end of file diff --git a/dot_config/waybar/custom_modules/executable_custom-gpu.sh b/dot_config/waybar/custom_modules/executable_custom-gpu.sh new file mode 100644 index 0000000..822704b --- /dev/null +++ b/dot_config/waybar/custom_modules/executable_custom-gpu.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +raw_clock=$(cat /sys/class/drm/card1/device/pp_dpm_sclk | grep -oe '[0-9]{0,4}Mhz \W' | sed "s/Mhz \*//") +# clock=$(echo "scale=1;$raw_clock/1000" | bc | sed -e 's/^-\./-0./' -e 's/^\./0./') + +raw_temp=$(cat /sys/class/drm/card1/device/hwmon/hwmon4/temp1_input) +temperature=$(($raw_temp/1000)) +busypercent=$(cat /sys/class/hwmon/hwmon4/device/gpu_busy_percent) +deviceinfo=$(glxinfo -B | grep 'Device:' | sed 's/^.*: //') +driverinfo=$(glxinfo -B | grep "OpenGL version") + +# echo '{"text": "'$clock'GHz |  '$temperature'°C | '$busypercent'%", "class": "custom-gpu", "tooltip": "'$deviceinfo'\n'$driverinfo'"}' + +echo '{"text": "'$temperature'°C | '$busypercent'%", "class": "custom-gpu", "tooltip": "'$deviceinfo'\n'$driverinfo'"}' diff --git a/dot