Initial commit

This commit is contained in:
Casey 2024-07-13 13:41:00 +03:00
commit 4754312729
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
40 changed files with 2475 additions and 0 deletions

57
dot_bashrc Normal file
View File

@ -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";

8
dot_config/X11/xcompose Normal file
View File

@ -0,0 +1,8 @@
include "%L"
<Multi_key> <Multi_key> <c> <t> <a> : "Σ:з̭̌"
<Multi_key> <m> <o> <g> <u> <s> : "ඞ"
<Multi_key> <w> <o> <o> <z> <y>: "🥴"
<Multi_key> <space> <space>: ""
<Multi_key> <s> <h> <r> <u> <g> : "¯\\_(ツ)_/¯"
<Multi_key> <k> <m> <s> : "┤ûMo╙@🞂å⋂\"┼╗≤╝Å╟δL━╫O╬fÅ↑"
<Multi_key> <o> <8> : "ośmionóżek"

48
dot_config/X11/xresources Normal file
View File

@ -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 <KeyPress> Insert: insert-selection(CLIPBOARD) \n\
Ctrl Shift <Key>V: insert-selection(CLIPBOARD) \n\
Ctrl Shift <Key>C: copy-selection(CLIPBOARD) \n\
Ctrl <Btn1Up>: 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

60
dot_config/bash/aliases Normal file
View File

@ -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'

26
dot_config/bash/environ Normal file
View File

@ -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

423
dot_config/bash/functions Normal file
View File

@ -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 <stdio.h>\n' > src/main.c;
printf '#include <math.h>\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 <stdio.h>\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
}

View File

@ -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
]]

Binary file not shown.

After

Width:  |  Height:  |  Size: 648 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 718 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 603 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

52
dot_config/dunst/dunstrc Normal file
View File

@ -0,0 +1,52 @@
[global]
font = "Terminus (TTF) 12px"
markup = yes
format = "<b>%a: %s</b> <u>%p</u>\n%b"
sort = yes
indicate_hidden = yes
alignment = left
icon_position = left
show_age_threshold = 60
word_wrap = no
ignore_newline = no
width = (250, 720)
height = 100
origin = top-right
offset = 8x8
transparency = 0
idle_threshold = 120
monitor = 0
follow = keyboard
transparency = 15
sticky_history = yes
line_height = 0
separator_height = 2
padding = 4
horizontal_padding = 4
separator_color = frame
dmenu = dmenu -c -l 8 -p dunst
browser = /usr/bin/x-www-browser
frame_width = 1
frame_color = "#464a73"
max_icon_size = 32
mouse_left_click = close_current
mouse_right_click = context
always_run_scripts = false
script = ~/.config/dunst/handler.sh
[urgency_low]
background = "#1a1a1a"
foreground = "#a3a3a3"
timeout = 10
[urgency_normal]
background = "#1a1a1a"
foreground = "#c2f2f2"
timeout = 10
[urgency_critical]
foreground = "#efefef"
background = "#bf6979"
timeout = 0
# vim: ft=dosini

View File

@ -0,0 +1,71 @@
#!/bin/bash
PATH="${PATH}:${HOME}/.local/bin"
# When the script is called details of the notification that triggered it will be passed via environment variables. The following variables are available: DUNST_APP_NAME, DUNST_SUMMARY, DUNST_BODY, DUNST_ICON_PATH, DUNST_URGENCY, DUNST_ID, DUNST_PROGRESS, DUNST_CATEGORY, DUNST_STACK_TAG, DUNST_URLS, DUNST_TIMEOUT, DUNST_TIMESTAMP, DUNST_DESKTOP_ENTRY, and DUNST_STACK_TAG.
#date | tee -a /tmp/dunst-events.log;
#env | grep DUNST | tee -a /tmp/dunst-events.log;
#echo | tee -a /tmp/dunst-events.log;
if [ -z "$INNER" ]; then
INNER=yes "$0" "$@" >>"/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;

386
dot_config/i3/config Normal file
View File

@ -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 windows width.
# Pressing right will grow the windows width.
# Pressing up will shrink the windows height.
# Pressing down will grow the windows 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'

View File

@ -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';

View File

@ -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;

View File

@ -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

View File

@ -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;

27
dot_config/ncmpc/config Normal file
View File

@ -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%"

View File

