From 94d2955ab00990ed49366195b079dc70bd0af268 Mon Sep 17 00:00:00 2001 From: Arthur Khachaturov Date: Thu, 28 Nov 2024 22:19:16 +0300 Subject: [PATCH] idc changed a lot of files --- .config/X11/autostart | 7 +-- .config/X11/runonce | 5 ++ .config/X11/xprofile | 5 +- .config/alacritty/alacritty.toml | 63 ++++++++++++++++++++++++++ .config/alacritty/alacritty.yml | 6 +-- .config/clangd/config.yaml | 10 ++++ .config/nvim/init.lua | 3 +- .config/nvim/lazy-lock.json | 40 ++++++++++++++++ .config/nvim/lua/config/mappings.lua | 7 ++- .config/nvim/lua/lsp/init.lua | 14 +++--- .config/nvim/lua/plugins/init.lua | 6 ++- .config/nvim/lua/plugins/peekaboo.lua | 6 +++ .config/nvim/lua/plugins/telescope.lua | 7 ++- .config/nvim/lua/utils/init.lua | 5 ++ .config/nvim/lua/utils/inspect.lua | 2 + .config/picom.conf | 2 +- .config/tmux/keybinds.conf | 2 +- .config/tmux/theme.conf | 2 +- .config/tmux/tmux.conf | 4 +- .config/zsh/.zprofile | 1 - .config/zsh/.zshenv | 3 +- .config/zsh/.zshrc | 18 ++++---- .gitconfig | 3 +- .gitignore | 1 - .local/bin/scripts/ie | 17 ++++++- .local/bin/scripts/tg | 12 +++-- .local/bin/scripts/volume | 2 +- .local/bin/scripts/xr | 20 ++++---- .local/bin/source/src_add_path | 14 +++++- .local/bin/statusbar/sb-battery | 41 +++++++++++------ .xinitrc | 19 +++++--- 31 files changed, 267 insertions(+), 80 deletions(-) create mode 100755 .config/X11/runonce create mode 100644 .config/alacritty/alacritty.toml create mode 100644 .config/clangd/config.yaml create mode 100644 .config/nvim/lazy-lock.json create mode 100644 .config/nvim/lua/plugins/peekaboo.lua create mode 100644 .config/nvim/lua/utils/init.lua create mode 100644 .config/nvim/lua/utils/inspect.lua diff --git a/.config/X11/autostart b/.config/X11/autostart index 94a52ca..a324973 100755 --- a/.config/X11/autostart +++ b/.config/X11/autostart @@ -1,7 +1,7 @@ set -x # setxkbmap -layout us,ru -option grp:win_space_toggle -xwallpaper --zoom ${HOME}/.local/share/wallpaper/wallpaper.png +xwallpaper --zoom "${HOME}"/.local/share/wallpaper/wallpaper.png launch() { cmd="$1" @@ -13,10 +13,7 @@ launch() { xrdb -merge ~/.Xresources launch xsettingsd & -# launch picom --config="${HOME}/.config/picom.conf" & -launch copyq & launch dunst & -launch flameshot & launch dwmblocks & -# vim: ft=bash +# vim: ft=sh diff --git a/.config/X11/runonce b/.config/X11/runonce new file mode 100755 index 0000000..14f3c48 --- /dev/null +++ b/.config/X11/runonce @@ -0,0 +1,5 @@ +clipmenud & +flameshot & +easyeffects --gapplication-service & + +# vim: ft=sh diff --git a/.config/X11/xprofile b/.config/X11/xprofile index 75c56b7..dfae023 100644 --- a/.config/X11/xprofile +++ b/.config/X11/xprofile @@ -1,11 +1,10 @@ -systemctl --user import-environment DISPLAY - set -a TERMINAL=/usr/bin/alacritty TERM=/usr/bin/alacritty -_JAVA_AWT_WM_NONREPARENTING=1 +_JAVA_AWT_WM_NONREPARENTING=1 AWT_TOOLKIT=MToolkit +QT_ENABLE_HIGHDPI_SCALING=1 MOZ_USE_XINPUT2=1 diff --git a/.config/alacritty/alacritty.toml b/.config/alacritty/alacritty.toml new file mode 100644 index 0000000..6cbc0ca --- /dev/null +++ b/.config/alacritty/alacritty.toml @@ -0,0 +1,63 @@ + +[colors.bright] +black = "#696969" +blue = "#007FFF" +cyan = "#00CCCC" +green = "#03C03C" +magenta = "#FF1493" +red = "#FF2400" +white = "#FFFAFA" +yellow = "#FDFF00" + +[colors.normal] +black = "#101010" +blue = "#0087BD" +cyan = "#20B2AA" +green = "#009F6B" +magenta = "#9A4EAE" +red = "#C40233" +white = "#C6C6C6" +yellow = "#FFD700" + +[colors.primary] +background = "#101010" +foreground = "#C6C6C6" + +[cursor.style] +blinking = "Off" +shape = "Block" + +[env] +TERM = "xterm-256color" + +[font] +size = 11.5 + +[font.glyph_offset] +x = 0 +y = 0 + +[font.normal] +family = "Mononoki Nerd Font Propo" + +[font.offset] +x = 0 +y = 0 + +[window] +dynamic_padding = true + +[window.padding] +x = 2 +y = 2 + +[keyboard] +bindings = [ + {key = "Slash", mods = "Control", chars = "\u001f"}, + {key = "Space", mods = "Control", chars = "\u0000"}, + {key = "Back", mods = "Control", chars = "\u001b\u007f"}, + {key = "M", mods = "Control", chars = "\u0100"} +] + +[general] +live_config_reload = true diff --git a/.config/alacritty/alacritty.yml b/.config/alacritty/alacritty.yml index 24e1025..3089b27 100644 --- a/.config/alacritty/alacritty.yml +++ b/.config/alacritty/alacritty.yml @@ -33,15 +33,15 @@ env: TERM: xterm-256color font: - size: 11 + size: 11.5 glyph_offset: x: 0 y: 0 normal: family: "Mononoki Nerd Font Propo" offset: - x: 1 - y: 2 + x: 0 + y: 0 key_bindings: - chars: "\x1f" diff --git a/.config/clangd/config.yaml b/.config/clangd/config.yaml new file mode 100644 index 0000000..0fcee1e --- /dev/null +++ b/.config/clangd/config.yaml @@ -0,0 +1,10 @@ +If: + PathMatch: '.*\.(c|h)' +CompileFlags: + Add: [ -std=c20 ] + +--- +If: + PathMatch: '.*\.(cpp|hpp)' +CompileFlags: + Add: [ -std=c++20 ] diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 6320cf5..4715125 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,4 +1,5 @@ --- Remap leader key to +-- Useful tools for lua +Utils = require('utils') -- Load basic configuration require("config") diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..a03d74b --- /dev/null +++ b/.config/nvim/lazy-lock.json @@ -0,0 +1,40 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "LuaSnip": { "branch": "master", "commit": "45db5addf8d0a201e1cf247cae4cdce605ad3768" }, + "Navigator.nvim": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" }, + "bufferline.nvim": { "branch": "main", "commit": "0b2fd861eee7595015b6561dade52fb060be10c4" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, + "fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" }, + "indent-blankline.nvim": { "branch": "master", "commit": "18603eb949eba08300799f64027af11ef922283f" }, + "iptables": { "branch": "master", "commit": "0d18b1e468f547dd7e2c494d42bc134a1e0eac7e" }, + "lazy.nvim": { "branch": "main", "commit": "7967abe55752aa90532e6bb4bd4663fe27a264cb" }, + "lspkind.nvim": { "branch": "master", "commit": "cff4ae321a91ee3473a92ea1a8c637e3a9510aec" }, + "lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" }, + "nvim-autopairs": { "branch": "master", "commit": "fd2badc24e675f947162a16c124d395bde80dbd6" }, + "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, + "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" }, + "nvim-lspconfig": { "branch": "master", "commit": "bb682c167a0878338b4313b55538953d1c039085" }, + "nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" }, + "nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" }, + "nvim-tree.lua": { "branch": "master", "commit": "d41b4ca013ed89e41b9c0ecbdae5f1633e42f7fa" }, + "nvim-treesitter": { "branch": "master", "commit": "4af16a10b7f1e79275f712a1c6dcf725d301a303" }, + "nvim-treesitter-context": { "branch": "master", "commit": "e6cc783b74606d97ca9eff6494e3f5c2ca603a50" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "bf8d2ad35d1d1a687eae6c065c3d524f7ab61b23" }, + "nvim-web-devicons": { "branch": "master", "commit": "9793801f974bba70e4ac5d7eae6c4f5659993d8e" }, + "onedark.nvim": { "branch": "master", "commit": "fae34f7c635797f4bf62fb00e7d0516efa8abe37" }, + "plenary.nvim": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" }, + "quickfix-reflector.vim": { "branch": "master", "commit": "6a6a9e28e1713b9e9db99eec1e6672e5666c01b9" }, + "telescope-emoji.nvim": { "branch": "master", "commit": "86248d97be84a1ce83f0541500ef9edc99ea2aa1" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, + "todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" }, + "trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" }, + "vim-fugitive": { "branch": "master", "commit": "d4877e54cef67f5af4f950935b1ade19ed6b7370" }, + "vim-peekaboo": { "branch": "master", "commit": "cc4469c204099c73dd7534531fa8ba271f704831" }, + "vim-sleuth": { "branch": "master", "commit": "cd9d382e33bb817abe7f10cdc3a606bf1d491d75" }, + "vim-wakatime": { "branch": "master", "commit": "53bba6bb8342de9cbdafc82142a9b5e82008d858" } +} diff --git a/.config/nvim/lua/config/mappings.lua b/.config/nvim/lua/config/mappings.lua index d2ccc50..afab213 100644 --- a/.config/nvim/lua/config/mappings.lua +++ b/.config/nvim/lua/config/mappings.lua @@ -20,7 +20,6 @@ map({ 'n', 'v' }, 'k', 'v:count == 0 ? "gk" : "k"', { expr = true, silent = true map({ 'n', 'v' }, 'j', 'v:count == 0 ? "gj" : "j"', { expr = true, silent = true }) -- Duplicate leader feats to gradually move to -map('n', '', function() require('utils.close_buffer').close_buffer() end) -- Copy and paste from clipboard map({ 'n', 'v' }, 'y', '"+y') @@ -33,6 +32,12 @@ map({ 'n', 'v' }, 'm', '10>') map({ 'n', 'v' }, 'N', '6-') map({ 'n', 'v' }, 'M', '6+') +-- goto files +map('n', 'f', 'gF') + +-- Close buffers quickly +map('n', '', ":bd", { silent = true }) + -- quickfix buffer map('n', '', ':cn', { silent = true }) map('n', '', ':cp', { silent = true }) diff --git a/.config/nvim/lua/lsp/init.lua b/.config/nvim/lua/lsp/init.lua index e1f49a3..21890e4 100644 --- a/.config/nvim/lua/lsp/init.lua +++ b/.config/nvim/lua/lsp/init.lua @@ -1,12 +1,14 @@ local servers = { - clangd = {}, - pyright = {}, - lua_ls = require('lsp.lua_ls'), - gopls = {}, - rust_analyzer = {}, bashls = {}, - hls = {}, + clangd = {}, eslint = {}, + gopls = {}, + hls = {}, + jdtls = {}, + kotlin_language_server = {}, + lua_ls = require('lsp.lua_ls'), + pyright = {}, + rust_analyzer = {}, ts_ls = {}, } diff --git a/.config/nvim/lua/plugins/init.lua b/.config/nvim/lua/plugins/init.lua index 666f7bf..5461c0c 100644 --- a/.config/nvim/lua/plugins/init.lua +++ b/.config/nvim/lua/plugins/init.lua @@ -1,13 +1,15 @@ return { 'rcarriga/nvim-notify', - 'psliwka/vim-smoothie', 'stefandtw/quickfix-reflector.vim', + 'tpope/vim-fugitive', 'tpope/vim-sleuth', + 'vim-scripts/iptables', { 'akinsho/bufferline.nvim', opts = {}, dependencies = { 'navarasu/onedark.nvim' } }, { 'ethanholz/nvim-lastplace', opts = {} }, + { 'folke/todo-comments.nvim', opts = {} }, { 'kylechui/nvim-surround', version = '*', event = 'VeryLazy', opts = {} }, { 'lukas-reineke/indent-blankline.nvim', main = 'ibl', opts = {} }, { 'norcalli/nvim-colorizer.lua', opts={ '*' }, dependencies = { 'navarasu/onedark.nvim' } }, - { 'wakatime/vim-wakatime', event = 'VeryLazy' }, + -- { 'wakatime/vim-wakatime', event = 'VeryLazy' }, { 'williamboman/mason.nvim', opts = {} }, } diff --git a/.config/nvim/lua/plugins/peekaboo.lua b/.config/nvim/lua/plugins/peekaboo.lua new file mode 100644 index 0000000..edef215 --- /dev/null +++ b/.config/nvim/lua/plugins/peekaboo.lua @@ -0,0 +1,6 @@ +return { + 'junegunn/vim-peekaboo', + config = function () + vim.g.peekaboo_window = 'enew' + end +} diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua index b78d0ff..724ece8 100644 --- a/.config/nvim/lua/plugins/telescope.lua +++ b/.config/nvim/lua/plugins/telescope.lua @@ -4,6 +4,7 @@ return { dependencies = { 'navarasu/onedark.nvim', 'nvim-lua/plenary.nvim', + 'xiyaowong/telescope-emoji.nvim', { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }, }, @@ -23,7 +24,8 @@ return { }, } - pcall(require('telescope').load_extension, 'fzf') + require('telescope').load_extension('fzf') + require('telescope').load_extension('emoji') vim.keymap.set('n', '/', function() require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_ivy { @@ -33,9 +35,10 @@ return { end) vim.keymap.set('n', '?', require('telescope.builtin').live_grep) + vim.keymap.set('n', 'wf', require('telescope.builtin').grep_string) vim.keymap.set('n', 'of', require('telescope.builtin').oldfiles) vim.keymap.set('n', 'af', require('telescope.builtin').git_files) vim.keymap.set('n', 'sf', require('telescope.builtin').find_files) - vim.keymap.set('n', 'fw', require('telescope.builtin').grep_string) + vim.keymap.set('n', '.', require('telescope').extensions.emoji.emoji) end } diff --git a/.config/nvim/lua/utils/init.lua b/.config/nvim/lua/utils/init.lua new file mode 100644 index 0000000..3a37cf7 --- /dev/null +++ b/.config/nvim/lua/utils/init.lua @@ -0,0 +1,5 @@ +local M = {} + +M.inspect = require('utils.inspect') + +return M diff --git a/.config/nvim/lua/utils/inspect.lua b/.config/nvim/lua/utils/inspect.lua new file mode 100644 index 0000000..3387810 --- /dev/null +++ b/.config/nvim/lua/utils/inspect.lua @@ -0,0 +1,2 @@ +-- https://github.com/kikito/inspect.lua +local a={Options={}}local tostring=tostring;local b=string.rep;local c=string.match;local d=string.char;local e=string.gsub;local f=string.format;local g;if rawget then g=rawget else g=function(h,i)return h[i]end end;local function j(h)return next,h,nil end;local function k(l)if c(l,'"')and not c(l,"'")then return"'"..l.."'"end;return'"'..e(l,'"','\\"')..'"'end;local m={["\a"]="\\a",["\b"]="\\b",["\f"]="\\f",["\n"]="\\n",["\r"]="\\r",["\t"]="\\t",["\v"]="\\v",["\127"]="\\127"}local n={["\127"]="\127"}for o=0,31 do local p=d(o)if not m[p]then m[p]="\\"..o;n[p]=f("\\%03d",o)end end;local function q(l)return e(e(e(l,"\\","\\\\"),"(%c)%f[0-9]",n),"%c",m)end;local r={['and']=true,['break']=true,['do']=true,['else']=true,['elseif']=true,['end']=true,['false']=true,['for']=true,['function']=true,['goto']=true,['if']=true,['in']=true,['local']=true,['nil']=true,['not']=true,['or']=true,['repeat']=true,['return']=true,['then']=true,['true']=true,['until']=true,['while']=true}local function s(l)return type(l)=="string"and not not l:match("^[_%a][_%a%d]*$")and not r[l]end;local t=math.floor;local function u(i,v)return type(i)=="number"and t(i)==i and 1<=i and i<=v end;local w={['number']=1,['boolean']=2,['string']=3,['table']=4,['function']=5,['userdata']=6,['thread']=7}local function x(y,z)local A,B=type(y),type(z)if A==B and(A=='string'or A=='number')then return y=self.depth then Y(Z,'{...}')else if self.cycles[h]>1 then Y(Z,f('<%d>',self:getId(h)))end;local G,H,F=E(h)Y(Z,'{')self.level=self.level+1;for o=1,F+H do if o>1 then Y(Z,',')end;if o<=F then Y(Z,' ')self:putValue(h[o])else local i=G[o-F]a1(self)if s(i)then Y(Z,i)else Y(Z,"[")self:putValue(i)Y(Z,"]")end;Y(Z,' = ')self:putValue(h[i])end end;local X=getmetatable(h)if type(X)=='table'then if F+H>0 then Y(Z,',')end;a1(self)Y(Z,' = ')self:putValue(X)end;self.level=self.level-1;if H>0 or type(X)=='table'then a1(self)elseif F>0 then Y(Z,' ')end;Y(Z,'}')end else Y(Z,f('<%s %d>',a5,self:getId(L)))end end;function a.inspect(a6,a7)a7=a7 or{}local a8=a7.depth or math.huge;local a9=a7.newline or'\n'local aa=a7.indent or' 'local R=a7.process;if R then a6=Q(R,a6,{},{})end;local K={}I(a6,K)local a2=setmetatable({buf={n=0},ids={},cycles=K,depth=a8,level=0,newline=a9,indent=aa},a0)a2:putValue(a6)return table.concat(a2.buf)end;setmetatable(a,{__call=function(ab,a6,a7)return a.inspect(a6,a7)end})return a diff --git a/.config/picom.conf b/.config/picom.conf index 7c2458a..da21c36 100644 --- a/.config/picom.conf +++ b/.config/picom.conf @@ -1,2 +1,2 @@ -backend = "xrender"; +backend = "glx"; vsync = true; diff --git a/.config/tmux/keybinds.conf b/.config/tmux/keybinds.conf index 2d1d583..3c15dcc 100644 --- a/.config/tmux/keybinds.conf +++ b/.config/tmux/keybinds.conf @@ -21,7 +21,7 @@ bind ';' "command-prompt" bind C-r "source-file ~/.config/tmux/tmux.conf" # Session binds -# bind C-n "new-session -c '#{pane_current_path}' -s '#{b:pane_current_path}'" +bind N "new-session -c '#{pane_current_path}' -s '#{b:pane_current_path}'" # bind C-x "set-option -g detach-on-destroy on; kill-session" bind X "set-option -g detach-on-destroy off; kill-session; set-option -g detach-on-destroy on" diff --git a/.config/tmux/theme.conf b/.config/tmux/theme.conf index 8e95033..b860ca7 100644 --- a/.config/tmux/theme.conf +++ b/.config/tmux/theme.conf @@ -5,7 +5,7 @@ set -g @theme-active-fg "color15" set -g @theme-urgent "red" # theme -set -g status-position "bottom" +set -g status-position "top" set -g status-style "bg=#{@theme-bg},fg=#{@theme-fg}" set -g message-style "bg=#{@theme-bg},fg=#{@theme-fg}" set -g status-justify "left" diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index d7e1cfa..09df37b 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -29,13 +29,13 @@ set -g visual-activity off set -g monitor-activity off # number windows with respect for base-index -set -g renumber-windows on +set -g renumber-windows off # Resize all windows to max size? setw -g aggressive-resize on # Change history limit -set -g history-limit 131072 +set -g history-limit 262144 # Source extra configs source-file ~/.config/tmux/theme.conf diff --git a/.config/zsh/.zprofile b/.config/zsh/.zprofile index b8cd215..e560026 100644 --- a/.config/zsh/.zprofile +++ b/.config/zsh/.zprofile @@ -2,4 +2,3 @@ # eval "$(ssh-agent -s)" # fi -systemctl --user import-environment XDG_CURRENT_DESKTOP diff --git a/.config/zsh/.zshenv b/.config/zsh/.zshenv index 3718ae0..8ffcddd 100644 --- a/.config/zsh/.zshenv +++ b/.config/zsh/.zshenv @@ -23,9 +23,10 @@ LC_ALL="en_US.UTF-8" # default apps EDITOR="/usr/bin/nvim" GPG_TTY="$(tty)" -MANPAGER="sh -c 'col -bx | batcat -l man -p'" +MANPAGER="sh -c 'col -bx | bat -l man -p'" MANROFFOPT="-c" MTR_OPTIONS="-t" +GNUPGHOME='~/.local/share/gnupg' SUDO_ASKPASS="${HOME}/.local/bin/scripts/dmenu_askpass" SSH_ASKPASS="${HOME}/.local/bin/scripts/ssh-askpass" diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index a7059fc..e795f30 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -1,6 +1,3 @@ -# [[ $- != *i* ]] && return # idk why would it be tho... - -. ~/.cargo/env . ~/.config/zsh/modes.sh # ls colors @@ -57,10 +54,10 @@ alias l="ls -lh" alias la="ls -lah" alias ll="ls -lh" alias tree="ls --tree" -alias lt="l -t" +alias lt="unbuffer lsd --color=always -lt" # set bat as help pager -alias -g -- --help='--help 2>&1 | batcat --language=help --style=plain' +alias -g -- --help='--help 2>&1 | bat --language=help --style=plain' # useful cd aliases alias ..="cd ../" @@ -76,16 +73,15 @@ alias venv="source src_venv" alias ex="source src_example" alias ap="source src_add_path" alias info="pinfo " -alias bat="batcat " +alias bat="bat " alias img="nsxiv " alias xclip="xclip -selection clipboard" alias d="diff --color -u " alias rgf="rg --files | rg " alias 7z="7zz" # for whatever reason 7z provides 7zz binary in debian -alias wt="watch -d -cn 0.1 " +alias wt="watch --color -d -cn 0.1 " alias cal="ncal -b" alias .e="source .env" -alias tp="taskell ${HOME}/.projects.md" # function aliases bl() { brightnessctl set "$1"% &> /dev/null; } @@ -99,7 +95,7 @@ compdef -a '_git; _git-commit' gdc # todo compdef '_files -g "*.md"' md # git aliases -gl() { git log "$@" | bat }; compdef '_git; _git-log' gl +gl() { git log --decorate "$@" | bat }; compdef '_git; _git-log' gl alias gs="git status" alias gc="git commit" alias gca="git commit --amend --no-edit" @@ -109,9 +105,11 @@ alias gck="git checkout" alias gb="git branch" alias gd="git diff" alias gr="git restore" -alias gr="git reset" +alias grs="git restore --staged" +alias grt="git reset" alias gcl="git clone" alias gds="gd --staged" +alias gm="git merge" # docker aliases alias dc="docker compose" diff --git a/.gitconfig b/.gitconfig index 243474d..680e9bc 100644 --- a/.gitconfig +++ b/.gitconfig @@ -1,5 +1,5 @@ [core] - pager = delta + pager = LESS="-Rz3" delta [user] email = me@wzray.ru name = Arthur Khachaturov @@ -14,5 +14,6 @@ syntax-theme = OneHalfDark [merge] conflictstyle = diff3 + tool = nvimdiff [diff] colorMoved = default diff --git a/.gitignore b/.gitignore index 0ec3d1f..617f0fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ .zcompdump -lazy-lock.json /.fonts/.uuid diff --git a/.local/bin/scripts/ie b/.local/bin/scripts/ie index 863089b..a022cac 100755 --- a/.local/bin/scripts/ie +++ b/.local/bin/scripts/ie @@ -1,6 +1,21 @@ #!/bin/bash API_ENDPOINT="http://ip-api.com/json/$1"'?fields=7876383' -printf "%s" "$(curl "${API_ENDPOINT}" 2>/dev/null)" | jq -r '[ "IP: \(.query)", "Country: \(.country)", "City: \(.city)", "ISP: \(.isp)", "ASN: \(.as)" ][] | "\(.)"' + +get_stats() { + api_response=$(curl "${API_ENDPOINT}" 2>/dev/null) + ip=$(jq -r .query <<<"$api_response") + ptr="$(dig -x "$ip" | grep -A 1 'ANSWER SECTION' | grep -v 'ANSWER SECTION')" + jq -r '[ "IP: \(.query)", "Country: \(.country)", "City: \(.city)", "ISP: \(.isp)", "ASN: \(.as)" ][] | "\(.)"' <<<"$api_response" + [ -n "$ptr" ] && echo "PTR: $ptr" +} + +if [ -t 0 ] && [ -t 1 ]; then + get_stats +elif [ -t 1 ]; then + notify-send -i /dev/null "Your IP address" "$(get_stats)" +else + curl -s ip.me +fi # vim: ft=bash diff --git a/.local/bin/scripts/tg b/.local/bin/scripts/tg index 7b5a6e6..a45444b 100755 --- a/.local/bin/scripts/tg +++ b/.local/bin/scripts/tg @@ -67,6 +67,7 @@ die() { main() { + msg="" while [ $# -gt 0 ]; do case "$1" in '-h'|'--help') help; exit 0 ;; @@ -74,16 +75,19 @@ main() { '-c'|'--code') tg__code=1; tg__params[parse_mode]='HTML' ;; '-r'|'--print-response') print_response=1 ;; '--tg'*) tg__params["${1#--tg}"]="$2"; shift ;; + *) msg+=" $1";; esac shift done - [ -t 0 ] && die "Can't run on stdin!" - - resp="$(tg::send_message "$@" 2>/dev/null)" + if [ -z "$msg" ]; then + [ -t 0 ] && die "Can't run on stdin!" + resp="$(tg::send_message "$@" 2>/dev/null)" + else + resp="$(tg::send_message "$@" 2>/dev/null <<<"$msg")" + fi [ -n "${print_response:+_}" ] && echo "$resp" - [ "$(jq .ok <<<"$resp")" = "true" ] || jq <<< "$resp" >&2 } diff --git a/.local/bin/scripts/volume b/.local/bin/scripts/volume index a414e3e..7703b77 100755 --- a/.local/bin/scripts/volume +++ b/.local/bin/scripts/volume @@ -1,4 +1,4 @@ #!/bin/bash -SINK="$(pactl list sinks short | grep RUNNING | cut -d ' ' -f 1)" +SINK="$(pactl list sinks short | grep RUNNING | grep -v 'easyeffects' | cut -d ' ' -f 1)" pactl set-sink-mute "$SINK" false ; pactl set-sink-volume "$SINK" "$1%" diff --git a/.local/bin/scripts/xr b/.local/bin/scripts/xr index cc47a95..6a5081a 100755 --- a/.local/bin/scripts/xr +++ b/.local/bin/scripts/xr @@ -1,7 +1,6 @@ #!/bin/bash # supress stderr -exec 2> /dev/null change_dpi() { sed -i -E --follow-symlinks "s/Xft\.dpi: .*?/Xft\.dpi: $1/g" ~/.Xresources @@ -27,15 +26,16 @@ if [[ -z "${EXT_MON}" ]]; then xrandr --rmmode "${INT_RES}" change_dpi 192 48 else - xrandr --rmmode "${INT_RES}" - # shellcheck disable=all - xrandr --newmode $(echo $INT_MODELINE) # this is a hack to make xrandr recognize the resolution - xrandr --addmode eDP-1 "${INT_RES}" - xrandr --output eDP-1 --pos 2560x400 --mode "${INT_RES}" --output "${EXT_MON}" --pos 0x0 --mode "2560x1440" --rate 144 --primary - change_dpi 96 24 - xinput --map-to-output "UGTABLET 6 inch PenTablet Mouse" "${EXT_MON}" - xinput --map-to-output "UGTABLET 6 inch PenTablet Pen (0)" "${EXT_MON}" - xinput --map-to-output "UGTABLET 6 inch PenTablet Eraser (0)" "${EXT_MON}" + : + # xrandr --rmmode "${INT_RES}" + # # shellcheck disable=all + # xrandr --newmode $(echo $INT_MODELINE) # this is a hack to make xrandr recognize the resolution + # xrandr --addmode eDP-1 "${INT_RES}" + # xrandr --output eDP-1 --pos 2560x400 --mode "${INT_RES}" --output "${EXT_MON}" --pos 0x0 --mode "2560x1440" --rate 144 --primary + # change_dpi 96 24 + # xinput --map-to-output "UGTABLET 6 inch PenTablet Mouse" "${EXT_MON}" + # xinput --map-to-output "UGTABLET 6 inch PenTablet Pen (0)" "${EXT_MON}" + # xinput --map-to-output "UGTABLET 6 inch PenTablet Eraser (0)" "${EXT_MON}" fi "${HOME}/.config/X11/autostart" diff --git a/.local/bin/source/src_add_path b/.local/bin/source/src_add_path index 2b098db..5431081 100644 --- a/.local/bin/source/src_add_path +++ b/.local/bin/source/src_add_path @@ -1,3 +1,15 @@ -export PATH="$1:$PATH" +[ -z "$1" ] && { + echo "Missing path parameter!" >&2 + return 1 +} + +full_path="$(readlink -e "$1")" + +[ ! -d "$full_path" ] && { + echo "Path doesn't exist!" >&2 + return 1 +} + +export PATH="$full_path:$PATH" # vim: ft=sh diff --git a/.local/bin/statusbar/sb-battery b/.local/bin/statusbar/sb-battery index b49a6e4..288598c 100755 --- a/.local/bin/statusbar/sb-battery +++ b/.local/bin/statusbar/sb-battery @@ -4,6 +4,11 @@ shopt -s extglob declare -a batteries +declare -A custom_icons=( + ["hid:b0003g0102v0000046Dp00004086"]=" " + ["hid:b0005g0000v0000054Cp000005C4"]=" " +) + status_by_charge() { capacity="$1" @@ -19,22 +24,30 @@ status_by_charge() { } for battery_path in /sys/class/power_supply/!(AC*); do - status="$(cat "${battery_path}/status")" - capacity="$(cat "${battery_path}/capacity")" - sep=$([ "$1" == "-s" ] && echo " ") + status="$(cat "${battery_path}/status")" + capacity="$(cat "${battery_path}/capacity")" + sep=$([ "$1" == "-s" ] && echo " ") + device_name=$(cat "${battery_path}/device/modalias") - case "${status}" in - "Full") status_symbol=" " ;; - "Discharging") status_symbol="$(status_by_charge "${capacity}")" ;; - "Charging") status_symbol="󱐥 " ;; - "Not charging") status_symbol="󱐤 " ;; - "Unknown") status_symbol="󰒲 " ;; - *) status_symbol="?? " ;; - esac + case "${status}" in + "Full") status_symbol=" " ;; + "Discharging") status_symbol="$(status_by_charge "${capacity}")" ;; + "Charging") status_symbol="󱐥 " ;; + "Not charging") status_symbol="󱐤 " ;; + "Unknown") status_symbol="󰒲 " ;; + *) status_symbol="?? " ;; + esac - [ "$capacity" -eq 100 ] && status_symbol=" " - [ "$status" = "Discharging" ] && [ "$capacity" -le 20 ] && { status_symbol="❗"; [ -n "$sep" ] && sep="" || sep=" "; } - batteries+=("${status_symbol}${sep}${capacity}%") + if [ "$capacity" -eq 100 ]; then + status_symbol=" " + elif [ -n "${custom_icons[$device_name]}" ]; then + status_symbol="${custom_icons["$device_name"]}" + elif [[ "$status" = "Discharging" && "$capacity" -le 20 ]]; then + status_symbol="❗" + [ -n "$sep" ] && sep="" || sep=" "; + fi + + batteries+=("${status_symbol}${sep}${capacity}%") done echo "${batteries[@]}" diff --git a/.xinitrc b/.xinitrc index bfcd495..65a03bc 100644 --- a/.xinitrc +++ b/.xinitrc @@ -1,17 +1,22 @@ . "${HOME}"/.config/X11/xprofile + +# dbus [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && eval "$(/usr/bin/dbus-launch --exit-with-session --sh-syntax)" dbus-update-activation-environment --verbose --all -xr -. "${HOME}"/.config/X11/autostart +# env +systemctl --user import-environment XDG_CURRENT_DESKTOP +systemctl --user import-environment DISPLAY + +# agents gpg-agent -d - -export XDG_CURRENT_DESKTOP="gtk" -export XDG_SESSION_DESKTOP="$XDG_CURRENT_DESKTOP" -export WINDOW_MANAGER="dwm" - eval "$(ssh-agent)" +# resolution and autostart +"${HOME}"/.config/X11/runonce +xr + +# dwm exec "${HOME}"/.local/src/dwm/dwm # vim: ft=sh