diff --git a/.alacritty.yml b/.alacritty.yml index 1ae05f3..f2ad4a3 100644 --- a/.alacritty.yml +++ b/.alacritty.yml @@ -5,7 +5,7 @@ window: font: normal: family: Iosevka Term SS08 - white: '#d0d0d0' + white: '#d0d0d0' bold: family: Iosevka Term SS08 style: bold @@ -16,4 +16,13 @@ font: colors: primary: foreground: '0x111111' - background: '0xdddddd' + background: '0xcccccc' + normal: + black: '0x000000' + red: '0xcc3333' + green: '0x33cc33' + yellow: '0x885800' + blue: '0x3333cc' + magenta: '0xcc33cc' + cyan: '0x33cccc' + white: '0xcccccc' diff --git a/.bash_aliases b/.bash_aliases index a427c9e..9f8e4d3 100644 --- a/.bash_aliases +++ b/.bash_aliases @@ -48,12 +48,13 @@ alias df="df -kTh" alias fzfpac="pacman -Slq | fzf -m --preview 'pacman -Si {1}' | xargs -ro sudo pacman -S" alias o="xdg-open" alias path="echo -e ${PATH//:/\\n}" # Pretty print path variables -alias wiki="vim +WikiIndex" # Programs alias feh="feh -B black --scale-down --auto-zoom" alias fm='pcmanfm' +alias v="nvim" +alias w="nvim +WikiIndex" alias g='git' alias lm='xbacklight -set' alias py='python' @@ -64,7 +65,15 @@ alias xev='xev | grep -A2 ButtonPress' # Ignore mouse movements reboot_to_windows () { - windows_title=$(grep -i windows /boot/grub/grub.cfg | cut -d "'" -f 2) - sudo grub-reboot "$windows_title" && sudo reboot + # Check if grub is installed by checking if the command exists, if it does + # not, then assume that the system is using systemd-boot + if grub-install --version &>/dev/null; then + windows_title=$(grep -i windows /boot/grub/grub.cfg | cut -d "'" -f 2) + sudo grub-reboot "$windows_title" + echo "Grub set to reboot to Windows" + else + sudo bootctl set-oneshot windows.conf + echo "Systemd set to reboot to Windows" + fi } alias reboot-to-windows='reboot_to_windows' diff --git a/.bashrc b/.bashrc index 2550c31..c51ed41 100644 --- a/.bashrc +++ b/.bashrc @@ -3,13 +3,12 @@ source /etc/os-release +# Aliases {{{ # Load aliases dynamically [ -f "$HOME/.bash_aliases" ] && source "$HOME/.bash_aliases" +# }}} -# Add ~/.bin to PATH -export PATH=~/.bin:$PATH - -# Prompt +# Prompt {{{ get_branch_name() { git symbolic-ref --quiet --short HEAD 2>/dev/null \ || git rev-parse --short HEAD 2>/dev/null \ @@ -19,16 +18,35 @@ get_git_info() { git rev-parse --is-inside-work-tree &>/dev/null || return echo -e " $(get_branch_name)" } -export PS1="\u \w ❭\[$(tput sgr0)\] " -# History +PS1="\u \w ❭\[$(tput sgr0)\] " + +# Ellipsis when deep in directory +export PROMPT_DIRTRIM=2 + +export PS1 +# }}} + +# Path {{{ +# Add ~/.bin to PATH +export PATH=~/.bin:$PATH +# }}} + +# History {{{ export HISTCONTROL=ignoreboth:erasedups export HISTSIZE=500000 # Omit `clear, ls...`; commands prepended with space export HISTIGNORE="clear:l: *" +# }}} -# Man pages +# Man pages {{{ export MANWIDTH=120 +# }}} + +# Editor {{{ +# Set vim as default editor +export EDITOR=nvim +# }}} # Vim export EDITOR=vim @@ -58,11 +76,50 @@ export PATH=~/.nvm/versions/node/v14.16.0/bin:$PATH export NVM_DIR="$HOME/.nvm" [[ -s "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh" --no-use -# X11 +# X11 {{{ export XDG_SESSION_TYPE=X11 +export XDG_CONFIG_HOME=$HOME/.config +# }}} -# Jupyter +# Nix package manager {{{ +# Add ~/.nix-profile/bin to PATH +export PATH=~/.nix-profile/bin:$PATH +# }}} + +# FZF {{{ +# Check if fzf is installed +if [ -f "/usr/bin/fzf" ]; then + # Fuzzy finder setup + export FZF_COMPLETION_TRIGGER='**' + export FZF_DEFAULT_COMMAND='ag --hidden --skip-vcs-ignores -t -g ""' + export FZF_DEFAULT_OPTS=" + --pointer='❭' + --height 10% + --color=fg:-1,bg:-1" + export FZF_CTRL_T_COMMAND="${FZF_DEFAULT_COMMAND}" + export FZF_CTRL_T_OPTS="--preview='bat {} | head -500'" + source /usr/share/fzf/completion.bash + source /usr/share/fzf/key-bindings.bash + + _fzf_setup_completion path vim + _fzf_setup_completion path zathura + _fzf_setup_completion path xournalpp + _fzf_setup_completion path nvim +else + echo "fzf not installed" +fi +# }}} + +# Node {{{ +# Move nvm folder away from home directory +export NVM_DIR="${XDG_CONFIG_HOME}/nvm" +# Pretty much what is in `/usr/share/nvm/init-nvm.sh` but we add the `--no-use` +# flag to `nvm.sh` to make it lazy +source /usr/share/nvm/nvm.sh --no-use +source /usr/share/nvm/bash_completion +source /usr/share/nvm/install-nvm-exec +# }}} + +# Jupyter {{{ export JUPYTERLAB_DIR=$HOME/.local/share/jupyter/lab - -# Ellipsis when deep in directory -export PROMPT_DIRTRIM=2 +# }}} diff --git a/.bin/alarm b/.bin/alarm deleted file mode 100755 index 927f520..0000000 --- a/.bin/alarm +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -sudo rtcwake -m no -l -t "$(date +%s -d 'tomorrow 09:30')" diff --git a/.bin/cam b/.bin/cam index ae24bd1..1f5e9aa 100755 --- a/.bin/cam +++ b/.bin/cam @@ -2,4 +2,4 @@ # Open webcam window -ffplay -f v4l2 -s 640x480 -i /dev/video0 >/dev/null 2>&1 & disown +ffplay -f v4l2 -x 640 -y 480 -i /dev/video0 >/dev/null 2>&1 & disown diff --git a/.bin/dmenu-trans b/.bin/dmenu-trans index c944174..6ce20ea 100755 --- a/.bin/dmenu-trans +++ b/.bin/dmenu-trans @@ -4,6 +4,6 @@ options="nl:en\nen:nl\nnl:fr\nfr:nl\nen:fr\nfr:en\nnl:de\nde:nl" selected=$(echo -e "$options" | dmenu -p "s?:t?" -i -l 0) -notify-send --app-name= -t 3000 "$(trans $selected -b "$(dmenu -p $selected &)" \ +notify-send --app-name= -t 3000 "$(trans "$selected" -b "$(dmenu -p "$selected" &)" \ | tr -d '\n' \ | xclip -sel clip -f)" diff --git a/.bin/fzf-book b/.bin/fzf-book index b6cfdde..be78542 100755 --- a/.bin/fzf-book +++ b/.bin/fzf-book @@ -4,7 +4,8 @@ # Generate menu of book filenames and save paths # Preview window contains metadata -selected="$(find /home/h/doc/books/ -regex '.*\.\(pdf\|epub\|djvu\)' -type f | sort | fzf --delimiter=/ --with-nth=-1 --preview 'pdfinfo {}' --preview-window=right:70%:wrap)" +# selected="$(find /home/h/doc/books/ -regex '.*\.\(pdf\|epub\|djvu\)' -type f | sort | fzf --delimiter=/ --with-nth=-1 --preview 'pdfinfo {}' --preview-window=right:70%:wrap)" +selected="$(find /home/h/doc/books/ -regex '.*\.\(pdf\|epub\|djvu\)' -type f | sort | fzf --delimiter=/ --with-nth=-1)" # Open and redirect output to /dev/null -zathura "$selected" 2> /dev/null & +zathura "$selected" --fork diff --git a/.bin/fzf-fontnames b/.bin/fzf-fontnames index bb21288..e19e3a0 100755 --- a/.bin/fzf-fontnames +++ b/.bin/fzf-fontnames @@ -11,11 +11,12 @@ update() { font_list=$(fc-list -f "%{fullname}\n") - echo "$font_list" | while read -r line ; do + echo "$font_list" | while read line ; do + first="$(echo "$line" | cut -d',' -f1)" last="$(echo "$line" | cut -d',' -f2)" - if "$(contains_dash "$first")"; then + if $(contains_dash "$first"); then echo "$last" >> "$fn" else echo "$first" >> "$fn" @@ -25,5 +26,5 @@ update() { case "$1" in --update) update;; - *) sort "$fn" | uniq | awk 'NF' | fzf;; + *) cat "$fn" | sort | uniq | awk 'NF' | fzf;; esac diff --git a/.bin/pacman-remove-unrequired b/.bin/pacman-remove-unrequired new file mode 100755 index 0000000..3aec840 --- /dev/null +++ b/.bin/pacman-remove-unrequired @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +sudo pacman -Qtdq | sudo pacman -Rns - diff --git a/.bin/pomo b/.bin/pomo index 6ee073b..ec39f91 100755 --- a/.bin/pomo +++ b/.bin/pomo @@ -13,45 +13,55 @@ from argparse import ArgumentParser from time import sleep from plyer import notification + def clear(): - os.system('echo -n "" > /tmp/pomo') + os.system('echo -n "" > /tmp/pomo') + atexit.register(clear) parser = ArgumentParser() -parser.add_argument('-p', '--prep-duration', type=int, help='Preparation duration of a session', default=0) -parser.add_argument('-w', '--work-duration', type=int, help='Duration of a session', default=25) -parser.add_argument('-b', '--break-duration', type=int, help='Duration of a break', default=5) -parser.add_argument('-r', '--repeats', type=int, help='Numer of sessions', default=1) +parser.add_argument('-p', '--prep-duration', type=int, + help='Pre session duration', default=0) +parser.add_argument('-w', '--work-duration', type=int, + help='Session duration', default=25) +parser.add_argument('-b', '--break-duration', type=int, + help='Break duration', default=5) +parser.add_argument('-r', '--repeats', type=int, + help='Numer of sessions', default=1) args = parser.parse_args() -prep_duration = args.prep_duration * 60 -work_duration = args.work_duration * 60 +prep_duration = args.prep_duration * 60 +work_duration = args.work_duration * 60 break_duration = args.break_duration * 60 repeats = args.repeats -def make_countdown(color): - def countdown(duration): - while duration!= 0: - mins = duration // 60 - secs = duration % 60 - os.system('echo -n "{:s} {:02d}:{:02d} \x01" > /tmp/pomo'.format(color, mins, secs)) - sleep(1) - duration -= 1 - return countdown -prep_countdown = make_countdown("\x01") -work_countdown = make_countdown("\x03") +def make_countdown(color): + def countdown(duration): + while duration != 0: + mins = duration // 60 + secs = duration % 60 + # os.system('echo -n "{:s} {:02d}:{:02d} \x01" > /tmp/pomo'.format(color, mins, secs)) + os.system('echo -n "{:02d}:{:02d}" > /tmp/pomo'.format(mins, secs)) + sleep(1) + duration -= 1 + return countdown + + +prep_countdown = make_countdown("\x01") +work_countdown = make_countdown("\x03") break_countdown = make_countdown("\x02") prep_countdown(prep_duration) -while repeats!=0: - notification.notify(title="Get started") - work_countdown(work_duration) - notification.notify(title="Time for a break") - break_countdown(break_duration) - notification.notify(title="Break is over, set a new timer") - repeats-=1 +while repeats != 0: + notification.notify(title="Get started") + work_countdown(work_duration) + if break_duration != 0: + notification.notify(title="Time for a break") + break_countdown(break_duration) + notification.notify(title="Break is over, back to work") + repeats -= 1 diff --git a/.bin/script b/.bin/script new file mode 100755 index 0000000..604d34b --- /dev/null +++ b/.bin/script @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +# Script to create script + +if [ -z "$1" ]; then + echo "Script name required" + exit +fi + +path="$HOME/.bin/$1" + +# Prevent overwriting existing script +set -o noclobber + +# Create script +cat > "$path" << EOF +#!/usr/bin/env bash + + +EOF + +chmod +x "$path" + +# Open script in editor on line 3 +"$EDITOR" +3 "$path" diff --git a/.condarc b/.condarc new file mode 100644 index 0000000..9ccc701 --- /dev/null +++ b/.condarc @@ -0,0 +1,4 @@ +channels: + - conda-forge + - defaults +channel_priority: strict diff --git a/.config/conda/condarc b/.config/conda/condarc new file mode 100644 index 0000000..9ccc701 --- /dev/null +++ b/.config/conda/condarc @@ -0,0 +1,4 @@ +channels: + - conda-forge + - defaults +channel_priority: strict diff --git a/.config/feh/keys b/.config/feh/keys new file mode 100644 index 0000000..9d06ac1 --- /dev/null +++ b/.config/feh/keys @@ -0,0 +1,12 @@ +prev_img h +next_img l +scroll_left L +scroll_right H +scroll_up J +scroll_down K +zoom_in j +zoom_out k +zoom_fit z +zoom_default = +mirror bar +close q Q diff --git a/.config/feh/themes b/.config/feh/themes new file mode 100644 index 0000000..1b26433 --- /dev/null +++ b/.config/feh/themes @@ -0,0 +1,3 @@ +feh \ +-B black \ +--auto-zoom diff --git a/.config/flameshot/flameshot.ini b/.config/flameshot/flameshot.ini new file mode 100644 index 0000000..fd23eb2 --- /dev/null +++ b/.config/flameshot/flameshot.ini @@ -0,0 +1,56 @@ +[General] +buttons=@Variant(\0\0\0\x7f\0\0\0\vQList\0\0\0\0\xf\0\0\0\0\0\0\0\x2\0\0\0\x3\0\0\0\x4\0\0\0\x5\0\0\0\x6\0\0\0\x12\0\0\0\x13\0\0\0\a\0\0\0\t\0\0\0\x10\0\0\0\n\0\0\0\v\0\0\0\r\0\0\0\xe) +checkForUpdates=false +contrastOpacity=127 +contrastUiColor=#ffffff +copyPathAfterSave=true +disabledTrayIcon=false +drawColor=#ff0044 +drawFontSize=7 +drawThickness=1 +fontFamily=Inter +saveLastRegion=true +savePath=/home/h/doc/clips +savePathFixed=true +showDesktopNotification=false +showHelp=false +showSidePanelButton=true +showStartupLaunchMessage=false +startupLaunch=true +uiColor=#484848 +undoLimit=106 +userColors=picker, #800000, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ffffff, #000000 + +[Shortcuts] +TYPE_ARROW=A +TYPE_CIRCLE=C +TYPE_CIRCLECOUNT= +TYPE_COMMIT_CURRENT_TOOL=Ctrl+Return +TYPE_COPY=Ctrl+C +TYPE_DELETE_CURRENT_TOOL=Del +TYPE_DRAWER=D +TYPE_EXIT=Ctrl+Q +TYPE_IMAGEUPLOADER=Return +TYPE_MARKER=M +TYPE_MOVESELECTION=Ctrl+M +TYPE_MOVE_DOWN=Down +TYPE_MOVE_LEFT=Left +TYPE_MOVE_RIGHT=Right +TYPE_MOVE_UP=Up +TYPE_OPEN_APP=Ctrl+O +TYPE_PENCIL=P +TYPE_PIN= +TYPE_PIXELATE=B +TYPE_RECTANGLE=R +TYPE_REDO=Ctrl+Shift+Z +TYPE_RESIZE_DOWN=Shift+Down +TYPE_RESIZE_LEFT=Shift+Left +TYPE_RESIZE_RIGHT=Shift+Right +TYPE_RESIZE_UP=Shift+Up +TYPE_SAVE=Ctrl+S +TYPE_SELECTION=S +TYPE_SELECTIONINDICATOR= +TYPE_SELECT_ALL=Ctrl+A +TYPE_TEXT=T +TYPE_TOGGLE_PANEL=Space +TYPE_UNDO=Ctrl+Z diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim new file mode 100644 index 0000000..f182e5b --- /dev/null +++ b/.config/nvim/init.vim @@ -0,0 +1,3 @@ +set runtimepath^=~/.vim runtimepath+=~/.vim/after +let &packpath = &runtimepath +source ~/.vimrc diff --git a/.config/picom/picom.conf b/.config/picom/picom.conf new file mode 100644 index 0000000..b992934 --- /dev/null +++ b/.config/picom/picom.conf @@ -0,0 +1,40 @@ +backend = "glx"; +glx-no-stencil = true; +glx-copy-from-font = false; + +active-opacity = 1.0; +inactive-opacity = 0.8; +frame-opacity = 0.8; +inactive-opacity-override = false; + +shadow = true; +shadow-radius = 16; +shadow-opacity = 0.5; +shadow-offset-x = -16; +shadow-offset-y = -16; +shadow-color = "#000000" + +fading = true; +fade-in-step = 0.05; +fade-out-step = 0.05; +fade-delta = 4 + +shadow-exclude = ["class_g = 'Rofi'", "class_g = 'albert'", "class_g = 'trayer'"]; +focus-exclude = ["class_g = 'Rofi'", "class_g = 'albert'", "class_g = 'trayer'"]; +blur-background-exclude = ["class_g = 'Rofi'", "class_g = 'albert'", "class_g = 'trayer'"]; + +blur-background = true; +blur-inactive = true; +blur-method = "dual_kawase"; +blur-strength = 8; + +wintypes: +{ + dock = { shadow = false; }; + dnd = { shadow = false; }; + tooltip = { shadow = false; }; + menu = { opacity = false; }; + dropdown_menu = { opacity = false; }; + popup_menu = { opacity = false; }; + utility = { opacity = false; }; +}; diff --git a/.config/zathura/zathurarc b/.config/zathura/zathurarc index 697d410..de05042 100644 --- a/.config/zathura/zathurarc +++ b/.config/zathura/zathurarc @@ -7,9 +7,9 @@ unmap f map f toggle_fullscreen map [fullscreen] f toggle_fullscreen -# Theme -set default-bg "#ffffff" -set default-fg "#eee" +# Initial theme +set default-bg "#cccccc" +set default-fg "#111" set statusbar-bg "#111" set statusbar-fg "#777" set inputbar-bg "#111" @@ -23,14 +23,10 @@ set completion-highlight-bg "#333" set highlight-fg "#ccc" set highlight-color "#111" set highlight-active-color "#333" - -# Dark mode -set recolor -set recolor-darkcolor "#aaa" -set recolor-lightcolor "#111" - -# midnight mode -map focus_inputbar "set default-bg \#111111" +set index-fg "#eee" +set index-bg "#111" +set index-active-fg "#eee" +set index-active-bg "#333" # Hide status bar set guioptions none @@ -38,5 +34,32 @@ set render-loading "false" map J zoom out map K zoom in -map i recolor unmap q + +# +# Hack for switching color themes (change default background too on recolor) +# + +# Default to light recolor +set recolor +set recolor-lightcolor "#cccccc" +set recolor-darkcolor "#111" +set recolor-keephue + +# No recolor +map focus_inputbar ":set recolor true" +map focus_inputbar ":set recolor false" +map focus_inputbar ":set default-bg \#fff" +map 1 feedkeys "" + +# Light recolor +map focus_inputbar ":set default-bg \#cccccc" +map focus_inputbar ":set recolor-lightcolor \#cccccc" +map focus_inputbar ":set recolor-darkcolor \#111" +map 2 feedkeys "" + +# Dark recolor +map focus_inputbar ":set default-bg \#111" +map focus_inputbar ":set recolor-lightcolor \#111" +map focus_inputbar ":set recolor-darkcolor \#aaa" +map 3 feedkeys "" diff --git a/.vimrc b/.vimrc index 5292e39..9829610 100644 --- a/.vimrc +++ b/.vimrc @@ -104,12 +104,13 @@ nn so :so % call plug#begin() " Coc Plug 'neoclide/coc.nvim', {'branch': 'release'} +Plug 'github/copilot.vim' " General +Plug 'unblevable/quick-scope' Plug 'tpope/vim-commentary' Plug 'machakann/vim-sandwich' Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } Plug 'junegunn/fzf.vim' -Plug 'vimwiki/vimwiki' " JS and TypeScript Plug 'pangloss/vim-javascript', { 'for': ['javascript', 'javascript.jsx'] } Plug 'leafgarland/typescript-vim', { 'for': ['typescript', 'typescript.tsx'] } @@ -119,6 +120,11 @@ Plug 'evanleck/vim-svelte', {'branch': 'main'} Plug 'neoclide/jsonc.vim' " LaTeX & markdown Plug 'lervag/vimtex' +" Wiki +Plug 'lervag/wiki.vim' +Plug 'hektor/taskwiki' +" Markdown +Plug 'vim-pandoc/vim-pandoc' Plug 'vim-pandoc/vim-pandoc-syntax' " TidalCycles Plug 'supercollider/scvim' @@ -129,29 +135,77 @@ call plug#end() """"""""""""""" " Coc +" `.../sandwich` {{{ +nmap s +xmap s +let g:sandwich#recipes = deepcopy(g:sandwich#default_recipes) +" }}} + +" `neoclide/coc.nvim` {{{ let g:coc_global_extensions = [ + \'coc-dictionary', + \'coc-syntax', \'coc-eslint', \'coc-prettier', \'coc-tsserver', - \'coc-python', \'coc-html', \'coc-emmet', \'coc-css', \'coc-svg', \'coc-svelte', + \'coc-jedi', \'coc-json', - \'coc-markdownlint', \'coc-yaml', \'coc-snippets', - \'coc-clangd' + \'coc-clangd', + \'coc-bibtex' \] " Autocomplete -imap (coc-snippets-expand) -nn es :CocCommand snippets.editSnippets -ino pumvisible() ? "\" : - \ coc#refresh() -ino pumvisible() ? "\" : "k" +" + +" `coc-snippets` + +" TODO: is this block even necessary anymore? +" +" I use `coc-snippets-exand-jump` here as it is more flexible afaics +" As stated in the docs: +" `coc-snippets-expand` Expand snippet w/ current inserted text +" `coc-snippets-expand-jump` Expand snippet or jump to next placeholder of current snippet if possible + +" Use tab for expansion in every context Don't use it for jumping as +" expansions have priority over jumping (which is not always what you want) +" +" E.g. You don't want to expand `time` to say `12:05` upon ``bing to go +" from arguments to body in a function snippet + +inor + \ coc#pum#visible() ? coc#_select_confirm() : + \ coc#expandable() ? "\=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\" : + \ "\" + +" Use and to move through suggestions +" Open suggestions if not yet open + +inor coc#pum#visible() ? coc#pum#next(1) : coc#refresh() + +" NOTE: As the followning interfered with digraphs, I replaced `coc#refresh` +" with `"\u\"` which afaik just does c-k when no completion menu is +" shown +" ``` +" inor coc#pum#visible() ? coc#pum#prev(1) : coc#refresh() +" ``` + +inor coc#pum#visible() ? coc#pum#prev(1) : "\u\" + +" NOTE: this is cutting text in visual mode, it is replaces `$VISUAL` on next +" expansion +" +" although I mapped it, I have yet to test this feature + +vmap (coc-snippets-select) + ino complete_info()["selected"] != "-1" ? "\" : "\u\" + " Show doccumentation fu! s:show_documentation() if (index(['vim','help'], &filetype) >= 0) @@ -160,13 +214,21 @@ fu! s:show_documentation() call CocAction('doHover') endif endfunction -nnoremap K :call show_documentation() +nn es :CocCommand snippets.editSnippets " Code action on cursor position nm do (coc-codeaction) -" Coc statusline -se statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} -" Prettier command +" Commands com! -nargs=0 Prettier :CocCommand prettier.formatFile +" }}} + +" `.../copilot` {{{ + +let g:copilot_node_command = "/home/h/.config/nvm/versions/node/v16.18.0/bin/node" +let g:copilot_no_tab_map = v:true +imap (copilot-next) +imap (copilot-prev) +imap