@ -0,0 +1,88 @@
" Copy/paste
set clipboard+=unnamedplus
inoremap <S-Insert> <ESC>"+gpa
nnoremap <S-Insert> "+gP
vnoremap <S-Insert> d"+gP
vnoremap <Leader>cp "+y
nnoremap <Leader>cp V"+y<ESC>
nnoremap <C-D> mzyyp`zj
inoremap <C-D> <ESC>mzyyp`zja
vnoremap <C-D> y`>p
nnoremap <Leader>XR :let @+=@"<CR>
nnoremap <Leader>XW :let @"=@+<CR>
nnoremap <silent> <Leader>mc :delmarks a-zA-Z0-9<CR>
" File saving
nnoremap <Leader>fs :w<CR>
nnoremap <Leader>qq :q<CR>
nnoremap <Leader>QQ :q!<CR>
nnoremap <Leader>qa :qa<CR>
nnoremap <Leader>QA :qa!<CR>
nnoremap <Leader>xx :x<CR>
nnoremap <C-S> :w<CR>
inoremap <C-S> <ESC>:w<CR>a
" Mouse
function! s:toggleMouse()
if &mouse == "a"
set mouse=
else
set mouse=a
endif
endfunction
command! ToggleMouse call <SID>toggleMouse()
nnoremap <Leader>mt :ToggleMouse<CR>
" Search
vnoremap // y/\V<C-R>"<CR>
vnoremap /<Right> y/\V<C-R>"
vnoremap /v/ y/\v<C-R>"<CR>
vnoremap /v<Right> y/\v<C-R>"
nnoremap / /\v
" Completion
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" Replace
nnoremap <Leader>re :%s///g<Left><Left><Left>
vnoremap <Leader>re y<esc>:%s/<C-R>"//g<Left><Left>
" Tabulation
inoremap <S-Tab> <C-D>
vnoremap < <gv
vnoremap > >gv
nnoremap <Leader>at mzggVG=`z
" Comments
imap <F20> <ESC><Space>c<Space>a
nmap <F20> <Space>c<Space>
vmap <F20> <Space>c<Space>gv
imap <S-F8> <ESC><Space>c<Space>a
nmap <S-F8> <Space>c<Space>
vmap <S-F8> <Space>c<Space>gv
" Space characters
nnoremap <Leader>St :set listchars=tab:┊\ <cr>
nnoremap <Leader>Ss :set listchars=tab:\\\|-,eol:$,nbsp:%,space:_,trail:#<cr>
nnoremap <Leader>Sn :set listchars=<cr>
inoremap <C-L>n <esc>:set listchars=tab:┊\ <cr>a
inoremap <C-L>s <esc>:set listchars=tab:\\\|-,eol:$,nbsp:%,space:_,trail:#<cr>a
inoremap <C-L>h <esc>:set listchars=<cr>a
" Movement
nnoremap <S-Home> gg
nnoremap <S-End> G
inoremap <S-Home> <esc>gga
inoremap <S-End> <esc>Ga
imap jj <Esc>
nnoremap <C-k> :m .-2<CR>==
nnoremap <C-j> :m .+1<CR>==
vnoremap <C-k> :m '<-2<CR>gv=gv
vnoremap <C-j> :m '>+1<CR>gv=gv
" Actions
nmap <Leader>AC <Plug>(coc-codeaction)
nmap <Leader>ac <Plug>(coc-codeaction-line)

View File

@ -0,0 +1,72 @@
" Splitting
nnoremap <Leader>sv :sp<CR>
nnoremap <Leader>- :sp<CR>
nnoremap <Leader>sh :vs<CR>
nnoremap <Leader>\ :vs<CR>
" Tabs
nnoremap <Leader>tn :tabnext<CR>
nnoremap <Leader>tp :tabprev<CR>
nnoremap <Leader>tc :tabnew<CR>
nnoremap <Leader>t= <C-W>=
nnoremap <Leader>tm :sp<CR><C-W>T
" NERDTree
nnoremap <Leader>tr :NERDTreeToggle<CR>:NERDTreeRefreshRoot<CR>
nnoremap <F8> :NERDTreeToggle<CR>:NERDTreeRefreshRoot<CR>
inoremap <F8> <ESC>:NERDTreeToggle<CR>:NERDTreeRefreshRoot<CR>
" Moving
nnoremap <Leader><Up> <C-W><Up>
nnoremap <Leader><Down> <C-W><Down>
nnoremap <Leader><Left> <C-W><Left>
nnoremap <Leader><Right> <C-W><Right>
nnoremap <Leader>h <C-W><Left>
nnoremap <Leader>j <C-W><Down>
nnoremap <Leader>k <C-W><Up>
nnoremap <Leader>l <C-W><Right>
" Resizing
nnoremap <Leader><C-Up> :res +2<CR>
nnoremap <Leader><C-Down> :res -2<CR>
nnoremap <Leader><C-Left> :vert res +2<CR>
nnoremap <Leader><C-Right> :vert res -2<CR>
nnoremap <Leader><C-k> :res +2<CR>
nnoremap <Leader><C-j> :res -2<CR>
nnoremap <Leader><C-h> :vert res +2<CR>
nnoremap <Leader><C-l> :vert res -2<CR>
nnoremap <C-W><C-Up> :res +2<CR>
nnoremap <C-W><C-Down> :res -2<CR>
nnoremap <C-W><C-Left> :vert res +2<CR>
nnoremap <C-W><C-Right> :vert res -2<CR>
" Terminal
tnoremap <A-q> <C-\><C-n>
nnoremap <Leader>tt :FloatermToggle<CR>
" Shift+F9 ... Shift+F12
nnoremap <F21> :FloatermPrev<CR>
nnoremap <F22> :FloatermNext<CR>
nnoremap <F23> :FloatermNew<CR>
nnoremap <F24> :FloatermToggle<CR>
tnoremap <F21> <C-\><C-n>:FloatermPrev<CR>
tnoremap <F22> <C-\><C-n>:FloatermNext<CR>
tnoremap <F23> <C-\><C-n>:FloatermNew<CR>
tnoremap <F24> <C-\><C-n>:FloatermToggle<CR>
nnoremap <S-F9> :FloatermPrev<CR>
nnoremap <S-F10> :FloatermNext<CR>
nnoremap <S-F11> :FloatermNew<CR>
nnoremap <S-F12> :FloatermToggle<CR>
tnoremap <S-F9> <C-\><C-n>:FloatermPrev<CR>
tnoremap <S-F10> <C-\><C-n>:FloatermNext<CR>
tnoremap <S-F11> <C-\><C-n>:FloatermNew<CR>
tnoremap <S-F12> <C-\><C-n>:FloatermToggle<CR>
" Startify
nnoremap <Leader>st :Startify<CR>
" Telescope
nnoremap <leader>ff <cmd>Telescope find_files<cr>
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
nnoremap <leader>fb <cmd>Telescope buffers<cr>
nnoremap <leader>fh <cmd>Telescope help_tags<cr>

51
dot_config/nvim/init.vim Normal file
View File

