diff --git a/.config/lf/lfrc b/.config/lf/lfrc index ae9a238..9f6958e 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -18,6 +18,15 @@ set cleaner ctpvclear &ctpv -s $id &ctpvquit $id +cmd on-cd &{{ + printf "\033]0; $PWD\007" > /dev/tty + export STARSHIP_SHELL= + fmt="$(starship prompt)" + lf -remote "send $id set promptfmt \"$fmt\"" +}} + +on-cd + # cmds/functions cmd open ${{ case $(file --mime-type "$(readlink -f $f)" -b) in @@ -49,13 +58,6 @@ cmd open ${{ esac }} -cmd on-cd &{{ - export STARSHIP_SHELL= - fmt="$(starship prompt)" - lf -remote "send $id set promptfmt \"$fmt\"" -}} - - cmd fzf_search ${{ selected=$(fzf-fd) if [ -n "$selected" ]; then @@ -64,14 +66,6 @@ cmd fzf_search ${{ fi }} -cmd fzf_grep ${{ - fzf-grep "$PWD" -}} - -cmd lazygit ${{ - lazygit -}} - cmd live_server ${{ setsid -f live-server "$PWD" }} @@ -162,27 +156,74 @@ cmd git_branch ${{ lf -remote "send $id updir" lf -remote "send $id cd \"$pwd_shell\"" }} +cmd git_root ${{ + root="$(git rev-parse --show-toplevel 2>/dev/null)" + if [ -n "$root" ]; then + lf -remote "send $id cd $root" + else + printf "Not in a git repository" + read -r _ + exit 1 + fi +}} map gb :git_branch +map gr :git_root map gp ${{clear; git pull --rebase || true; echo "press ENTER"; read ENTER}} map gs ${{clear; git status; echo "press ENTER"; read ENTER}} map gl ${{clear; git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit}} cmd sanitize ${{ set -f - # Only renames selected files. sanitizefs ${fx} - # renames Recursively. # sanitizefs ${PWD} }} +cmd resize-for-wallpaper ${{ + resolution=$(xrandr | grep '*' | awk '{print $1}' | head -n 1) + default_resolution="1366x768" + if [ -z "$resolution" ]; then + resolution=$default_resolution + fi + for input_image in $fx; do + filename=$(basename "$input_image") + extension="${filename##*.}" + filename="${filename%.*}" + output_image="${filename}-${resolution}.${extension}" + magick "$input_image" -resize "$resolution" "$output_image" + done +}} + +cmd toggle_preview %{{ + if [ "$lf_preview" = "true" ]; then + lf -remote "send $id :set preview false; set ratios 1:5" + else + lf -remote "send $id :set preview true; set ratios 1:2:3" + fi +}} + +cmd change_preview %{{ + if [ "$lf_previewer" = "ctpv" ]; then + lf -remote "send $id :set previewer exiftool; reload" + else + lf -remote "send $id :set previewer ctpv; reload" + fi +}} + +cmd share $curl -F"file=@$fx" -Fexpires=24 https://0x0.st | xclip -selection c + +map zp toggle_preview +map ze change_preview + # Bindings map :quit map / :fzf_search -map ? :fzf_grep -map live_server +map ? $fzf-grep "$PWD" +map sw $setsid -f live-server "$PWD" >/dev/null 2>&1 map J $lf -remote "send $id cd $(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf)" map r sanitize -map gh lazygit +map so $organize +map resize-for-wallpaper +map gh $lazygit map gg top map D delete map E extract diff --git a/.config/newsboat/config b/.config/newsboat/config index 23675da..0773254 100644 --- a/.config/newsboat/config +++ b/.config/newsboat/config @@ -33,7 +33,7 @@ browser linkhandler macro , open-in-browser macro t set browser "qndl" ; open-in-browser ; set browser linkhandler macro a set browser "tsp yt-dlp --embed-metadata -xic -f bestaudio/best --restrict-filenames" ; open-in-browser ; set browser linkhandler -macro v set browser "setsid -f mpv" ; open-in-browser ; set browser linkhandler +macro v set browser "setsid -f mpv >/dev/null 2>&1" ; open-in-browser ; set browser linkhandler macro w set browser "lynx" ; open-in-browser ; set browser linkhandler macro d set browser "dmenuhandler" ; open-in-browser ; set browser linkhandler macro c set browser "echo %u | xclip -r -sel c" ; open-in-browser ; set browser linkhandler diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index a52305d..fead070 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -5,10 +5,3 @@ require("options") require("manager") require("autocommands") require("mappings") - --- vim.cmd("hi Keyword gui=italic,bold cterm=italic,bold") -vim.cmd("hi Comment gui=italic cterm=italic") -vim.api.nvim_set_hl(0, "DiagnosticVirtualTextError", { link = "Comment" }) -vim.api.nvim_set_hl(0, "DiagnosticVirtualTextInfo", { link = "Comment" }) -vim.api.nvim_set_hl(0, "DiagnosticVirtualTextWarn", { link = "Comment" }) -vim.api.nvim_set_hl(0, "DiagnosticVirtualTextHint", { link = "Comment" }) diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index d2d8861..74069fc 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,6 +1,6 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, - "LuaSnip": { "branch": "master", "commit": "50fcf17db7c75af80e6b6109acfbfb4504768780" }, + "LuaSnip": { "branch": "master", "commit": "ce0a05ab4e2839e1c48d072c5236cce846a387bc" }, "alpha-nvim": { "branch": "main", "commit": "41283fb402713fc8b327e60907f74e46166f4cfd" }, "cmp-async-path": { "branch": "main", "commit": "7df7f3721c45aac26b6e0474087538f4681c9c7a" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, @@ -11,39 +11,39 @@ "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "flit.nvim": { "branch": "main", "commit": "a9be4e76c30a128f1e51af448c8321bf8366bcd4" }, "friendly-snippets": { "branch": "main", "commit": "682157939e57bd6a2c86277dfd4d6fbfce63dbac" }, - "fzf-lua": { "branch": "main", "commit": "235119b859d1d3dc136a5dbfd24b626b5af72130" }, - "gitsigns.nvim": { "branch": "main", "commit": "0dc886637f9686b7cfd245a4726f93abeab19d4a" }, + "fzf-lua": { "branch": "main", "commit": "3b91c1a471160bd8620bdca8f18743d954994daa" }, + "gitsigns.nvim": { "branch": "main", "commit": "39b5b6f48bde0595ce68007ffce408c5d7ac1f79" }, "harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" }, - "indent-blankline.nvim": { "branch": "master", "commit": "d98f537c3492e87b6dc6c2e3f66ac517528f406f" }, - "lazy.nvim": { "branch": "main", "commit": "bc620783663ab09d16bff9fdecc07da65b2a1528" }, + "indent-blankline.nvim": { "branch": "master", "commit": "65e20ab94a26d0e14acac5049b8641336819dfc7" }, + "lazy.nvim": { "branch": "main", "commit": "cea5920abb202753004440f94ec39bcf2927e02e" }, "leap.nvim": { "branch": "main", "commit": "eca8108dcd5f41fbde2a674dceb58b81ed887dc8" }, "lf.nvim": { "branch": "master", "commit": "69ab1efcffee6928bf68ac9bd0c016464d9b2c8b" }, - "lsp-zero.nvim": { "branch": "v3.x", "commit": "16de3b18c5f7b6230d89b8e64ce9a4801b6f8d08" }, + "lsp-zero.nvim": { "branch": "v3.x", "commit": "87701af045b3032515776abeb47eb8c2ddb5e679" }, "lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, "luasnip-latex-snippets.nvim": { "branch": "main", "commit": "4b91f28d91979f61a3e8aef1cee5b7c7f2c7beb8" }, "markdown-preview.nvim": { "branch": "main", "commit": "462ce41af003f5cdadab856f3a42dc27e39b89c8" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "37a336b653f8594df75c827ed589f1c91d91ff6c" }, - "mason-nvim-dap.nvim": { "branch": "main", "commit": "f5425eb1d0d794f0305d5eeebddabb74614683ff" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "4ba55f9755ebe8297d92c419b90a946123292ae6" }, "mason.nvim": { "branch": "main", "commit": "0950b15060067f752fde13a779a994f59516ce3d" }, - "mini.ai": { "branch": "main", "commit": "9fef1097bca44616133cde6a6769e7aa07d12d7d" }, - "mini.surround": { "branch": "main", "commit": "c40ac9c0060467a82430fab12d30395c5768b5e4" }, - "none-ls.nvim": { "branch": "main", "commit": "cc0a3c45047e3daf85d07c1571d65476cfce6480" }, - "nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" }, + "mini.ai": { "branch": "main", "commit": "45587078f323eaf41b9f701bbc04f8d1ab008979" }, + "mini.pairs": { "branch": "main", "commit": "927d19cbdd0e752ab1c7eed87072e71d2cd6ff51" }, + "mini.surround": { "branch": "main", "commit": "7098744c8d4573a4b32cb172965f6b2ba03465d2" }, + "none-ls.nvim": { "branch": "main", "commit": "0d1b3fa2ad0b371b94cb4b9a27ba6e5a1a915c91" }, "nvim-cmp": { "branch": "main", "commit": "a110e12d0b58eefcf5b771f533fc2cf3050680ac" }, "nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" }, "nvim-dap": { "branch": "master", "commit": "6f79b822997f2e8a789c6034e147d42bc6706770" }, "nvim-dap-ui": { "branch": "master", "commit": "b7267003ba4dd860350be86f75b9d9ea287cedca" }, - "nvim-dap-virtual-text": { "branch": "master", "commit": "d7c695ea39542f6da94ee4d66176f5d660ab0a77" }, + "nvim-dap-virtual-text": { "branch": "master", "commit": "484995d573c0f0563f6a66ebdd6c67b649489615" }, "nvim-html-css": { "branch": "main", "commit": "c514bd27ad560636ed39dea3e370b3103754e244" }, - "nvim-lspconfig": { "branch": "master", "commit": "6806370929cf6a35be6e5e0e74588515a4356e4d" }, + "nvim-lspconfig": { "branch": "master", "commit": "cf97d2485fc3f6d4df1b79a3ea183e24c272215e" }, "nvim-markdown": { "branch": "master", "commit": "bf5c87788156f072cfb87b994844424b164b5b44" }, "nvim-nio": { "branch": "master", "commit": "7969e0a8ffabdf210edd7978ec954a47a737bbcc" }, - "nvim-spectre": { "branch": "master", "commit": "ec67d4b5370094b923dfcf6b09b39142f2964861" }, - "nvim-treesitter": { "branch": "master", "commit": "b967bbc27b564001c3d3b8ea93444cf6d0b21d23" }, + "nvim-spectre": { "branch": "master", "commit": "49fae98ef2bfa8342522b337892992e3495065d5" }, + "nvim-treesitter": { "branch": "master", "commit": "acc1708b962e12cc1d671cd530782727801804c3" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" }, - "nvim-ts-autotag": { "branch": "main", "commit": "06fe07d7523ba8c755fac7c913fceba43b1720ee" }, - "nvim-ts-context-commentstring": { "branch": "main", "commit": "cb064386e667def1d241317deed9fd1b38f0dc2e" }, + "nvim-ts-autotag": { "branch": "main", "commit": "ddfccbf0df1b9349c2b9e9b17f4afa8f9b6c1ed1" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "2b7dcf6aab0947b9c4195f1d8aa592cdcd944ffe" }, "nvim-ufo": { "branch": "main", "commit": "aa2e676af592b4e99c105d80d6eafd1afc215d99" }, "nvim-web-devicons": { "branch": "master", "commit": "c0cfc1738361b5da1cd0a962dd6f774cc444f856" }, "outline.nvim": { "branch": "main", "commit": "028e0bc8ad3d511e9fc1f0678594a608eb908ee5" }, @@ -53,13 +53,14 @@ "promise-async": { "branch": "main", "commit": "28c1d5a295eb5310afa2523d4ae9aa41ec5a9de2" }, "qalc.nvim": { "branch": "main", "commit": "1b800b5d8f956c4780f079333cba4d8fb8c335a3" }, "qalculate.vim": { "branch": "main", "commit": "d0269924bfa623bf0f73218041241cc83e97379e" }, - "refactoring.nvim": { "branch": "master", "commit": "66fea340c84f43df696fe6d9f2a90796fbe9c9cf" }, + "refactoring.nvim": { "branch": "master", "commit": "c9c1a0995b7d9a534f3b9a4df7fd55240127eeb4" }, "todo-comments.nvim": { "branch": "main", "commit": "51e10f838e84b4756c16311d0b1ef0972c6482d2" }, - "toggleterm.nvim": { "branch": "main", "commit": "fee58a0473fd92b28c34f8f724e4918b15ba30a3" }, - "trouble.nvim": { "branch": "main", "commit": "2d8610a07033f2b367e71230ab128f8b89c2639d" }, + "toggleterm.nvim": { "branch": "main", "commit": "cd55bf6aab3f88c259fa29ea86bbdcb1a325687d" }, + "trouble.nvim": { "branch": "main", "commit": "42dcb58e95723f833135d5cf406c38bd54304389" }, "undotree": { "branch": "main", "commit": "eab459ab87dd249617b5f7187bb69e614a083047" }, + "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, "vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" }, - "vimtex": { "branch": "master", "commit": "8ed94566e6fe3f5b163131dc374d224d2d320db7" }, + "vimtex": { "branch": "master", "commit": "2dc2a5435809c13f6f4aa07964be4ef19a7864f5" }, "which-key.nvim": { "branch": "main", "commit": "0099511294f16b81c696004fa6a403b0ae61f7a0" }, "zen-mode.nvim": { "branch": "main", "commit": "78557d972b4bfbb7488e17b5703d25164ae64e6a" } } \ No newline at end of file diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua index 02924ab..48ff83a 100644 --- a/.config/nvim/lua/mappings.lua +++ b/.config/nvim/lua/mappings.lua @@ -26,7 +26,7 @@ vim.keymap.set("n", "", ":vsplit", { silent = true }) vim.keymap.set("n", "", ":split", { silent = true }) vim.keymap.set("n", "", ":w") vim.keymap.set('n', "gl", ':lua vim.diagnostic.open_float()') -vim.keymap.set("n", "cs", ":setlocal spell! spelllang=en_us", { desc = "Spellcheck", silent = true }) +vim.keymap.set("n", "cg", ":setlocal spell! spelllang=en_us", { desc = "Spellcheck", silent = true }) vim.keymap.set("x", "p", 'p:let @+=@0:let @"=@0', { silent = true }) vim.keymap.set("x", "K", ":m '<-2gv=gv") @@ -51,6 +51,18 @@ vim.keymap.set("t", "", "j") vim.keymap.set("t", "", "k") vim.keymap.set("t", "", "l") +vim.keymap.set("c", "", + function() + local mode = vim.fn.getcmdtype() + if mode == "?" or mode == "/" then + return ".*" + else + return " " + end + end, + { expr = true } +) + vim.keymap.set({ "x", "v", "n" }, ";", ":", { nowait = true }) vim.keymap.set({ "x", "v", "n" }, "", ":m .+1==") vim.keymap.set({ "x", "v", "n" }, "", ":m .-2==") diff --git a/.config/nvim/lua/plugins/editor.lua b/.config/nvim/lua/plugins/editor.lua index 1bfeabb..8e0c43c 100644 --- a/.config/nvim/lua/plugins/editor.lua +++ b/.config/nvim/lua/plugins/editor.lua @@ -156,7 +156,7 @@ return { -- illuminate { "RRethy/vim-illuminate", - enabled = false, + enabled = true, event = "VeryLazy", opts = { delay = 200, @@ -285,12 +285,37 @@ return { -- autopairs { "windwp/nvim-autopairs", + enabled = false, event = "InsertEnter", opts = { ignored_next_char = "[%w%.]", }, }, + { + "echasnovski/mini.pairs", + event = "VeryLazy", + opts = { + modes = { insert = true, command = true, terminal = false }, + -- skip autopair when next character is one of these + skip_next = [=[[%w%%%'%[%"%.%`%$]]=], + -- skip autopair when the cursor is inside these treesitter nodes + skip_ts = { "string" }, + -- skip autopair when next character is closing pair + -- and there are more closing pairs than opening pairs + skip_unbalanced = true, + -- better deal with markdown code blocks + markdown = true, + }, + keys = { + { + "up", + function() vim.g.minipairs_disable = not vim.g.minipairs_disable end, + desc = "Toggle Auto Pairs", + } + } + }, + -- leap { "ggandor/leap.nvim", diff --git a/.config/nvim/lua/plugins/fzf.lua b/.config/nvim/lua/plugins/fzf.lua index 1809cc9..5e90a86 100644 --- a/.config/nvim/lua/plugins/fzf.lua +++ b/.config/nvim/lua/plugins/fzf.lua @@ -7,25 +7,29 @@ return { { "l", function() require("fzf-lua").live_grep_native() end, desc = "Live Grep" }, { "o", function() require("fzf-lua").oldfiles() end, desc = "Open Recent file" }, { "b", function() require("fzf-lua").builtin() end, desc = "FZF menu" }, - { "ca", function() require("fzf-lua").lsp_code_actions() end, mode = { "n", "v" }, desc = "LSP Code Actions" }, - { "cd", function() require("fzf-lua").lsp_definitions() end, mode = { "n", "v" }, desc = "LSP Definitions" }, - { "cD", function() require("fzf-lua").lsp_declarations() end, mode = { "n", "v" }, desc = "LSP Declarations" }, - { "cI", function() require("fzf-lua").lsp_implementations() end, mode = { "n", "v" }, desc = "LSP Implementations" }, - { "cr", function() require("fzf-lua").lsp_references() end, mode = { "n", "v" }, desc = "LSP References" }, + { "ca", function() require("fzf-lua").lsp_code_actions() end, mode = { "n", "v" }, desc = "LSP Code Actions" }, + { "cd", function() require("fzf-lua").lsp_definitions() end, mode = { "n", "v" }, desc = "LSP Definitions" }, + { "cD", function() require("fzf-lua").lsp_declarations() end, mode = { "n", "v" }, desc = "LSP Declarations" }, + { "cI", function() require("fzf-lua").lsp_implementations() end, mode = { "n", "v" }, desc = "LSP Implementations" }, + { "cr", function() require("fzf-lua").lsp_references() end, mode = { "n", "v" }, desc = "LSP References" }, { "ce", function() require("fzf-lua").lsp_document_diagnostics() end, desc = "LSP Diagnostics" }, { "cwe", function() require("fzf-lua").lsp_workspace_diagnostics() end, desc = "LSP Workspace Diagnostics" }, - { "cD", function() require("fzf-lua").lsp_declarations() end, mode = { "n", "v" }, desc = "LSP Declarations" }, + { "cs", function() require("fzf-lua").lsp_document_symbols() end, desc = "Symbols" }, + { "cS", function() require("fzf-lua").lsp_workspace_symbols() end, desc = "Workspace Symbols" }, + { "cD", function() require("fzf-lua").lsp_declarations() end, mode = { "n", "v" }, desc = "LSP Declarations" }, }, - opts = { - previewers = { - builtin = { - extensions = { - ["png"] = { "ueberzug" }, - ["jpg"] = { "ueberzug" }, - }, - ueberzug_scaler = "cover", + config = function() + require("fzf-lua").setup({ + previewers = { + builtin = { + extensions = { + ["png"] = { "ueberzug" }, + ["jpg"] = { "ueberzug" }, + }, + ueberzug_scaler = "fit_contain", + } } - } - } + }) + end, } } diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua index cc258f6..7d261a9 100644 --- a/.config/nvim/lua/plugins/lsp.lua +++ b/.config/nvim/lua/plugins/lsp.lua @@ -132,6 +132,13 @@ return { severity_sort = true, }) + -- vim.cmd("hi Keyword gui=italic,bold cterm=italic,bold") + vim.cmd("hi Comment gui=italic cterm=italic") + vim.api.nvim_set_hl(0, "DiagnosticVirtualTextError", { link = "Comment" }) + vim.api.nvim_set_hl(0, "DiagnosticVirtualTextInfo", { link = "Comment" }) + vim.api.nvim_set_hl(0, "DiagnosticVirtualTextWarn", { link = "Comment" }) + vim.api.nvim_set_hl(0, "DiagnosticVirtualTextHint", { link = "Comment" }) + require("mason-lspconfig").setup({ ensure_installed = { "clangd", @@ -144,6 +151,7 @@ return { "texlab", "jsonls", "eslint", + "vtsls", }, handlers = { lsp_zero.default_setup, @@ -190,6 +198,44 @@ return { -- }, -- }) -- end, + vtsls = function() + require("lspconfig").vtsls.setup({ + filetypes = { + "javascript", + "javascriptreact", + "javascript.jsx", + "typescript", + "typescriptreact", + "typescript.tsx", + }, + settings = { + complete_function_calls = true, + vtsls = { + enableMoveToFileCodeAction = true, + autoUseWorkspaceTsdk = true, + experimental = { + completion = { + enableServerSideFuzzyMatch = true, + }, + }, + }, + typescript = { + updateImportsOnFileMove = { enabled = "always" }, + suggest = { + completeFunctionCalls = true, + }, + inlayHints = { + enumMemberValues = { enabled = true }, + functionLikeReturnTypes = { enabled = true }, + parameterNames = { enabled = "literals" }, + parameterTypes = { enabled = true }, + propertyDeclarationTypes = { enabled = true }, + variableTypes = { enabled = false }, + }, + }, + }, + }) + end }, }) end, diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index d209c3f..f0ce135 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -7,6 +7,7 @@ [ -f "$XINITRC" ] && alias startx="startx \$XINITRC" alias svn="svn --config-dir \"$XDG_CONFIG_HOME\"/subversion" +alias adb='HOME="$XDG_DATA_HOME"/android adb' # sudo not required for some system commands for command in mount umount pacman updatedb su shutdown poweroff reboot; do diff --git a/.config/suckless/dwm b/.config/suckless/dwm index 8f1aa63..46e5c38 160000 --- a/.config/suckless/dwm +++ b/.config/suckless/dwm @@ -1 +1 @@ -Subproject commit 8f1aa6309dd959fab0a504537be2fbb8a4a09b85 +Subproject commit 46e5c3812f917194ae6150817aa1be11c77c75e5 diff --git a/.config/suckless/dwmblocks b/.config/suckless/dwmblocks index bd2594e..32145ca 160000 --- a/.config/suckless/dwmblocks +++ b/.config/suckless/dwmblocks @@ -1 +1 @@ -Subproject commit bd2594edee18145b982f2c69a5aca98f4f4c3ace +Subproject commit 32145ca97ca555355df7ff3227dd1fdf910a9853 diff --git a/.config/x11/xprofile b/.config/x11/xprofile index 5a6f6e7..e9190d8 100755 --- a/.config/x11/xprofile +++ b/.config/x11/xprofile @@ -6,7 +6,7 @@ setbg & # set the background with the `setbg` script xrdb "${XDG_CONFIG_HOME:-$HOME/.config}"/x11/xresources & xrdbpid=$! # Uncomment to use Xresources colors/settings on startup -autostart="fuz-cache xcompmgr mpd pipewire unclutter remapd clipmenud dunst" +autostart="fuz-cache picom mpd pipewire unclutter remapd clipmenud dunst" for program in $autostart; do pidof -sx "$program" || "$program" & diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index cc5dbdd..67bc7c6 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -96,6 +96,8 @@ export QT_SCALE_FACTOR=1.1 export MOZ_USE_XINPUT2="1" # Mozilla smooth scrolling/touchpads. export AWT_TOOLKIT="MToolkit wmname LG3D" # May have to install wmname export _JAVA_AWT_WM_NONREPARENTING=1 # Fix for Java applications in dwm +export MAXIMA_USERDIR="$XDG_CONFIG_HOME"/maxima +export ANDROID_USER_HOME="$XDG_DATA_HOME"/android [ ! -f ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ] && setsid shortcuts >/dev/null 2>&1 diff --git a/.local/bin/dmenuhandler b/.local/bin/dmenuhandler index 9e6174a..b8ba86b 100755 --- a/.local/bin/dmenuhandler +++ b/.local/bin/dmenuhandler @@ -2,7 +2,7 @@ # Feed this script a link and it will give dmenu # some choice programs to use to open it. -feed="${1:-$(true | dmenu -bw 2 -Y 190 -X 333 -W 700 -p 'Paste: ')}" +feed="${1:-$(true | dmenu -bw 2 -Y 190 -X 333 -W 700 -p ': ')}" case "$(printf " Search in Browser\\n Open in Browser\\n Copy Selection\\n Queue Video\\n Queue Audio\\n Queue Download\\n Play\\n Play (loop)\\n View Image\\n Set Background\\n Open PDF\\n Open in Vim" | dmenu -i -l 16 -W 200 -Y 15 -X 1151 -bw 2)" in " Copy Selection") echo "$feed" | xclip -selection clipboard ;; @@ -14,7 +14,7 @@ case "$(printf " Search in Browser\\n Open in Browser\\n Copy Select " Open PDF") curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && zathura "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;; " Open Image") curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && nsxiv -a "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;; " Open in Vim") curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && setsid -f "$TERMINAL" -e "$EDITOR" "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;; - " Set Background") curl -L "$feed" > $XDG_CACHE_HOME/pic ; xwallpaper --zoom $XDG_CACHE_HOME/pic >/dev/null 2>&1 ;; + " Set Background") curl -L "$feed" > "$XDG_CACHE_HOME/pic" ; xwallpaper --zoom "$XDG_CACHE_HOME/pic" >/dev/null 2>&1 ;; " Search in Browser") setsid -f "$BROWSER" -search "$feed" >/dev/null 2>&1 ;; " Open in Browser") setsid -f "$BROWSER" "$feed" >/dev/null 2>&1 ;; esac diff --git a/.local/bin/fetch b/.local/bin/fetch index 06c0816..aa385e7 100755 Binary files a/.local/bin/fetch and b/.local/bin/fetch differ diff --git a/.local/bin/fix-audio b/.local/bin/fix-audio new file mode 100755 index 0000000..6ea8a1b --- /dev/null +++ b/.local/bin/fix-audio @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +killall pipewire +setsid -f pipewire +sleep 3 +wpctl set-mute @DEFAULT_AUDIO_SINK@ 0 +pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}" diff --git a/.local/bin/fuz-cache b/.local/bin/fuz-cache index 617aa0b..449b4b8 100755 --- a/.local/bin/fuz-cache +++ b/.local/bin/fuz-cache @@ -8,7 +8,7 @@ mkdir -p "$CACHE_DIR" FD_OPTIONS="--hidden --color=always" -FD_EXCLUDE_ARGS="-E .cache -E .github -E github -E .local/state -E .ssh -E .android -E GIMP -E Thunar -E .config/blender -E .config/mpv/script_modules -E .config/mpv/scripts -E .config/tmux/plugins -E fontforge -E fzf-tab-completion -E .gnupg -E libreoffice -E node_modules -E obsidian -E .obsidian -E qBittorrent -E subversion -E .terminfo -E terminfo" +FD_EXCLUDE_ARGS="-E .cache -E .github -E github -E .local/state -E .ssh -E .android -E GIMP -E Thunar -E .config/blender -E .config/mpv/script_modules -E .config/mpv/scripts -E .config/tmux/plugins -E fontforge -E fzf-tab-completion -E .gnupg -E libreoffice -E node_modules -E obsidian -E .obsidian -E qBittorrent -E subversion -E .terminfo -E terminfo -E .local/share/nvim/mason/packages -E *.pyc -E .maxima -E .config/vivaldi -E .mozilla -E *.o" # Function to populate the cache populate_cache() { diff --git a/.local/bin/fuz-launcher b/.local/bin/fuz-launcher new file mode 100755 index 0000000..b88da8e --- /dev/null +++ b/.local/bin/fuz-launcher @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +dwmc setlayoutex 2 + +st fuz + +dwmc setlayoutex 0 diff --git a/.local/bin/mangamenu b/.local/bin/mangamenu new file mode 100755 index 0000000..0223c17 --- /dev/null +++ b/.local/bin/mangamenu @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +manga_dir="$HOME/me/manga" + +fzf_cmd_base="fzf --no-info --border --height=100% --margin=10%,22% --preview-window=border-left" + +list_manga="fd -t d --base-directory $manga_dir -d 1 --format={/}" +prompt_manga="'Manga  '" +preview_manga="'fuz-preview $manga_dir/{}/cover.jpg'" +fzf_cmd_manga="$fzf_cmd_base --prompt $prompt_manga --preview $preview_manga" + +selected_manga=$(eval "$list_manga" | eval "$fzf_cmd_manga") +[[ -z "$selected_manga" ]] && exit 0 + +list_chapters="fd --base-directory $manga_dir/$selected_manga -d 1 -e pdf" +prompt_chapters="'Chapters  '" +preview_chapters="'fuz-preview $manga_dir/$selected_manga/{}'" +opener_chapters="'enter:execute:setsid -f firefox $manga_dir/$selected_manga/{} >/dev/null 2>&1'" +fzf_cmd_chapters="$fzf_cmd_base --prompt $prompt_chapters --preview $preview_chapters" + +selected_chapter=$(eval "$list_chapters" | eval "$fzf_cmd_chapters" "--bind" "$opener_chapters") +[[ -z "$selected_chapter" ]] && exit 0 diff --git a/.local/bin/men b/.local/bin/men new file mode 100755 index 0000000..63748d5 --- /dev/null +++ b/.local/bin/men @@ -0,0 +1,68 @@ +#!/usr/bin/env bash + +# Grand Unification of Manuals + +man_pages() { + apropos . | + grep -v -E '^.+ \(0\)' | + awk '{print $2 " " $1}' | + sort | + fzf --bind='ctrl-t:toggle-preview' \ + --height=100% \ + --pointer=" " \ + --ellipsis= \ + --color="16" \ + --border=none \ + --margin=5%,5%,5%,5% \ + --ansi \ + --info=inline-right \ + --reverse \ + --tiebreak=begin \ + --preview-window="70%,right,border-left" \ + --preview="echo {1} | sed -E \"s/^\((.+)\)/\1/\" | xargs -I{S} man {S} {2} 2>/dev/null | col -bx | bat -l man -p --color always" | + sed -E 's/^\((.+)\)/\1/' | + xargs -r man +} + +tldr_pages() { + selected=$(tldr --list | + fzf --bind='ctrl-t:toggle-preview' \ + --preview "tldr {1} --color=always" \ + --preview-window=right,70%,border-left \ + --margin=5% \ + --height=100% \ + --info=inline-right) + + if [ -n "$selected" ]; then + temp_file=$(mktemp /tmp/tldr.XXXXXX.md) + tldr "$selected" --raw --color=always >"$temp_file" + nvim -R "$temp_file" + rm "$temp_file" + fi +} + +# FIX: +nvim_docs() { + nvim "+lua require('fzf-lua').helptags()" +} + +# TODO: cht.sh + +main_menu() { + options=(" Man Pages" " TLDR Pages" " Nvim Docs") + choice=$(printf '%s\n' "${options[@]}" | fzf --height=100% --no-info --no-border --margin=30%,35% --prompt="") + + case $choice in + " Man Pages") + man_pages + ;; + " TLDR Pages") + tldr_pages + ;; + " Nvim Docs") + nvim_docs + ;; + esac +} + +main_menu diff --git a/.local/bin/organize b/.local/bin/organize new file mode 100755 index 0000000..de75560 --- /dev/null +++ b/.local/bin/organize @@ -0,0 +1,63 @@ +#!/usr/bin/env sh + +# Auto organize files into respective folders using categories + +organize() { + case "$(file -biL "$1")" in + *video*) + [ ! -d "Videos" ] && mkdir "Videos" + mv -- "$1" "Videos/$1" + printf "Moved %s to Videos\n" "$1" + ;; + + *audio*) + [ ! -d "Audios" ] && mkdir "Audios" + mv -- "$1" "Audios/$1" + printf "Moved %s to Audios\n" "$1" + ;; + + *image*) + [ ! -d "Images" ] && mkdir "Images" + mv -- "$1" "Images/$1" + printf "Moved %s to Images\n" "$1" + ;; + + *pdf* | *document* | *epub* | *djvu* | *cb*) + [ ! -d "Documents" ] && mkdir "Documents" + mv -- "$1" "Documents/$1" + printf "Moved %s to Documents\n" "$1" + ;; + + *text*) + [ ! -d "Plaintext" ] && mkdir "Plaintext" + mv -- "$1" "Plaintext/$1" + printf "Moved %s to Plaintext\n" "$1" + ;; + + *tar* | *xz* | *compress* | *7z* | *rar* | *zip*) + [ ! -d "Compressed" ] && mkdir "Compressed" + mv -- "$1" "Compressed/$1" + printf "Moved %s to Compressed\n" "$1" + ;; + + *binary*) + [ ! -d "Binaries" ] && mkdir "Binaries" + mv -- "$1" "Binaries/$1" + printf "Moved %s to Binaries\n" "$1" + ;; + + *) + [ ! -d "Others" ] && mkdir "Others" + mv -- "$1" "Others/$1" + printf "Moved %s to Others\n" "$1" + ;; + esac +} + +main() { + for file in *; do + [ -f "$file" ] && organize "$file" + done +} + +main "$@" diff --git a/.local/bin/pgen b/.local/bin/pgen index af45c77..4e3d080 100755 --- a/.local/bin/pgen +++ b/.local/bin/pgen @@ -4,7 +4,7 @@ [[ -z "$1" ]] && echo "Error: Project name not provided" >&2 && exit 1 [[ ! $1 =~ ^[a-zA-Z0-9_-]+$ ]] && echo "Error: Invalid project name. Chars allowed: [a-zA-Z0-9_-]" >&2 && exit 1 -project_dir="$HOME/Projects/cpp20/$1" +project_dir="$HOME/projects/cpp20/$1" [[ -d "$project_dir" ]] && cd "$project_dir" && nvim main.cpp && exit 1 diff --git a/.local/bin/spnotes b/.local/bin/spnotes new file mode 100755 index 0000000..ec90731 --- /dev/null +++ b/.local/bin/spnotes @@ -0,0 +1,14 @@ +#!/usr/bin/env sh + +# Command for notes scratchpad used in dwm +fd --color=always \ + --base-directory ~/notes \ + -e md -e txt -e qalc \ + | fzf \ + --ansi \ + --prompt="Notes  " \ + --margin="10%,5%" \ + --no-info --height=100% --scrollbar="" \ + --preview="glow ~/notes/{}" \ + --preview-window="border-left" \ + | xargs -r nvim diff --git a/.local/bin/statusbar/sb-battery b/.local/bin/statusbar/sb-battery index 4aa310a..b3570f4 100755 --- a/.local/bin/statusbar/sb-battery +++ b/.local/bin/statusbar/sb-battery @@ -12,14 +12,7 @@ case $BLOCK_BUTTON in  : battery very low! - Scroll to adjust brightness" ;; - 3) notify-send " Battery module" " : discharging -󰅙 : not charging - : stagnant charge -󱐋 : charging - : charged - : battery very low! - -- Scroll to adjust brightness" ;; + 3) dwmc view 7; wpctl set-mute @DEFAULT_AUDIO_SINK@ 1 ; pkill -RTMIN+10 "${STATUSBAR:-dwmblocks}" ; st bat ~/.bashrc ; st lf ;; 4) xbacklight -inc 15 ;; 5) xbacklight -dec 15 ;; 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; @@ -44,7 +37,7 @@ for battery in /sys/class/power_supply/BAT?*; do "Full") status="^C2^ ^d^" ;; "Discharging") status="^C5^ ^d^" ;; "Charging") status="^C3^󱐋 ^d^" ;; - "Not charging") status="^C1^ 󱈸 ^d^" ;; + "Not charging") status="^C1^ ^d^" ;; "Unknown") status="^C6^ ^d^" ;; *) exit 1 ;; esac diff --git a/.local/bin/statusbar/sb-volume b/.local/bin/statusbar/sb-volume index 2785770..ff5adde 100755 --- a/.local/bin/statusbar/sb-volume +++ b/.local/bin/statusbar/sb-volume @@ -7,7 +7,7 @@ case $BLOCK_BUTTON in 2) wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle ;; 4) wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+ ;; 5) wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%- ;; - 3) notify-send "󰎈 Volume module" "\- Shows volume 󰎈,  if muted. + 3) notify-send "󰝚 Volume module" "\- Shows volume 󰎈,  if muted. - Middle click to mute. - Scroll to change." ;; 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; @@ -29,15 +29,26 @@ split() { vol="$(printf "%.0f" "$(split "$vol" ".")")" -case 1 in - $((vol >= 70)) ) icon="󰝚 " ;; - $((vol >= 30)) ) icon="󰎈 " ;; - $((vol >= 1)) ) icon="󰎋 " ;; - * ) echo  && exit ;; -esac - if [ ! -e ~/.cache/bar_color ]; then + case 1 in + $((vol >= 100)) ) icon="󰝚 ━━━━━⏽ " ;; + $((vol >= 80)) ) icon="󰝚 ━━━━⏽━ " ;; + $((vol >= 60)) ) icon="󰝚 ━━━⏽━━ " ;; + $((vol >= 40)) ) icon="󰝚 ━━⏽━━━ " ;; + $((vol >= 20)) ) icon="󰝚 ━⏽━━━━ " ;; + $((vol >= 1)) ) icon="󰝚 ⏽━━━━━ " ;; + * ) echo " " && exit ;; + esac echo "$icon$vol%" else + case 1 in + $((vol >= 100)) ) icon="󰝚 ^C3^━━━━━^d^⏽ " ;; + $((vol >= 80)) ) icon="󰝚 ^C3^━━━━^d^⏽━ " ;; + $((vol >= 60)) ) icon="󰝚 ^C3^━━━^d^⏽━━ " ;; + $((vol >= 40)) ) icon="󰝚 ^C3^━━^d^⏽━━━ " ;; + $((vol >= 20)) ) icon="󰝚 ^C3^━^d^⏽━━━━ " ;; + $((vol >= 1)) ) icon="󰝚 ^d^⏽━━━━━ " ;; + * ) echo "^C4^ ^d^" && exit ;; + esac echo "^C4^$icon^d^$vol%" fi diff --git a/README.md b/README.md index b2cd111..40b4a3d 100644 --- a/README.md +++ b/README.md @@ -7,19 +7,18 @@ Here are some details about this setup - **OS** = EndeavourOS - **Login Manager** = None -- **WM** = [dwm](https://github.com/mintycube/dotfiles/tree/main/.config/suckless/dwm) -- **Bar** = [dwmblocks](https://github.com/mintycube/dotfiles/tree/main/.config/suckless/dwmblocks) -- **LockScreen** = [slock](https://github.com/mintycube/dotfiles/tree/main/.config/suckless/slock) -- **Compositor** = [picom](https://github.com/yshui/picom) +- **WM** = [dwm](https://github.com/mintycube/dwm) +- **Bar** = [dwmblocks](https://github.com/mintycube/dwmblocks) +- **LockScreen** = [slock](https://github.com/mintycube/slock) - **Resolution** = 1366x768 - **Cursor-theme** = [Bibata-Modern-Ice](https://github.com/ful1e5/Bibata_Cursor) - **Shell** = [zsh](https://wiki.archlinux.org/index.php/Zsh) + [zsh4humans](https://github.com/romkatv/zsh4humans) -- **Terminal** = [st](https://github.com/mintycube/dotfiles/tree/main/.config/suckless/st) +- **Terminal** = [st](https://github.com/mintycube/st) - **Font** = JetBrainsMono Nerd Font -- **Editor** = [Neovim](https://github.com/mintycube/dotfiles/tree/dwm/.config/nvim) +- **Editor** = [Neovim](https://github.com/mintycube/dotfiles/tree/main/.config/nvim) - **File Manager** = [lf](https://github.com/gokcehan/lf) + [ctpv](https://github.com/NikitaIvanovV/ctpv) - **Browser** = Firefox -- **Menu** = [dmenu](https://github.com/mintycube/dotfiles/tree/main/.config/suckless/dmenu) +- **Menu** = [dmenu](https://github.com/mintycube/dmenu) - **Image-viewer** = [nsxiv](https=//github.com/nsxiv/nsxiv) - **Music-player** = [mpd](https=//github.com/MusicPlayerDaemon/MPD) + [ncmpcpp](https://github.com/ncmpcpp/ncmpcpp) - **Pdf-viewer** = [zathura](https=//github.com/pwmt/zathura)