diff --git a/.config/X11/xinitrc b/.config/X11/xinitrc index f3404d5..6d6ecee 100644 --- a/.config/X11/xinitrc +++ b/.config/X11/xinitrc @@ -3,21 +3,9 @@ setxkbmap -option caps:escape xsetroot -cursor_name left_ptr & equiset & -xcompmgr & -monis & -dpi & mpd & xss-lock -l -- exeflock4 & - -case ${1} in -(k) - nhkd & - katriawm - ;; -(*) - sxhkd & - bspwm - ;; -esac +xrdb -merge "$XDG_CONFIG_HOME/X11/xresources" +monis & exec runsvdir -P ~/.local/service.x 'log: ...........................................................................................................................................................................................................................................................................................................................................................................................................' diff --git a/.config/alacritty.yml b/.config/alacritty.yml index a14d323..508e6fa 100644 --- a/.config/alacritty.yml +++ b/.config/alacritty.yml @@ -47,7 +47,7 @@ colors: # Normal colors normal: - black: '#1c1c1c' + black: '#2c2c2c' red: '#ef2f27' green: '#519f50' yellow: '#faa030' diff --git a/.config/bspwm/bspwmrc b/.config/bspwm/bspwmrc index 82226ff..473db81 100755 --- a/.config/bspwm/bspwmrc +++ b/.config/bspwm/bspwmrc @@ -3,8 +3,9 @@ bspc rule -r "*" bspmonis & +randbg & -bspc config border_width 1 +bspc config border_width 2 bspc config window_gap 6 bspc config top_padding 10 bspc config left_padding 0 @@ -14,10 +15,10 @@ bspc config split_ratio 0.5 # Opciones bspc config gapless_monocle true -bspc config single_monocle false bspc config ignore_ewmh_focus true bspc config pointer_follows_focus true bspc config removal_adjustment true +bspc config single_monocle false bspc config borderless_monocle false bspc config remove_unplugged_monitors false bspc config remove_disabled_monitors false @@ -47,6 +48,10 @@ bspc rule -a Catia state=floating bspc rule -a Cadence state=floating bspc rule -a mpv state=floating bspc rule -a Alacritty:flota state=floating -bspc rule -a Sxiv:fontpreview state=floating +bspc rule -a Sxiv:flota state=floating +bspc rule -a Firefox state=floating bspc rule -a Zathura state=tiled -bspc rule -a Alacritty:multi desktop='^1' +bspc rule -a gzdoom state=fullscreen + +xcompmgr & +unclutter --jitter 30 --timeout 3 --ignore-scrolling & diff --git a/.config/dunst/dunstrc b/.config/dunst/dunstrc index db20d46..70d7334 100644 --- a/.config/dunst/dunstrc +++ b/.config/dunst/dunstrc @@ -78,7 +78,7 @@ [urgency_low] background = "#212121" foreground = "#e8d0c0" - frame_color = "#b16286" + frame_color = "#73d0ff" timeout = 3 [urgency_normal] diff --git a/.config/git/config b/.config/git/config index b09bc3a..d3324c1 100644 --- a/.config/git/config +++ b/.config/git/config @@ -65,12 +65,14 @@ [credential] helper = /usr/libexec/git-core/git-credential-libsecret -[merge] - tool = nvr - conflictstyle = diff3 +[mergetool "nvim"] + cmd = nvim -f -c \"Gdiffsplit!\" \"$MERGED\" -[mergetool "nvr"] - cmd = nvr -s -d $LOCAL $BASE $REMOTE $MERGED -c 'wincmd J | wincmd =' +[merge] + tool = nvim + +[mergetool] + prompt = false [diff] tool = nvr diff --git a/.config/mpv/mpv.conf b/.config/mpv/mpv.conf index def2402..8da1ee5 100644 --- a/.config/mpv/mpv.conf +++ b/.config/mpv/mpv.conf @@ -1,7 +1,8 @@ # This file goes in ~/.config/mpv ao=jack,alsa, -scale=ewa_lanczossharp -cscale=ewa_lanczossharp +# scale=ewa_lanczossharp +# cscale=ewa_lanczossharp +# hwdec=vaapi deband=no geometry=50%:50% alang=eng,en @@ -13,7 +14,6 @@ osc=yes ytdl-format=bestvideo[height<=?1080]+bestaudio/best screenshot-format=png screenshot-directory="~/img/scrot" -hwdec=vaapi osd-level=1 osd-duration="3500" osd-font="IBM Plex Sans" diff --git a/.config/newsboat/config b/.config/newsboat/config index 5c90ff8..0389f79 100644 --- a/.config/newsboat/config +++ b/.config/newsboat/config @@ -2,6 +2,8 @@ always-display-description yes display-article-progress yes reload-only-visible-feeds yes +openbrowser-and-mark-jumps-to-next-unread yes +toggleitemread-jumps-to-next-unread yes auto-reload yes show-keymap-hint no text-width 80 @@ -57,14 +59,13 @@ bind-key d pagedown bind-key u pageup bind-key l open bind-key h quit -bind-key a toggle-article-read +bind-key M mark-feed-read +bind-key o open-in-browser-and-mark-read bind-key n next-unread bind-key N prev-unread bind-key D pb-download bind-key U show-urls bind-key x pb-delete -bind-key ^t next-unread -bind-key / open-search # programas externos notify-program "notify-send" @@ -75,9 +76,7 @@ save-path ~/.config/newsboat/saved # macros con prefijo macro , open-in-browser macro d set browser "ytdl"; open-in-browser ; set browser linkhandler -macro a set browser "bandcamp"; open-in-browser ; set browser linkhandler macro v set browser "setsid nohup mpv"; open-in-browser ; set browser linkhandler macro w set browser "tmux split-window -hp 60 && tmux send-keys '$lynx %u && tmux kill-pane\n'"; open-in-browser ; set browser linkhandler -macro r set browser "tmux split-window -hp 60 && tmux send-keys 'tuir -l %u && tmux kill-pane\n'"; open-in-browser ; set browser linkhandler # vim: ft=conf cms=#%s diff --git a/.config/nvim/autoload/dead/statusline.vim b/.config/nvim/autoload/dead/statusline.vim index 5c94f29..c4f37d8 100644 --- a/.config/nvim/autoload/dead/statusline.vim +++ b/.config/nvim/autoload/dead/statusline.vim @@ -8,12 +8,11 @@ endfunction function! dead#statusline#StatusLine() abort let l:statusline='' - let l:statusline.='%#error#' - let l:statusline.=dead#statusline#LinterStatus() - let l:statusline.='%#User1#' - let l:statusline.=dead#statusline#LinePasteMode() + let l:statusline.='%#TabLineFill#%{dead#statusline#LinterStatus()} ' + let l:statusline.='%#User6#%{fugitive#head()} ' + let l:statusline.='%{dead#statusline#LinePasteMode()}' let l:statusline.='%= ' - let l:statusline.=' %p%% %l:%c ' + let l:statusline.='%#User1#%p%% %l:%c ' let l:statusline.=dead#statusline#ModeColor() let l:statusline.=dead#statusline#CurrentMode() return l:statusline @@ -53,7 +52,7 @@ endfunction function! dead#statusline#LinePasteMode() abort let paste_status = &paste if paste_status == 1 - return ' paste ' + return '[paste]' else return '' endif @@ -78,13 +77,8 @@ function! dead#statusline#LinterStatus() abort let l:all_errors = l:counts.error + l:counts.style_error let l:all_non_errors = l:counts.total - l:all_errors return l:counts.total == 0 ? '' : printf( - \ '  :%d  :%d ', + \ ' :%d  :%d', \ l:all_non_errors, \ l:all_errors \) endfunction - -function! dead#statusline#GitStatus() - let [a,m,r] = GitGutterGetHunkSummary() - return printf('+%d ~%d -%d', a, m, r) -endfunction diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index cc650ba..9c3a232 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -8,7 +8,6 @@ let $GIT_EDITOR = 'nvr -cc split --remote-wait' if executable("rg") set grepprg=rg\ --vimgrep endif -set runtimepath+=/usr/share/vim/vimfiles/ let mapleader="\" let maplocalleader=',' @@ -30,4 +29,6 @@ packadd! loupe packadd! vim-commentary packadd! fzf.vim packadd! fern.vim -packadd! gina.vim +packadd! ale +packadd! coc.nvim +packadd! vim-fugitive diff --git a/.config/nvim/plugin/mappings/fm.vim b/.config/nvim/plugin/mappings/fm.vim index f128fd2..c7d2dad 100644 --- a/.config/nvim/plugin/mappings/fm.vim +++ b/.config/nvim/plugin/mappings/fm.vim @@ -19,8 +19,8 @@ function! s:init_fern() abort \ "\(fern-action-collapse)", \ ) - nmap H (fern-action-open:split) - nmap V (fern-action-open:vsplit) + nmap (fern-action-open:split) + nmap (fern-action-open:vsplit) nmap t (fern-action-open:tabedit) nmap r (fern-action-rename) nmap R (fern-action-reload) @@ -28,15 +28,17 @@ function! s:init_fern() abort nmap K (fern-action-new-dir) nmap c (fern-action-copy) nmap m (fern-action-move) - nmap h (fern-action-hidden:toggle) + nmap ! (fern-action-hidden:toggle) nmap C (fern-action-clipboard-copy) nmap M (fern-action-clipboard-move) nmap P (fern-action-clipboard-paste) + nmap l (fern-action-expand) nmap D (fern-action-remove) nmap (fern-action-leave) nmap (fern-action-mark-toggle) nmap (fern-my-open-expand-collapse) nmap o (fern-my-expand-or-collapse) + nmap (fern-action-open-and-close) endfunction augroup fern-custom diff --git a/.config/nvim/plugin/mappings/gitgutter.vim b/.config/nvim/plugin/mappings/git.vim similarity index 56% rename from .config/nvim/plugin/mappings/gitgutter.vim rename to .config/nvim/plugin/mappings/git.vim index 5b30f71..d087188 100644 --- a/.config/nvim/plugin/mappings/gitgutter.vim +++ b/.config/nvim/plugin/mappings/git.vim @@ -4,3 +4,8 @@ nmap ghu (GitGutterUndoHunk) nmap ghs (GitGutterStageHunk) nmap {c (GitGutterPrevHunk) nmap }c (GitGutterNextHunk) + +nnoremap ff :G +nnoremap fd :Gvdiffsplit! +nnoremap fh :diffget //2 +nnoremap fl :diffget //3 diff --git a/.config/nvim/plugin/settings.vim b/.config/nvim/plugin/settings.vim index 608b1ed..92bb92a 100644 --- a/.config/nvim/plugin/settings.vim +++ b/.config/nvim/plugin/settings.vim @@ -22,7 +22,7 @@ set notimeout set ignorecase set scrolloff=5 set sidescroll=5 -set shortmess+=aoOWsc +set shortmess+=aoIOWsc set foldmethod=marker set foldclose=all set foldlevelstart=10 @@ -49,13 +49,7 @@ set listchars+=precedes:<,extends:> set diffopt+=algorithm:histogram,indent-heuristic set diffopt+=foldcolumn:0 set fillchars=eob:\ ,stlnc:\ ,stl:\ ,vert:\│ +set formatoptions+=nl +set formatoptions-=crot let formatlistpat='^\s*\(\d\+[\]:.)}\t ]\|[*-][\t ]\)\s*' -let g:netrw_dirhistmax=0 match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$' -set formatoptions& - \ formatoptions+=n - \ formatoptions+=l - \ formatoptions-=c - \ formatoptions-=r - \ formatoptions-=o - \ formatoptions-=t diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index e63db06..3534c4a 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -20,9 +20,6 @@ super + shift + {1-9,0} super + ctrl + {1-9,0} id=$(bspc query -N -n); bspc node -d {1-9,10}; bspc node -f ${id} -super + {_,shift} + ntilde - minve {hide,show} - super + {equal, plus, minus} bspc node -l {normal, above, below} @@ -41,22 +38,25 @@ super + shift + {d,a} super + {_,shift,ctrl} + u bspc node {@/ -B,@brother -B,@/ -E} +super + m + bspc monitor -f last + # Run Applications +super + {_,shift} + ntilde + minve {hide,show} + +super + space + j4-dmenu-desktop --dmenu="dmenu -i -w 250 -p ' ' " --no-generic + super + {b,q,s,n,p,t,r,d,i} {$BROWSER,powermenu,vent,escribir,pom,tv,ref,leer,wpadd} -super + {_,shift,ctrl} + m - {monis,unimon,espejo} - super + {_,shift} + g {grabar,corte} super + {z,x,v} $TERMINAL {_,--class=flota,--class=flota -e pulsemixer} -super + space - j4-dmenu-desktop --dmenu="dmenu -i -w 250 -p ' ' " --no-generic - super + {F1,F2,F3} {fecha,tapa,notifocus} diff --git a/.config/sxiv/exec/key-handler b/.config/sxiv/exec/key-handler index 8fac6f9..87e3ac0 100755 --- a/.config/sxiv/exec/key-handler +++ b/.config/sxiv/exec/key-handler @@ -2,7 +2,7 @@ while read -r file do case "$1" in - "b") setbg "$file" & ;; + "b") hsetroot -fill "$file" & ;; "m") mv "$file" "$HOME/img/rand" ;; "r") convert -rotate 90 "$file" "$file" ;; "R") convert -rotate -90 "$file" "$file" ;; diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 7ff1fd8..64ed40f 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -40,3 +40,4 @@ for f in "${ZDOTDIR}"/conf/*; do done source $XDG_DATA_HOME/lscolors.sh +source "$ZDOTDIR/other.zsh" diff --git a/.config/zsh/conf/00_prompt.zsh b/.config/zsh/conf/00_prompt.zsh index 8dc0e96..5b6c28f 100644 --- a/.config/zsh/conf/00_prompt.zsh +++ b/.config/zsh/conf/00_prompt.zsh @@ -1,44 +1,33 @@ # Set PS1 and RPS1 precmd() { - local cwd git_branch git_toplvl suffix newline + local git_branch git_toplvl suffix # -- Add a line before the prompt [[ -v PS1_NL ]] && echo || PS1_NL= - newline=$'\n' - # -- PS1 (in precmd, avoid tools updating PS1) if [[ $EUID == 0 ]]; then suffix='%(?,%F{yellow},%F{red})%n%f:' else suffix='%(?,%F{yellow},%F{red})>%f' fi - - if [[ -n $SSH_CONNECTION ]]; then - PS1="%F{231}${SSH_TTY:+[%n@%m]}%f%B${SSH_TTY:+:}${newline}${suffix}%b " - else - PS1="%B${suffix}%b " - fi + PS1="%B${suffix}%b " # -- RPS1 # Error code if != 0 RPS1='%B%(?..%{%F{red}%}(%?%)%{%f%}) ' - # if in git repo, print ·/ + # if in git repo, print / if git_branch="$( git rev-parse --abbrev-ref HEAD 2>/dev/null )"; then [[ -z "$(git status --porcelain 2>/dev/null)" ]] \ - && RPS1+="%F{green}${git_branch}%F{231} " \ - || RPS1+="%F{166}${git_branch}%F{231} " - + && RPS1+="%F{green}${git_branch}%F{231}%b " \ + || RPS1+="%F{166}${git_branch}%F{231}%b " git_toplvl="$( git rev-parse --show-toplevel 2>/dev/null )" - cwd="${${PWD##${git_toplvl}}:-/}" - - RPS1+="%F{240}[%F{12}${git_toplvl##*/}%F{240}]%f%b" + RPS1+="%F{240}[%F{201}${git_toplvl##*/}:%F{12}%2~%F{240}]%f" else - RPS1+='%F{12}%2~%f%b' + RPS1+='%b%F{12}%2~%f' fi } - export SPROMPT="zsh: correct %F{red}'%R'%f to %F{green}'%r'%f [%B%Uy%u%bes, %B%Un%u%bo, %B%Ue%u%bdit, %B%Ua%u%bbort]? " function zle-keymap-select { diff --git a/.config/zsh/conf/03_aliases.zsh b/.config/zsh/conf/03_aliases.zsh index 8437c55..622e019 100644 --- a/.config/zsh/conf/03_aliases.zsh +++ b/.config/zsh/conf/03_aliases.zsh @@ -1,19 +1,19 @@ # Programas alias \ - vdi='nvim -d' \ + v='$EDITOR' \ + x='xui' \ + m='neomutt' \ + z='zathura' \ + g='lab' \ se='sudoedit' \ - gdl='gallery-dl' \ am='alsamixer' \ pm='pulsemixer' \ nb='newsboat -q' \ - v='$EDITOR' \ - play='ncmpcpp' \ - x='xui' \ - z='zathura' \ py='python ' \ - pyserv='python -m http.server' \ - git='lab' \ - irc='catgirl freenode' + vdi='nvim -d' \ + irc='catgirl' \ + play='ncmpcpp' \ + pyserv='python -m http.server' # XBPS alias \ diff --git a/.local/bin/bspmonis b/.local/bin/bspmonis new file mode 100755 index 0000000..de3281b --- /dev/null +++ b/.local/bin/bspmonis @@ -0,0 +1,15 @@ +#!/bin/sh + +M=$(bspc query -M --names) +NUM=$(echo "$M" | awk 'END{print NR}') + +if [ "$NUM" = 1 ]; then + bspc monitor -d 1 2 3 4 5 6 7 8 9 10 + bspc rule -a Firefox:Navigator state=tiled desktop='^2' +elif [ "$NUM" = 2 ]; then + pri=$(echo "$M" | awk NR==1) + sec=$(echo "$M" | awk NR==2) + bspc monitor "$pri" -d 1 2 3 4 5 + bspc monitor "$sec" -d 6 7 8 9 10 + bspc rule -a Firefox:Navigator state=tiled desktop='^6' +fi diff --git a/.local/bin/cfg b/.local/bin/cfg deleted file mode 100755 index 5979c8c..0000000 --- a/.local/bin/cfg +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env zsh - -function () { - # Bookmarks - local -A bookmarks=( - 'nvim' '~/.config/nvim/init.vim' - 'git' '$XDG_CONFIG_HOME/git/config' - 'gtk2' '~/.config/gtk-2.0/gtkrc-2.0' - 'gtk3' '~/.config/gtk-3.0/settings.ini' - 'lf' '~/.config/lf/lfrc' - 'preview' '~/.local/bin/lfview' - 'mpv' '~/.config/mpv/mpv.conf' - 'xres' '~/.config/X11/xresources' - 'wm' '~/.config/bspwm/bspwmrc' - 'keys' '~/.config/sxhkd/sxhkdrc' - 'shell' '~/.config/zsh/.zshrc' - 'dunst' '~/.config/dunst/dunstrc' - 'music' '~/.config/ncmpcpp/config' - 'tmux' '~/.config/tmux/tmux.conf' - 'xinit' '~/.config/X11/xinitrc' - 'alias' '~/.config/zsh/aliases.zsh' - 'term' '~/.config/alacritty.yml' - 'env' '~/.zshenv' - ) - - local selected_bookmark - - if [[ "$1" != '' ]] { - selected_bookmark="${bookmarks[$1]}" - } else { - local bookmarks_table - - local key - foreach key (${(k)bookmarks}) { - bookmarks_table+="$key ${bookmarks[$key]}\n" - } - - if (! hash fzf &>/dev/null) { - return 1 - } else { - selected_bookmark=$( - printf "$bookmarks_table" \ - | fzf \ - --height='45%' \ - ) - - selected_bookmark="${selected_bookmark[(ws: :)2]}" - } - } - - if [[ "$selected_bookmark" != '' ]] { - eval $EDITOR "$selected_bookmark" - } else { - exit 0 - } -} diff --git a/.local/bin/escribir b/.local/bin/escribir index caff5f4..4b42a00 100755 --- a/.local/bin/escribir +++ b/.local/bin/escribir @@ -1,27 +1,26 @@ #!/bin/sh -prog() { - $TERMINAL --class=flota -e nvim "$@" -} +abrir() { ${TERMINAL:-alacritty} --class=flota -e nvim "$@"; } +listar() { ${DMENU:-dmenu} -i -w 125 "$@"; } diario() { cd "$HOME/doc/blog" || exit - menuBlog=$(printf "Hoy\\nMañana\\nAyer\\nArchivo" | dmenu -i -w 120 -p " ") + menuBlog=$(printf "Hoy\\nMañana\\nAyer\\nArchivo" | listar -p " ") case $menuBlog in - "Hoy") prog "$(date -I)".md ;; - "Mañana") prog "$(date --date='tomorrow' +%F)".md ;; - "Ayer") prog "$(date --date='yesterday' +%F)".md ;; + "Hoy") abrir "$(date -I)".md ;; + "Mañana") abrir "$(date --date='tomorrow' +%F)".md ;; + "Ayer") abrir "$(date --date='yesterday' +%F)".md ;; "Archivo") archivo ;; esac } notas() { cd "$HOME/doc/notas" || exit - menuNota=$(printf "Nueva\\nArchivo" | dmenu -i -w 120 -p " ") + menuNota=$(printf "Nueva\\nArchivo" | listar -p " ") case $menuNota in "Nueva") nombre="$(dmenu -i -p "Titulo: ")" 2>/dev/null - prog "$nombre".md + abrir "$nombre".md ;; "Archivo") archivo ;; esac @@ -34,16 +33,16 @@ articulo() { nombreForm="$(echo "$nombre" | tr ' ' '-')" hugo new articulos/"$nombreForm".md sleep 5 - prog content/articulos/"$nombre".md + abrir content/articulos/"$nombre".md } archivo() { selarch=$(fd -d 1 -e md | sort -Mr | dmenu -i -w 200 -p " ") [ -z "$selarch" ] && exit 0 - prog "$selarch" + abrir "$selarch" } -MENU="$(printf "Artículo\\nPersonal\\nNotas" | dmenu -i -w 130 -p " ")" +MENU="$(printf "Artículo\\nPersonal\\nNotas" | listar -p " ")" case $MENU in 'Personal') diario ;; 'Artículo') articulo ;; diff --git a/.local/bin/fp b/.local/bin/fp index 69e64fe..92537c9 100755 --- a/.local/bin/fp +++ b/.local/bin/fp @@ -1,241 +1,93 @@ -#!/usr/bin/env bash -# -# Siddharth Dushantha 2020 -# -# Dependencies: sxiv, imagemagick, xdotool, fzf +#!/bin/sh +# Font preview with ueberzug and fzf +# https://github.com/OliverLew/fontpreview-ueberzug +# Dependencies: imagemagick, ueberzug, fzf, fontconfig +# This is inspired by https://github.com/sdushantha/fontpreview -VERSION=1.0.7 +# Checking for environment variables if available. +# These are compatible with original fontpreview. +SIZE=${FONTPREVIEW_SIZE:-800x800} +FONT_SIZE=${FONTPREVIEW_FONT_SIZE:-50} +BG_COLOR=${FONTPREVIEW_BG_COLOR:-#080808} +FG_COLOR=${FONTPREVIEW_FG_COLOR:-#b3b1ad} +PREVIEW_TEXT=${FONTPREVIEW_PREVIEW_TEXT:-"Jackdaws Love\nMy Big Sphinx\nOf Quartz\n\n1234567890\n¡!@#$\%|^&*\n',.;:_-=+\"\n(){}[]<>¿?ñÑ"} -# Default values -SEARCH_PROMPT="> " -SIZE=532x365 -POSITION="+0+0" -FONT_SIZE=34 -BG_COLOR="#ffffff" -FG_COLOR="#000000" -PREVIEW_TEXT="Jackdaws love\nmy big sphinx\nof quartz\n\n1234567890\n¡!@$\%|=+:;\"\'\n(){}[]<>¿?ñÑ" +# Ueberzug related variables +FIFO="/tmp/fontpreview-ueberzug-fifo" +IMAGE="/tmp/fontpreview-ueberzug-img.png" +ID="fontpreview-ueberzug" +WIDTH=$(tput cols) +HEIGHT=$(tput lines) -show_help() { -printf "%s" "\ -usage: fontpreview [-h] [--size \"px\"] [--position \"+x+y\"] [--search-prompt SEARCH_PROMPT] - [--font-size \"FONT_SIZE\"] [--bg-color \"BG_COLOR\"] [--fg-color \"FG_COLOR\"] - [--preview-text \"PREVIEW_TEXT\"] [-i font.otf] [-o preview.png] [--version] - -┌─┐┌─┐┌┐┌┌┬┐┌─┐┬─┐┌─┐┬ ┬┬┌─┐┬ ┬ -├┤ │ ││││ │ ├─┘├┬┘├┤ └┐┌┘│├┤ │││ -└ └─┘┘└┘ ┴ ┴ ┴└─└─┘ └┘ ┴└─┘└┴┘ -Very customizable and minimal font previewer written in bash - -optional arguments: - -h, --help show this help message and exit - -i, --input filename of the input font (.otf, .ttf, .woff are supported) - -o, --output filename of the output preview image (input.png if not set) - --size size of the font preview window - --position the position where the font preview window should be displayed - --search-prompt input prompt of fuzzy searcher - --font-size font size - --bg-color background color of the font preview window - --fg-color foreground color of the font preview window - --preview-text preview text that should be displayed in the font preview window - --version show the version of fontpreview you are using -" +usage() { + echo "Usage: fontpreview [-h] [-s FONT_SIZE] [-b BG] [-f FG] [-t TEXT]" } -pre_exit() { - # Get the proccess ID of this script and kill it. - # We are dumping the output of kill to /dev/null - # because if the user quits sxiv before they - # exit this script, an error will be shown - # from kill and we dont want that - kill -9 "$(cat "$PIDFILE" 2>/dev/null)" &> /dev/null - - # Delete tempfiles, so we don't leave useless files behind. - rm -rf "$FONTPREVIEW_DIR" +start_ueberzug() { + mkfifo "$FIFO" || exit 1 + touch "$IMAGE" || exit 1 + ueberzug layer --parser simple --silent <"$FIFO" & + # https://github.com/seebye/ueberzug/issues/54#issuecomment-502869935 + exec 3>"$FIFO" } -generate_preview(){ - # Credits: https://bit.ly/2UvLVhM - convert -size $SIZE xc:"$BG_COLOR" \ - -gravity center \ - -pointsize $FONT_SIZE \ - -font "$1" \ - -fill "$FG_COLOR" \ - -annotate +0+0 "$PREVIEW_TEXT" \ - -flatten "$2" +stop_ueberzug() { + exec 3>&- + rm "$FIFO" "$IMAGE" >/dev/null 2>&1 } -main(){ - # Checkig if needed dependencies are installed - dependencies=(sxiv convert fzf) - for dependency in "${dependencies[@]}"; do - type -p "$dependency" &>/dev/null || { - echo "error: Could not find '${dependency}', is it installed?" >&2 - exit 1 - } - done - - # Checking for enviornment variables which the user might have set. - # This config file for fontpreview is pretty much the bashrc, zshrc, etc - # Majority of the variables in fontpreview can changed using the enviornment variables - # and this makes fontpreview very customizable - [[ $FONTPREVIEW_SEARCH_PROMPT != "" ]] && SEARCH_PROMPT=$FONTPREVIEW_SEARCH_PROMPT - [[ $FONTPREVIEW_SIZE != "" ]] && SIZE=$FONTPREVIEW_SIZE - [[ $FONTPREVIEW_POSITION != "" ]] && POSITION=$FONTPREVIEW_POSITION - [[ $FONTPREVIEW_FONT_SIZE != "" ]] && FONT_SIZE=$FONTPREVIEW_FONT_SIZE - [[ $FONTPREVIEW_BG_COLOR != "" ]] && BG_COLOR=$FONTPREVIEW_BG_COLOR - [[ $FONTPREVIEW_FG_COLOR != "" ]] && FG_COLOR=$FONTPREVIEW_FG_COLOR - [[ $FONTPREVIEW_PREVIEW_TEXT != "" ]] && PREVIEW_TEXT=$FONTPREVIEW_PREVIEW_TEXT - - # Save the window ID of the terminal window fontpreview is executed in. - # This is so that when we open up sxiv, we can change the focus back to - # the terminal window, so that the user can search for the fonts without - # having to manualy change the focus back to the terminal. - - # Flag to run some commands only once in the loop - FIRST_RUN=true - - while true; do - # List out all the fonts which imagemagick is able to find, extract - # the font names and then pass them to fzf - font=$(convert -list font | awk -F: '/^[ ]*Font: /{print substr($NF,2)}' | fzf --prompt="$SEARCH_PROMPT") - - # Exit if nothing is returned by fzf, which also means that the user - # has pressed [ESCAPE] - [[ -z $font ]] && return - - generate_preview "$font" "$FONT_PREVIEW" - - if [[ $FIRST_RUN == true ]]; then - FIRST_RUN=false - - # Display the font preview using sxiv - #sxiv -g "$SIZE$POSITION" "$FONT_PREVIEW" -N "fontpreview" -b & - sxiv -N "fontpreview" -b -g "$SIZE$POSITION" "$FONT_PREVIEW" & - - # Change focus from sxiv, back to the terminal window - # so that user can continue to search for fonts without - # having to manually change focus back to the terminal window - - # Save the process ID so that we can kill - # sxiv when the user exits the script - echo $! >"$PIDFILE" - - # Check for crashes of sxiv - elif [[ -f $PIDFILE ]] ; then - if ! pgrep -F "$PIDFILE" >/dev/null 2>&1; then - echo "Restart sxiv - You maybe using a obsolete version. " >&2 - # Display the font preview using sxiv - sxiv -g "$SIZE$POSITION" -N "fontpreview" -b "$FONT_PREVIEW" & - - # Change focus from sxiv, back to the terminal window - # so that user can continue to search for fonts without - # having to manually change focus back to the terminal window - - # Save the process ID so that we can kill - # sxiv when the user exits the script - echo $! >"$PIDFILE" - fi - - fi - done +preview() { + # In fzf the cols and lines are those of the preview pane + [ -f "$1" ] || fontfile=$(fc-match -f "%{file}" "$1") + convert -size "$SIZE" xc:"$BG_COLOR" -fill "$FG_COLOR" \ + -pointsize "$FONT_SIZE" -font "$fontfile" -gravity center \ + -annotate +0+0 "$PREVIEW_TEXT" "$IMAGE" && + { + printf "action\tadd\tidentifier\t%s\t" "$ID" + printf "x\t%d\ty\t%d\tpath\t%s\t" 2 1 "$IMAGE" + printf "width\t%d\theight\t%d\n" "$WIDTH" "$HEIGHT" + } >"$FIFO" || + printf "action\tremove\tidentifier\t%s\n" "$ID" >"$FIFO" } -# Disable CTRL-Z because if we allowed this key press, -# then the script would exit but, sxiv would still be -# running -trap "" SIGTSTP - -trap pre_exit EXIT - -# Use mktemp to create a temporary directory that won't -# collide with temporary files of other application. -FONTPREVIEW_DIR="$(mktemp -d "${TMPDIR:-/tmp}/fontpreview_dir.XXXXXXXX")" || exit -PIDFILE="$FONTPREVIEW_DIR/fontpreview.pid" -touch "$PIDFILE" || exit -FONT_PREVIEW="$FONTPREVIEW_DIR/fontpreview.png" -touch "$FONT_PREVIEW" || exit -TERMWIN_IDFILE="$FONTPREVIEW_DIR/fontpreview.termpid" -touch "$TERMWIN_IDFILE" || exit - -font=$1 - - -# Parse the arguments -options=$(getopt -o hi:o: --long position:,size:,version,search-prompt:,font-size:,bg-color:,fg-color:,preview-text:,input:,output:,help -- "$@") -eval set -- "$options" - -while true; do - case "$1" in - --size) - shift - FONTPREVIEW_SIZE=$2 - ;; - --position) - shift - FONTPREVIEW_POSITION=$2 - ;; - -h|--help) - show_help - exit - ;; - --version) - echo $VERSION - exit - ;; - -i|--input) - input_file="$2" - ;; - -o|--output) - output_file="$2" - ;; - --search-prompt) - FONTPREVIEW_SEARCH_PROMPT=$2 - ;; - --font-size) - FONTPREVIEW_FONT_SIZE=$2 - ;; - --bg-color) - FONTPREVIEW_BG_COLOR=$2 - ;; - --fg-color) - FONTPREVIEW_FG_COLOR=$2 - ;; - --preview-text) - FONTPREVIEW_PREVIEW_TEXT=$2 - ;; - --) - shift - break - ;; +while getopts "hs:b:f:t:" arg; do + case "$arg" in + s) FONT_SIZE=$OPTARG ;; + b) BG_COLOR=$OPTARG ;; + f) FG_COLOR=$OPTARG ;; + t) PREVIEW_TEXT=$OPTARG ;; + *) + usage + exit + ;; esac - shift done +shift $((OPTIND - 1)) - -# Point a font file to fontpreview and it will preview it. -# Example: -# $ fontpreview /path/to/fontFile.ttf -# -# This is useful because people can preview fonts which they have not -# installed onto their system. So if they want to preview a font file that -# is in their Downloads directory, then they can easily preview it. -if [ -f "$font" ]; then - generate_preview "$font" "$FONT_PREVIEW" - - # Display the font preview using sxiv - sxiv -g "$SIZE$POSITION" -N "fontpreview" -b "$FONT_PREVIEW" & - - # For some strange reason, sxiv just doesnt have time to read the file - sleep 0.1 - exit +if [ "$#" = 0 ]; then + trap stop_ueberzug EXIT QUIT INT TERM + # Check if dependencies are installed + for dependency in ueberzug convert fzf fc-list; do + command -v "$dependency" >/dev/null 2>&1 || + { + echo "Please install ${dependency}." >&2 + exit 1 + } + done + # Prepare + start_ueberzug + # Export cli args as environment variables for preview command + export FONTPREVIEW_FONT_SIZE="$FONT_SIZE" + export FONTPREVIEW_BG_COLOR="$BG_COLOR" + export FONTPREVIEW_FG_COLOR="$FG_COLOR" + export FONTPREVIEW_PREVIEW_TEXT="$PREVIEW_TEXT" + # The preview command runs this script again with an argument + fc-list -f "%{family}:%{style}\n" | + while IFS=: read -r family style; do + echo "${family%,*}${style:+:${style%,*}}" + done | sort | uniq | + fzf --reverse --cycle --preview "sh $0 {}" \ + --preview-window "left:$((WIDTH / 2)):noborder:wrap" +elif [ "$#" = 1 ]; then + [ -p "$FIFO" ] && preview "$1" fi - -# Check if the user gave an input file if they did, then create a preview -# and then save the preview to the current working directory -if [ "$input_file" != "" ] ; then - [ -z "$output_file" ] && output_file="${input_file}.png" - generate_preview "$input_file" "$output_file" - exit -fi - -main diff --git a/.local/bin/monis b/.local/bin/monis index 620a76f..72c14c1 100755 --- a/.local/bin/monis +++ b/.local/bin/monis @@ -1,12 +1,11 @@ #!/bin/sh conectados=$(xrandr -q | awk '/ connected/ {count++} END {print count}') +pri=$(xrandr -q | awk '/ connected/ {print $1}' | sed -sn 1p) sec=$(xrandr -q | awk '/ connected/ {print $1}' | sed -sn 2p) if [ "$conectados" = 1 ]; then - xrandr --output LVDS1 --primary --auto --scale 1.0x1.0 "$(xrandr -q | awk '/ disconnected/ {print "--output", $1, "--off"}' | paste -sd ' ')" - randbg + xrandr --output "$pri" --primary --auto --scale 1.0x1.0 "$(xrandr -q | awk '/ disconnected/ {print "--output", $1, "--off"}' | paste -sd ' ')" elif [ "$conectados" = 2 ]; then - xrandr --output LVDS1 --primary --auto --scale 1.0x1.0 --output "$sec" --right-of LVDS1 --auto --scale 1.0x1.0 - randbg + xrandr --output "$pri" --primary --auto --scale 1.0x1.0 --output "$sec" --right-of "$pri" --auto --scale 1.0x1.0 fi diff --git a/.local/bin/unimon b/.local/bin/unimon index b0e3d94..dfdfd74 100755 --- a/.local/bin/unimon +++ b/.local/bin/unimon @@ -1,6 +1,8 @@ #!/bin/sh -xrandr --output LVDS1 --primary --auto --scale 1.0x1.0 "$(xrandr -q | awk '/ disconnected/ {print "--output", $1, "--off"}' | paste -sd ' ')" +pri=$(xrandr -q | awk '/ connected/ {print $1}' | sed -sn 1p) + +xrandr --output "$pri" --primary --auto --scale 1.0x1.0 "$(xrandr -q | awk '/ disconnected/ {print "--output", $1, "--off"}' | paste -sd ' ')" if [ -e /tmp/bspwm_0_0-socket ]; then bspc config remove_disabled_monitors diff --git a/.local/bin/upd b/.local/bin/upd index e05e6cd..0fd38cb 100755 --- a/.local/bin/upd +++ b/.local/bin/upd @@ -1,10 +1,6 @@ #!/bin/sh sudo xbps-install -Su -echo "Actualizando db..." -sudo updatedb -echo "Actualizando manpages..." -sudo makewhatis /usr/share/man echo "Actualizando la lista de paquetes..." paclist echo "Listo." diff --git a/.local/sv/dunst/run b/.local/sv/dunst/run deleted file mode 100755 index eb802b4..0000000 --- a/.local/sv/dunst/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -exec dunst diff --git a/.local/sv/unclutter/run b/.local/sv/unclutter/run deleted file mode 100755 index 8631966..0000000 --- a/.local/sv/unclutter/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/sh - -exec unclutter --jitter 30 --timeout 3 --ignore-scrolling diff --git a/.ssh/config b/.ssh/config deleted file mode 100644 index 07ff3a5..0000000 --- a/.ssh/config +++ /dev/null @@ -1 +0,0 @@ -AddKeysToAgent yes diff --git a/.zshenv b/.zshenv index e23761a..7f5b23c 100644 --- a/.zshenv +++ b/.zshenv @@ -8,7 +8,6 @@ fi export VISUAL="$EDITOR" export GIT_EDITOR="$EDITOR" export TERMINAL="alacritty" -# export BROWSER="firefox" export BROWSER="${${DISPLAY:-lynx}:+firefox}" export COLORTERM="truecolor" export OPENER="xdg-open" @@ -28,25 +27,25 @@ export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" export XDG_DATA_HOME="$HOME/.local/share" export XDG_CONFIG_HOME="$HOME/.config" export XDG_CACHE_HOME="$HOME/.cache" -export XINITRC="$XDG_CONFIG_HOME/X11/xinitrc" -export ZDOTDIR="$XDG_CONFIG_HOME/zsh" +export XINITRC="${XDG_CONFIG_HOME:-$HOME/.config}/X11/xinitrc" +export ZDOTDIR="${XDG_CONFIG_HOME:-$HOME/.config}/zsh" export GPG_TTY=$(tty) -export GNUPGHOME="$XDG_DATA_HOME/gnupg" +export GNUPGHOME="${XDG_DATA_HOME:-$HOME/.local/share}/gnupg" export SSH_ASKPASS="/bin/gnome-ssh-askpass" -export PASSWORD_STORE_DIR="$XDG_DATA_HOME/pass" +export PASSWORD_STORE_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/pass" eval $(keychain --dir ~/.local/share/keychain --quiet --eval --noask --agents ssh,gpg id_rsa) -export NOTMUCH_CONFIG="$XDG_CONFIG_HOME/notmuch-config" -export WGETRC="$XDG_CONFIG_HOME/wget/wgetrc" -export WEECHAT_HOME="$XDG_CONFIG_HOME/weechat" -export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc" -export NODE_REPL_HISTORY="$XDG_DATA_HOME/node_repl_history" -export RANDFILE="$XDG_DATA_HOME/rnd" -export GOPATH="$XDG_DATA_HOME/go" -export HISTFILE="$XDG_DATA_HOME/bash/history" +export NOTMUCH_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/notmuch-config" +export WGETRC="${XDG_CONFIG_HOME:-$HOME/.config}/wget/wgetrc" +export WEECHAT_HOME="${XDG_CONFIG_HOME:-$HOME/.config}/weechat" +export NPM_CONFIG_USERCONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/npm/npmrc" +export NODE_REPL_HISTORY="${XDG_DATA_HOME:-$HOME/.local/share}/node_repl_history" +export RANDFILE="${XDG_DATA_HOME:-$HOME/.local/share}/rnd" +export GOPATH="${XDG_DATA_HOME:-$HOME/.local/share}/go" +export HISTFILE="${XDG_DATA_HOME:-$HOME/.local/share}/bash/history" -_JAVA_OPTIONS="-Djava.util.prefs.userRoot=${XDG_DATA_HOME}/java " +_JAVA_OPTIONS="-Djava.util.prefs.userRoot=${XDG_DATA_HOME:-$HOME/.local/share}/java " _JAVA_OPTIONS+="-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true " _JAVA_OPTIONS+="-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel" export _JAVA_OPTIONS @@ -54,21 +53,19 @@ export _JAVA_OPTIONS eval "$(sed 's/^[^#].*/export &/g;t;d' ${DIR:-$XDG_CONFIG_HOME}/user-dirs.dirs)" # }}} # FZF {{{ -export FZF_DEFAULT_COLORS='--color=dark,fg:-1,fg+:254,bg:-1,bg+:235,hl:33,hl+:33,info:8,border:1,prompt:4,pointer:3,marker:3,spinner:8,header:6' - -export FZF_DEFAULT_OPTS="$FZF_DEFAULT_COLORS \ - --extended \ +export FZF_DEFAULT_OPTS="--cycle \ + --color=bg:-1,hl:#5fff87,bg+:-1,hl+:#ffaf5f \ + --color=info:#af87ff,prompt:#5fff87,pointer:#ff87d7,marker:#ff87d7,spinner:#ff87d7 \ --reverse \ --inline-info \ --no-bold \ --ansi \ - --bind ctrl-f:page-down,ctrl-b:page-up \ - --preview-window wrap" + --preview-window :wrap:noborder" export FZF_DEFAULT_COMMAND="fd -t f -c always -H" -export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" export FZF_COMPLETION_OPTS='+c -x' export FZF_CTRL_T_OPTS="--select-1 --exit-0 --preview 'bat --color=always {}'" +export FZF_CTRL_R_OPTS="--preview 'echo {}' --preview-window down:3:hidden:wrap --bind '?:toggle-preview'" export FZF_VIM_LOG=$(git config --get alias.l | awk '{$1=""; print $0;}' | tr -d '\r') # }}} # Less {{{ diff --git a/doc/xbpaketes b/doc/xbpaketes index 49e55be..408ce4e 100644 --- a/doc/xbpaketes +++ b/doc/xbpaketes @@ -11,6 +11,7 @@ alsa-plugins-samplerate alsa-plugins-speex alsa-utils android-udev-rules +ansible atool audacity base-system @@ -63,8 +64,10 @@ keychain klystrack krita lf +libXfixes-devel libXft-devel libXinerama-devel +libXrandr-devel libfluidsynth libjack-32bit libopenal @@ -91,6 +94,7 @@ neovim neovim-remote newsboat nfs-utils +nftables nodejs notmuch noto-fonts-cjk @@ -110,8 +114,11 @@ powertop pulseaudio pulsemixer python3 +python3-ansible-lint python3-pip ripgrep +rkhunter +runit-nftables setxkbmap shellcheck shfmt @@ -127,10 +134,12 @@ tmux toilet transmission udevil +ueberzug unclutter-xfixes unrar unzip vice +vifm void-repo-multilib void-repo-nonfree vsv