@ -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="\<Space>"
let mapleader="\<Space>"
" Smooth scroll on touch devices
map <ScrollWheelUp> <C-Y>
imap <ScrollWheelUp> <C-X><C-Y>
map <ScrollWheelDown> <C-E>
imap <ScrollWheelDown> <C-X><C-E>
" Natural language
set keymap=russian-jcukenwin
lmap \| /
set iminsert=0
set imsearch=0
inoremap <A-Space> <C-^>
" Random stuff
set t_kB=
set t_Co=256
syntax on
set modeline
" Sourcing stuff
let g:initvim_folder = expand("<sfile>: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

View File

@ -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

View File

@ -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")

View File

@ -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 <F11> :call ToggleSpoiler()<CR>
inoremap <F11> <ESC>:call ToggleSpoiler()<CR>a

View File

@ -0,0 +1,6 @@
set tabstop=4
set softtabstop=4
set shiftwidth=4
set textwidth=79
set expandtab noautoindent
set fileformat=unix

View File

@ -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 <F12> :w<CR>:call ExecuteCurrentFile()<CR>
inoremap <F12> <ESC>:w<CR>:call ExecuteCurrentFile()<CR>a

View File

@ -0,0 +1,18 @@
vnoremap <C-l>tt <esc>`>a}<esc>`<i\texttt{<esc>
vnoremap <C-l>bf <esc>`>a}<esc>`<i\textbf{<esc>
vnoremap <C-l>sl <esc>`>a}<esc>`<i\textsl{<esc>
vnoremap <C-l>sc <esc>`>a}<esc>`<i\textsc{<esc>
inoremap <C-l>#<space> \section{}<Left>
inoremap <C-l>##<space> \subsection{}<Left>
inoremap <C-l>###<space> \subsubsection{}<Left>
inoremap <C-l>ol<space> \begin{enumerate}<CR>\end{enumerate}<esc>O
inoremap <C-l>ul<space> \begin{itemize}<CR>\end{itemize}<esc>O
inoremap <C-l>li<space> \item<space>{}<esc>i
inoremap <C-l>code<space> \begin{minted}{}<CR>\end{minted}<esc>O
inoremap <C-l>pre<space> \texttt{}<Left>
inoremap <C-l>b<space> \textbf{}<Left>
inoremap <C-l>\<space> \textbackslash
inoremap <C-l>i<space> \emph{}<Left>
inoremap <C-l>s<space> \cancel{}<Left>
inoremap <C-l>br<space> \newline<CR>
inoremap <C-l>pt<space> \newpage<CR>

View File

@ -0,0 +1,4 @@
set tabstop=2
set softtabstop=2
set shiftwidth=2
set noautoindent

View File

@ -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 <Leader>rn <Plug>(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({})

View File

@ -0,0 +1,36 @@
" Characters
inoremap <C-K><space>  
inoremap <C-K>+- ±
inoremap <C-K>-+
inoremap <C-K>^ ⊕
inoremap <C-K>&<space>
inoremap <C-K>\|<space>
inoremap <C-K>&& ∧
inoremap <C-K>\|\|
inoremap <C-K>\\
inoremap <C-K>in
inoremap <C-K>!in
inoremap <C-K>has
inoremap <C-K>!has
inoremap <C-K>each
inoremap <C-K>ex
inoremap <C-K>!ex
inoremap <C-K>dt
inoremap <C-K>sub
inoremap <C-K>!sub
inoremap <C-K>ssub
inoremap <C-K>sup
inoremap <C-K>!sup
inoremap <C-K>ssup
inoremap <C-K>~>
inoremap <C-K>~<
inoremap <C-K>sum
inoremap <C-K>prod
inoremap <C-K>setN
inoremap <C-K>setZ
inoremap <C-K>setQ
inoremap <C-K>setR
inoremap <C-K>setC
" Fix collisions with digraphs
inoremap <C-K><C-K> <C-K>

View File

@ -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:<label>]"
label = %percentage_used:3%%
[module/cpu]
type = internal/cpu
interval = 1
format = "[CPU:<label>]"
label = %percentage:3%%
[module/rootfs]
type = internal/fs
interval = 30
mount-0 = /
mount-1 = /mnt/windows
mount-2 = /run/media/hkc/626A60A76A607A25
format-mounted = [<label-mounted>]
label-mounted = %mountpoint%:%percentage_used:2%%
label-warn = %mountpoint%:%percentage_used:2%%
format-warn = [%{F#c22d5f}<label-warn>%{F-}]
[module/temperature]
type = internal/temperature
thermal-zone = 0
base-temperature = 40
warn-temperature = 60
format = "[T:<label>]"
format-warn = "[T!<label-warn>]"
format-warn-foreground = ${colors.alert}
label = "%temperature-c:3%"
label-warn = %temperature-c:3%
[module/battery]
type = internal/battery
battery = BAT0
adapter = AC
full-at = 100
format-charging = <label-charging>
format-discharging = <label-discharging>
format-full = "<label-full>"
label-full = "[BAT:FULL]"
label-charging = "[BAT:%percentage%%]"
label-discharging = "[BAT:%percentage%%]"
[module/dirtymem]
type = custom/script
exec = (while sleep 0.5; do grep Dirty /proc/meminfo; done) | ~/scripts/cplot "([0-9]+(\\.[0-9]+)?) kB"
tail = true
;==================================================
; NETWORK USAGE INFO
;==================================================
[module/net-base]
type = internal/network
interval = 1
label-connected = "%local_ip%@%ifname%"
label-connected-foreground = ${colors.active}
label-disconnected = "OFFLINE@%ifname%"
label-disconnected-foreground = ${colors.foreground}
format-connected = "[<label-connected>]"
format-disconnected = "[<label-disconnected>]"
[module/net-all]
type = custom/script
exec = ~/.config/polybar/info-speed enp0s25 wlp3s0
tail = true
[module/net-wlan0]
inherit = module/net-base
label-connected = "w:%essid%:%local_ip%"
format-connected = "[<label-connected>]"
interface = wlp3s0
[module/net-wlan1]
inherit = module/net-base
label-connected = "w1:%essid%"
format-connected = "[<label-connected>]"
interface = wlan1
[module/net-eth0]
inherit = module/net-base
interface = enp0s25
[module/net-eth1]
inherit = module/net-base
interface = eth1
[module/net-usb0]
inherit = module/net-base
interface = wlp0s29f7u1
unknown-as-up = true
;==================================================
; GENERIC SETTINGS (i.e volume/brightness/etc)
;==================================================
[module/volume]
type = internal/alsa
format-volume = "[<label-volume>]"
format-muted = "[<label-muted>]"
label-volume = "%percentage:3%%"
label-muted = "%percentage:3%%"
[module/workspace]
type = internal/i3
label-focused-foreground = ${colors.active}
[module/kbd-layout]
type = internal/xkeyboard
blacklist-0 = num lock
blacklist-1 = scroll lock
format = [<label-layout>|<label-indicator>]
label-layout = %layout%
label-indicator-on-capslock = "%{F#6da18a}C%{F-}"
label-indicator-off-capslock = "c"
[module/kbd-speed]
type = custom/script
exec = ~/.config/polybar/info-typespeed.sh
tail = true
[module/brightness]
type = internal/xbacklight
output = ${env:MONITOR:eDP-1}
enable-scroll = true
format = "[<ramp>]"
ramp-0 = "d"
ramp-1 = "l"
ramp-2 = "m"
ramp-3 = "B"
ramp-4 = "F"
[module/music]
type = custom/script
exec = printf "%s - %s" "$(playerctl metadata xesam:artist)" "$(playerctl metadata xesam:title)"
click-left = playerctl play-pause
click-middle = playerctl stop
scroll-up = playerctl volume 0.05+
scroll-down = playerctl volume 0.05-
interval = 1
[module/music-next]
type = custom/script
exec = "echo \\>"
click-left = playerctl next
[module/music-prev]
type = custom/script
exec = "echo \\<"
click-left = playerctl previous
[module/btn-lamp]
type = custom/script
exec = echo "[lamp]"
click-left = "curl http://roomlamp.dumbies.l.cf/index?tgl=130"
[settings]
screenchange-reload = true
;compositing-background = xor
;compositing-background = screen
;compositing-foreground = source
;compositing-border = over
;pseudo-transparency = false
[global/wm]
margin-top = 0
margin-bottom = 0
; vim:ft=dosini

View File

@ -0,0 +1,78 @@
#include <sys/select.h>
#include <sys/time.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#define INTERVAL 2000
void msleep(uint64_t ms);
void read_iface_usage(char *name, uint64_t *rx_bytes, uint64_t *tx_bytes);
void humanize_bytes(char *str, size_t size, uint64_t bytes);
void get_all_iface_usage(char **names, int num, uint64_t *rx, uint64_t *tx);
int main(int argc, char **argv)
{
uint64_t old_rx, old_tx, new_rx, new_tx, delta_rx, delta_tx;
char str_rx[255], str_tx[255];
get_all_iface_usage((argv + 1), argc - 1, &old_rx, &old_tx);
for (;;) {
get_all_iface_usage((argv + 1), argc - 1, &new_rx, &new_tx);
delta_rx = new_rx - old_rx; delta_tx = new_tx - old_tx;
delta_rx /= (float)(INTERVAL / 1000.0);
delta_tx /= (float)(INTERVAL / 1000.0);
old_rx = new_rx; old_tx = new_tx;
humanize_bytes(str_rx, 255, delta_rx);
humanize_bytes(str_tx, 255, delta_tx);
printf("[%s/s|%s/s]\n", str_rx, str_tx);
fflush(stdout);
msleep(INTERVAL);
}
}
void msleep(uint64_t ms)
{
struct timeval tv;
tv.tv_sec = ms / 1000;
tv.tv_usec = (ms % 1000) * 1000;
select(0, NULL, NULL, NULL, &tv);
};
void read_iface_usage(char *name, uint64_t *rx_bytes, uint64_t *tx_bytes)
{
char path_rx[255], path_tx[255];
snprintf(path_rx, 255, "/sys/class/net/%s/statistics/rx_bytes", name);
snprintf(path_tx, 255, "/sys/class/net/%s/statistics/tx_bytes", name);
FILE *fd_rx = fopen(path_rx, "r"),
*fd_tx = fopen(path_tx, "r");
fscanf(fd_rx, "%zd", rx_bytes);
fscanf(fd_tx, "%zd", tx_bytes);
fclose(fd_rx);
fclose(fd_tx);
}
void get_all_iface_usage(char **names, int num, uint64_t *rx, uint64_t *tx)
{
*rx = 0; *tx = 0;
uint64_t trx, ttx;
for (int i = 0; i < num; i++) {
read_iface_usage(names[i], &trx, &ttx);
*rx += trx;
*tx += ttx;
}
}
void humanize_bytes(char *str, size_t size, uint64_t bytes)
{
char prefixes[7] = "kMGTP";
if (bytes < 1024)
{
snprintf(str, size, "%6.1f B", (double)bytes);
return;
}
int index = (int)floor(log(bytes) / log(1024.f));
float value = bytes / pow(1024, index);
snprintf(str, size, "%6.1f %ciB", value, prefixes[index - 1]);
}

View File

@ -0,0 +1,65 @@
#!/bin/sh
# shellcheck disable=SC2016,SC2059
KEYBOARD_ID="AT Translated Set 2 keyboard"
SECOND_KEYBOARD_ID="13";
# cpm: characters per minute
# wpm: words per minute (1 word = 5 characters)
METRIC=cpm
FORMAT="[%3d]"
INTERVAL=10
# If you have a keyboard layout that is not listed here yet, create a condition
# yourself. $3 is the key index. Use `xinput test "AT Translated Set 2 keyboard"`
# to see key codes in real time. Be sure to open a pull request for your
# layout's condition!
LAYOUT=qwerty
case "$LAYOUT" in
qwerty) CONDITION='($3 >= 10 && $3 <= 19) || ($3 >= 24 && $3 <= 33) || ($3 >= 37 && $3 <= 53) || ($3 >= 52 && $3 <= 58)'; ;;
azerty) CONDITION='($3 >= 10 && $3 <= 19) || ($3 >= 24 && $3 <= 33) || ($3 >= 37 && $3 <= 54) || ($3 >= 52 && $3 <= 57)'; ;;
qwertz) CONDITION='($3 >= 10 && $3 <= 20) || ($3 >= 24 && $3 <= 34) || ($3 == 36) || ($3 >= 38 && $3 <= 48) || ($3 >= 52 && $3 <= 58)'; ;;
dvorak) CONDITION='($3 >= 10 && $3 <= 19) || ($3 >= 27 && $3 <= 33) || ($3 >= 38 && $3 <= 47) || ($3 >= 53 && $3 <= 61)'; ;;
dontcare) CONDITION='1'; ;; # Just register all key presses, not only letters and numbers
*) echo "Unsupported layout \"$LAYOUT\""; exit 1; ;;
esac
# We have to account for the fact we're not listening a whole minute
multiply_by=60
divide_by=$INTERVAL
case "$METRIC" in
wpm) divide_by=$((divide_by * 5)); ;;
cpm) ;;
*) echo "Unsupported metric \"$METRIC\""; exit 1; ;;
esac
hackspeed_cache="$(mktemp -p '' hackspeed_cache.XXXXX)"
trap 'rm "$hackspeed_cache"' EXIT
# Write a dot to our cache for each key press
printf '' > "$hackspeed_cache"
( xinput test "$KEYBOARD_ID" & xinput test "$SECOND_KEYBOARD_ID") | \
stdbuf -o0 awk '$1 == "key" && $2 == "press" && ('"$CONDITION"') {printf "."}' >> "$hackspeed_cache" &
while true; do
# Ask the kernel how big the file is with the command `stat`. The number we
# get is the file size in bytes, which equals the amount of dots the file
# contains, and hence how much keys were pressed since the file was last
# cleared.
lines=$(stat --format %s "$hackspeed_cache")
# Truncate the cache file so that in the next iteration, we count only new
# keypresses
printf '' > "$hackspeed_cache"
# The shell only does integer operations, so make sure to first multiply and
# then divide
value=$((lines * multiply_by / divide_by))
printf "$FORMAT\\n" "$value"
sleep $INTERVAL
done

