From 4754312729d0dac2357b00061c54e2b98450c406 Mon Sep 17 00:00:00 2001 From: hkc Date: Sat, 13 Jul 2024 13:41:00 +0300 Subject: [PATCH] Initial commit --- dot_bashrc | 57 +++ dot_config/X11/xcompose | 8 + dot_config/X11/xresources | 48 ++ dot_config/bash/aliases | 60 +++ dot_config/bash/environ | 26 ++ dot_config/bash/functions | 423 ++++++++++++++++++ dot_config/conky/conky.conf | 67 +++ .../conky/images/icon_status_follower.png | Bin 0 -> 648 bytes dot_config/conky/images/icon_status_love.png | Bin 0 -> 718 bytes .../conky/images/icon_status_stress.png | Bin 0 -> 673 bytes dot_config/conky/images/icon_status_yami.png | Bin 0 -> 603 bytes dot_config/conky/images/window.png | Bin 0 -> 4076 bytes dot_config/dunst/dunstrc | 52 +++ dot_config/dunst/executable_handler.sh | 71 +++ dot_config/i3/config | 386 ++++++++++++++++ dot_config/i3/executable_autostart.sh | 34 ++ dot_config/i3/executable_locker.sh | 39 ++ dot_config/i3/executable_power.sh | 11 + dot_config/i3/executable_volumectrl.sh | 15 + dot_config/ncmpc/config | 27 ++ dot_config/nvim/bind-edit.vim | 88 ++++ dot_config/nvim/bind-tabs-n-windows.vim | 72 +++ dot_config/nvim/init.vim | 51 +++ dot_config/nvim/langprefs/clang.vim | 11 + dot_config/nvim/langprefs/load.vim | 9 + dot_config/nvim/langprefs/md.vim | 18 + dot_config/nvim/langprefs/python.vim | 6 + dot_config/nvim/langprefs/run.vim | 73 +++ dot_config/nvim/langprefs/tex.vim | 18 + dot_config/nvim/langprefs/web.vim | 4 + dot_config/nvim/plugins.vim | 73 +++ dot_config/nvim/symbols.vim | 36 ++ dot_config/polybar/config.ini | 248 ++++++++++ dot_config/polybar/executable_info-speed.c | 78 ++++ .../polybar/executable_info-typespeed.sh | 65 +++ dot_config/polybar/executable_run.sh | 23 + private_dot_local/bin/executable_fscr | 131 ++++++ private_dot_local/bin/executable_musicctl | 45 ++ private_dot_local/bin/executable_scr | 36 ++ .../bin/executable_setupwallpaper | 66 +++ 40 files changed, 2475 insertions(+) create mode 100644 dot_bashrc create mode 100644 dot_config/X11/xcompose create mode 100644 dot_config/X11/xresources create mode 100644 dot_config/bash/aliases create mode 100644 dot_config/bash/environ create mode 100644 dot_config/bash/functions create mode 100644 dot_config/conky/conky.conf create mode 100644 dot_config/conky/images/icon_status_follower.png create mode 100644 dot_config/conky/images/icon_status_love.png create mode 100644 dot_config/conky/images/icon_status_stress.png create mode 100644 dot_config/conky/images/icon_status_yami.png create mode 100644 dot_config/conky/images/window.png create mode 100644 dot_config/dunst/dunstrc create mode 100644 dot_config/dunst/executable_handler.sh create mode 100644 dot_config/i3/config create mode 100644 dot_config/i3/executable_autostart.sh create mode 100644 dot_config/i3/executable_locker.sh create mode 100644 dot_config/i3/executable_power.sh create mode 100644 dot_config/i3/executable_volumectrl.sh create mode 100644 dot_config/ncmpc/config create mode 100644 dot_config/nvim/bind-edit.vim create mode 100644 dot_config/nvim/bind-tabs-n-windows.vim create mode 100644 dot_config/nvim/init.vim create mode 100644 dot_config/nvim/langprefs/clang.vim create mode 100644 dot_config/nvim/langprefs/load.vim create mode 100644 dot_config/nvim/langprefs/md.vim create mode 100644 dot_config/nvim/langprefs/python.vim create mode 100644 dot_config/nvim/langprefs/run.vim create mode 100644 dot_config/nvim/langprefs/tex.vim create mode 100644 dot_config/nvim/langprefs/web.vim create mode 100644 dot_config/nvim/plugins.vim create mode 100644 dot_config/nvim/symbols.vim create mode 100644 dot_config/polybar/config.ini create mode 100644 dot_config/polybar/executable_info-speed.c create mode 100644 dot_config/polybar/executable_info-typespeed.sh create mode 100644 dot_config/polybar/executable_run.sh create mode 100644 private_dot_local/bin/executable_fscr create mode 100644 private_dot_local/bin/executable_musicctl create mode 100644 private_dot_local/bin/executable_scr create mode 100644 private_dot_local/bin/executable_setupwallpaper diff --git a/dot_bashrc b/dot_bashrc new file mode 100644 index 0000000..f10c897 --- /dev/null +++ b/dot_bashrc @@ -0,0 +1,57 @@ +#!/bin/bash +export HISTCONTROL=ignoreboth +export HISTSIZE=-1 +export HISTFILESIZE=-1 +shopt -s histappend +shopt -s checkwinsize +shopt -s direxpand +shopt -s checkjobs +complete -cf doas + + +if [ -x /usr/bin/dircolors ]; then + if test -r ~/.dircolors; then + eval "$(dircolors -b ~/.dircolors)"; + else + eval "$(dircolors -b)"; + fi; +fi; + +if ! shopt -oq posix; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + source /usr/share/bash-completion/bash_completion; + elif [ -f /etc/bash_completion ]; then + source /etc/bash_completion + fi +fi + +__PS1_PREFIX='\[\033[32m\]\u\[\033[0m\]' +[[ $UID -eq 0 ]] \ + && __PS1_PREFIX='\[\033[31m\]\u\[\033[0m\]'; + +__PS1_HOST=''; +[[ -n "$SSH_CLIENT" || $UID -eq 0 ]] \ + && __PS1_HOST='\[\033[36m\]@\[\033[31m\]\h\[\033[0m\]'; +__PS1_PROMPT='\[\033[32m\]>\[\033[0m\] '; + +__prompt_git_info() { + local ref; + ref="$(GIT_OPTIONAL_LOCKS=0 git symbolic-ref --short HEAD 2>/dev/null)" \ + || ref="$(GIT_OPTIONAL_LOCKS=0 git rev-parse --short HEAD 2>/dev/null)" \ + || return 0; + printf "\001\033[32m\002[%s]\001\033[0m\002" "${ref}"; +} +__prompt_venv_info() { + [[ -n "$VIRTUAL_ENV" ]] \ + && printf "\001\033[31m\002[%s]\001\033[0m\002" \ + "$(realpath --relative-to="${PWD}" "${VIRTUAL_ENV}")"; +} + +__PS1_PATH='\[\033[33m\]:\[\033[34m\]\w\[\033[0m\]'; +__PS1_INFO="\$(__prompt_git_info)\$(__prompt_venv_info)" +PS1="${__PS1_PREFIX}${__PS1_HOST}${__PS1_PATH} ${__PS1_INFO}\n${__PS1_PROMPT}"; +unset __PS1_PREFIX __PS1_HOST __PS1_PATH __PS1_PROMPT __PS1_INFO; + +[ -f "$HOME/.config/bash/environ" ] && source "$HOME/.config/bash/environ"; +[ -f "$HOME/.config/bash/functions" ] && source "$HOME/.config/bash/functions"; +[ -f "$HOME/.config/bash/aliases" ] && source "$HOME/.config/bash/aliases"; diff --git a/dot_config/X11/xcompose b/dot_config/X11/xcompose new file mode 100644 index 0000000..ec0c693 --- /dev/null +++ b/dot_config/X11/xcompose @@ -0,0 +1,8 @@ +include "%L" + : "Σ:з̭̌" + : "ඞ" + : "🥴" + : "⁢" + : "¯\\_(ツ)_/¯" + : "┤ûMo╙@🞂å⋂\"┼╗≤╝Å╟δL━╫O╬fÅ↑" + <8> : "ośmionóżek" diff --git a/dot_config/X11/xresources b/dot_config/X11/xresources new file mode 100644 index 0000000..f060582 --- /dev/null +++ b/dot_config/X11/xresources @@ -0,0 +1,48 @@ + +! FONTS +Xft.antialias: 1 +Xft.hinting: 1 +Xft.hintstyle: hintslight +Xft.rgba: greyscale +Xft.lcdfilter: lcddefault + +! XTerm settings +XTerm.vt100.bellIsUrgent: true +XTerm.vt100.metaSendsEscape: true +XTerm.vt100.selectToClipboard: true +XTerm.font.linedrawing: true +XTerm.vt100.locale: false +XTerm.vt100.utf8: true +XTerm*font: -xos4-terminus-medium-r-normal--12-120-72-72-c-60-iso10646-1 +XTerm*font1: -xos4-terminus-medium-r-normal--12-120-72-72-c-60-iso10646-1 + +XTerm*VT100.Translations: #override \ + Shift Insert: insert-selection(CLIPBOARD) \n\ + Ctrl Shift V: insert-selection(CLIPBOARD) \n\ + Ctrl Shift C: copy-selection(CLIPBOARD) \n\ + Ctrl : exec-formatted("xdg-open '%t'", PRIMARY) + +XTerm.termName: xterm-256color +! XTerm.vt100.font: 10x20 + +! special +*.foreground: #bfbfbf +*.background: #1a1a1a +*.cursorColor: #888888 + +! *.color0: #363636 +! *.color1: #8c3f52 +! *.color2: #6da18a +! *.color3: #b39374 +! *.color4: #546799 +! *.color5: #433057 +! *.color6: #597080 +! *.color7: #a3a3a3 +! *.color8: #888888 +! *.color9: #bf6979 +! *.color10: #86bf8f +! *.color11: #f0ebc0 +! *.color12: #6699cc +! *.color13: #66294c +! *.color14: #a1d5e6 +! *.color15: #dadada diff --git a/dot_config/bash/aliases b/dot_config/bash/aliases new file mode 100644 index 0000000..dac33dc --- /dev/null +++ b/dot_config/bash/aliases @@ -0,0 +1,60 @@ +#!/bin/bash + +# Pretty colors! +alias ls="ls --color=auto" +alias grep="grep --color=auto" +alias fgrep="fgrep --color=auto" +alias egrep="egrep --color=auto" + +# Nyaliases for ls +if type exa 2>/dev/null >/dev/null; then + alias ls="exa" + alias ll="ls -alhF" + alias la="ls -A" + alias l="ls -F" +else + alias ll="ls -alhF" + alias la="ls -A" + alias l="ls -CF" +fi + +# Coding stuff i guess +alias py="python3 -q" +alias edit="\$EDITOR" +alias :q="exit" +alias :e="edit" + +command -v doas >/dev/null 2>&1 \ + && alias sudo="sfxc play windows/uac; sudo"; + +alias mypk="cat \${SSH_KEY_PATH}.pub" +alias termbin="nc termbin.com 9999" +alias myip="curl eth0.me" + +# Media stuff +alias ffmpeg="ffmpeg -hide_banner" +alias ffplay="ffplay -hide_banner" +alias ffprobe="ffprobe -hide_banner" + +if command -v yt-dlp >/dev/null 2>&1; then + alias ytdv="yt-dlp -f 'bestvideo[height=?720]'" + alias ytda="yt-dlp -f 'bestaudio[ext=mp3]/bestaudio' \ + --add-metadata --embed-thumbnail --extract-audio \ + --audio-format mp3 --retries infinite" +fi; + +# Git stuff +alias ga="git add --verbose" +alias gaa="ga --all" +alias gc="git commit -v" +alias gca="gc -a" +alias gd="git diff" +alias gp="git push -v" +alias gpl="git pull" +alias glog="git log --stat" +alias glgp="glog -p" +alias glogg="glog --graph" +alias gst="git status" + +alias uq='python3 -c '"'"'(lambda up, sys, json: json.dump(up.parse_qs(up.urlparse(sys.stdin.read()).query), sys.stdout))(__import__("urllib.parse").parse,__import__("sys"),__import__("json"))'"'"' | jq' +alias z='zoxide' diff --git a/dot_config/bash/environ b/dot_config/bash/environ new file mode 100644 index 0000000..e0b64aa --- /dev/null +++ b/dot_config/bash/environ @@ -0,0 +1,26 @@ +#!/bin/bash + +export XDG_DATA_HOME="$HOME/.local/share"; +export XDG_CONFIG_HOME="$HOME/.config"; +export XDG_STATE_HOME="$HOME/.local/state"; +export XDG_CACHE_HOME="$HOME/.cache"; +source "${XDG_CONFIG_HOME}/user-dirs.dirs"; + +export EDITOR="nvim" +export GIT_PRETTY="--pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset'" +export SSH_KEY_PATH="$HOME/.ssh/id_ed25519" +export PATH="$PATH:$HOME/.local/bin:$HOME/.local/share/scripts:$HOME/go/bin:$XDG_DATA_HOME/cargo/bin:/home/hkc/.platformio/penv/bin" +export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' +export MANPAGER="less -R --use-color -Dd+r -Du+b" +export GPG_TTY="$(tty)" +export TODO_PATH="$HOME/.local/share/todo.txt" + +export HISTFILE="${XDG_STATE_HOME}/bash/history"; +export CARGO_HOME="$XDG_DATA_HOME"/cargo; +export ELINKS_CONFDIR="$XDG_CONFIG_HOME"/elinks +export GNUPGHOME="$XDG_DATA_HOME"/gnupg +export LESSHISTFILE="$XDG_CACHE_HOME"/less/history +export XCOMPOSEFILE="$XDG_CONFIG_HOME"/X11/xcompose +export RUSTUP_HOME="$XDG_DATA_HOME"/rustup + +source ~/.config/bash/environ.priv diff --git a/dot_config/bash/functions b/dot_config/bash/functions new file mode 100644 index 0000000..00adab7 --- /dev/null +++ b/dot_config/bash/functions @@ -0,0 +1,423 @@ +#!/bin/bash + +tdm() { + local awk_preview="/^~/ { next } + /^#+/ { print '\\033[35;3m'\$0'\\033[0m'; next } + /^ *\[\+\] / { print '\\033[32m'\$0'\\033[0m'; next } + /^ *\[x\] / { print '\\033[31m'\$0'\\033[0m'; next } + /^ *\[ \] / { print '\\033[33m'\$0'\\033[0m'; next } + /^ \* / { print '\\033[34m'\$0'\\033[0m'; next } + /^[0-9]+\. / { print '\\033[34m'\$0'\\033[0m'; next } + /^>/ { print '\\033[92m'\$0'\\033[0m'; next } + /^\(!\)/ { print '\\033[91;7m'\$0'\\033[0m'; next } + /.*/ { print \$0; next }"; + local act="$1"; shift; + [ -z "$TODO_PATH" ] && return; + case "$act" in + motd) [ "$(tdm num)" -eq 0 ] && return; + printf "\033[33m===== TODO =====\033[0m\n"; + tdm print;; + print) + awk "$awk_preview" "$TODO_PATH";; + add) echo "$*" | tee -a "$TODO_PATH";; + num) grep -vcP "^~" "$TODO_PATH";; + ed) case "$EDITOR" in + *vim) $EDITOR -c "set syntax=markdown" "$TODO_PATH";; + *) $EDITOR "$TODO_PATH";; + esac;; + *) echo "tdm [print|add|num|ed]";; + esac; +} + +# Project management +#alias p="cd \"\$(find ~/projects/ -type d -name '.git' | sed 's|/.git$||' | gum filter)\"" +p() { + _log() { + printf "\033[33m * \033[34m%s\033[0m\n" "$@"; + } + + local cmd="$1"; shift; + local projects_dir="${HOME}/projects"; + case "$cmd" in + ls) find "${projects_dir}" -type d -name .git \ + | sed -e 's|/.git$||' -e "s|^${projects_dir}||";; + cd) dirname="$1"; + if [ "$dirname" = "" ]; then + dirname="$( (printf -- "--cancel--\n"; p ls) | gum filter)" || return; + if [ "$dirname" = "--cancel--" ]; then return; fi; + fi; + cd "${projects_dir}/${dirname}" || return; + if [ -d "${projects_dir}/${dirname}/venv" ]; then + export VIRTUAL_ENV_DISABLE_PROMPT=1; + source "${projects_dir}/${dirname}/venv/bin/activate"; + fi; + ;; + mk) + project_name="$(gum input --placeholder="Project name?" --value="$1")" || return; + project_type="$(printf "Python\nC\nPackwiz\nNone\n" | gum choose)" || return; + mkdir -vp "$projects_dir/$project_name"; + cd "$projects_dir/$project_name" || return; + case "$project_type" in + Packwiz) + _log "Initializing Packwiz pack"; + packwiz init --modloader fabric; + ;; + Python) + _log "Creating .gitignore"; + printf '*.py[cow]\n__pycache__/\nvenv/\n' > .gitignore; + + _log "Creating requirements.txt"; + echo > requirements.txt; + + _log "Creating $project_name/__main__.py"; + mkdir -vp "$project_name"; + printf 'def main():\n' > "$project_name/__main__.py"; + printf " print('Hi!')\n\n" >> "$project_name/__main__.py"; + printf "if __name__ == '__main__':\n" >> "$project_name/__main__.py"; + printf " main()\n" >> "$project_name/__main__.py"; + + _log "Creating virtualenv"; + python3 -m virtualenv venv; + ;; + C) + _log "Creating directories"; + mkdir -vp src obj; + touch Makefile src/main.c obj/.gitkeep; + + _log "Creating src/main.c"; + printf '#include \n' > src/main.c; + printf '#include \n\n' >> src/main.c; + printf 'int main(void) {\n' >> src/main.c; + printf ' printf("Hi!\\n");\n' >> src/main.c; + printf '}\n' >> src/main.c; + + _log "Creating Makefile"; + printf 'CFLAGS += \n' > Makefile; + printf 'LDFLAGS := -lm\n' >> Makefile; + printf 'OBJECTS := \n\n' >> Makefile; + printf '%s: lib\n' "$project_name" >> Makefile; + # shellcheck disable=SC2016 + printf '\t$(CC) $(CFLAGS) $(OBJECTS) src/main.c $(LDFLAGS) -o %s\n\n' "$project_name" >> Makefile; + printf 'all: %s\n\n' "$project_name" >> Makefile; + # shellcheck disable=SC2016 + printf 'lib: $(OBJECTS)\n\n' >> Makefile; + printf 'clean:\n' >> Makefile; + # shellcheck disable=SC2016 + printf '\t$(RM) $(OBJECTS) %s\n\n' "$project_name" >> Makefile; + printf 'obj/%%.o: src/%%.c\n' >> Makefile; + # shellcheck disable=SC2016 + printf '\t$(CC) $(CFLAGS) -c $^ -o $@\n' >> Makefile; + + _log "Creating .gitignore" + printf 'obj/*\n%s\n' "$project_name" > .gitignore; + ;; + None) echo "nyan";; + *) echo "k bai"; return;; + esac; + _log "Creating Git repository"; + git init; git add -v .; + + _log "Commiting base project"; + git commit -m 'Initial commit'; + + _log "Adding remote"; + git remote add origin "ssh://git@[201:4230::a949:3323:1d96:1979]:2222/hkc/$project_name"; + + _log "Pushing"; + git push --set-upstream origin master; + ;; + esac; +} + +pcolor() { + if [ "$1" = "all" ]; then pcolor nrm 256 true; return $?; fi; + if [ "$1" = "" ]; then pcolor nrm; return $?; fi; + + _tex() { + if [ "$1" = "" ]; then + printf "\033[40m %-56s \033[0m\n" ""; + else + printf "\033[40;37m %-56s \033[0m\n" "$1"; + fi; + } + + while [ "$#" -ge 1 ]; do + local opt="$1"; shift; + case "$opt" in + sep) _tex "";; + nrm) _tex "Normal"; + for((i=40;i<48;i++)); do + printf "\033[40m %3d \033[%dm" "$i" "$i"; + for((j=30;j<38;j++)); do + printf "\033[%dm%3d" "$j" "$j"; + done; + for((j=90;j<98;j++)); do + printf "\033[%dm%3d" "$j" "$j"; + done; + printf "\033[40m \033[0m\n"; + done; + for((i=100;i<108;i++)); do + printf "\033[40m %3d \033[%dm" "$i" "$i"; + for((j=30;j<38;j++)); do + printf "\033[%dm%3d" "$j" "$j"; + done; + for((j=90;j<98;j++)); do + printf "\033[%dm%3d" "$j" "$j"; + done; + printf "\033[40m \033[0m\n"; + done; + _tex "";; + 256) _tex "6x6x6 cube + 24 grayscale"; + for((y=0;y<18;y++)); do + printf "\033[40m %02x->%02x " \ + "$((y * 12 + 16))" \ + "$((y * 12 + 16 + 11))"; + for((x=0;x<12;x++)); do + i=$((x + y * 12 + 16)); + printf "\033[48;5;%dm %3d" "$i" "$i"; + done; + printf "\033[40m \033[0m\n"; + done; + printf "\033[40m %02x->%02x " "232" "255"; + for((i=232;i<=255;i++)); do + printf "\033[48;5;%dm%02x" "$i" "$i"; + done; + printf "\033[40m \033[0m\n"; + _tex "";; + true) _tex "24bit RGB TrueColor"; + for((y=0;y<48;y+=2)); do + printf "\033[40m "; + for((x=0;x<48;x++)); do + b_r=$((x * 256 / 48)); + b_g=$((y * 256 / 48)); + b_b=$(((x + y) * 256 / 48)); + f_r=$((x * 256 / 48)); + f_g=$(((y + 1) * 256 / 48)); + f_b=$(((x + y + 1) * 256 / 48)); + printf "\033[48;2;%d;%d;%d;38;2;%d;%d;%dm\u2584" \ + "$b_r" "$b_g" "$b_b" "$f_r" "$f_g" "$f_b"; + done; + printf "\033[40m \033[0m\n"; + done; + _tex;; + esac; + done +} + +lscolors() { + if [ "$1" = "all" ]; then + lscolors nrm bri 256 true; + return $?; + fi; + + if [ "$1" = "" ]; then + lscolors nrm bri; + return $?; + fi; + + local fcn="\033[%dm \033[0m"; + local fcc="\033[%dm\033[%dm %3d \033[0m"; + + if [ "$1" = "nrm" ]; then shift; + printf "\033[40m %-56s \033[0m\n" ""; + printf "\033[40m %-56s \033[0m\n" "Normal"; + printf "\033[40m "; + for((i=40;i<48;i++)); do printf "$fcn" $i; done; + printf "\033[40m \033[0m\n"; + printf "\033[40m "; + for((i=40;i<48;i++)); do printf "$fcc" $i 97 $i; done; + printf "\033[40m \033[0m\n"; + printf "\033[40m "; + for((i=40;i<48;i++)); do printf "$fcn" $i; done; + printf "\033[40m \033[0m\n"; + fi; + + if [ "x$1" = "xbri" ]; then shift; + printf "\033[40m %-56s \033[0m\n" ""; + printf "\033[40m %-56s \033[0m\n" "Bright"; + printf "\033[40m "; + for((i=100;i<108;i++)); do printf "$fcn" $i; done; + printf "\033[40m \033[0m\n"; + printf "\033[40m "; + for((i=100;i<108;i++)); do printf "$fcc" $i 30 $i; done; + printf "\033[40m \033[0m\n"; + printf "\033[40m "; + for((i=100;i<108;i++)); do printf "$fcn" $i; done; + printf "\033[40m \033[0m\n"; + fi; + + if [ "x$1" = "x256" ]; then shift; + printf "\033[40m %-56s \033[0m\n" ""; + printf "\033[40m %-56s \033[0m\n" "256 Colors palette"; + for((y=0;y<32;y++)); do + printf "\033[40m "; + for((x=0;x<8;x++)); do + i=$((y * 8 + x)); + if [ "$i" -le 7 ]; then n=15; + elif [ "$i" -le 15 ]; then n=0; + elif [ "$i" -ge 232 ]; then n=$((255 - i + 232)); + else + ni=$((i - 16)); + nb=$((5 - (ni % 6))); ni=$((ni / 6)); + ng=$((5 - (ni % 6))); ni=$((ni / 6)); + nr=$((5 - (ni % 6))); + n=$((16 + nb + ng * 6 + nr * 36)); + fi + printf "\033[48;5;%d;38;5;%dm %3d \033[40m" $i $n $i; + done; + printf "\033[40m \n"; + done + fi; + + if [ "x$1" = "x256blk" ]; then shift; + printf "\033[40m %-32s \033[0m\n" ""; + printf "\033[40m %-32s \033[0m\n" "256 Colors palette"; + for((y=0;y<16;y++)); do + printf "\033[40m "; + for((x=0;x<16;x++)); do + i=$((y * 16 + x)); + printf "\033[48;5;%dm \033[40m" $i; + done; + printf "\033[40m \n"; + done + fi; + + if [ "x$1" = "xtrue" ]; then shift; + printf "\033[40m %-56s \033[0m\n" ""; + printf "\033[40m %-56s \033[0m\n" "TrueColor"; + for ((y=0;y<56;y=y+2)); do + printf "\033[40m "; + for((x=0;x<56;x++)); do + r1=$((x * 255 / 56)); + g1=$((255 * (56 - y) / 56)); + b1=$((255-r1)); + r2=$((x * 255 / 56)); + g2=$((255 * (56 - (y + 1)) / 56)); + b2=$((255-r2)); + printf "\033[48;2;%d;%d;%d;38;2;%d;%d;%dm\u2584" \ + "$r1" "$g1" "$b1" "$r2" "$g2" "$b2"; + done; + printf "\033[40m \n"; + done; + + fi; + + printf "\033[40m %-56s \033[0m\n" ""; +} + +exper() { + case "$1" in + c) filename="$(mktemp "tmpXXXXXXXX.c" --tmpdir)"; + printf '#include \n\nint main(void)\n{\n return 0;\n}' > "$filename"; + binary="${filename/.c/}"; + echo "filename=${filename} binary=${binary}"; + nvim -O "$filename" \ + "term://ronchange '$filename' sh -c 'set -xe; \ + gcc -o $binary $filename -Wall -pedantic \ + -std=c99 -lm; sleep 0.2; time $binary'"; + ;; + cpp) filename="$(mktemp "tmpXXXXXXXX.cpp" --tmpdir)"; + printf 'int main(void)\n{\n return 0;\n}' > "$filename"; + binary="${filename/.cpp/}"; + echo "filename=${filename} binary=${binary}"; + nvim -O "$filename" \ + "term://ronchange '$filename' sh -c 'set -xe; \ + g++ -o $binary $filename -Wall -pedantic \ + -lm; sleep 0.2; time $binary'"; + ;; + rs) filename="$(mktemp "tmpXXXXXXXX.rs" --tmpdir)"; + printf 'fn main() {\n\n}' > "$filename"; + binary="${filename/.rs/}"; + echo "filename=${filename} binary=${binary}"; + nvim -O "$filename" \ + "term://ronchange '$filename' sh -c 'set -xe; \ + rustc $filename -o $binary; sleep 0.2; time $binary'"; + ;; + py) filename="$(mktemp "tmpXXXXXXXX.py" --tmpdir)"; + printf 'print("Hi")' > "$filename"; + nvim -O "$filename" \ + "term://ronchange '$filename' python3 '$filename'"; + ;; + sh) filename="$(mktemp "tmpXXXXXXXX.sh" --tmpdir)"; + printf '#!/bin/sh\necho hi' > "$filename"; + nvim -O "$filename" \ + "term://ronchange '$filename' /bin/sh '$filename'"; + ;; + lua) filename="$(mktemp "tmpXXXXXXXX.lua" --tmpdir)"; + printf 'print("meow")' > "$filename"; + nvim -O "$filename" \ + "term://ronchange '$filename' /sbin/lua '$filename'"; + ;; + java) dirname="$(mktemp "tmpXXXXXXXX-java" --tmpdir -d)"; + printf "public class Experiment {\n public static void main(String[] args) {\n\n }\n}\n" > "$dirname/Experiment.java"; + nvim -O "$dirname/Experiment.java" \ + "term://ronchange '$dirname/Experiment.java' sh -c 'cd $dirname; set -xe; javac Experiment.java; java Experiment'"; + ;; + *) return;; + esac; +} + +k8shelper() { + cmd="$1"; shift; + case "$cmd" in + pod_name_from_ip) + kubectl get --all-namespaces --output json pods | jq -r ".items[] | select(.status.podIP==\"$1\").metadata | \"\\(.namespace)/\\(.name)\"";; + logwatch) kubectl logs -n "${1}" -f "$(kubectl get pod -n "${1}" | grep "${2}" | head -n 1 | awk '{print$1}')";; + logall) + namespace="${1}"; + local pid_list=() + while read -r pod_name; do + kubectl logs -n "${namespace}" "${pod_name}" -f | awk "{print\"${pod_name}: \"\$0}" & bg >/dev/null 2>&1; + pid_list+=("$$"); + done < <(kubectl get pod -n "${namespace}" | grep -v 'NAME' | awk '{print$1}'); + read -r; + for log_pid in "${pid_list[@]}"; do + kill "${log_pid}"; + done; + ;; + shell) + namespace="${1}"; shift; + partial_name="${1}"; shift; + pod_name="$(kubectl get pod -n "${namespace}" | grep "${partial_name}" | head -n 1 | awk '{print$1}')"; + kubectl exec -n "${namespace}" -it "${pod_name}" -- sh -c "bash || ash || sh";; + exec) + namespace="${1}"; shift; + partial_name="${1}"; shift; + pod_name="$(kubectl get pod -n "${namespace}" | grep "${partial_name}" | head -n 1 | awk '{print$1}')"; + kubectl exec -n "${namespace}" -it "${pod_name}" -- "${@}";; + nodeport) + NODE_PORT=$(kubectl get --namespace "${1}" -o jsonpath="{.spec.ports[0].nodePort}" services "${2}"); + NODE_IP=$(kubectl get nodes --namespace "${1}" -o jsonpath="{.items[0].status.addresses[0].address}"); + echo "${NODE_IP}:${NODE_PORT}"; + ;; + + *) return;; + esac; +} + +bandcampdl() { + url="${1}"; + YT_DLP_COMMAND="yt-dlp -f "'bestaudio[ext=mp3]/bestaudio'" --add-metadata --embed-thumbnail --extract-audio --audio-format mp3 --retries infinite"; + echo "${YT_DLP_COMMAND}"; + curl "${url}" -fsSL | grep -oP '/(track|album)/[^"]+' | sort -r | uniq \ + | while read -r name; do + if [[ "${name}" =~ /album/ ]]; then + $YT_DLP_COMMAND -o '%(playlist)s/%(playlist_autonumber)2d - %(title)s.%(ext)s' "${url}${name}" + elif [[ "${name}" =~ /track/ ]]; then + $YT_DLP_COMMAND -o '%(title)s.%(ext)s' "${url}${name}" + else + echo "oopsie! ${name} is invalid"; + fi + done +} + +fded() { + readarray -t filelist < <(fd "$@"); + if [ "${#filelist[@]}" = 0 ]; then + echo "No files found"; + elif [ "${#filelist[@]}" = 1 ]; then + nvim "${filelist[0]}"; + else + printf "%s\n" "${filelist[@]}" | gum filter | xargs nvim + fi +} diff --git a/dot_config/conky/conky.conf b/dot_config/conky/conky.conf new file mode 100644 index 0000000..66384bb --- /dev/null +++ b/dot_config/conky/conky.conf @@ -0,0 +1,67 @@ +-- Conky, a system monitor https://github.com/brndnmtthws/conky +-- +-- This configuration file is Lua code. You can write code in here, and it will +-- execute when Conky loads. You can use it to generate your own advanced +-- configurations. +-- +-- Try this (remove the `--`): +-- +-- print("Loading Conky config") +-- +-- For more on Lua, see: +-- https://www.lua.org/pil/contents.html + +conky.config = { + alignment = 'top_right', + background = false, + border_width = 0, + cpu_avg_samples = 2, + default_color = '#000000', + double_buffer = true, + draw_borders = true, + draw_graph_borders = false, + draw_outline = false, + draw_shades = false, + extra_newline = false, + font = 'Dinkie Bitmap:size=12', + gap_x = 20, + gap_y = 40, + minimum_height = 361, + minimum_width = 405, + maximum_width = 405, + net_avg_samples = 2, + no_buffers = true, + out_to_console = false, + out_to_ncurses = false, + out_to_stderr = false, + out_to_x = true, + own_window = true, + own_window_class = 'Conky', + own_window_type = 'override', + own_window_transparent = true, + own_window_argb_visual = false, + show_graph_range = false, + show_graph_scale = false, + stippled_borders = 0, + update_interval = 1.0, + uppercase = false, + use_spacer = 'none', + use_xft = true +} + +conky.text = [[ +${image ~/.config/conky/images/window.png -p 0,0} +${voffset -5}${goto 40}${color #4d23cf}Task Manager +${image ~/.config/conky/images/icon_status_follower.png -p 18,61} +${goto 80}${voffset 15}${color #6eb5df}Screen time +${goto 80}${voffset 2}${color #4d23cf}${font Press Start 2P:size=24}${uptime_short} +${image ~/.config/conky/images/icon_status_stress.png -p 18,136} +${goto 80}${voffset -30}${color #6eb5df}${font Dinkie Bitmap:size=12}CPU +${goto 100}${voffset 2}${color #4d23cf}${font Press Start 2P:size=20}${cpu}${color #989898}${font Press Start 2P:size=12}/100${goto 250}${voffset -45}${cpugraph 55,130 #6eb4e1 #6eb4e1} +${image ~/.config/conky/images/icon_status_love.png -p 18,209} +${goto 80}${voffset -5}${color #6eb5df}${font Dinkie Bitmap:size=12}Memory +${goto 100}${voffset 2}${color #4d23cf}${font Press Start 2P:size=20}${memperc}${color #989898}${font Press Start 2P:size=12}/100${goto 250}${voffset -45}${memgraph 55,130 #6eb4e1 #6eb4e1} +${image ~/.config/conky/images/icon_status_yami.png -p 18,282} +${goto 80}${voffset -5}${color #6eb5df}${font Dinkie Bitmap:size=12}Used space (/) +${goto 100}${voffset 2}${color #4d23cf}${font Press Start 2P:size=20}${fs_used_perc /}${color #989898}${font Press Start 2P:size=12}/100 +]] diff --git a/dot_config/conky/images/icon_status_follower.png b/dot_config/conky/images/icon_status_follower.png new file mode 100644 index 0000000000000000000000000000000000000000..6a51ed06c94a8884df305af16421554acbc7f575 GIT binary patch literal 648 zcmV;30(bq1P)n&KHlNa%7=AGT3wd%wJnJ|U3V)HOG?vVq*Bj z0Hq=S=l($`%MnHV!}%px#bKa~!k8F7F+j0FiuPc7n&Lk+8Ho5KhW#k&&;hwIG4x}A z(zH)3*s;kKh3^^10j9Sv`azMoLq7&c)$ryLAD9-=`$Un&*N#)Ckve>109Qyqe*z0R zJ`}#B%zv!vVB!{N)xh&73{Y_n6!B{dAT%s*!b&6bwi!%(_{IQwNaL0#4~VWj3a0wRlZ#+__{0FLJr8RwKD_-MOiRk3 zmeVlt^tJ>r-O_goMV{M45ryAkQUy`pv4JFqy}o`NzXE8U82T}QXm>+$bx|%%%9Vi_ zplC!~n#E9e6GBm1pA7vNAXlTbge;ggv0y@z`HfY*iG>;p|JBXs4AcO_CkD{-f|fjl zhbxVK-*pE}yP%aixPS{EBxb&zxeul{GVn4`0}P)SfB{7N8!|c|ubPk709c3;3t%;~ zmV6omHNfzT0b&8JHV(bP@Qneakuh*y@N~&1q>dy&Y#t*7hHnhO0D4SN8*JY*5rq$H i=QE)7z;J;f9|HiFc)-kSaFlNV0000n&KHlNa%7=AGT3wd%wJnJ|U3V)HOG?vVq*Bj z0Hq=S=l($`%MnHV!}%px#bKa~!k8F7F+j0FiuPc7n&Lk+8Ho5KhW#k&&;hwIG4x}A z(zH)3*s;kKh3^^10j9Sv`azMoLq7&c)$ryLAD9-=`$Un&*N#)Ckve>109Qyqe*z0R zJ`}#B%zv!vVB!{N)xh&73{Y_n6!B{d7)S!cHwMr{8n--oKy>9%F#QL{pI`;1#sDE;Ao2=@f8mK3R&}^yN)(O%{xNy(7`ZWk4$xzS5ZGvB1g6nTp{s9B zf@$M7sOr~Q)S?t~K_{BQQ9FEM0M?#|wH6=V{tl)kWl%#1CT<`C;kU0?jw0XEQ-#%{ znvymYzLtC%3jbndKbQ`jQUDRyeG^QrgSJj_i4Xl4K$NqPaX!><%V&kI`e5FWucPl6o^_iTCx3g38U1**CQ zhwvJAR-GBb*ti``$w{$-Y4niC@W4<77#@JdM0Gr*oRwG2XTS!&>c~PEXYS**;47MZ z`;{YLT1#FFuRd5v!)jpkkcWZc7X!os^colrc+vQ{)Da1Ag**%l-xxsZ34zm~r%OH| zbtD1wJhpw$M6%2qzA*p;=rKWUKyJvxz>tpt01p1+m!f;0hX4Qo07*qoM6N<$f|Thl AiU0rr literal 0 HcmV?d00001 diff --git a/dot_config/conky/images/icon_status_stress.png b/dot_config/conky/images/icon_status_stress.png new file mode 100644 index 0000000000000000000000000000000000000000..c055b8d837f16d33a85dd7f18ebec48741042ba4 GIT binary patch literal 673 zcmV;S0$%-zP)n&KHlNs-c(}|GYfKKm7=VR5xgnl)oC$@$$Wt0j$8CR#B0dda zKHiwX74q^?$HD4{PYh5R@_+6hgt8n_#6O&0f>j&_%5cO4p^%4x;S&QC8>DCtrl%?X zLz97sPh!}Qq7EIP$Ao+oai!DHj{!>4KCxiOCRY@`XB-EZ-oEGuMdl9u7$8-{n@fCP zT14*?MHXK>PFhoFeUyEpAmB*D=hJQVPNNbRCwg0D4}~l85kcrP1%Z?tp0*6Gfsda^Zu-%-1vb!SqH3UIuD_;S&Qe0E>z0 zccC7+Nwk^p)h+rDQaS>_Gj7=Quvn4mTwH{@Yp$j1Nx7V_7{DxgDF00000NkvXX Hu0mjfQ#Ke; literal 0 HcmV?d00001 diff --git a/dot_config/conky/images/icon_status_yami.png b/dot_config/conky/images/icon_status_yami.png new file mode 100644 index 0000000000000000000000000000000000000000..4b4179889f4454f834bfa8fcbcec5e4ad8843f99 GIT binary patch literal 603 zcmV-h0;K(kP)OxQ545t;UGjVrC=%I(BjZw4%Q+<4*nAw4GlpE z4J|G%(H8vx$4CjPwZ(=Y9Kt~(XmDwe$Z#==AZ!o~&U**Fm-pj#-^+Tp?{eNb_ug~g zJ0I_T*XNKpl}+dREd90%xiRSn#r*((Ma&OCSA1)Cg>|SZDXYkcOTa|M3F(Z3{8}W^ zt7T{}9L01=iAMk{&s%X;4dvG*fzl!(4gsqwzg`(9{9InTy!Izx)o@vKfTu}3t2{n*zYQRxIk3?NDq4APYYBGL^4N-rWvkfwAH zBnU|FH39-xilCHy@%kO-{JL}Q+&lNroq6}{SzQnFkVi@uEA%4|B^Mir8eR*;Lo8dO5R8wO#W031XN=vv`J|2x zC3jbL3`KlAHjdp~oZ$i8D0Go8H$MD%%!BTOx!~uX!wq}Oy~oufaAN5;uBs2(M8lAx zFK4cRWhg?NJ2@NP+14?)D5)7nC*TcOXsTTJZXNMMz<#Kjn%Ma!=vx2@7^J5GO(vO5 z(r2Sd%&Um>D-di1q{%Pwf)Ndt4QK|%Bl3Z!E(D896S4%^l)$0K*=Ye>lmHIG_m&3% z7Pp@s3;}je_}C%YiGcT%Ym7Efwh}HsHg!=1Qz;A zK*Io}&0``(0c9|7=;G%O01@ecO?S&$?WrFT57gRP@|+04 zfK!Z3(eZ?1hNfgoU^oDXunl47*lithjBc@SvOc=;Jyh**Z+G_Xyg-=j)i6EE{n?feJH~lu`ySIqI881m z=pEM3lMZ3ZUXT91@%; zQFzsv;+v5$i;Z8?{2l;X^_b>QA~Y0O_wczsf6}JLkzTeSz`7Yc_5t9Uwtyt6yGo;z z1_15sFj$2a_fGR^@h0lC%~X@k^oI_L5eR{{76c1|&INnc*Fm)OK0+j_w}J=eAoWR; zN50A2Ju1nYNwUT24U@Vz^AAUwtY(phFj`8jE}B!0eB&_?rw2Ct@id(2k^6kj`jo5> z1$f`bu$iAXN>tF7v3P*uwbJL=QujTf9DPN%E>X1$$lgDUYS5E;5>{!h{)wR)SzD-d zCPFut{-cYZOhy7ncIHRl*Jsq@6my6lOWc{q6X3{B>88)8p>l0Eq$N9A5w9+Y(m1rp< z%v*%dClwmK7OFe>z3sG7MmV>u=X&zm8O8$0+a&I_?fl*#rZt~z6cTV>` zkC&hQ>P}82pEFJUXg$!gqW3xVGsTWS17j3>cxMb+ge&tj^fa2w|Mbf=<9x2chg_W~ zX(gGpG-5h)I>yQdhKJo{Pwb{kHcS>u=7ve3ii-1#r;F*Wwykp%XB6Wm1^7>J* ztH)qNUBw_kJ;6XYt=6vKgHhv=>YVs$j=b8ciOh3Mc1)d%NUZHwdp@N5r!I4xN5_=~ zfd#J)ua4(J)IxkhMkcE!8yOZRwfUm?s>Z6uoxLA=b9;x=6*ARjMr4VZ#LSV*nHq=7 z0hh(`h4?qF29=AK^KCcq4L2h%E8FJTSY5tarCWw86CAEDt1mcNP-~iGT9P%4Zmsx= ze~&M!;i^~~rJg9qd*MSI(N3J`n)dS6jikn;kh+jRkJO=z(PK;{JePSwZ@uX(w&`Q(8voLfukzdMLD$%-Zq@pIzzj)7alN0_8?)z*3zM!TwEjw*%|3Rs#rmLpMtQC`G zA31}($4_!01(Ete0ag%#ricyG3bQ+Lupe}n?_Iox%7p8;%CU8=xa?XjcCCc_W%rkw z%lO>8zC0@9+asnC5(yqmkrzWh4}XL@E;~MK4P_9HjE=O9(unttu{qN(ld9m~KZ(3G zqy0lWMSD6EEn}wqQo>LH1}~Ppt~RbzCts)0A?arOVaNt&V{pUhtgI2gmBTL24hC!sZ5nDj*L6JUb5;c zjWXen6Ce2?iup{E@aR?avfG`WQrF1J561@h7nQWty7ajXxUDQtOJvzGr4*+w zr!w7S92V~bbzQx3eYmYI6_tanlj zP#i(|neZdEpN4n_)KL}*!(wZCOr3wcJ;rVNOE4-jTK)O7W1inzJ8*Gjk9KD79HYwk zow(rAIq2XYcX-e|Qr8g~TN%2UmKg_jPIh%>AK?ANtJ6V;dJ}&zKb2Rr4K&&%$VIu^gV0UgpqqH2RG;mXzg`cS zhW8yO?j|rJsS?r?dZHMk*0L_Zm6hi;e2-QR3y^&-eL`8B$GOKn<(wQ+q5DH?BZU66 z{+!gU)TDP_ck_-`o7T8qPIR<%oO}B|Ku+e`&ZUF(X8%clp3Ubo%w~&sdGCpk+`qrt zwftCcki?agM53ff+dg!blb9gCH+h})EldCi5(EGn4#0O3`Cb9wwln~%4gjd60l=9k8~xk=Z}e~f+!Md)|3SF_+id@|`2U^W{%N*KK8LW%_xGyeHsO_B)L5w|A4vA0XGB zuiOUWKLv^PWFd_xUAxm${0k9JUhRf|o7hnSWX>"/tmp/dunst-entries-$(id -u || echo "$USER").log" 2>&1; + exit; +fi + +if [ "$DUNST_TIMEOUT" -eq 0 ]; then exit; fi + +echo; date; env | grep -iP "^DUNST"; + +if [ "$DUNST_APP_NAME" = "i3" ] && [ "$DUNST_SUMMARY" = "volume" ]; then + exit; +fi; + +if { [ "$DUNST_APP_NAME" = "discord" ] && [ "$DUNST_SUMMARY" = "Diamond" ]; } \ + || [[ "$DUNST_SUMMARY" =~ "<3" ]] \ + || [[ "$DUNST_SUMMARY" =~ "<22" ]] ; then + sfxc play bell; + exit; +fi; + +if [ "$DUNST_DESKTOP_ENTRY" = "org.telegram.desktop" ] \ + && [[ "$DUNST_SUMMARY" =~ "Gmail Bot" ]] \ + || [ "$DUNST_DESKTOP_ENTRY" = "Thunderbird" ]; then + sfxc play windows/notify_email; + exit; +fi; + +if [ "$DUNST_DESKTOP_ENTRY" = "org.telegram.desktop" ]; then + sfxc play telegram; + exit; +fi; + +if [ "$DUNST_APP_NAME" = "xfce4-power-manager" ]; then + case "$DUNST_BODY" in + "System is running on Battery power") ;; + "System is running on low power") sfxc play windows/battery_low;; + #"Your Battery is charging") sfxc play hl1/medshot4;; + #"Your Battery is fully charged") sfxc play hl1/suitchargeok1;; + "Your Battery is discharging") ;; + Brightness*) sfxc play windows/information_bar;; + *) aplay ~/.local/share/sounds/button_select.wav;; + esac; + exit; + #aplay ~/.local/share/sounds/successful_hit.wav; exit; +fi; + +if [ "$DUNST_APP_NAME" = "udiskie" ]; then + case "$DUNST_SUMMARY" in + "Device added") sfxc play windows/hardware_insert;; + "Device unmounted") sfxc play windows/hardware_remove;; + *) ;; + esac; + exit +fi + +# sfxc play windows/notify_system_generic; + +#case "$DUNST_URGENCY" in +# NORMAL) aplay /usr/share/sounds/freedesktop/stereo/dialog-information.wav ;; +# URGENT) aplay /usr/share/sounds/freedesktop/stereo/dialog-warning.wav ;; +#esac; + diff --git a/dot_config/i3/config b/dot_config/i3/config new file mode 100644 index 0000000..cc29346 --- /dev/null +++ b/dot_config/i3/config @@ -0,0 +1,386 @@ +# i3 config file (v4) +font pango:lemon 7 + +# Terminus (TTF) 9 + +# Lmao +set $mod Mod4 +set $Locker "/bin/bash ~/.config/i3/locker.sh" +set $Locker_suspend "/bin/bash ~/.config/i3/locker.sh suspend" +set $Locker_hibernate "/bin/bash ~/.config/i3/locker.sh hibernate" +set $terminal st + + +set $left h +set $down j +set $up k +set $right l + +floating_modifier Mod4 + +# Notifications +bindsym $mod+bracketleft exec --no-startup-id dunstctl close +bindsym $mod+Shift+bracketleft exec --no-startup-id dunstctl close-all +bindsym $mod+bracketright exec --no-startup-id dunstctl history-pop +bindsym $mod+Shift+bracketright exec --no-startup-id dunstctl context + +# Basics +bindsym $mod+Return exec $terminal +bindsym $mod+Shift+v exec $terminal vtm +bindsym $mod+Ctrl+Return exec st -C '#363636@0' -C '#953641@1' -C '#679a2f@2' -C '#ca973e@3' -C '#535f7f@4' -C '#655876@5' -C '#728c91@6' -C '#a3a3a3@7' -C '#888888@8' -C '#c47b86@9' -C '#89be7f@10' -C '#f9c0ad@11' -C '#6283bd@12' -C '#ad8bc5@13' -C '#a9dfe2@14' -C '#dadada@15' -f lemon -A 0.95 +bindsym $mod+F4 kill +bindsym $mod+shift+r exec rofi -show drun +bindsym $mod+shift+d exec --no-startup-id dmenu_run -c -l 20 -g 2 +bindsym $mod+d exec --no-startup-id dmenu_run -c -l 20 -g 2 + +# Focusing +bindsym $mod+$left focus left +bindsym $mod+$down focus down +bindsym $mod+$up focus up +bindsym $mod+$right focus right +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right +bindsym Mod1+Tab focus next + +focus_follows_mouse no + + +# Moving focused +bindsym $mod+Mod1+$left move left +bindsym $mod+Mod1+$down move down +bindsym $mod+Mod1+$up move up +bindsym $mod+Mod1+$right move right +bindsym $mod+Mod1+Left move left +bindsym $mod+Mod1+Down move down +bindsym $mod+Mod1+Up move up +bindsym $mod+Mod1+Right move right + + +# Splitting +bindsym $mod+g split h +bindsym $mod+v split v + +# Fullscreen +bindsym $mod+f fullscreen toggle + +# Layout +bindsym $mod+t border normal 1 +bindsym $mod+y border pixel +bindsym $mod+u border none + +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split +bindsym $mod+Shift+f sticky toggle +bindsym $mod+Shift+space floating toggle +bindsym $mod+space focus mode_toggle +bindsym $mod+Mod1+minus move scratchpad +bindsym $mod+minus scratchpad show + +# Workspaces +set $workspace1 "1" +set $workspace2 "2" +set $workspace3 "3" +set $workspace4 "4" +set $workspace5 "5" +set $workspace6 "6" +set $workspace7 "7" +set $workspace8 "8" +set $workspace9 "9" +set $workspace10 "10:IM" +set $workspace11 "11" +set $workspace12 "12" +set $workspace13 "13" +set $workspace14 "14" +set $workspace15 "15" +set $workspace16 "16" +set $workspace17 "17" +set $workspace18 "18" +set $workspace19 "19" +set $workspace20 "20" + +# switch to workspace +bindsym $mod+1 workspace $workspace1 +bindsym $mod+2 workspace $workspace2 +bindsym $mod+3 workspace $workspace3 +bindsym $mod+4 workspace $workspace4 +bindsym $mod+5 workspace $workspace5 +bindsym $mod+6 workspace $workspace6 +bindsym $mod+7 workspace $workspace7 +bindsym $mod+8 workspace $workspace8 +bindsym $mod+9 workspace $workspace9 +bindsym $mod+0 workspace $workspace10 +bindsym $mod+Control+1 workspace $workspace11 +bindsym $mod+Control+2 workspace $workspace12 +bindsym $mod+Control+3 workspace $workspace13 +bindsym $mod+Control+4 workspace $workspace14 +bindsym $mod+Control+5 workspace $workspace15 +bindsym $mod+Control+6 workspace $workspace16 +bindsym $mod+Control+7 workspace $workspace17 +bindsym $mod+Control+8 workspace $workspace18 +bindsym $mod+Control+9 workspace $workspace19 +bindsym $mod+Control+0 workspace $workspace20 + +bindsym $mod+Tab workspace next +bindsym $mod+Shift+Tab workspace prev +bindsym $mod+Ctrl+Left workspace prev +bindsym $mod+Ctrl+Right workspace next + +bindsym $mod+mod1+1 move container to workspace $workspace1 +bindsym $mod+mod1+2 move container to workspace $workspace2 +bindsym $mod+mod1+3 move container to workspace $workspace3 +bindsym $mod+mod1+4 move container to workspace $workspace4 +bindsym $mod+mod1+5 move container to workspace $workspace5 +bindsym $mod+mod1+6 move container to workspace $workspace6 +bindsym $mod+mod1+7 move container to workspace $workspace7 +bindsym $mod+mod1+8 move container to workspace $workspace8 +bindsym $mod+mod1+9 move container to workspace $workspace9 +bindsym $mod+mod1+0 move container to workspace $workspace10 +bindsym $mod+Control+mod1+1 move container to workspace $workspace11 +bindsym $mod+Control+mod1+2 move container to workspace $workspace12 +bindsym $mod+Control+mod1+3 move container to workspace $workspace13 +bindsym $mod+Control+mod1+4 move container to workspace $workspace14 +bindsym $mod+Control+mod1+5 move container to workspace $workspace15 +bindsym $mod+Control+mod1+6 move container to workspace $workspace16 +bindsym $mod+Control+mod1+7 move container to workspace $workspace17 +bindsym $mod+Control+mod1+8 move container to workspace $workspace18 +bindsym $mod+Control+mod1+9 move container to workspace $workspace19 +bindsym $mod+Control+mod1+0 move container to workspace $workspace20 + +# Resizing +mode "resize" { + # These bindings trigger as soon as you enter the resize mode + + # Pressing left will shrink the window’s width. + # Pressing right will grow the window’s width. + # Pressing up will shrink the window’s height. + # Pressing down will grow the window’s height. + bindsym $down resize shrink height 10 px + bindsym $up resize grow height 10 px + bindsym $left resize shrink width 10 px + bindsym $right resize grow width 10 px + + # same bindings, but for the arrow keys + bindsym Left resize shrink width 10 px + bindsym Down resize grow height 10 px + bindsym Up resize shrink height 10 px + bindsym Right resize grow width 10 px + + # Same but with small step + bindsym Shift+$down resize shrink height 1 px or 1 ppt + bindsym Shift+$up resize grow height 1 px or 1 ppt + bindsym Shift+$left resize shrink width 1 px or 1 ppt + bindsym Shift+$right resize grow width 1 px or 1 ppt + + bindsym Shift+Left resize shrink width 1 px or 1 ppt + bindsym Shift+Down resize grow height 1 px or 1 ppt + bindsym Shift+Up resize shrink height 1 px or 1 ppt + bindsym Shift+Right resize grow width 1 px or 1 ppt + + + # back to normal: Enter or Escape + bindsym Return mode "default" + bindsym Escape mode "default" +} + +bindsym $mod+r mode "resize" + +# Exiting +#set $mode_system System: --L --E --S --H --R --P +#mode "$mode_system" { +# bindsym l exec --no-startup-id $Locker +# bindsym e exec --no-startup-id i3-msg exit +# bindsym s exec --no-startup-id $Locker_suspend +# bindsym h exec --no-startup-id $Locker_hibernate +# bindsym r exec --no-startup-id systemctl reboot +# bindsym p exec --no-startup-id systemctl poweroff -i + +# #back to normal: Enter or Escape +# bindsym Return mode "default" +# bindsym Escape mode "default" +#} +#bindsym $mod+Delete mode "$mode_system" +bindsym $mod+Delete exec /bin/bash ~/.config/i3/power.sh + +set $mode_mouse Mouse: h j k l [ y u i ] +mode "$mode_mouse" { + bindsym Shift+$up exec --no-startup-id xdotool mousemove_relative 0 -1 + bindsym Shift+$down exec --no-startup-id xdotool mousemove_relative 0 1 + bindsym Shift+$left exec --no-startup-id xdotool mousemove_relative -- -1 0 + bindsym Shift+$right exec --no-startup-id xdotool mousemove_relative 1 0 + bindsym Shift+Up exec --no-startup-id xdotool mousemove_relative 0 -1 + bindsym Shift+Down exec --no-startup-id xdotool mousemove_relative 0 1 + bindsym Shift+Left exec --no-startup-id xdotool mousemove_relative -- -1 0 + bindsym Shift+Right exec --no-startup-id xdotool mousemove_relative 1 0 + + bindsym Control+$up exec --no-startup-id xdotool mousemove_relative 0 -20 + bindsym Control+$down exec --no-startup-id xdotool mousemove_relative 0 20 + bindsym Control+$left exec --no-startup-id xdotool mousemove_relative -- -20 0 + bindsym Control+$right exec --no-startup-id xdotool mousemove_relative 20 0 + bindsym Control+Up exec --no-startup-id xdotool mousemove_relative 0 -20 + bindsym Control+Down exec --no-startup-id xdotool mousemove_relative 0 20 + bindsym Control+Left exec --no-startup-id xdotool mousemove_relative -- -20 0 + bindsym Control+Right exec --no-startup-id xdotool mousemove_relative 20 0 + + bindsym $up exec --no-startup-id xdotool mousemove_relative 0 -10 + bindsym $down exec --no-startup-id xdotool mousemove_relative 0 10 + bindsym $left exec --no-startup-id xdotool mousemove_relative -- -10 0 + bindsym $right exec --no-startup-id xdotool mousemove_relative 10 0 + bindsym Up exec --no-startup-id xdotool mousemove_relative 0 -10 + bindsym Down exec --no-startup-id xdotool mousemove_relative 0 10 + bindsym Left exec --no-startup-id xdotool mousemove_relative -- -10 0 + bindsym Right exec --no-startup-id xdotool mousemove_relative 10 0 + + bindsym y exec --no-startup-id xdotool mousedown 1; exec sleep 0.05; exec xdotool mouseup 1 + bindsym Shift+y exec --no-startup-id xdotool mousedown 1 + bindsym u exec --no-startup-id xdotool mousedown 2; exec sleep 0.05; exec xdotool mouseup 2 + bindsym Shift+u exec --no-startup-id xdotool mousedown 2 + bindsym i exec --no-startup-id xdotool mousedown 3; exec sleep 0.05; exec xdotool mouseup 3 + bindsym Shift+i exec --no-startup-id xdotool mousedown 3 + bindsym t exec --no-startup-id xdotool mousedown 4; exec sleep 0.05; exec xdotool mouseup 4 + bindsym g exec --no-startup-id xdotool mousedown 5; exec sleep 0.05; exec xdotool mouseup 5 + + bindsym Return mode "default" + bindsym Escape mode "default" +} +bindsym $mod+z mode "$mode_mouse" + + +set $mode_altnum Numpad: ... +mode "$mode_altnum" { + bindsym Escape mode default + bindsym --release 3 exec xdotool type ♥ +} +bindsym $mod+Mod1+space mode "$mode_altnum" + +# Colors +# bg-primary: #211a35 rgb( 33, 26, 53) +# bg-secondary: #1b172c rgb( 27, 23, 44) +# bg-dark: #171231 rgb( 23, 18, 49) +# fg-active: #79b3f9 rgb(121, 179, 249) +# fg-normal: #6349c2 rgb( 99, 73, 194) +# Class border bckgrnd text indic-r bd_chld +client.focused #211a35 #211a35 #79b3f9 #546799 #1a1a1a +client.unfocused #1b172c #1b172c #6349c2 #546799 #1a1a1a +client.focused_inactive #171231 #171231 #79b3f9 #1a1a1a +client.urgent #bf6979 #733453 #f5f5f5 #c98f8f #bf6979 +client.background #211a35 + +# Gaps +set $gaps_default_inner 25 +set $gaps_default_outer 15 + +gaps inner 0 +gaps outer 0 + +bindsym $mod+Shift+i gaps inner current toggle $gaps_default_inner +bindsym $mod+Shift+o gaps outer current toggle $gaps_default_outer + +default_border normal 1 +default_floating_border pixel 1 + +# Windows settings +for_window [class="Anydesk" title="anydesk"] floating enable +for_window [class="Ibus-ui-gtk3"] move scratchpad +for_window [class="craftos-luajit"] floating enable +for_window [instance="craftos-luajit"] floating enable +for_window [class="ripdrag"] floating enable +for_window [class="steam_proton" title="Windose"] floating enable +for_window [class="VirtScreen"] floating enable +for_window [class="com-group_finity-mascot-Main"] floating enable +for_window [class="Chromium"] border none +for_window [class="boorudownloader.exe"] floating enable +for_window [class="fontforge"] floating enable +for_window [class="flameshot"] floating enable +for_window [class="Display-im6.q16"] floating enable +for_window [class="Display"] floating enable +for_window [class="ffplay"] floating enable +for_window [class="Yad"] floating enable +for_window [class="Tk"] floating enable +for_window [class="mpv"] floating enable +for_window [class="qpaeq"] floating enable +for_window [class="Nitrogen"] floating enable +for_window [class="floating"] floating enable +for_window [instance="floating"] floating enable +for_window [class="windose.exe"] floating enable +for_window [title="TL.*Loading launcher"] floating enable +for_window [title=".*Pixel Game Engine.*"] floating enable + +for_window [window_role="PictureInPicture"] sticky enable + + +assign [class="TelegramDesktop"] $workspace10 + +# Media +set $mute pamixer -t +set $vol_inc sh ~/.config/i3/volumectrl.sh inc +set $vol_dec sh ~/.config/i3/volumectrl.sh dec +set $music_player ncmpc +set $music_stop ~/.local/bin/musicctl stop +set $music_pause ~/.local/bin/musicctl pause +set $music_next ~/.local/bin/musicctl next +set $music_prev ~/.local/bin/musicctl prev +set $music_fwd ~/.local/bin/musicctl seekf +set $music_rev ~/.local/bin/musicctl seekb +set $music_vinc mpc volume +2 +set $music_vdec mpc volume -2 +set $music_mute mpc toggleoutput 2 + +bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute 0 toggle +bindsym Control+XF86AudioMute exec --no-startup-id $music_mute +bindsym XF86AudioMute exec --no-startup-id $mute +bindsym XF86AudioRaiseVolume exec --no-startup-id $vol_inc +bindsym XF86AudioLowerVolume exec --no-startup-id $vol_dec +bindsym Mod4+F9 exec --no-startup-id $vol_dec +bindsym Mod4+F10 exec --no-startup-id $vol_inc +bindsym Mod4+F11 exec --no-startup-id $mute + +bindsym Control+XF86AudioRaiseVolume exec --no-startup-id $music_vinc +bindsym Control+XF86AudioLowerVolume exec --no-startup-id $music_vdec +bindsym XF86AudioNext exec --no-startup-id $music_next +bindsym XF86AudioPrev exec --no-startup-id $music_prev +bindsym Control+XF86AudioNext exec --no-startup-id $music_fwd +bindsym Control+XF86AudioPrev exec --no-startup-id $music_rev +bindsym XF86AudioStop exec --no-startup-id $music_stop +bindsym XF86AudioPlay exec --no-startup-id $music_pause +bindsym Control+XF86Search exec --no-startup-id playerctl previous +bindsym Control+XF86LaunchA exec --no-startup-id playerctl play-pause +bindsym Control+XF86Explorer exec --no-startup-id playerctl next + +bindsym $mod+Shift+F5 exec --no-startup-id ~/.local/bin/musicctl prev +bindsym $mod+F5 exec --no-startup-id ~/.local/bin/musicctl seekb +bindsym $mod+F6 exec --no-startup-id ~/.local/bin/musicctl pause +bindsym $mod+F7 exec --no-startup-id ~/.local/bin/musicctl stop +bindsym $mod+Shift+F8 exec --no-startup-id ~/.local/bin/musicctl next +bindsym $mod+F8 exec --no-startup-id ~/.local/bin/musicctl seekf +bindsym $mod+m exec --no-startup-id $terminal -e $music_player +bindsym $mod+Shift+m exec --no-startup-id $terminal -e mocp + +# Screenshot +bindsym $mod+p exec --no-startup-id ~/.local/bin/scr +bindsym $mod+Print exec --no-startup-id ~/.local/bin/scr +bindsym $mod+Shift+p --release exec --no-startup-id ~/.local/bin/scr -s +bindsym $mod+Shift+s --release exec --no-startup-id ~/.local/bin/scr -s +bindsym $mod+Mod1+p --release exec --no-startup-id ~/.local/bin/fscr +bindsym $mod+Ctrl+p --release exec --no-startup-id ~/.local/bin/scr -U -s +bindsym Print exec flameshot gui + +# Autostart +exec_always --no-startup-id ~/.config/i3/autostart.sh + +# Other stuff +bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" +bindsym $mod+Mod1+i exec --no-startup-id ~/.local/bin/select-emoji +bindsym $mod+i exec --no-startup-id ~/.local/bin/imgsearch +bindsym $mod+Shift+c reload; exec --no-startup-id ~/.config/polybar/run.sh +bindsym $mod+c exec --no-startup-id ~/.local/bin/ssh-menu +bindsym $mod+F1 exec --no-startup-id ~/.local/bin/toggletouchpad +bindsym --release $mod+F2 exec --no-startup-id transset +bindsym Mod4+Ctrl+F2 exec --no-startup-id brightnessctl s 5%- +bindsym Mod4+Ctrl+F3 exec --no-startup-id brightnessctl s 5%+ +bindsym $mod+F3 exec sh -c 'i3-msg -rt get_workspaces | jq -r .[].name | dmenu -c -p "goto:" | xargs i3-msg workspace' +bindsym $mod+Mod1+F3 exec sh -c 'i3-msg -rt get_workspaces | jq -r .[].name | dmenu -c -p "move:" | xargs i3-msg move container to workspace' + + diff --git a/dot_config/i3/executable_autostart.sh b/dot_config/i3/executable_autostart.sh new file mode 100644 index 0000000..dbcf829 --- /dev/null +++ b/dot_config/i3/executable_autostart.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +~/.config/polybar/run.sh || true; + +"${HOME}/.local/bin/setupwallpaper" || hsetroot -solid '#1a1a1a'; +xrdb -load "$XDG_CONFIG_HOME/X11/xresources" + +# (nitrogen --restore || true) & disown; +xset r rate 250 25; +touchpad_dev_name=$(xinput | grep -oP '(SynPS/2 Synaptics TouchPad|Synaptics TM2722-001)'); +xinput set-prop "${touchpad_dev_name}" 'libinput Natural Scrolling Enabled' 1; +xinput set-prop "${touchpad_dev_name}" 'libinput Tapping Enabled' 1; +xcompmgr & disown; +nm-applet & disown; +lxqt-policykit-agent & disown; +(xfce4-clipman || true) & disown; +xfce4-power-manager & disown; +syncthingtray & disown; +blueman-applet & disown; +killall oneko; +conky & disown; +#oneko -bg '#1a1a1a' -fg '#bfbfbf' -tofocus -sakura & disown; + +##either one or another. never both at the same time. +#setxkbmap -model pc104 -layout us,ru -option grp:caps_toggle -option compose:ralt; +# ibus-daemon -drxR; + +[ -f "${HOME}/.config/xkb.conf" ] \ + && xkbcomp "${HOME}/.config/xkb.conf" :0 2>/dev/null; +synclient HorizTwoFingerScroll=1 TapButton1=1 TapButton2=3 TapButton3=2; + +pactl load-module module-null-sink sink_name=music rate=44100 channels=2; +pw-link 'music' 'alsa_output.pci-0000_00_1b.0.analog-stereo'; + diff --git a/dot_config/i3/executable_locker.sh b/dot_config/i3/executable_locker.sh new file mode 100644 index 0000000..4903fac --- /dev/null +++ b/dot_config/i3/executable_locker.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# scrot -za 0,0,1024,600 /tmp/lock.png; +# convert /tmp/lock.png -blur 2x2 /tmp/lock.png +# i3lock -nec 131313; +export DISPLAY=:0 +export XDG_SEAT=seat0 +export LOGNAME=$(whoami) +export XDG_SESSION_TYPE=tty +export XAUTHORITY=$HOME/.lyxauth +export MOTD_SHOWN=pam +export XDG_SESSION_CLASS=user +export XDG_VTNR=2 +export XDG_SESSION_ID=$(cat /proc/self/sessionid) +export XDG_RUNTIME_DIR=/run/user/$(id -u) + +scrot -oF /tmp/screen.png +magick /tmp/screen.png -scale 5% -scale 2000% -statistic Median 4 \ + -font "unscii-16-full" -pointsize 48 \ + -draw "gravity Center fill #131313 text -4,260 'Locked'" \ + -draw "gravity Center fill #131313 text 4,260 'Locked'" \ + -draw "gravity Center fill #131313 text -4,252 'Locked'" \ + -draw "gravity Center fill #131313 text 4,252 'Locked'" \ + -draw "gravity Center fill #efefef text 0,256 'Locked'" \ + /tmp/lock.png; + +rm /tmp/screen.png + +if [ "x$1" = "x" ]; then + i3lock -befni /tmp/lock.png +else + i3lock -befi /tmp/lock.png + sleep 0.5; + i3-msg mode default; + case "$1" in + hibernate) systemctl hibernate ;; + suspend) systemctl suspend ;; + esac; +fi +# rm /tmp/lock.png; diff --git a/dot_config/i3/executable_power.sh b/dot_config/i3/executable_power.sh new file mode 100644 index 0000000..2e5eced --- /dev/null +++ b/dot_config/i3/executable_power.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +option=$(echo -e "Lock\nShutdown\nReboot\nSleep/suspend\nHibernate" | dmenu -p "Power:" -l 5 -c) + +case "$option" in + "Lock") ~/.config/i3/locker.sh;; + "Shutdown") poweroff;; + "Reboot") reboot;; + "Sleep/suspend") ~/.config/i3/locker.sh suspend;; + "Hibernate") ~/.config/i3/locker.sh hibernate;; +esac diff --git a/dot_config/i3/executable_volumectrl.sh b/dot_config/i3/executable_volumectrl.sh new file mode 100644 index 0000000..30fa884 --- /dev/null +++ b/dot_config/i3/executable_volumectrl.sh @@ -0,0 +1,15 @@ +#!/bin/sh +act="$1"; shift; + +show_volume_notification() { + volume_percent=$(pamixer --get-volume); + #is_muted=$(pamixer --get-mute); + + notify-send -u low -h "int:value:${volume_percent}" -a i3 volume; +} + +case "$act" in + inc) pamixer -i 2; show_volume_notification; sfxc play:rs pjsk/slider_up ;; + dec) pamixer -d 2; show_volume_notification; sfxc play:rs pjsk/slider_down ;; + fwd) pamixer "$@"; code="$?"; exit "$code"; ;; +esac; diff --git a/dot_config/ncmpc/config b/dot_config/ncmpc/config new file mode 100644 index 0000000..30a61a8 --- /dev/null +++ b/dot_config/ncmpc/config @@ -0,0 +1,27 @@ +host = 127.0.0.1 +port = 6600 + +color background = black +color title = white/black +color title-bold = red/black +color line = red/black +color line-flags = green + +color list = blue +color list-bold = yellow +color browser-directory = green +color browser-playlist = red + +color progressbar = blue/black +color progressbar-background = red/black +color status-state = /black +color status-time = /black +color status-song = green/black + +color alert = red/black +chat-prefix = "> " + +scroll = yes +scroll-sep = " ::: " +list-format = "[[%artist% - ]%title%]|%file%" +status-format = "[[%artist% - ]%title%]|%file%" diff --git a/dot_config/nvim/bind-edit.vim b/dot_config/nvim/bind-edit.vim new file mode 100644 index 0000000..3aa8c0b --- /dev/null +++ b/dot_config/nvim/bind-edit.vim @@ -0,0 +1,88 @@ +" Copy/paste +set clipboard+=unnamedplus +inoremap "+gpa +nnoremap "+gP +vnoremap d"+gP +vnoremap cp "+y +nnoremap cp V"+y +nnoremap mzyyp`zj +inoremap mzyyp`zja +vnoremap y`>p +nnoremap XR :let @+=@" +nnoremap XW :let @"=@+ +nnoremap mc :delmarks a-zA-Z0-9 + +" File saving +nnoremap fs :w +nnoremap qq :q +nnoremap QQ :q! +nnoremap qa :qa +nnoremap QA :qa! +nnoremap xx :x +nnoremap :w +inoremap :wa + +" Mouse +function! s:toggleMouse() + if &mouse == "a" + set mouse= + else + set mouse=a + endif +endfunction +command! ToggleMouse call toggleMouse() +nnoremap mt :ToggleMouse + +" Search +vnoremap // y/\V" +vnoremap / y/\V" +vnoremap /v/ y/\v" +vnoremap /v y/\v" +nnoremap / /\v + +" Completion +inoremap pumvisible() ? "\" : "\" +inoremap pumvisible() ? "\" : "\" + +" Replace +nnoremap re :%s///g +vnoremap re y:%s/"//g + +" Tabulation +inoremap +vnoremap < >gv +nnoremap at mzggVG=`z + +" Comments +imap ca +nmap c +vmap cgv +imap ca +nmap c +vmap cgv + +" Space characters +nnoremap St :set listchars=tab:┊\ +nnoremap Ss :set listchars=tab:\\\|-,eol:$,nbsp:%,space:_,trail:# +nnoremap Sn :set listchars= +inoremap n :set listchars=tab:┊\ a +inoremap s :set listchars=tab:\\\|-,eol:$,nbsp:%,space:_,trail:#a +inoremap h :set listchars=a + +" Movement +nnoremap gg +nnoremap G +inoremap gga +inoremap Ga + +imap jj +nnoremap :m .-2== +nnoremap :m .+1== +vnoremap :m '<-2gv=gv +vnoremap :m '>+1gv=gv + + +" Actions +nmap AC (coc-codeaction) +nmap ac (coc-codeaction-line) diff --git a/dot_config/nvim/bind-tabs-n-windows.vim b/dot_config/nvim/bind-tabs-n-windows.vim new file mode 100644 index 0000000..0aa7622 --- /dev/null +++ b/dot_config/nvim/bind-tabs-n-windows.vim @@ -0,0 +1,72 @@ +" Splitting +nnoremap sv :sp +nnoremap - :sp +nnoremap sh :vs +nnoremap \ :vs + +" Tabs +nnoremap tn :tabnext +nnoremap tp :tabprev +nnoremap tc :tabnew +nnoremap t= = +nnoremap tm :spT + +" NERDTree +nnoremap tr :NERDTreeToggle:NERDTreeRefreshRoot +nnoremap :NERDTreeToggle:NERDTreeRefreshRoot +inoremap :NERDTreeToggle:NERDTreeRefreshRoot + +" Moving +nnoremap +nnoremap +nnoremap +nnoremap +nnoremap h +nnoremap j +nnoremap k +nnoremap l + +" Resizing +nnoremap :res +2 +nnoremap :res -2 +nnoremap :vert res +2 +nnoremap :vert res -2 +nnoremap :res +2 +nnoremap :res -2 +nnoremap :vert res +2 +nnoremap :vert res -2 +nnoremap :res +2 +nnoremap :res -2 +nnoremap :vert res +2 +nnoremap :vert res -2 + +" Terminal +tnoremap +nnoremap tt :FloatermToggle + +" Shift+F9 ... Shift+F12 +nnoremap :FloatermPrev +nnoremap :FloatermNext +nnoremap :FloatermNew +nnoremap :FloatermToggle +tnoremap :FloatermPrev +tnoremap :FloatermNext +tnoremap :FloatermNew +tnoremap :FloatermToggle +nnoremap :FloatermPrev +nnoremap :FloatermNext +nnoremap :FloatermNew +nnoremap :FloatermToggle +tnoremap :FloatermPrev +tnoremap :FloatermNext +tnoremap :FloatermNew +tnoremap :FloatermToggle + +" Startify +nnoremap st :Startify + +" Telescope +nnoremap ff Telescope find_files +nnoremap fg Telescope live_grep +nnoremap fb Telescope buffers +nnoremap fh Telescope help_tags diff --git a/dot_config/nvim/init.vim b/dot_config/nvim/init.vim new file mode 100644 index 0000000..8268cc8 --- /dev/null +++ b/dot_config/nvim/init.vim @@ -0,0 +1,51 @@ +set number relativenumber list title incsearch ruler +set expandtab autoindent tabstop=4 shiftwidth=4 +set mouse=a notimeout timeoutlen=2500 termguicolors +set encoding=utf-8 fileencoding=utf-8 colorcolumn=81 +set virtualedit=block + +" Leaders +let maplocalleader="\" +let mapleader="\" + +" Smooth scroll on touch devices +map +imap +map +imap + +" Natural language +set keymap=russian-jcukenwin +lmap \| / +set iminsert=0 +set imsearch=0 +inoremap + +" Random stuff +set t_kB= +set t_Co=256 +syntax on + + +set modeline + +" Sourcing stuff +let g:initvim_folder = expand(":p:h") +exec 'set runtimepath+='.fnameescape(g:initvim_folder) + +if getenv("LIGHT_MODE") == "yes" + set background=light + colorscheme humanoid +else + " colorscheme madeline +endif + +let g:langprefs_path = g:initvim_folder."/langprefs" +exec 'source '.fnameescape(g:initvim_folder."/bind-tabs-n-windows.vim") +exec 'source '.fnameescape(g:initvim_folder."/bind-edit.vim") +exec 'source '.fnameescape(g:initvim_folder."/plugins.vim") +exec 'source '.fnameescape(g:initvim_folder."/langprefs/load.vim") +exec 'source '.fnameescape(g:initvim_folder."/langprefs/run.vim") +exec 'source '.fnameescape(g:initvim_folder."/symbols.vim") + +colorscheme catppuccin-macchiato diff --git a/dot_config/nvim/langprefs/clang.vim b/dot_config/nvim/langprefs/clang.vim new file mode 100644 index 0000000..aa95d89 --- /dev/null +++ b/dot_config/nvim/langprefs/clang.vim @@ -0,0 +1,11 @@ +set tabstop=2 +set softtabstop=2 +set shiftwidth=2 +set textwidth=79 +set expandtab autoindent +set fileformat=unix + +function! Formatonsave() + let l:formatdiff = 1 + silent %! clang-format +endfunction diff --git a/dot_config/nvim/langprefs/load.vim b/dot_config/nvim/langprefs/load.vim new file mode 100644 index 0000000..037d1db --- /dev/null +++ b/dot_config/nvim/langprefs/load.vim @@ -0,0 +1,9 @@ +au BufNewFile,BufRead,BufEnter *.py + \ exec 'source '.fnameescape(g:langprefs_path."/python.vim") +au BufNewFile,BufRead,BufEnter *.c + \ exec 'source '.fnameescape(g:langprefs_path."/clang.vim") +au BufNewFile,BufRead,BufEnter *.{html,css,js,ts,php} + \ exec 'source '.fnameescape(g:langprefs_path."/web.vim") +au BufNewFile,BufRead,BufEnter *.{tex,ltx} + \ exec 'source '.fnameescape(g:langprefs_path."/tex.vim") + diff --git a/dot_config/nvim/langprefs/md.vim b/dot_config/nvim/langprefs/md.vim new file mode 100644 index 0000000..acf2bc7 --- /dev/null +++ b/dot_config/nvim/langprefs/md.vim @@ -0,0 +1,18 @@ + +syntax match Conceal "||.*||" conceal cchar=? + +let s:spoilered = 0 + +function! ToggleSpoiler() + if s:spoilered + hi Conceal guibg=#8087a2 guifg=#8087a2 + let s:spoilered = 0 + else + hi Conceal guibg=none + let s:spoilered = 1 + endif +endfunction + +nnoremap :call ToggleSpoiler() +inoremap :call ToggleSpoiler()a + diff --git a/dot_config/nvim/langprefs/python.vim b/dot_config/nvim/langprefs/python.vim new file mode 100644 index 0000000..db99cef --- /dev/null +++ b/dot_config/nvim/langprefs/python.vim @@ -0,0 +1,6 @@ +set tabstop=4 +set softtabstop=4 +set shiftwidth=4 +set textwidth=79 +set expandtab noautoindent +set fileformat=unix diff --git a/dot_config/nvim/langprefs/run.vim b/dot_config/nvim/langprefs/run.vim new file mode 100644 index 0000000..482e4a4 --- /dev/null +++ b/dot_config/nvim/langprefs/run.vim @@ -0,0 +1,73 @@ +function s:TraverseBackwardsUntilFound(path, glob) + let cur_path = resolve(fnamemodify(a:path, ':p:h')) + while cur_path != "/" + let result = globpath(cur_path, a:glob) + if result != "" + return result + endif + let cur_path = resolve(cur_path.."/..") + endwhile + return "" +endfunction + +function! ExecuteCurrentFile() + let file_wd = expand('%:p:h') + let file_name = expand('%:t') + echom "Running ".file_name + + let lines = readfile(expand('%')) + let ndx = match(lines, "x-run: .*") + let makefile_path = s:TraverseBackwardsUntilFound(file_wd, "Makefile") + + if ndx != -1 + let cmd = matchstr(lines[ndx], "x-run: .*")[7:] + exec 'FloatermNew --autoclose=0 cd '.fnameescape(file_wd).'; ' + \ . substitute(cmd, '%', fnameescape(file_name), '') + elseif &filetype == 'python' + exec 'FloatermNew --autoclose=0 cd '.fnameescape(file_wd).'; ' + \ . 'python3 '.fnameescape(file_name) + elseif &filetype == 'lua' + exec 'FloatermNew --autoclose=0 cd '.fnameescape(file_wd).'; ' + \ . 'lua '.fnameescape(file_name) + elseif &filetype == 'c' + let exec_name = expand('%:t:r') + exec 'FloatermNew --autoclose=0 cd ' . fnameescape(file_wd) . '; ' + \ . 'cc -o '.fnameescape(exec_name).' '.fnameescape(file_name) + \ . ' -lm' + \ . ' && ' + \ . 'exec '.fnameescape(exec_name) + elseif &filetype == 'rust' + let cargo_file = s:TraverseBackwardsUntilFound(file_wd, "Cargo.toml") + if cargo_file != "" + exec 'FloatermNew --autoclose=0 cd '.fnameescape(file_wd).'; cargo run' + else + let exec_name = expand('%:t:r') + exec 'FloatermNew --autoclose=0 cd ' . fnameescape(file_wd) . '; ' + \ . 'rustc '.fnameescape(file_name) + \ . ' && ' + \ . 'exec '.fnameescape(exec_name) + endif + elseif &filetype == 'vim' + exec 'source '.expand('%') + elseif &filetype == 'dot' + let img_name = expand('%:t:r') . ".png" + exec '! cd ' . fnameescape(file_wd) . '; ' + \ . 'dot -Tpng '.fnameescape(file_name).' >'.fnameescape(img_name) + \ . ' && ' + \ . 'sxiv '.fnameescape(img_name) + elseif &filetype == 'sh' + exec 'FloatermNew --autoclose=0 cd ' . fnameescape(file_wd) . '; ' + \ . '/bin/bash ' . fnameescape(file_name) + elseif makefile_path != "" + let makefile_dir = fnamemodify(makefile_path, ":p:h") + exec 'FloatermNew --autoclose=0 cd '.fnameescape(makefile_dir).'; ' + \ . 'make run' + else + echohl ErrorMsg + echom "Unknown file type: ".&filetype + echohl None + endif +endfunction + +nnoremap :w:call ExecuteCurrentFile() +inoremap :w:call ExecuteCurrentFile()a diff --git a/dot_config/nvim/langprefs/tex.vim b/dot_config/nvim/langprefs/tex.vim new file mode 100644 index 0000000..72effd4 --- /dev/null +++ b/dot_config/nvim/langprefs/tex.vim @@ -0,0 +1,18 @@ +vnoremap tt `>a}` +vnoremap bf `>a}` +vnoremap sl `>a}` +vnoremap sc `>a}` +inoremap # \section{} +inoremap ## \subsection{} +inoremap ### \subsubsection{} +inoremap ol \begin{enumerate}\end{enumerate}O +inoremap ul \begin{itemize}\end{itemize}O +inoremap li \item{}i +inoremap code \begin{minted}{}\end{minted}O +inoremap pre \texttt{} +inoremap b \textbf{} +inoremap \ \textbackslash +inoremap i \emph{} +inoremap s \cancel{} +inoremap br \newline +inoremap pt \newpage diff --git a/dot_config/nvim/langprefs/web.vim b/dot_config/nvim/langprefs/web.vim new file mode 100644 index 0000000..2f78832 --- /dev/null +++ b/dot_config/nvim/langprefs/web.vim @@ -0,0 +1,4 @@ +set tabstop=2 +set softtabstop=2 +set shiftwidth=2 +set noautoindent diff --git a/dot_config/nvim/plugins.vim b/dot_config/nvim/plugins.vim new file mode 100644 index 0000000..223dcab --- /dev/null +++ b/dot_config/nvim/plugins.vim @@ -0,0 +1,73 @@ + +let g:coc_global_extensions = ['coc-html', 'coc-emmet', 'coc-clangd', + \ 'coc-tsserver', 'coc-sh', 'coc-pyright', 'coc-json', + \ 'coc-css', 'coc-calc' ] + +let g:coc_filetype_map = { + \ 'yaml.ansible': 'ansible', + \ } + +let g:plugins_dir='~/.local/share/nvim/plugged' +" INFO: change to 1 for portable mode on Windows +if 0 + " WARN: node should be installed here + let $PATH.=';'.fnameescape(g:initvim_folder.'/node') + " FIXME: not sure if that's a good idea... + let $LOCALAPPDATA=fnameescape(g:initvim_folder."/localdata") + let $HOMEPATH=$LOCALAPPDATA + let $USERPROFILE=$HOMEPATH + " WARN: you should create localdata/{coc,plugged} yourself :) + let g:coc_data_home=fnameescape(g:initvim_folder.'/localdata/coc') + let g:coc_config_home=fnameescape(g:initvim_folder.'/localdata/coc') + let g:plugins_dir=fnameescape(g:initvim_folder.'/localdata/plugged') +endif +let g:instant_username = "kc" +exec 'source '.fnameescape(g:initvim_folder."/plug.vim") +call plug#begin(g:plugins_dir) + +Plug 'jbyuki/venn.nvim' +Plug 'wakatime/vim-wakatime' +Plug 'andweeb/presence.nvim' +Plug 'sheerun/vim-polyglot' +Plug 'preservim/nerdtree' +Plug 'neoclide/coc.nvim', { 'branch': 'release' } +Plug 'mhinz/vim-startify' +Plug 'voldikss/vim-floaterm' +Plug 'norcalli/nvim-colorizer.lua' +Plug 'lewis6991/gitsigns.nvim' +Plug 'folke/todo-comments.nvim' +Plug 'chentoast/marks.nvim' +Plug 'lewis6991/spellsitter.nvim' +Plug 'preservim/nerdcommenter' +"Plug 'rubixninja314/vim-mcfunction' +Plug 'nvim-lua/plenary.nvim' +Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.0' } +"Plug 'https://git.sr.ht/~sircmpwn/hare.vim/' +Plug 'https://github.com/vftdan/vim-termescape' +Plug 'jbyuki/instant.nvim' +Plug 'kylechui/nvim-surround' +Plug 'windwp/nvim-autopairs' +Plug 'theRealCarneiro/hyprland-vim-syntax' +"Plug 'dbeniamine/cheat.sh-vim' +"Plug 'feline-nvim/feline.nvim' +Plug 'catppuccin/nvim', { 'as': 'catppuccin' } + +call plug#end() +autocmd CursorHold * silent call CocActionAsync('highlight') + +let g:NERDDefaultAlign = 'left' + +"exec 'source '.fnameescape(g:initvim_folder.'/autoload/AnsiEsc.vim') + +nmap rn (coc-rename) + +lua require('colorizer').setup() +lua require('todo-comments').setup({ signs = false }) +lua require('marks').setup({}) +lua require('gitsigns').setup() +lua require('spellsitter').setup({ enable = true }) +lua require('nvim-surround').setup() +lua require("nvim-autopairs").setup {} +lua require('presence').setup({ buttons=false }) +lua require("catppuccin").setup({ transparent_background=true, flavour="macchiato" }) +"lua require("feline").setup({}) diff --git a/dot_config/nvim/symbols.vim b/dot_config/nvim/symbols.vim new file mode 100644 index 0000000..ce67484 --- /dev/null +++ b/dot_config/nvim/symbols.vim @@ -0,0 +1,36 @@ +" Characters +inoremap   +inoremap +- ± +inoremap -+ ∓ +inoremap ^ ⊕ +inoremap & ∩ +inoremap \| ∪ +inoremap && ∧ +inoremap \|\| ∨ +inoremap \\ ∖ +inoremap in ∈ +inoremap !in ∉ +inoremap has ∋ +inoremap !has ∌ +inoremap each ∀ +inoremap ex ∃ +inoremap !ex ∄ +inoremap dt ∆ +inoremap sub ⊂ +inoremap !sub ⊄ +inoremap ssub ⊊ +inoremap sup ⊃ +inoremap !sup ⊅ +inoremap ssup ⊋ +inoremap ~> ≳ +inoremap ~< ≲ +inoremap sum ∑ +inoremap prod ∏ +inoremap setN ℕ +inoremap setZ ℤ +inoremap setQ ℚ +inoremap setR ℝ +inoremap setC ℂ +" Fix collisions with digraphs +inoremap + diff --git a/dot_config/polybar/config.ini b/dot_config/polybar/config.ini new file mode 100644 index 0000000..2d2b57f --- /dev/null +++ b/dot_config/polybar/config.ini @@ -0,0 +1,248 @@ +;========================================================== +; +; +; ██████╗ ██████╗ ██╗ ██╗ ██╗██████╗ █████╗ ██████╗ +; ██╔══██╗██╔═══██╗██║ ╚██╗ ██╔╝██╔══██╗██╔══██╗██╔══██╗ +; ██████╔╝██║ ██║██║ ╚████╔╝ ██████╔╝███████║██████╔╝ +; ██╔═══╝ ██║ ██║██║ ╚██╔╝ ██╔══██╗██╔══██║██╔══██╗ +; ██║ ╚██████╔╝███████╗██║ ██████╔╝██║ ██║██║ ██║ +; ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ +; +; +; To learn more about how to configure Polybar +; go to https://github.com/polybar/polybar +; +; The README contains a lot of information +; +;========================================================== + +[colors] +background = #1b172c +foreground = #6349c2 +active = #79b3f9 +alert = #c22d5f +success = #6de18a + +[bar/default] +monitor = ${env:MONITOR:LVDS1} +width = 100% +height = 16 +padding = 1 + +background = ${colors.background} +foreground = ${colors.foreground} +separator = " " +font-0 = lemon:pixelsize=7 +font-1 = xos4 Terminus:pixelsize=9 +font-2 = Unifont:pixelsize=9 + +cursor-click = pointer +cursor-scroll = ns-resize + + +[bar/tray] +inherit = bar/default +modules-left = time time-dia workspace +modules-right = btn-lamp kbd-speed kbd-layout brightness volume +tray-position = right +tray-detached = false +tray-padding = 3 +wm-restack = i3 +bottom = true +# override-redirect = true + + +[bar/main] +inherit = bar/default +modules-left = memory cpu battery temperature rootfs +modules-center = music-prev music music-next +modules-right = net-wlan0 net-wlan1 net-eth0 net-eth1 net-usb0 net-all + +[module/time] +type = internal/date +interval = 1.0 +time = %I:%M:%S +label = %time% + +[module/time-dia] +type = custom/script +interval = 5 +exec = TZ=Europe/Warsaw date "+[Dia:%I:%M]" + +;================================================== +; SYSTEM STATS (i.e RAM/CPU/HDD/TEMP/BATTERY) +;================================================== +[module/memory] +type = internal/memory +interval = 1 +format = "[MEM: