diff --git a/.bash_xinitrc b/.bash_xinitrc index bc153f6..bf84ef3 100644 --- a/.bash_xinitrc +++ b/.bash_xinitrc @@ -34,7 +34,7 @@ updatebar ######################## More or less shell specific ##################### -pathadd () { +pathappend () { # just works NORM_PATH=":${PATH}:" NORM_PATH="$(printf '%s' "${NORM_PATH}" | sed 's/::/:/g')" @@ -45,7 +45,7 @@ pathadd () { PATH="${PATH:+"${PATH%:}"}${NORM_PATH_TO_ADD%:}" fi } -export pathadd +export pathappend ld_lib_path_add () { # just works @@ -82,20 +82,20 @@ export GOPATH="${HOME}"/go ld_lib_path_add "${LD_LIBRARY_PATH}:${HOME}/.local/lib" export LD_LIBRARY_PATH -pathadd '/bin' -pathadd '/sbin' -pathadd '/usr/bin' -pathadd '/usr/sbin' -pathadd '/usr/local/bin' -pathadd '/usr/lcoal/sbin' -pathadd '/usr/local/games' -pathadd '/usr/games' -pathadd '/snap/bin' -pathadd "${HOME}"/bin -pathadd "${HOME}"/.local/bin -pathadd "${HOME}"/.local/include -pathadd "${HOME}"/.brew/bin -pathadd "${GOPATH}"/bin +pathappend '/bin' +pathappend '/sbin' +pathappend '/usr/bin' +pathappend '/usr/sbin' +pathappend '/usr/local/bin' +pathappend '/usr/lcoal/sbin' +pathappend '/usr/local/games' +pathappend '/usr/games' +pathappend '/snap/bin' +pathappend "${HOME}"/bin +pathappend "${HOME}"/.local/bin +pathappend "${HOME}"/.local/include +pathappend "${HOME}"/.brew/bin +pathappend "${GOPATH}"/bin export PATH # add cargo bin to path diff --git a/.bashrc b/.bashrc index 17cd2d7..c4f5b71 100644 --- a/.bashrc +++ b/.bashrc @@ -85,16 +85,6 @@ alias xpaste='xsel --clipboard --output' alias aptclean='sudo apt -y update && sudo apt -y full-upgrade && sudo apt -y dist-upgrade && sudo apt -y autoremove && sudo apt -y clean' -alias paruu=' printf "\033[30;41m%s\033[m\n" "pacman -Sy archlinux-keyring" \ - && yes | sudo pacman -Sy archlinux-keyring \ - && printf "\033[30;41m%s\033[m\n" "pacman -Syyuu --noconfirm" \ - && yes | sudo pacman -Syyuu --noconfirm \ - && printf "\033[30;41m%s\033[m\n" "paru -Syu --devel --noconfirm" \ - && yes | paru -Syu --devel --noconfirm \ - && printf "\033[30;41m%s\033[m\n" "pacman -Qtdq | pacman -Rns -" \ - && pacman -Qtdq | sudo pacman --noconfirm -Rns - \ - && printf "\033[30;41m%s\033[m\n" "########## Done #########"' -alias paruuu=' clear && time (paruu)' alias pacman='pacman --color=auto' alias pcker='nvim "${HOME}"/.config/nvim/lua/*/packer.lua' alias after='nvim "${HOME}"/.config/nvim/after/plugin' @@ -122,6 +112,7 @@ alias cmatrix='cmatrix -u3 -Cred' alias gca='git add -u && git commit -m "Automatic add"' alias watch='watch -tcn.1' alias pacop='clear && 2>/dev/null paco && 2>/dev/null paco --strict' +alias xterm='xterm -bg black -fg white' alias norm='alacritty -e sh -c '\''watch -cn.5 \ norminette -R CheckForbiddenSourceHeader'\'' & disown' alias norm2='alacritty -e sh -c '\''watch -cn.5 \ @@ -130,6 +121,49 @@ alias norm2='alacritty -e sh -c '\''watch -cn.5 \ alias dotconf='git --git-dir="${HOME}"/.dotfiles/ --work-tree="${HOME}"' 2>/dev/null dotconf config status.showUntrackedFiles no +function paruuu () { + ssid="$(iw dev wlan0 link | + grep SSID | + sed -e 's/[[:blank:]]*SSID: //' \ + -e 's/[[:blank:]]*$//' + )" + if : \ + && [ ! "${ssid}" = "Free Wifi" ] \ + && [ ! "${ssid}" = "FreeWifi" ] \ + && [ ! "${ssid}" = "DS_JD-Tree" ] \ + && [ ! "${ssid}" = "Haihin" ] \ + && [ ! "${ssid}" = "∞" ] \ + && [ ! "${ssid}" = "\xe2\x88\x9e" ] \ + && [ ! "${ssid}" = $'\xe2\x88\x9e' ] \ + && [ ! "${ssid}" = "Nichts 5" ] \ + && [ ! "${ssid}" = "Nichts 2,4" ] \ + && [ ! "${ssid}" = "Pink Flamingo" ] \ + && [ ! "${ssid}" = "Pink Flamingo_5G" ] \ + && [ ! "${ssid}" = "42Berlin_Student" ] \ + && [ ! "${ssid}" = "42Berlin_Guest" ] \ + && [ ! "${ssid}" = "ZorgatiHome Guest" ] \ + && [ ! "${ssid}" = "Hackme" ] \ + && : ; then + printf '\033[31m%s\033m\n' "You're connected to '${ssid}', do you want to continue?" + read X + else + clear + time ( + printf "\033[30;41m%s\033[m\n" "pacman -Sy archlinux-keyring" \ + && yes | sudo pacman -Sy archlinux-keyring \ + && printf "\033[30;41m%s\033[m\n" "pacman -Syyuu --noconfirm" \ + && yes | sudo pacman -Syyuu --noconfirm \ + && printf "\033[30;41m%s\033[m\n" "paru -Syu --devel --noconfirm" \ + && yes | paru -Syu --devel --noconfirm \ + && printf "\033[30;41m%s\033[m\n" "pacman -Qtdq | pacman -Rns -" \ + && { pacman -Qtdq | 2>/dev/null sudo pacman --noconfirm -Rns - \ + || printf "\033[30;42m%s\033[m\n" "No orphan packages!"; } \ + && printf "\033[30;42m%s\033[m\n" "###### Done without error ######" \ + || printf "\033[30;41m%s\033[m\n" "###### Some error occured! ######" + ) + fi +} + function skill () { if [ -n "${1}" ] ; then # shellcheck disable=SC2046,SC2009 @@ -140,6 +174,11 @@ function skill () { fi } +function wpa_restart () { + skill wpa_supplicant + sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf +} + function bat () { 2>/dev/null command -v batcat && { batcat "${@}"; return 0; } 2>/dev/null command -v bat && { $(type -P bat) "${@}"; return 0; } @@ -322,9 +361,13 @@ fi 2>/dev/null xset -b # sudo kbdrate --rate=30.0 --delay=250 +complete -C pomo pomo # shellcheck disable=SC1091 if [ -f "${HOME}"/.userbashrc ]; then . "${HOME}"/.userbashrc; fi # Simplified *Bash* Prompt, e.g. for tty/system/linux console # unset PS0; PS1='\033[94m\u\033[37m@\033[32m\h\033[37m@\033[33m$(basename -- "$(tty)") \033[36m\w \033[35m\$\033[m ' + + +alias new_mp_project='clear && builtin cd -P ./ && python3 -m venv ./env/ && . ./env/bin/activate && pip install --no-input opencv-python mediapipe && pip freeze > ./requirements.txt && printf '\''#!/usr/bin/env python3\n\nfrom typing import NoReturn\n\nimport mediapipe as mp\nimport cv2\n\n\ndef main() -> NoReturn:\n\tpass\n\nif __name__ == '\''"'\''"'\''__main__'\''"'\''"'\'':\n\tmain()\n'\'' 1>./main.py && chmod +x ./main.py && printf '\''__pycache__/\nenv/\n'\'' 1>.gitignore && git init && git add -A && git commit -m '\''Initial commit'\'' && git ls-files && echo Done' diff --git a/.config/crontab_tosuman b/.config/crontab_tosuman index a9abda3..70123b4 100644 --- a/.config/crontab_tosuman +++ b/.config/crontab_tosuman @@ -1 +1 @@ -0 * * * * /home/tosuman/.local/bin/system_update.sh +0 * * * * /home/tosuman/.local/bin/system_update.shc diff --git a/.config/nvim/after/plugin/lsp.lua b/.config/nvim/after/plugin/lsp.lua index 074341f..5042925 100644 --- a/.config/nvim/after/plugin/lsp.lua +++ b/.config/nvim/after/plugin/lsp.lua @@ -79,7 +79,7 @@ null_ls.setup({ } }) -require("norme").setup({ - -- Your configuration - cmd = os.getenv('HOME') .. '/.local/bin/norminette' -}) +-- require("norme").setup({ +-- -- Your configuration +-- cmd = os.getenv('HOME') .. '/.local/bin/norminette' +-- }) diff --git a/.local/bin/system_update.sh b/.local/bin/system_update.sh index 06ffddd..93a836d 100755 --- a/.local/bin/system_update.sh +++ b/.local/bin/system_update.sh @@ -2,15 +2,17 @@ export PATH="${PATH}:/home/tosuman/.local/bin" export SHELL='/usr/bin/bash' -export DISPLAY=:0 number_of_tmux_sessions="$(tmux ls | wc -l)" if [ "${number_of_tmux_sessions}" = "0" ] ; then - alacritty & disown + DISPLAY=:0 alacritty & disown + DISPLAY=:1 alacritty & disown + DISPLAY=:2 alacritty & disown sleep 1 +else + tmux new-window -c '/home/tosuman' && + tmux rename-window 'System Update' fi -tmux new-window -c '/home/tosuman' \ - && tmux rename-window 'System Update' \ - && tmux send-key 'paruuu' ENTER +tmux send-key 'paruuu' ENTER diff --git a/.profile b/.profile index 2840667..4ca44e2 100644 --- a/.profile +++ b/.profile @@ -1,3 +1,7 @@ +#!/usr/bin/bash +# This file ought to be sourced, above line for syntax highlighting purposes. + +# shellcheck disable=SC2009 if ! ps aux|grep -v grep|grep startx 1>/dev/null; then startx 1>/home/tosuman/.startx.log 2>&1 fi @@ -6,6 +10,7 @@ fi if [ -n "$BASH_VERSION" ] ; then # include .bashrc if it exists if [ -f "$HOME/.bashrc" ] && [ -r "$HOME/.bashrc" ]; then + # shellcheck disable=SC1091 . "$HOME/.bashrc" fi fi diff --git a/.tmux.conf b/.tmux.conf index 64e8c66..83897f4 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -11,6 +11,7 @@ bind-key -T copy-mode-vi V send -X select-line bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel 'xclip -in -selection clipboard' set-option -g escape-time 10 set -g focus-events on +bind-key r source-file "~/.tmux.conf" # After scrolling and selecting text, don't leave copy mode bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-selection @@ -26,7 +27,7 @@ set -g status-left "#[bg=#fb4934,fg=#3c3836]  #{session_name} #[bg=#fe8019,fg set -g window-status-format "#[bg=#504945] #{window_index}-#{window_name} #{?#{==:#{window_index},#{session_windows}},#[bg=#3c3836 fg=#504945],}" set -g window-status-current-format "#[bg=#a89984,fg=#504945]#[fg=#282828] #{window_index}-#{window_name} #[bg=#504945,fg=#a89984]#{?#{==:#{window_index},#{session_windows}},#[bg=#3c3836],}" set -g window-status-separator "" -set -g status-right "#(pwd) #[fg=#504945]#[bg=#504945,fg=#a89984] #(whoami)  #[bg=#a89984,fg=#282828] #{host_short} 󰍹 #[bg=#a89984,fg=#fe8019]#[bg=#fe8019,fg=#fb4934]#[bg=#fb4934,fg=#3c3836] #(date +%H:%M) " +set -g status-right "#(2>/dev/null pomo && 2>/dev/null pomo | grep -Fq -- '-' && 2>/dev/null 1>&2 paplay '/home/tosuman/music/Gong Sound Effect.mp3') #(pwd) #[fg=#504945]#[bg=#504945,fg=#a89984] #(whoami)  #[bg=#a89984,fg=#282828] #{host_short} 󰍹 #[bg=#a89984,fg=#fe8019]#[bg=#fe8019,fg=#fb4934]#[bg=#fb4934,fg=#3c3836] #(date +%H:%M) " set -g status-right-length 500 set -g status-interval 1 set -g pane-base-index 1 @@ -52,4 +53,4 @@ bind-key -r -T prefix C-j resize-pane -D 2 bind-key -r -T prefix C-k resize-pane -U 2 bind-key -r -T prefix C-l resize-pane -R 2 -bind-key -T prefix C-u popup '/usr/local/bin/tmux_urls.py' +bind-key -T prefix C-u popup -E '~/.local/bin/tmux_urls.py'