View File

@ -0,0 +1,23 @@
#!/bin/bash
echo "Killing polybar...";
killall -q polybar;
echo "Waiting for polybar to die...";
deadline=$(($(date +%s) + 10));
while pgrep -u $UID -x polybar >/dev/null; do
sleep 0.5;
[ $deadline -gt "$(date +%s)" ] || (
echo "Timed out, force-killing...";
killall -q -KILL polybar;
);
done
primary_monitor="$(xrandr --listactivemonitors \
| tail -n+2 | head -n 1 | awk '{print$4}')";
interfaces="$(ip a show up \
| sed -ne 's/^\([[:alnum:]]\+\): \+\([[:alnum:]]\+\).*$/\2/p' \
| grep -v ^lo)";
MONITOR=${primary_monitor} IFACES=${interfaces} polybar main & disown;
MONITOR=${primary_monitor} IFACES=${interfaces} polybar tray & disown;

View File

@ -0,0 +1,131 @@
#!/usr/bin/env python3
r"""
#!/bin/sh
name="$(date +"scrot_%Y.%m.%d_%H.%M.%S.png")";
out_path="$HOME/images/shots/$name";
info="$(xwininfo)";
width="$(echo "$info" | grep -oP 'Width: \d+' | grep -oP '\d+')";
height="$(echo "$info" | grep -oP 'Height: \d+' | grep -oP '\d+')";
abs_x="$(echo "$info" | grep -oP 'Absolute upper-left X:\s+\d+' | grep -oP '\d+')";
abs_y="$(echo "$info" | grep -oP 'Absolute upper-left Y:\s+\d+' | grep -oP '\d+')";
abs_x=$((abs_x - 40));
abs_y=$((abs_y - 40));
width=$((width + 80));
height=$((height + 80));
# scrot -b -a "${abs_x},${abs_y},${width},${height}" "$name" || exit;
maim --geometry "${width}x${height}+${abs_x}+${abs_y}" --capturebackground "$name" || exit;
mv "$name" "$out_path";
xclip -selection clipboard -t 'image/png' < "$out_path";
notify-send -a "scrot" "Saved screenshot" "${out_path}";
"""
from PIL import Image, ImageFile, PngImagePlugin, ImageFilter
from subprocess import PIPE, Popen, check_call, check_output, CalledProcessError
from typing import NamedTuple
from datetime import datetime
from json import dumps
from pathlib import Path
PADDING = 32
taken_time = datetime.now()
output_path = Path(f"~/images/shots/scrot_{taken_time:%Y.%m.%d_%H.%M.%S}.png").expanduser()
class Geometry(NamedTuple):
x: int
y: int
w: int
h: int
def __str__(self):
return f"{self.w}x{self.h}{self.x:+d}{self.y:+d}"
with ImageFile.Parser() as parser:
with Popen([
"scrot", "--file", "-", "--silent", "--format", "bmp"
], stdout=PIPE) as proc:
if not proc.stdout:
raise ValueError(
"WHY the FUCK I have to check for it EVERY time???"
)
while chunk := proc.stdout.read(131072):
parser.feed(chunk)
screenshot = parser.close()
try:
output = check_output([
"slop",
"-l",
"-c", "0.3,0.4,0.6,0.4",
"-f", "%x %y %w %h",
"--tolerance", "999999",
], encoding="utf-8",)
except CalledProcessError:
exit(1)
original_geometry = Geometry(*map(int, output.split()))
padded_geometry = Geometry(
original_geometry.x - PADDING,
original_geometry.y - PADDING,
original_geometry.w + PADDING * 2,
original_geometry.h + PADDING * 2,
)
with Image.new("RGBA", (padded_geometry.w, padded_geometry.h), 0) as canvas:
backdrop = screenshot.crop((
padded_geometry.x,
padded_geometry.y,
padded_geometry.x + padded_geometry.w,
padded_geometry.y + padded_geometry.h,
))
canvas.paste(
backdrop
.filter(ImageFilter.GaussianBlur(2))
.filter(ImageFilter.MedianFilter(5)),
(0, 0),
)
crop = screenshot.crop((
original_geometry.x,
original_geometry.y,
original_geometry.x + original_geometry.w,
original_geometry.y + original_geometry.h,
))
canvas.paste(crop, (PADDING, PADDING))
data = PngImagePlugin.PngInfo()
data.add_text( "fscr", dumps({
"timestamp": taken_time.timestamp(),
"geometry": {
"x": original_geometry.x,
"y": original_geometry.y,
"w": original_geometry.w,
"h": original_geometry.h,
},
}))
canvas.save(output_path, pnginfo=data)
check_call([
"xclip",
"-sel", "c",
"-i", output_path,
"-t", "image/png"
])

