diff options
author | awy <awy@awy.one> | 2024-11-28 17:49:11 +0300 |
---|---|---|
committer | awy <awy@awy.one> | 2024-11-28 17:49:11 +0300 |
commit | abeb2dcdf2f2e6ca3ed1836d8cf3d6edf93129f3 (patch) | |
tree | b67df3bfdaeddf4165361899053cb4c74d2681e5 |
upload
47 files changed, 1659 insertions, 0 deletions
diff --git a/.config/btop/btop.conf b/.config/btop/btop.conf new file mode 100644 index 0000000..1935df2 --- /dev/null +++ b/.config/btop/btop.conf @@ -0,0 +1 @@ +color_theme = "/usr/share/btop/themes/nord.theme" diff --git a/.config/dunst/dunstrc b/.config/dunst/dunstrc new file mode 100644 index 0000000..00edf24 --- /dev/null +++ b/.config/dunst/dunstrc @@ -0,0 +1,28 @@ +[global] + monitor = 0 + follow = keyboard + width = 400 + height = 400 + offset = 0x19 + padding = 2 + horizontal_padding = 2 + transparency = 25 + font = monospace 14 + format = "<b>%s</b>\n%b" + +[urgency_low] + background = "#2e3440" + foreground = "#d8dee9" + timeout = 3 + +[urgency_normal] + background = "#2e3440" + foreground = "#d8dee9" + frame_color = "#5e81ac" + timeout = 5 + +[urgency_critical] + background = "#2e3440" + foreground = "#d8dee9" + frame_color = "#5e81ac" + timeout = 10 diff --git a/.config/fontconfig/fonts.conf b/.config/fontconfig/fonts.conf new file mode 100644 index 0000000..3d1d626 --- /dev/null +++ b/.config/fontconfig/fonts.conf @@ -0,0 +1,39 @@ +<?xml version='1.0'?> +<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> +<fontconfig> + <alias> + <family>serif</family> + <prefer> + <family>SourceSerif</family> + <family>Noto Color Emoji</family> + <family>FontAwesome</family> + <family>SymbolsNerdFont</family> + </prefer> + </alias> + <alias> + <family>sans-serif</family> + <prefer> + <family>SourceSans</family> + <family>Noto Color Emoji</family> + <family>FontAwesome</family> + <family>SymbolsNerdFont</family> + </prefer> + </alias> + <alias> + <family>sans</family> + <prefer> + <family>SourceSans</family> + <family>Noto Color Emoji</family> + <family>FontAwesome</family> + <family>SymbolsNerdFont</family> + </prefer> + </alias> + <alias> + <family>monospace</family> + <prefer> + <family>SourceCodePro</family> + <family>FontAwesome</family> + <family>SymbolsNerdFont</family> + </prefer> + </alias> +</fontconfig> diff --git a/.config/foot/foot.ini b/.config/foot/foot.ini new file mode 100644 index 0000000..f76e697 --- /dev/null +++ b/.config/foot/foot.ini @@ -0,0 +1,262 @@ +# -*- conf -*- + +# shell=$SHELL (if set, otherwise user's default shell from /etc/passwd) +# term=foot (or xterm-256color if built with -Dterminfo=disabled) +# login-shell=no + +# app-id=foot # globally set wayland app-id. Default values are "foot" and "footclient" for desktop and server mode +# title=foot +# locked-title=no + +font=monospace:size=14 +# font-bold=<bold variant of regular font> +# font-italic=<italic variant of regular font> +# font-bold-italic=<bold+italic variant of regular font> +font-size-adjustment=2 +# line-height=<font metrics> +# letter-spacing=0 +# horizontal-letter-offset=0 +# vertical-letter-offset=0 +# underline-offset=<font metrics> +# underline-thickness=<font underline thickness> +# strikeout-thickness=<font strikeout thickness> +# box-drawings-uses-font-glyphs=no +# dpi-aware=no + +# initial-window-size-pixels=700x500 # Or, +# initial-window-size-chars=<COLSxROWS> +# initial-window-mode=windowed +pad=10x10 # optionally append 'center' +# resize-by-cells=yes +# resize-keep-grid=yes +# resize-delay-ms=100 + +# bold-text-in-bright=no +# word-delimiters=,│`|:"'()[]{}<> +# selection-target=primary +# workers=<number of logical CPUs> +# utmp-helper=/usr/lib/utempter/utempter # When utmp backend is ‘libutempter’ (Linux) +# utmp-helper=/usr/libexec/ulog-helper # When utmp backend is ‘ulog’ (FreeBSD) + +[environment] +# name=value + +[bell] +# urgent=no +# notify=no +# visual=no +# command= +# command-focused=no + +[desktop-notifications] +# command=notify-send --wait --app-name ${app-id} --icon ${app-id} --category ${category} --urgency ${urgency} --expire-time ${expire-time} --hint STRING:image-path:${icon} --hint BOOLEAN:suppress-sound:${muted} --hint STRING:sound-name:${sound-name} --replace-id ${replace-id} ${action-argument} --print-id -- ${title} ${body} +# command-action-argument=--action ${action-name}=${action-label} +# close="" +# inhibit-when-focused=yes + + +[scrollback] +# lines=1000 +# multiplier=3.0 +# indicator-position=relative +# indicator-format="" + +[url] +# launch=xdg-open ${url} +# label-letters=sadfjklewcmpgh +# osc8-underline=url-mode +# protocols=http, https, ftp, ftps, file, gemini, gopher +# uri-characters=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.,~:;/?#@!$&%*+="'()[] + +[cursor] +style=beam +color = 2e3440 d8dee9 +# blink=yes +# blink-rate=500 +# beam-thickness=1.5 +# underline-thickness=<font underline thickness> + +[mouse] +# hide-when-typing=no +# alternate-scroll-mode=yes + +[touch] +# long-press-delay=400 + +[colors] +foreground = d8dee9 +background = 2e3440 + +# selection-foreground = d8dee9 +# selection-background = 4c566a + +regular0 = 3b4252 +regular1 = bf616a +regular2 = a3be8c +regular3 = ebcb8b +regular4 = 81a1c1 +regular5 = b48ead +regular6 = 88c0d0 +regular7 = e5e9f0 + +bright0 = 4c566a +bright1 = bf616a +bright2 = a3be8c +bright3 = ebcb8b +bright4 = 81a1c1 +bright5 = b48ead +bright6 = 8fbcbb +bright7 = eceff4 + +dim0 = 373e4d +dim1 = 94545d +dim2 = 809575 +dim3 = b29e75 +dim4 = 68809a +dim5 = 8c738c +dim6 = 6d96a5 +dim7 = aeb3bb +## dimmed colors (see foot.ini(5) man page) +# dim0=<not set> +# ... +# dim7=<not-set> + +## The remaining 256-color palette +# 16 = <256-color palette #16> +# ... +# 255 = <256-color palette #255> + +## Sixel colors +# sixel0 = 000000 +# sixel1 = 3333cc +# sixel2 = cc2121 +# sixel3 = 33cc33 +# sixel4 = cc33cc +# sixel5 = 33cccc +# sixel6 = cccc33 +# sixel7 = 878787 +# sixel8 = 424242 +# sixel9 = 545499 +# sixel10 = 994242 +# sixel11 = 549954 +# sixel12 = 995499 +# sixel13 = 549999 +# sixel14 = 999954 +# sixel15 = cccccc + +## Misc colors +# selection-foreground=<inverse foreground/background> +# selection-background=<inverse foreground/background> +# jump-labels=<regular0> <regular3> # black-on-yellow +# scrollback-indicator=<regular0> <bright4> # black-on-bright-blue +# search-box-no-match=<regular0> <regular1> # black-on-red +# search-box-match=<regular0> <regular3> # black-on-yellow +# urls=<regular3> + +[csd] +# preferred=server +# size=26 +# font=<primary font> +# color=<foreground color> +# hide-when-maximized=no +# double-click-to-maximize=yes +# border-width=0 +# border-color=<csd.color> +# button-width=26 +# button-color=<background color> +# button-minimize-color=<regular4> +# button-maximize-color=<regular2> +# button-close-color=<regular1> + +[key-bindings] +# scrollback-up-page=Shift+Page_Up +# scrollback-up-half-page=none +# scrollback-up-line=none +# scrollback-down-page=Shift+Page_Down +# scrollback-down-half-page=none +# scrollback-down-line=none +# scrollback-home=none +# scrollback-end=none +# clipboard-copy=Control+Shift+c XF86Copy +# clipboard-paste=Control+Shift+v XF86Paste +# primary-paste=Shift+Insert +# search-start=Control+Shift+r +# font-increase=Control+plus Control+equal Control+KP_Add +# font-decrease=Control+minus Control+KP_Subtract +# font-reset=Control+0 Control+KP_0 +# spawn-terminal=Control+Shift+n +# minimize=none +# maximize=none +# fullscreen=none +# pipe-visible=[sh -c "xurls | fuzzel | xargs -r firefox"] none +# pipe-scrollback=[sh -c "xurls | fuzzel | xargs -r firefox"] none +# pipe-selected=[xargs -r firefox] none +# pipe-command-output=[wl-copy] none # Copy last command's output to the clipboard +# show-urls-launch=Control+Shift+o +# show-urls-copy=none +# show-urls-persistent=none +# prompt-prev=Control+Shift+z +# prompt-next=Control+Shift+x +# unicode-input=Control+Shift+u +# noop=none + +[search-bindings] +# cancel=Control+g Control+c Escape +# commit=Return +# find-prev=Control+r +# find-next=Control+s +# cursor-left=Left Control+b +# cursor-left-word=Control+Left Mod1+b +# cursor-right=Right Control+f +# cursor-right-word=Control+Right Mod1+f +# cursor-home=Home Control+a +# cursor-end=End Control+e +# delete-prev=BackSpace +# delete-prev-word=Mod1+BackSpace Control+BackSpace +# delete-next=Delete +# delete-next-word=Mod1+d Control+Delete +# extend-char=Shift+Right +# extend-to-word-boundary=Control+w Control+Shift+Right +# extend-to-next-whitespace=Control+Shift+w +# extend-line-down=Shift+Down +# extend-backward-char=Shift+Left +# extend-backward-to-word-boundary=Control+Shift+Left +# extend-backward-to-next-whitespace=none +# extend-line-up=Shift+Up +# clipboard-paste=Control+v Control+Shift+v Control+y XF86Paste +# primary-paste=Shift+Insert +# unicode-input=none +# quit=none +# scrollback-up-page=Shift+Page_Up +# scrollback-up-half-page=none +# scrollback-up-line=none +# scrollback-down-page=Shift+Page_Down +# scrollback-down-half-page=none +# scrollback-down-line=none +# scrollback-home=none +# scrollback-end=none + +[url-bindings] +# cancel=Control+g Control+c Control+d Escape +# toggle-url-visible=t + +[text-bindings] +# \x03=Mod4+c # Map Super+c -> Ctrl+c + +[mouse-bindings] +# scrollback-up-mouse=BTN_WHEEL_BACK +# scrollback-down-mouse=BTN_WHEEL_FORWARD +# font-increase=Control+BTN_WHEEL_BACK +# font-decrease=Control+BTN_WHEEL_FORWARD +# selection-override-modifiers=Shift +# primary-paste=BTN_MIDDLE +# select-begin=BTN_LEFT +# select-begin-block=Control+BTN_LEFT +# select-extend=BTN_RIGHT +# select-extend-character-wise=Control+BTN_RIGHT +# select-word=BTN_LEFT-2 +# select-word-whitespace=Control+BTN_LEFT-2 +# select-quote = BTN_LEFT-3 +# select-row=BTN_LEFT-4 + +# vim: ft=dosini diff --git a/.config/i3blocks/config b/.config/i3blocks/config new file mode 100644 index 0000000..0ccbb8b --- /dev/null +++ b/.config/i3blocks/config @@ -0,0 +1,54 @@ +[packages] +command=sb-pacpackages +interval=once +signal=8 + +[news] +command=sb-news +interval=once +signal=6 + +[memory] +command=sb-memory +interval=10 +signal=14 + +[doppler] +command=sb-doppler +interval=once +signal=13 + +[weather] +command=sb-forecast +interval=3600 +signal=5 + +[mail] +command=sb-mailbox +interval=180 +signal=12 + +[nettraf] +command=sb-nettraf +interval=1 +signal=16 + +[microphone] +command=sb-microphone +interval=once +signal=23 + +[volume] +command=sb-volume +interval=once +signal=10 + +[clock] +command=sb-clock +interval=60 +signal=1 + +[internet] +command=sb-internet +interval=5 +signal=4 diff --git a/.config/lf/cleaner b/.config/lf/cleaner new file mode 100755 index 0000000..1227249 --- /dev/null +++ b/.config/lf/cleaner @@ -0,0 +1,4 @@ +#!/bin/sh +#rm ~/.cache/lf/* -f +exec kitty +kitten icat --clear --stdin no --silent --transfer-mode file </dev/null >/dev/tty + diff --git a/.config/lf/icons b/.config/lf/icons new file mode 100644 index 0000000..aad068c --- /dev/null +++ b/.config/lf/icons @@ -0,0 +1,77 @@ +di 📁 +fi 📃 +tw 🤝 +ow 📂 +ln ⛓ +or ❌ +ex 🎯 +*.txt ✍ +*.mom ✍ +*.me ✍ +*.ms ✍ +*.avif 🖼 +*.png 🖼 +*.webp 🖼 +*.ico 🖼 +*.jpg 📸 +*.jpe 📸 +*.jpeg 📸 +*.gif 🖼 +*.svg 🗺 +*.tif 🖼 +*.tiff 🖼 +*.xcf 🖌 +*.html 🌎 +*.xml 📰 +*.gpg 🔒 +*.css 🎨 +*.pdf 📚 +*.djvu 📚 +*.epub 📚 +*.csv 📓 +*.xlsx 📓 +*.tex 📜 +*.md 📘 +*.r 📊 +*.R 📊 +*.rmd 📊 +*.Rmd 📊 +*.m 📊 +*.mp3 🎵 +*.opus 🎵 +*.ogg 🎵 +*.m4a 🎵 +*.flac 🎼 +*.wav 🎼 +*.mkv 🎥 +*.mp4 🎥 +*.webm 🎥 +*.mpeg 🎥 +*.avi 🎥 +*.mov 🎥 +*.mpg 🎥 +*.wmv 🎥 +*.m4b 🎥 +*.flv 🎥 +*.zip 📦 +*.rar 📦 +*.7z 📦 +*.tar 📦 +*.z64 🎮 +*.v64 🎮 +*.n64 🎮 +*.gba 🎮 +*.nes 🎮 +*.gdi 🎮 +*.1 ℹ +*.nfo ℹ +*.info ℹ +*.log 📙 +*.iso 📀 +*.img 📀 +*.bib 🎓 +*.ged 👪 +*.part 💔 +*.torrent 🔽 +*.jar ♨ +*.java ♨ diff --git a/.config/lf/lfrc b/.config/lf/lfrc new file mode 100644 index 0000000..56ca258 --- /dev/null +++ b/.config/lf/lfrc @@ -0,0 +1,25 @@ +set ifs "\n" +set icons +set sixel true +set cleaner ~/.config/lf/cleaner +set previewer ~/.config/lf/scope + +cmd open ${{ + case $(file --mime-type "$(readlink -f $f)" -b) in + text/*|application/json|inode/x-empty|application/x-subrip) $EDITOR $fx;; + video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;; + audio/*|video/x-ms-asf) mpv --audio-display=no $f ;; + *) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;; + esac +}} + +cmd delete ${{ + clear; tput cup $(($(tput lines)/3)); tput bold + set -f + printf "%s\n\t" "$fx" + printf "delete?[y/N]" + read ans + [ $ans = "y" ] && rm -rf -- $fx +}} + +map D delete diff --git a/.config/lf/scope b/.config/lf/scope new file mode 100755 index 0000000..b79c4b6 --- /dev/null +++ b/.config/lf/scope @@ -0,0 +1,13 @@ +#!/bin/sh +case "$(file -Lb --mime-type -- "$1")" in + image/*) + chafa -f sixel -s "$2x$3" --animate off --polite on "$1" + exit 1 + ;; + text/* | */xml | application/json | application/x-ndjson) bat -p --theme ansi --terminal-width "$(($4-2))" -f "$1" ;; + audio/* | application/octet-stream) mediainfo "$1" || exit 1 ;; + video/*) + CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + [ ! -f "$CACHE" ] && ffmpegthumbnailer -i "$1" -o "$CACHE" -s 0 + chafa -f sixel -s "$2x$3" --animate off --polite on "$CACHE" +esac diff --git a/.config/newsboat/config b/.config/newsboat/config new file mode 100644 index 0000000..3feffa5 --- /dev/null +++ b/.config/newsboat/config @@ -0,0 +1,57 @@ +#show-read-feeds no +auto-reload yes +notify-program notify-send +notify-always yes + +external-url-viewer "urlscan -dc -r 'linkhandler {}'" + +bind-key j down +bind-key k up +bind-key j next articlelist +bind-key k prev articlelist +bind-key J next-feed articlelist +bind-key K prev-feed articlelist +bind-key G end +bind-key g home +bind-key d pagedown +bind-key u pageup +bind-key l open +bind-key h quit +bind-key a toggle-article-read +bind-key n next-unread +bind-key N prev-unread +bind-key D pb-download +bind-key U show-urls +bind-key x pb-delete + +color listnormal cyan default +color listfocus black yellow standout bold +color listnormal_unread blue default +color listfocus_unread yellow default bold +color info red black bold +color article white default bold + +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 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 +macro C set browser "youtube-viewer --comments=%u" ; open-in-browser ; set browser linkhandler +macro p set browser "peertubetorrent %u 480" ; open-in-browser ; set browser linkhandler +macro P set browser "peertubetorrent %u 1080" ; open-in-browser ; set browser linkhandler + +highlight all "---.*---" yellow +highlight feedlist ".*(0/0))" black +highlight article "(^Feed:.*|^Title:.*|^Author:.*)" cyan default bold +highlight article "(^Link:.*|^Date:.*)" default default +highlight article "https?://[^ ]+" green default +highlight article "^(Title):.*$" blue default +highlight article "\\[[0-9][0-9]*\\]" magenta default bold +highlight article "\\[image\\ [0-9]+\\]" green default bold +highlight article "\\[embedded flash: [0-9][0-9]*\\]" green default bold +highlight article ":.*\\(link\\)$" cyan default +highlight article ":.*\\(image\\)$" blue default +highlight article ":.*\\(embedded flash\\)$" magenta default diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000..431b0af --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1,20 @@ +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) + +local otps = {} + +require("vim-options") +require("lazy").setup("plugins") diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..8eb77b0 --- /dev/null +++ b/.config/nvim/lazy-lock.json @@ -0,0 +1,14 @@ +{ + "lazy.nvim": { "branch": "main", "commit": "7967abe55752aa90532e6bb4bd4663fe27a264cb" }, + "lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" }, + "nord.nvim": { "branch": "master", "commit": "80c1e5321505aeb22b7a9f23eb82f1e193c12470" }, + "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, + "nvim-lspconfig": { "branch": "master", "commit": "59a6766cbf32c7e4cf3ed685ccad7ffe1dde8c40" }, + "nvim-treesitter": { "branch": "master", "commit": "1c111e3e8f42c85b16cb4bf30e4254fcb5607817" }, + "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" }, + "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" } +} diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua new file mode 100644 index 0000000..a564707 --- /dev/null +++ b/.config/nvim/lua/plugins.lua @@ -0,0 +1 @@ +return {} diff --git a/.config/nvim/lua/plugins/lsp-config.lua b/.config/nvim/lua/plugins/lsp-config.lua new file mode 100644 index 0000000..7178d3e --- /dev/null +++ b/.config/nvim/lua/plugins/lsp-config.lua @@ -0,0 +1,28 @@ +return { + { + "williamboman/mason.nvim", + config = function() + require("mason").setup() + end + }, + { + "williamboman/mason-lspconfig.nvim", + config = function() + require("mason-lspconfig").setup({ + ensure_installed = { "lua_ls", "clangd", "html", "cssls" } + }) + end + }, + { + "neovim/nvim-lspconfig", + config = function() + local lspconfig = require("lspconfig") + local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities.textDocument.completion.completionItem.snippetSupport = true + lspconfig.lua_ls.setup({}) + lspconfig.clangd.setup({}) + lspconfig.html.setup({capabilities = capabilities,}) + lspconfig.cssls.setup({capabilities = capabilities,}) + end + } +} diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..6975bb8 --- /dev/null +++ b/.config/nvim/lua/plugins/lualine.lua @@ -0,0 +1,11 @@ +return { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + require('lualine').setup({ + options = { + theme = 'nord' + } + }) + end +} diff --git a/.config/nvim/lua/plugins/neo-tree.lua b/.config/nvim/lua/plugins/neo-tree.lua new file mode 100644 index 0000000..65f280d --- /dev/null +++ b/.config/nvim/lua/plugins/neo-tree.lua @@ -0,0 +1,12 @@ +return { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + }, + config = function() + vim.keymap.set('n', '<C-n>', ':Neotree filesystem reveal left<CR>', {}) + end +} diff --git a/.config/nvim/lua/plugins/nord.lua b/.config/nvim/lua/plugins/nord.lua new file mode 100644 index 0000000..d586f1a --- /dev/null +++ b/.config/nvim/lua/plugins/nord.lua @@ -0,0 +1,8 @@ +return { + "shaunsingh/nord.nvim", + priority = 1000 , + config = function() + -- require("nord").setup({}) + vim.cmd.colorscheme "nord" + end +} diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..c646155 --- /dev/null +++ b/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,9 @@ +return { + 'nvim-telescope/telescope.nvim', tag = '0.1.8', + dependencies = { 'nvim-lua/plenary.nvim' }, + config = function() + local builtin = require("telescope.builtin") + vim.keymap.set('n', '<C-p>', builtin.find_files, {}) + vim.keymap.set('n', '<leader>fg', builtin.live_grep, {}) + end +} diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..0e5b9fe --- /dev/null +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,11 @@ +return {"nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function() + local config = require("nvim-treesitter.configs") + config.setup({ + ensure_installed = { "c", "lua", "html", "css" }, + highlight = { enable = true }, + indent = { enable = true }, + }) + end +} diff --git a/.config/nvim/lua/vim-options.lua b/.config/nvim/lua/vim-options.lua new file mode 100644 index 0000000..8068602 --- /dev/null +++ b/.config/nvim/lua/vim-options.lua @@ -0,0 +1,4 @@ +vim.cmd("set title") +vim.cmd("set clipboard+=unnamedplus") +vim.cmd("set relativenumber") +vim.g.mapleader = " " diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc new file mode 100644 index 0000000..b7da08e --- /dev/null +++ b/.config/shell/aliasrc @@ -0,0 +1,14 @@ +# Verbosity and settings that you pretty much just always are going to want. +alias \ + cp="cp -iv" \ + mv="mv -iv" \ + rm="rm -vI" + +# Colorize commands +alias \ + ls="ls -hN --color=auto" \ + grep="grep --color=auto" \ + ip="ip -color=auto" + +alias \ + v="nvim" diff --git a/.config/shell/profile b/.config/shell/profile new file mode 100644 index 0000000..6e19541 --- /dev/null +++ b/.config/shell/profile @@ -0,0 +1,22 @@ +export PATH="$PATH:$(find ~/.local/bin -type d | paste -sd ':' -)" +export ZDOTDIR="$HOME/.config/zsh" +export BROWSER="firefox" +export EDITOR="nvim" +export MANPAGER='nvim +Man!' +export TERMINAL="foot" +export TERMINAL_PROG="foot" + +export XDG_CONFIG_HOME="$HOME/.config" +export XDG_DATA_HOME="$HOME/.local/share" +export XDG_CACHE_HOME="$HOME/.cache" +export XDG_STATE_HOME="$HOME/.local/state" +export XDG_DOWNLOAD_DIR="$HOME/downloads" + +export GIT_CONFIG="$XDG_CONFIG_HOME/git/config" +export PASSWORD_STORE_DIR="$XDG_DATA_HOME"/pass +export NPM_CONFIG_USERCONFIG=$XDG_CONFIG_HOME/npm/npmrc +export CARGO_HOME="$XDG_DATA_HOME"/cargo + +export BEMENU_OPTS='--fb "#2e3440" --ff "#d8dee9" --nb "#2e3440" --nf "#d8dee9" --tb "#2e3440" --hb "#2e3440" --tf "#bf616a" --hf "#ebcb8b" --af "d8dee9" --ab "#2e3440" --fn "monospace 14"' + +[ "$(tty)" = "/dev/tty1" ] && ! pidof -s sway >/dev/null 2>&1 && exec dbus-run-session sway --unsupported-gpu diff --git a/.config/sway/config b/.config/sway/config new file mode 100644 index 0000000..5d3ce70 --- /dev/null +++ b/.config/sway/config @@ -0,0 +1,122 @@ +exec dbus-update-activation-environment --all + +set $mod Mod4 +set $term foot +set $browser firefox +set $menu bemenu-run + +font pango:monospace 10 + +# AUTOSTART +exec start-pipewire +exec reloadsingbox +exec dunst +exec foot --server + +# WORKSPACES +workspace 1 output DP-2 +workspace 2 output DP-3 + +output DP-3 mode 2560x1440@240Hz position 2560 0 +output DP-2 mode 2560x1440@165Hz position 0 0 +# output * bg /mnt/ssd/papes/thiemeyer_road_to_samarkand.jpg fill +exec_always swaybg -c 4C566A +# COLORS +client.focused #5e81ac #5e81ac #d8dee9 #5e81ac #5e81ac +client.focused_inactive #3b4252 #3b4252 #d8dee9 #3b4252 #3b4252 +client.unfocused #2e3440 #2e3440 #d8dee9 #2e3440 #2e3440 +client.urgent #bf616a #bf616a #d8dee9 #bf616a #bf616a +client.placeholder #000000 #0c0c0c #d8dee9 #000000 #0c0c0c +client.background #2e3440 + +# STYLE +gaps inner 10 +default_border pixel 3 +default_floating_border pixel 3 +for_window [class=.*] border pixel 3 + +floating_modifier $mod normal +# floating window assigments +for_window [window_role = "pop-up"] floating enable +for_window [window_role = "bubble"] floating enable +for_window [window_role = "dialog"] floating enable +for_window [window_type = "dialog"] floating enable +for_window [window_role = "task_dialog"] floating enable +for_window [window_type = "menu"] floating enable +for_window [app_id = "floating"] floating enable +for_window [app_id = "floating_update"] floating enable, resize set width 1000px height 600px +for_window [class = "(?i)pinentry"] floating enable +for_window [title = "Administrator privileges required"] floating enable +for_window [title = "About Mozilla Firefox"] floating enable +for_window [window_role = "About"] floating enable +for_window [app_id="firefox" title="Library"] floating enable, border pixel 1, sticky enable + +# BINDS +bindsym $mod+h focus left +bindsym $mod+k focus down +bindsym $mod+j focus up +bindsym $mod+l focus right +bindsym $mod+f fullscreen +bindsym $mod+s layout toggle split +bindsym $mod+Shift+space floating toggle +bindsym $mod+Return exec $term +bindsym $mod+w exec $browser +bindsym $mod+d exec $menu +bindsym $mod+Shift+d exec tessen +bindsym $mod+grave exec bookmarks +bindsym $mod+m exec $term -e spotify_player +bindsym $mod+e exec 'sh -c "$term -e neomutt; pkill -RTMIN+12 i3blocks"' +bindsym $mod+Shift+n exec 'sh -c "$term -e newsboat; pkill -RTMIN+6 i3blocks"' +bindsym $mod+Shift+s exec sh -c slurp | grim -t jpeg -g - - | wl-copy +bindsym $mod+Shift+r exec $term -e btop + +# 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 + +bindsym $mod+q kill + +bindsym $mod+Shift+e reload +bindsym $mod+Shift+q exec sysact + +# INPUT +input * { + xkb_layout "us,ru" + xkb_options "grp:win_space_toggle" + accel_profile flat +} + +# BAR +bar { + position top + # swaybar_command waybar + status_command i3blocks + + separator_symbol " | " + colors + { + background #2e3440 + active_workspace #2e3440 #2e3440 #d8dee9 + focused_workspace #2e3440 #2e3440 #d8dee9 + inactive_workspace #2e3440 #2e3440 #3b4252 + } +} diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc new file mode 100644 index 0000000..a98b25a --- /dev/null +++ b/.config/zsh/.zshrc @@ -0,0 +1,59 @@ +# Enable colors and change prompt: + +autoload -U colors && colors # Load colors +autoload -Uz vcs_info +precmd_vcs_info() { vcs_info } +precmd_functions+=( precmd_vcs_info ) +# neovim beam cursor fix +function precmd { print -Pn "\e[ q" } +zstyle ':vcs_info:git:*' formats "[%b]%{$fg[yellow]%}%u" +zstyle ':vcs_info:*' check-for-changes true +zstyle ':vcs_info:*' unstagedstr '*' +setopt PROMPT_SUBST +PROMPT='%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$fg[red]%}${vcs_info_msg_0_}%{$reset_color%}$%b ' +setopt autocd # Automatically cd into typed directory. +stty stop undef # Disable ctrl-s to freeze terminal. +setopt interactive_comments + +HISTSIZE=10000000 +SAVEHIST=10000000 +HISTFILE="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/history" +setopt append_history +setopt inc_append_history +setopt share_history +setopt hist_ignore_dups +setopt hist_ignore_all_dups +setopt hist_expire_dups_first +setopt hist_find_no_dups +setopt hist_save_no_dups +setopt hist_reduce_blanks +setopt hist_verify +[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" + +autoload -U compinit; compinit +zstyle ':completion:*' menu select +zmodload zsh/complist +compinit +_comp_options+=(globdots) # Include hidden files. + +source "/usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh" + +lfcd () { + tmp="$(mktemp -uq)" + trap 'rm -f $tmp >/dev/null 2>&1 && trap - HUP INT QUIT TERM PWR EXIT' HUP INT QUIT TERM PWR EXIT + lf -last-dir-path="$tmp" "$@" + if [ -f "$tmp" ]; then + dir="$(cat "$tmp")" + [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" + fi +} +bindkey -s '^o' '^ulfcd\n' + +unset SSH_AGENT_PID +if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then + export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" +fi + +export PASSWORD_STORE_CLIP_TIME=5 +# Load syntax highlighting; should be last. +source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh 2>/dev/null diff --git a/.local/bin/bookmarks b/.local/bin/bookmarks new file mode 100755 index 0000000..444b251 --- /dev/null +++ b/.local/bin/bookmarks @@ -0,0 +1,142 @@ +#!/bin/dash + +URLQUERY_FILE="${HOME}/.local/share/urlquery" +ACTION_MENU="@@" + +CLIPBOARD() { + wl-paste +} + +DMENU() { + bemenu -i -l "${1}" -p "${2}" +} + +error_notify() { + notify-send "${1}" + exit "1" +} + +ensure_file_exists() { + [ -f "${URLQUERY_FILE}" ] || { + notify-send "${URLQUERY_FILE} does not exist. Creating it now." + printf "SearXNG=https://searx.tiekoetter.com/search?q=\n" > "${URLQUERY_FILE}" + } +} + +get_selection() { + cut -d= -f1 "${URLQUERY_FILE}" | DMENU "${LINE_COUNT}" "Bookmarks" +} + +update_file() { + pattern="${1}" + replacement="${2}" + + sed "/${pattern}/c\\${replacement}" "${URLQUERY_FILE}" > "${URLQUERY_FILE}.tmp" && + mv "${URLQUERY_FILE}.tmp" "${URLQUERY_FILE}" || + error_notify "Failed to update the file." +} + +is_valid_url() { + printf "%s\n" "${1}" | grep -qE "^https?://[^[:space:]/?#][^[:space:]]+$" +} + +add_bookmark() { + URL="$(CLIPBOARD)" + + is_valid_url "${URL}" || error_notify "The clipboard content is not a valid URL." + + grep -q "=${URL}$" "${URLQUERY_FILE}" && + notify-send "The URL is already in the list." && return + + NAME="$(printf "" | DMENU "0" "Name")" + + [ -n "${NAME}" ] && printf "%s\n" "${NAME}=${URL}" >> "${URLQUERY_FILE}" && + notify-send "'${NAME}' is bookmarked." +} + +delete_bookmark() { + NAME="$(get_selection)" + + [ -z "${NAME}" ] && error_notify "Failed to delete the bookmark." && return + + sed "/^${NAME}=/d" "${URLQUERY_FILE}" > "${URLQUERY_FILE}.tmp" + mv "${URLQUERY_FILE}.tmp" "${URLQUERY_FILE}" + + [ -s "${URLQUERY_FILE}" ] && grep -qE "\S" "${URLQUERY_FILE}" || rm "${URLQUERY_FILE}" + + notify-send "'${NAME}' is deleted." +} + +edit_name() { + OLD_NAME="${1}" + NEW_NAME="$(printf "" | DMENU "0" "New Name")" + + [ -z "${NEW_NAME}" ] && return + + URL="$(grep "^${OLD_NAME}=" "${URLQUERY_FILE}" | cut -d= -f2)" + + update_file "^${OLD_NAME}=" "${NEW_NAME}=${URL}" +} + +edit_url() { + NAME="${1}" + NEW_URL="$(echo "" | DMENU "0" "New URL")" + + [ -z "${NEW_URL}" ] && return + + update_file "^${NAME}=.*" "${NAME}=${NEW_URL}" +} + +edit_bookmark() { + NAME="$(get_selection)" + + [ -z "${NAME}" ] && error_notify "Failed to edit the bookmark." && return + + FIELD="$(printf "Name\nURL\n" | DMENU "2" "Edit")" + + case "${FIELD}" in + "Name")edit_name "${NAME}";; + "URL")edit_url "${NAME}" + esac + + notify-send "'${NAME}' is updated." +} + +open_bookmark() { + URL="$(grep "^${SELECTION}=" "${URLQUERY_FILE}" | cut -d= -f2-)" + + [ -z "${URL}" ] && notify-send "Bookmark not found." && exit "1" + + case "${URL}" in + *"search"* | *"wiki"* | *"packages"* | *"chatgpt"*) QUERY="$(echo "" | DMENU "0" "Search")" + URL="${URL}${QUERY}" + ;; + esac + + "${BROWSER}" "${URL}" || notify-send "Failed to open the URL." +} + +ensure_file_exists + +LINE_COUNT="$(wc -l < "${URLQUERY_FILE}")" + +[ "${LINE_COUNT}" -ge "15" ] && LINE_COUNT="15" + +SELECTION="$(get_selection)" + +[ -z "${SELECTION}" ] && exit + +case "${SELECTION}" in + "${ACTION_MENU}") + ACTION="$(printf "Add\nDelete\nEdit\n" | DMENU "3" "Action")" + + case "${ACTION}" in + "Add") add_bookmark ;; + "Delete") delete_bookmark ;; + "Edit") edit_bookmark ;; + esac + ;; + *) + open_bookmark + ;; +esac diff --git a/.local/bin/cron/checkup b/.local/bin/cron/checkup new file mode 100755 index 0000000..387c04e --- /dev/null +++ b/.local/bin/cron/checkup @@ -0,0 +1,18 @@ +#!/bin/sh + +# Syncs repositories and downloads updates, meant to be run as a cronjob. +export DISPLAY=':0' + +notify-send "📦 Repository Sync" "Checking for package updates..." + +doas pacman -Syyuw --noconfirm || notify-send "Error downloading updates. + +Check your internet connection, if pacman is already running, or run update manually to see errors." +pkill -RTMIN+8 "${STATUSBAR:-i3blocks}" + +if pacman -Qu | grep -v "\[ignored\]" +then + notify-send "🎁 Repository Sync" "Updates available. Click statusbar icon (📦) for update." +else + notify-send "📦 Repository Sync" "Sync complete. No new packages for update." +fi diff --git a/.local/bin/cron/newsup b/.local/bin/cron/newsup new file mode 100755 index 0000000..dd85c9f --- /dev/null +++ b/.local/bin/cron/newsup @@ -0,0 +1,16 @@ +#!/bin/sh + +# Set as a cron job to check for new RSS entries for newsboat. +# If newsboat is open, sends it an "R" key to refresh. +export DISPLAY=':0' + +/usr/bin/notify-send "📰 Updating RSS feeds..." + +pgrep -f newsboat$ && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name "^newsboat$")" R && exit + +echo > /tmp/newsupdate +pkill -RTMIN+6 "${STATUSBAR:-i3blocks}" +/usr/bin/newsboat -x reload +rm -f /tmp/newsupdate +pkill -RTMIN+6 "${STATUSBAR:-i3blocks}" +/usr/bin/notify-send "📰 RSS feed update complete." diff --git a/.local/bin/linkhandler b/.local/bin/linkhandler new file mode 100755 index 0000000..17adc30 --- /dev/null +++ b/.local/bin/linkhandler @@ -0,0 +1,26 @@ +#!/bin/sh + +# Feed script a url or file location. +# If an image, it will view in nsxiv, +# if a video or gif, it will view in mpv +# if a music file or pdf, it will download, +# otherwise it opens link in browser. + +if [ -z "$1" ]; then + url="$(xclip -o)" +else + url="$1" +fi + +case "$url" in + *mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtube.com/shorts*|*youtu.be*|*youtube.com/v/*|*hooktube.com*|*bitchute.com*|*videos.lukesmith.xyz*|*odysee.com*) + setsid -f mpv -quiet "$url" >/dev/null 2>&1 ;; + *png|*jpg|*jpe|*jpeg|*gif|*webp) + curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && imv "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;; + *pdf|*cbz|*cbr) + curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;; + *mp3|*flac|*opus|*mp3?source*) + qndl "$url" 'curl -LO' >/dev/null 2>&1 ;; + *) + [ -f "$url" ] && setsid -f "$TERMINAL" -e "$EDITOR" "$url" >/dev/null 2>&1 || setsid -f "$BROWSER" "$url" >/dev/null 2>&1 +esac diff --git a/.local/bin/reloadsingbox b/.local/bin/reloadsingbox new file mode 100755 index 0000000..731c618 --- /dev/null +++ b/.local/bin/reloadsingbox @@ -0,0 +1,3 @@ +#!/bin/sh +killall sing-box +setsid -f sing-box -c /mnt/ssd/settings/config.json run diff --git a/.local/bin/start-pipewire b/.local/bin/start-pipewire new file mode 100755 index 0000000..e883493 --- /dev/null +++ b/.local/bin/start-pipewire @@ -0,0 +1,7 @@ +#!/bin/sh +killall pipewire +killall pipewire-pulse +killall wireplumber +setsid -f pipewire +setsid -f pipewire-pulse +setsid -f wireplumber diff --git a/.local/bin/statusbar/sb-clock b/.local/bin/statusbar/sb-clock new file mode 100755 index 0000000..56d15d3 --- /dev/null +++ b/.local/bin/statusbar/sb-clock @@ -0,0 +1,29 @@ +#!/bin/sh + +clock=$(date '+%I') + +case "$clock" in + "00") icon="🕛" ;; + "01") icon="🕐" ;; + "02") icon="🕑" ;; + "03") icon="🕒" ;; + "04") icon="🕓" ;; + "05") icon="🕔" ;; + "06") icon="🕕" ;; + "07") icon="🕖" ;; + "08") icon="🕗" ;; + "09") icon="🕘" ;; + "10") icon="🕙" ;; + "11") icon="🕚" ;; + "12") icon="🕛" ;; +esac + +case $BLOCK_BUTTON in + 1) notify-send "This Month" "$(cal | sed "s/\<$(date +'%e'|tr -d ' ')\>/<b><span color='red'>&<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -d3)" ;; + 2) setsid -f "$TERMINAL" -e calcurse ;; + 3) notify-send "📅 Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\` + - Middle click opens calcurse if installed" ;; + 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +date "+%Y %b %d (%a) $icon %H:%M" diff --git a/.local/bin/statusbar/sb-doppler b/.local/bin/statusbar/sb-doppler new file mode 100755 index 0000000..f673fb3 --- /dev/null +++ b/.local/bin/statusbar/sb-doppler @@ -0,0 +1,22 @@ +#!/bin/sh + +# Show a Doppler RADAR of a user's preferred location. +secs=600 # Download a new doppler radar if one hasn't been downloaded in $secs seconds. +radarloc="${XDG_CACHE_HOME:-$HOME/.cache}/radar" +doppler="${XDG_CACHE_HOME:-$HOME/.cache}/doppler.gif" + +getdoppler() { curl -sL https://meteoinfo.ru/hmc-output/rmap/phenomena.gif > "$doppler" ;} + +showdoppler() { setsid -f mpv "$doppler" > /dev/null ;} + +case $BLOCK_BUTTON in + 1) [ $(($(date '+%s') - $(stat -c %Y "$doppler"))) -gt "$secs" ] && getdoppler + showdoppler ;; + 2) getdoppler && showdoppler ;; + 3) notify-send "🗺️ Doppler RADAR module" "\- Left click for local Doppler RADAR. +- Middle click to update RADAR location. +After $secs seconds, new clicks will also automatically update the doppler RADAR." ;; + 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +echo 🌅 diff --git a/.local/bin/statusbar/sb-forecast b/.local/bin/statusbar/sb-forecast new file mode 100755 index 0000000..d0e5326 --- /dev/null +++ b/.local/bin/statusbar/sb-forecast @@ -0,0 +1,53 @@ +#!/bin/sh + +# Displays today's precipication chance (☔), and daily low (🥶) and high (🌞). +# Usually intended for the statusbar. + +url="${WTTRURL:-wttr.in}" +weatherreport="${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport" + +# Get a weather report from 'wttr.in' and save it locally. +getforecast() { timeout --signal=1 2s curl -sf "$url/$LOCATION" > "$weatherreport" || exit 1; } + +# Forecast should be updated only once a day. +checkforecast() { + [ -s "$weatherreport" ] && [ "$(stat -c %y "$weatherreport" 2>/dev/null | + cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] +} + +getprecipchance() { + echo "$weatherdata" | sed '16q;d' | # Extract line 16 from file + grep -wo "[0-9]*%" | # Find a sequence of digits followed by '%' + sort -rn | # Sort in descending order + head -1q # Extract first line +} + +getdailyhighlow() { + echo "$weatherdata" | sed '13q;d' | # Extract line 13 from file + grep -o "m\\([-+]\\)*[0-9]\\+" | # Find temperatures in the format "m<signed number>" + sed 's/[+m]//g' | # Remove '+' and 'm' + sort -g | # Sort in ascending order + sed -e 1b -e '$!d' # Extract the first and last lines +} + +readfile() { weatherdata="$(cat "$weatherreport")" ;} + +showweather() { + readfile + printf "rain: %s min: %s° max: %s°\n" "$(getprecipchance)" $(getdailyhighlow) +} + +case $BLOCK_BUTTON in + 1) setsid -f "$TERMINAL" -e less -Sfr "$weatherreport" ;; + 2) getforecast && showweather ;; + 3) notify-send "🌈 Weather module" "\- Left click for full forecast. +- Middle click to update forecast. +☔: Chance of rain/snow +🥶: Daily low +🌞: Daily high" ;; + 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +checkforecast || getforecast + +showweather diff --git a/.local/bin/statusbar/sb-internet b/.local/bin/statusbar/sb-internet new file mode 100755 index 0000000..07774e0 --- /dev/null +++ b/.local/bin/statusbar/sb-internet @@ -0,0 +1,43 @@ +#!/bin/sh + +# Show wifi 📶 and percent strength or 📡 if none. +# Show 🌐 if connected to ethernet or ❎ if none. +# Show 🔒 if a vpn connection is active + +togglevpn() { + if [ ! -n "$(cat /sys/class/net/libre/operstate 2>/dev/null)" ];then + reloadsingbox + notify-send " Internet module" "Connected to VPN" + else + killall sing-box + notify-send " Internet module" "Disconnected from VPN" + fi +} + +case $BLOCK_BUTTON in + 1) togglevpn 2>/dev/null ;; + 3) notify-send "🌐 Internet module" "\- Click to enable/disable VPN + ❌: wifi disabled + 📡: no wifi connection + 📶: wifi connection with quality + ❎: no ethernet + 🌐: ethernet working + 🔒: vpn is active + " ;; + 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +# Wifi +if [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'up' ] ; then + wifiicon="$(awk '/^\s*w/ { print "📶", int($3 * 100 / 70) "% " }' /proc/net/wireless)" +elif [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'down' ] ; then + [ "$(cat /sys/class/net/w*/flags 2>/dev/null)" = '0x1003' ] && wifiicon="📡 " || wifiicon="❌ " +fi + +# Ethernet +[ "$(cat /sys/class/net/e*/operstate 2>/dev/null)" = 'up' ] && ethericon=" " || ethericon="❎" + +# Wireguard +[ -n "$(cat /sys/class/net/libre/operstate 2>/dev/null)" ] && tunicon=" " + +printf "%s%s%s\n" "$wifiicon" "$ethericon" "$tunicon" diff --git a/.local/bin/statusbar/sb-mailbox b/.local/bin/statusbar/sb-mailbox new file mode 100755 index 0000000..9177e03 --- /dev/null +++ b/.local/bin/statusbar/sb-mailbox @@ -0,0 +1,20 @@ +#!/bin/sh + +# Displays number of unread mail and an loading icon if updating. +# When clicked, brings up `neomutt`. + +case $BLOCK_BUTTON in + 1) setsid -w -f "$TERMINAL" -e neomutt; pkill -RTMIN+12 i3blocks ;; + 2) setsid -f mailsync >/dev/null ;; + 3) notify-send "📬 Mail module" "\- Shows unread mail +- Shows 🔃 if syncing mail +- Left click opens neomutt +- Middle click syncs mail" ;; + 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +unread="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)" + +pidof mailsync >/dev/null 2>&1 && icon=" " + +[ "$unread" = "0" ] && [ "$icon" = "" ] || echo " $unread$icon" diff --git a/.local/bin/statusbar/sb-memory b/.local/bin/statusbar/sb-memory new file mode 100755 index 0000000..d95d85c --- /dev/null +++ b/.local/bin/statusbar/sb-memory @@ -0,0 +1,12 @@ +#!/bin/sh + +case $BLOCK_BUTTON in + 1) notify-send "🧠 Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;; + 2) setsid -f "$TERMINAL" -e btop ;; + 3) notify-send "🧠 Memory module" "\- Shows Memory Used/Total. +- Click to show memory hogs. +- Middle click to open htop." ;; + 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +free --mebi | sed -n '2{p;q}' | awk '{printf (" %2.2fGiB/%2.2fGiB\n", ( $3 / 1024), ($2 / 1024))}' diff --git a/.local/bin/statusbar/sb-microphone b/.local/bin/statusbar/sb-microphone new file mode 100755 index 0000000..45754c2 --- /dev/null +++ b/.local/bin/statusbar/sb-microphone @@ -0,0 +1,37 @@ +#!/bin/sh + +# Prints the current microphone volume or if muted. + +case $BLOCK_BUTTON in + 1) setsid -w -f "$TERMINAL" -e pulsemixer; pkill -RTMIN+23 "${STATUSBAR:-i3blocks}" ;; + 2) wpctl set-mute @DEFAULT_SOURCE@ toggle ;; + 4) wpctl set-volume @DEFAULT_SOURCE@ 1%+ ;; + 5) wpctl set-volume @DEFAULT_SOURCE@ 1%- ;; + 3) notify-send " Microphone volume module" "\- Shows volume , if muted. +- Middle click to mute. +- Scroll to change." ;; + 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +vol="$(wpctl get-volume @DEFAULT_AUDIO_SOURCE@)" + +# If muted, print and exit. +[ "$vol" != "${vol%\[MUTED\]}" ] && echo && exit + +vol="${vol#Volume: }" + +split() { + # For ommiting the . without calling and external program. + IFS=$2 + set -- $1 + printf '%s' "$@" +} + +vol="$(printf "%.0f" "$(split "$vol" ".")")" + +case 1 in + $((vol >= 1)) ) icon="" ;; + * ) echo && exit ;; +esac + +echo "$icon $vol%" diff --git a/.local/bin/statusbar/sb-nettraf b/.local/bin/statusbar/sb-nettraf new file mode 100755 index 0000000..2f223d6 --- /dev/null +++ b/.local/bin/statusbar/sb-nettraf @@ -0,0 +1,29 @@ +#!/bin/sh + +# Module showing network traffic. Shows how much data has been received (RX) or +# transmitted (TX) since the previous time this script ran. So if run every +# second, gives network traffic per second. + +case $BLOCK_BUTTON in + 1) setsid -f "$TERMINAL" -e bmon ;; + 3) notify-send "🌐 Network traffic module" "🔻: Traffic received +🔺: Traffic transmitted" ;; + 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +update() { + sum=0 + for arg; do + read -r i < "$arg" + sum=$(( sum + i )) + done + cache=/tmp/${1##*/} + [ -f "$cache" ] && read -r old < "$cache" || old=0 + printf %d\\n "$sum" > "$cache" + printf %d\\n $(( sum - old )) +} + +rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes) +tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes) + +printf " %4sB %4sB\\n" $(numfmt --to=iec $rx $tx) diff --git a/.local/bin/statusbar/sb-news b/.local/bin/statusbar/sb-news new file mode 100755 index 0000000..f5e09fd --- /dev/null +++ b/.local/bin/statusbar/sb-news @@ -0,0 +1,17 @@ +#!/bin/sh + +# Displays number of unread news items and an loading icon if updating. +# When clicked, brings up `newsboat`. + +case $BLOCK_BUTTON in + 1) setsid "$TERMINAL" -e newsboat ;; + 2) setsid -f newsup >/dev/null && exit ;; + 3) notify-send " News module" "\- Shows unread news items +- Shows 🔃 if updating with \`newsup\` +- Left click opens newsboat +- Middle click syncs RSS feeds +<b>Note:</b> Only one instance of newsboat (including updates) may be running at a time." ;; + 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + + cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ if($1>0) print " " $1}')$(cat "${XDG_CONFIG_HOME:-$HOME/.config}"/newsboat/.update 2>/dev/null)" diff --git a/.local/bin/statusbar/sb-pacpackages b/.local/bin/statusbar/sb-pacpackages new file mode 100755 index 0000000..9b12f34 --- /dev/null +++ b/.local/bin/statusbar/sb-pacpackages @@ -0,0 +1,29 @@ +#!/bin/sh + +# Displays number of upgradeable packages. +# For this to work, have a `pacman -Sy` command run in the background as a +# cronjob every so often as root. This script will then read those packages. +# When clicked, it will run an upgrade via pacman. +# +# Add the following text as a file in /usr/share/libalpm/hooks/statusbar.hook: +# +# [Trigger] +# Operation = Upgrade +# Type = Package +# Target = * +# +# [Action] +# Description = Updating statusbar... +# When = PostTransaction +# Exec = /usr/bin/pkill -RTMIN+8 dwmblocks # Or i3blocks if using i3. + +case $BLOCK_BUTTON in + 1) setsid -f "$TERMINAL" -e sb-popupgrade ;; + 2) notify-send "$(/usr/bin/pacman -Qu)" ;; + 3) notify-send "🎁 Upgrade module" "📦: number of upgradable packages +- Left click to upgrade packages +- Middle click to show upgradable packages" ;; + 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +pacman -Qu | grep -Fcv "[ignored]" | sed "s/^/ /;s/^ 0$//g" diff --git a/.local/bin/statusbar/sb-popupgrade b/.local/bin/statusbar/sb-popupgrade new file mode 100755 index 0000000..900f2a6 --- /dev/null +++ b/.local/bin/statusbar/sb-popupgrade @@ -0,0 +1,9 @@ +#!/bin/sh + +printf "Beginning upgrade.\\n" + +yay -Syu +pkill -RTMIN+8 "${STATUSBAR:-i3blocks}" + +printf "\\nUpgrade complete.\\nPress <Enter> to exit window.\\n\\n" +read -r _ diff --git a/.local/bin/statusbar/sb-volume b/.local/bin/statusbar/sb-volume new file mode 100755 index 0000000..2676ead --- /dev/null +++ b/.local/bin/statusbar/sb-volume @@ -0,0 +1,39 @@ +#!/bin/sh + +# Prints the current volume or 🔇 if muted. + +case $BLOCK_BUTTON in + 1) setsid -w -f "$TERMINAL" -e pulsemixer; pkill -RTMIN+10 "${STATUSBAR:-i3blocks}" ;; + 2) wpctl set-mute @DEFAULT_SINK@ toggle ;; + 4) wpctl set-volume @DEFAULT_SINK@ 1%+ ;; + 5) wpctl set-volume @DEFAULT_SINK@ 1%- ;; + 3) notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted. +- Middle click to mute. +- Scroll to change." ;; + 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)" + +# If muted, print 🔇 and exit. +[ "$vol" != "${vol%\[MUTED\]}" ] && echo && exit + +vol="${vol#Volume: }" + +split() { + # For ommiting the . without calling and external program. + IFS=$2 + set -- $1 + printf '%s' "$@" +} + +vol="$(printf "%.0f" "$(split "$vol" ".")")" + +case 1 in + $((vol >= 70)) ) icon=" " ;; + $((vol >= 30)) ) icon=" " ;; + $((vol >= 1)) ) icon=" " ;; + * ) echo && exit ;; +esac + +echo "$icon $vol%" diff --git a/.local/bin/sysact b/.local/bin/sysact new file mode 100755 index 0000000..b83f47f --- /dev/null +++ b/.local/bin/sysact @@ -0,0 +1,26 @@ +#!/bin/sh + +# A dmenu wrapper script for system functions. +export WM="sway" +case "$(readlink -f /sbin/init)" in + *systemd*) ctl='systemctl' ;; + *) ctl='loginctl' ;; +esac + +wmpid(){ # This function is needed if there are multiple instances of the window manager. + tree="$(pstree -ps $$)" + tree="${tree#*$WM(}" + echo "${tree%%)*}" +} + +case "$(printf "🔒 lock\n🚪 leave $WM\n♻️ renew $WM\n🐻 hibernate\n🔃 reboot\n🖥️shutdown\n💤 sleep\n📺 display off" | bemenu -i -p 'Action: ')" in + '🔒 lock') slock ;; + "🚪 leave $WM") swaymsg exit ;; + "♻️ renew $WM") kill -HUP "$(wmpid)" ;; + '🐻 hibernate') slock $ctl hibernate -i ;; + '💤 sleep') slock $ctl suspend -i ;; + '🔃 reboot') $ctl reboot -i ;; + '🖥️shutdown') $ctl poweroff -i ;; + '📺 display off') xset dpms force off ;; + *) exit 1 ;; +esac diff --git a/README.md b/README.md new file mode 100644 index 0000000..2ada761 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# sway dots diff --git a/aurdeps.txt b/aurdeps.txt new file mode 100644 index 0000000..8a89625 --- /dev/null +++ b/aurdeps.txt @@ -0,0 +1,6 @@ +tessen +sing-box +sing-geoip-db +sing-geoip-rule-set +sing-geosite-db +sing-geosite-rule-set diff --git a/dependencies.txt b/dependencies.txt new file mode 100644 index 0000000..cb70699 --- /dev/null +++ b/dependencies.txt @@ -0,0 +1,72 @@ +# sway +sway +i3blocks +swaybg + +# sound +pipewire +pipewire-pulse +wireplumber + +# fonts +adobe-source-code-pro-fonts +adobe-source-sans-fonts +adobe-source-serif-fonts +ttf-nerd-fonts-symbols +ttf-font-awesome +noto-fonts-emoji +fontconfig + +# lf +lf +ffmpegthumbnailer +mediainfo +bat +chafa + +# apps +foot +firefox +wl-clipboard +neovim +grim +slurp +zsh +zsh-autosuggestions +mpv +yt-dlp +unzip +dunst +imv +newsboat + +# utilities +gnupg +# pinentry-qt deps +kwindowsystem +kguiaddons +# dark theme qt +qt6ct +openssh-dinit +fakeroot +polkit +fastfetch +btop +libnotify + +#html and css lsp dep +npm + +man + +#tessen +pass +pass-otp +which +wtype +#muttwizard +neomutt +isync +msmtp +cronie-dinit +lynx @@ -0,0 +1,108 @@ +#!/bin/sh +set -e +WORKDIRECTORY=$PWD +PERMUSER=$(logname) + +if [ "$(id -u)" -ne 0 ] + then printf "The script has to be run as root.\n" + exit +fi + +DEPLIST="`sed -e 's/#.*$//' -e '/^$/d' dependencies.txt | tr '\n' ' '`" +pacman -Sy --noconfirm +pacman -S $DEPLIST --noconfirm + +usermod -aG seat,input,audio,video $PERMUSER +doas -u $PERMUSER cp -r "$WORKDIRECTORY"/.config /home/$PERMUSER +doas -u $PERMUSER cp -r "$WORKDIRECTORY"/.local /home/$PERMUSER +doas -u $PERMUSER cp -a "$WORKDIRECTORY"/.zprofile /home/$PERMUSER + +doas -u $PERMUSER mkdir -p /home/$PERMUSER/.config/git +doas -u $PERMUSER mkdir -p /home/$PERMUSER/.config/npm +doas -u $PERMUSER touch /home/$PERMUSER/.config/npm/npmrc +doas -u $PERMUSER mkdir -p /home/$PERMUSER/.cache/lf +doas -u $PERMUSER mkdir -p /home/$PERMUSER/.cache/zsh +doas -u $PERMUSER mkdir -p /home/$PERMUSER/.local/share/themes +doas -u $PERMUSER mkdir -p /home/$PERMUSER/.local/share/icons +doas -u $PERMUSER mkdir -p /home/$PERMUSER/.local/share/fonts + +cd "$WORKDIRECTORY" || exit +doas -u $PERMUSER git clone https://github.com/awnrt/gruvbox-gtk-theme +doas -u $PERMUSER cp -r gruvbox-gtk-theme/Gruvbox-Dark /home/$PERMUSER/.local/share/themes +doas -u $PERMUSER cp -r gruvbox-gtk-theme/Gruvbox-Icons /home/$PERMUSER/.local/share/icons + +doas -u $PERMUSER dbus-launch gsettings set org.gnome.desktop.interface gtk-theme "Gruvbox-Dark" +doas -u $PERMUSER dbus-launch gsettings set org.gnome.desktop.interface icon-theme "Gruvbox-Icons" +doas -u $PERMUSER dbus-launch gsettings set org.gnome.desktop.wm.preferences button-layout 'appmenu' +doas -u $PERMUSER dbus-launch gsettings set org.gnome.desktop.interface font-name "Sans 11" + +cd "$WORKDIRECTORY" || exit +doas -u $PERMUSER git clone https://github.com/zdharma-continuum/fast-syntax-highlighting +#doas -u $PERMUSER git clone https://github.com/Aloxaf/fzf-tab +mkdir -p /usr/share/zsh/plugins +cp -rf fast-syntax-highlighting /usr/share/zsh/plugins +#cp -rf fzf-tab /usr/share/zsh/plugins +git clone https://git.awy.one/dwl +cd dwl +make clean install +cd "$WORKDIRECTORY" +git clone https://git.awy.one/someblocks +cd someblocks +make clean install +cd "$WORKDIRECTORY" + +ln -s /usr/bin/wmenu /usr/bin/dmenu + +doas -u $PERMUSER mkdir -p /home/$PERMUSER/.ssh +doas -u $PERMUSER mkdir -p /home/$PERMUSER/.gnupg +doas -u $PERMUSER touch /home/$PERMUSER/.gnupg/gpg-agent.conf + +cat <<EOL >> /home/$PERMUSER/.gnupg/gpg-agent.conf +enable-ssh-support +pinentry-program /usr/bin/pinentry-qt +default-cache-ttl 34560000 +max-cache-ttl 34560000 +EOL + +cat <<EOL >> /home/$PERMUSER/.config/npm/npmrc +prefix=\${XDG_DATA_HOME}/npm +cache=\${XDG_CACHE_HOME}/npm +init-module=\${XDG_CONFIG_HOME}/npm/config/npm-init.js +logs-dir=\${XDG_STATE_HOME}/npm/logs +EOL + +doas -u $PERMUSER find /home/$PERMUSER/.gnupg -type f -exec chmod 600 {} \; +doas -u $PERMUSER find /home/$PERMUSER/.gnupg -type d -exec chmod 700 {} \; +doas -u $PERMUSER find /home/$PERMUSER/.ssh -type f -exec chmod 600 {} \; +doas -u $PERMUSER find /home/$PERMUSER/.ssh -type d -exec chmod 700 {} \; + +chsh -s /bin/zsh $PERMUSER + +mkdir -p /root/.config/nvim +cat <<EOL >> /root/.config/nvim/init.vim +set title +set clipboard+=unnamedplus +set relativenumber +colorscheme vim +EOL + +sed -i -e "/^#"Color"/s/^#//" /etc/pacman.conf +sed -i -e '/Color/a\ILoveCandy' /etc/pacman.conf + +rm /home/$PERMUSER/.bash* + +# makeflags set to number of threads and pacman elevation is doas +sed -i 's/#MAKEFLAGS=.*$/MAKEFLAGS="-j'$(nproc)'"/' /etc/makepkg.conf +sed -i 's/#PACMAN_AUTH=.*$/PACMAN_AUTH=(doas)/' /etc/makepkg.conf +doas -u $PERMUSER git clone https://aur.archlinux.org/yay.git +cd yay +doas -u $PERMUSER makepkg -csi --noconfirm +cd "$WORKDIRECTORY" +DEPLIST="`sed -e 's/#.*$//' -e '/^$/d' aurdeps.txt | tr '\n' ' '`" +doas -u $PERMUSER yay -S $DEPLIST --noconfirm +cd .. +rm -rf dwldots +rm -rf yay +rm -rf go + +echo "Your linux is riced!" |