View File

@ -0,0 +1,45 @@
#!/bin/sh
action="$1";
music_backend="mpd";
if ~/.local/bin/mocpcli >/dev/null 2>&1; then
music_backend="mocp";
fi;
mpd_trackname() { mpc current; }
mocp_trackname() {
local info="$(mocp -i)";
artist="$(echo "$info" | grep -P '^Artist:' | sed 's!^Artist: !!')";
album="$(echo "$info" | grep -P '^Album:' | sed 's!^Album: !!')";
title="$(echo "$info" | grep -P '^SongTitle:' | sed 's!^SongTitle: !!')";
if [ "x$album" = "x" ]; then
echo "$artist - $title";
else
echo "$artist - $album - $title";
fi;
}
mpd_next() { mpc next; }
mocp_next() { ~/.local/bin/mocpcli -f; }
mpd_prev() { mpc prev; }
mocp_prev() { ~/.local/bin/mocpcli -r; }
mpd_pause() { mpc toggle; }
mocp_pause() { ~/.local/bin/mocpcli -G; }
mpd_stop() { mpc stop; }
mocp_stop() { ~/.local/bin/mocpcli -s; }
mpd_seekf() { mpc seek 5; }
mocp_seekf() { ~/.local/bin/mocpcli -k 5; }
mpd_seekb() { mpc seek -5; }
mocp_seekb() { ~/.local/bin/mocpcli -k -5; }
case "${action}" in
status) ${music_backend}_trackname;;
trackname) ${music_backend}_trackname;;
next) ${music_backend}_next;;
prev) ${music_backend}_prev;;
pause) ${music_backend}_pause;;
stop) ${music_backend}_stop;;
seekf) ${music_backend}_seekf;;
seekb) ${music_backend}_seekb;;
esac;

View File

@ -0,0 +1,36 @@
#!/bin/sh
SHAREX_URL="changeme";
SHAREX_TOKEN="changeme";
upscale="no";
upload="no";
if [ "$1" = "-U" ]; then shift
upscale="yes";
fi
if [ "$1" = "-upload" ]; then shift
upload="yes";
fi
name=$(date +"scrot_%Y.%m.%d_%H.%M.%S.png");
out_path="$HOME/images/shots/$name";
# scrot -z -b "$@" "$name" || exit;
maim "$@" --hidecursor --capturebackground "$name" -l -c "0.3,0.4,0.6,0.4" || exit $?;
if [ "$upscale" = "yes" ]; then
convert "$name" -scale "200%" PNG24:"$out_path";
else
cp "$name" "$out_path";
fi;
rm "$name";
xclip -sel c -i "$out_path" -t 'image/png';
notify-send "screenshot" "$out_path"
if [ "$upload" = "yes" ]; then
curl -H "Content-Type: multipart/form-data" \
-H "authorization: $SHAREX_TOKEN" \
-F "file=@$out_path" \
"$SHAREX_URL";
fi

View File

@ -0,0 +1,66 @@
#!/bin/bash
export DISPLAY=:0
export BATTERY=BAT0
source /etc/lsb-release
wp_folder="${HOME}/images/wallpapers";
base_background="#131313";
textpos_1="0,665"; text_c1="#cfcfcf";
textpos_2="0,680"; text_c2="#cfcfcf";
textpos_s_1="1,666"; text_s_c1="#131313";
textpos_s_2="1,681"; text_s_c2="#131313";
text_1="$(date +"%a %Y-%m-%d")"; text_2=""
export SOULMATE="Dia"
export OTHER_ROLE="wife"
splash_text="$1";
if [ "$splash_text" = "" ]; then
splash_text="$(sort -R ~/.local/share/splashes.txt | grep -vP '^#' | grep -vP '^\s+$' | head -n 1)";
echo "$(date +%s) $splash_text" | tee -a ~/.local/share/splashes.log;
splash_text="$(echo -n "$splash_text" | jq -r)";
splash_text="$(eval "echo -n \"$splash_text\"")";
fi;
text_2="${splash_text}";
source_image="$wp_folder/wallpaper.png";
#if [[ "$(date +%a)" = "Fri" ]]; then
# source_image="$wp_folder/friday2.png";
#fi
if [[ "$source_image" = "${wp_folder}/friday2.png" ]]; then
textpos_1="0,420";
textpos_2="0,435";
fi
errors=" ";
bat_energy_full=$(cat /sys/class/power_supply/$BATTERY/energy_full);
bat_energy_design=$(cat /sys/class/power_supply/$BATTERY/energy_full_design);
bat_health=$((bat_energy_full * 100 / bat_energy_design));
if [ ${bat_health} -le 50 ]; then
errors="${errors}
[E:PWR] Low battery health (${bat_health}%)";
fi
convert "$source_image" \
-font "Unifont" \
-pointsize 16 \
-draw "gravity North \
fill ${text_s_c1} text ${textpos_s_1}'${text_1}' \
fill ${text_s_c2} text ${textpos_s_2}'${text_2}' \
fill ${text_c1} text ${textpos_1}'${text_1}' \
fill ${text_c2} text ${textpos_2}'${text_2}'; \
gravity NorthWest \
fill #efefef text 8,20'${errors}'" \
/tmp/current-wallpaper.png; # 2>/dev/null;
if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
killall swaybg;
swaybg -i /tmp/current-wallpaper.png -m center & disown;
else
hsetroot -solid "$base_background" -center /tmp/current-wallpaper.png;
fi;