From 434ea3e0bdeda5c97269956bde6fb4e35eac49e5 Mon Sep 17 00:00:00 2001 From: deadguy Date: Fri, 8 May 2020 15:51:46 -0300 Subject: [PATCH] vimwiki y 2 cosas mas en un commit que me olvide de pushear, que quedo en medio de hacer experimentos con cosas. --- .config/git/config | 15 +- .config/lf/lfrc | 2 +- .config/mpv/mpv.conf | 134 ---------------- .config/nvim/ftplugin/mail.vim | 21 +-- .config/nvim/ftplugin/vimwiki.vim | 12 +- .config/nvim/init.vim | 37 +++-- .config/sxhkd/sxhkdrc | 8 +- .config/zsh/.zprofile | 2 +- .config/zsh/aliases.plugin.zsh | 5 +- .local/bin/cachetear | 2 +- .local/bin/fp | 244 ++++++++++++++++++++++++++++++ .local/bin/notas | 28 ++++ .local/bin/powermenu | 2 +- .local/bin/upd | 2 +- .local/bin/volu | 20 --- .local/bin/zu | 29 ++++ .local/sv/runsvdir-deadguy/run | 8 +- .zshenv | 2 +- doc/xbpaketes | 13 +- 19 files changed, 380 insertions(+), 206 deletions(-) create mode 100755 .local/bin/fp create mode 100755 .local/bin/notas delete mode 100755 .local/bin/volu create mode 100755 .local/bin/zu diff --git a/.config/git/config b/.config/git/config index b9d1edc..c291f3f 100644 --- a/.config/git/config +++ b/.config/git/config @@ -9,7 +9,7 @@ email = adeadguy@protonmail.com [core] - editor = nvim + editor = nvr --remote-wait-silent excludesfile = /home/deadguy/.config/git/gitignore autocrlf = input whitespace = warn @@ -25,18 +25,17 @@ helper = /usr/libexec/git-core/git-credential-libsecret [merge] - tool = vimdiff + tool = nvr conflictstyle = diff3 -[mergetool] - prompt = false - keepBackup = false +[mergetool "nvr"] + cmd = nvr -s -d $LOCAL $BASE $REMOTE $MERGED -c 'wincmd J | wincmd =' [diff] - tool = vimdiff + tool = nvr -[difftool] - prompt = false +[difftool "nvr"] + cmd = nvr -s -d $LOCAL $REMOTE [commit] gpgsign = true diff --git a/.config/lf/lfrc b/.config/lf/lfrc index 7f01821..c712bac 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -277,7 +277,7 @@ map bg $setbg $f map U %du -sh $f map Y %cp -ri $fs . map D %mv -i $fs . -map mp $mpv "$f" +map ma $mepetre "$f" map za %za -r "$f" "$f" map zu $zu "$f" map zg $hx add "$f" diff --git a/.config/mpv/mpv.conf b/.config/mpv/mpv.conf index cd12e05..def2402 100644 --- a/.config/mpv/mpv.conf +++ b/.config/mpv/mpv.conf @@ -1,7 +1,4 @@ # This file goes in ~/.config/mpv -#vo=opengl-hq -#proflie=opengl-hq -#msg-level=all=fatal,ao=error ao=jack,alsa, scale=ewa_lanczossharp cscale=ewa_lanczossharp @@ -26,7 +23,6 @@ osd-margin-x="10" osd-margin-y="10" osd-bar-align-x="0" osd-bar-align-y="0.75" -term-playing-msg='${filename}' sub-auto=fuzzy sub-file-paths-append=ass sub-file-paths-append=srt @@ -44,136 +40,6 @@ cursor-autohide=1000 prefetch-playlist=yes hls-bitrate=max save-position-on-quit -term-osd-bar no-border msg-module msg-color - -# -# mpv configuration file -# -# Configuration files are read system-wide from /usr/local/etc/mpv.conf -# and per-user from ~/.config/mpv/mpv.conf, where per-user settings override -# system-wide settings, all of which are overridden by the command line. -# -# Configuration file settings and the command line options use the same -# underlying mechanisms. Most options can be put into the configuration file -# by dropping the preceding '--'. See the man page for a complete list of -# options. -# -# Lines starting with '#' are comments and are ignored. -# -# See the CONFIGURATION FILES section in the man page -# for a detailed description of the syntax. -# -# Profiles should be placed at the bottom of the configuration file to ensure -# that settings wanted as defaults are not restricted to specific profiles. -# -# Note that the commented example options usually do _not_ set the default -# values. Calling mpv with --list-options is a nice way to see the default -# values for most options. - -################## -# video settings # -################## - -# Specify default video driver (see --vo=help for a list). -#vo=vdpau - -# Start in fullscreen mode by default. -#fs=yes - -# force starting with centered window -#geometry=50%:50% - -# don't allow a new window to have a size larger than 90% of the screen size -#autofit-larger=90%x90% - -# Disable the On Screen Controller (OSC). -#osc=no - -# Keep the player window on top of all other windows. -#ontop=yes - -################## -# audio settings # -################## - -# Specify default audio driver (see --ao=help for a list). -#ao=alsa - -# Disable softvol usage, and always use the system mixer if available. -#softvol=no - -# Scale audio tempo by playback speed without altering pitch. (By default does -# nothing if playback speed is not changed. May introduce artifacts.) -#af=scaletempo - -# Output 5.1 audio natively, and upmix/downmix audio with a different format. -#audio-channels=5.1 -# Disable any automatic remix, _if_ the audio output accepts the audio format. -# of the currently played file. See caveats mentioned in the manpage. -# (This is the default.) -#audio-channels=auto - -################## -# other settings # -################## - -# Pretend to be a web browser. Might fix playback with some streaming sites, -# but also will break with shoutcast streams. -#user-agent="Mozilla/5.0" - -# cache settings -# -# Use 8MB input cache by default. The cache is enabled for network streams only. -#cache-default=8192 -# -# Use 8MB input cache for everything, even local files. -#cache=8192 -# -# If a seek is issued, and the target is 1024KB past the cached range, then -# keep reading until the seek target is hit, instead of doing a real seek. -#cache-seek-min=1024 -# -# Disable the behavior that the player will pause if the cache goes below a -# certain fill size. -#cache-pause=no -# -# Read ahead about 5 seconds of audio and video packets. -#demuxer-readahead-secs=5.0 - -# Display English subtitles if available. -#slang=en - -# Play Finnish audio if available, fall back to English otherwise. -#alang=fi,en - -# Change subtitle encoding. For Arabic subtitles use 'cp1256'. -# If the file seems to be valid UTF-8, prefer UTF-8. -#sub-codepage=utf8:cp1256 - -# Enable hardware decoding if available. Often, this requires using an certain -# video output, otherwise no hardware decoding will be used. -#hwdec=auto - -############ -# Profiles # -############ - -# The options declared as part of profiles override global default settings, -# but only take effect when the profile is active. - -# The following profile can be enabled on the command line with: --profile=vdpau - -#[vdpau] -# The profile forces the vdpau VO. -#vo=vdpau -# Use hardware decoding (this might break playback of some h264 files) -#hwdec=vdpau -# Most video filters do not work with hardware decoding. -#vf-clr=yes - - -# You can also include other configuration files. -#include=/path/to/the/file/you/want/to/include diff --git a/.config/nvim/ftplugin/mail.vim b/.config/nvim/ftplugin/mail.vim index 65c47be..214f792 100644 --- a/.config/nvim/ftplugin/mail.vim +++ b/.config/nvim/ftplugin/mail.vim @@ -1,9 +1,12 @@ -highlight clear SpellBad -highlight SpellBad term=standout ctermfg=1 -highlight SpellBad term=underline cterm=underline -highlight clear SpellCap -highlight SpellCap term=underline cterm=underline -highlight clear SpellRare -highlight SpellRare term=underline cterm=underline -highlight clear SpellLocal -highlight SpellLocal term=underline cterm=underline +" The virgin plugin vs the chad local options +setlocal nonumber norelativenumber laststatus=0 showmode +setlocal signcolumn=no textwidth=80 wrap sw=2 +setlocal tabstop=2 expandtab softtabstop=2 linebreak +setlocal autoindent noruler colorcolumn=80 +setlocal spell spelllang=es,en_us + +nnoremap [s +nnoremap ]s +nnoremap z= +nnoremap zg +inoremap u[s1z=`]au diff --git a/.config/nvim/ftplugin/vimwiki.vim b/.config/nvim/ftplugin/vimwiki.vim index dbc51cb..842f206 100644 --- a/.config/nvim/ftplugin/vimwiki.vim +++ b/.config/nvim/ftplugin/vimwiki.vim @@ -3,8 +3,12 @@ setlocal signcolumn=no textwidth=80 wrap sw=2 setlocal tabstop=2 expandtab softtabstop=2 linebreak setlocal autoindent noruler colorcolumn=80 setlocal spell spelllang=es,en_us,cjk -setlocal spellcapcheck -nnoremap [s -nnoremap ]s -nnoremap z= +nnoremap Vimwiki2HTML +nnoremap VimwikiMakeDiaryNote +nnoremap VimwikiDiaryGenerateLinks +nnoremap [S +nnoremap ]S +nnoremap z= +nnoremap zg +inoremap u[s1z=`]au diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 2534445..31dcc24 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -5,6 +5,7 @@ let g:python_host_skip_check=1 " Skip python 2 host check let python_highlight_all=1 " full python syntax highlighting let g:python3_host_prog = '/bin/python3' let g:node_host_prog = '~/.local/share/npm/bin/neovim-node-host' +let $GIT_EDITOR = 'nvr -cc split --remote-wait' if empty(glob('~/.local/share/nvim/site/autoload/plug.vim')) silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs @@ -73,6 +74,7 @@ set pastetoggle= set fillchars+=vert:\ set grepprg=rg\ --vimgrep\ --hidden\ --no-heading set grepformat=%f:%l:%c:%m,%f:%l:%m +set conceallevel=1 match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$' set wildignore+=*.jpg,*.jpeg,*.bmp,*.gif,*.png,*.svg " image @@ -89,11 +91,7 @@ endif let mapleader="\" let maplocalleader=',' let formatlistpat='^\s*\(\d\+[\]:.)}\t ]\|[*-][\t ]\)\s*' -let g:polyglot_disabled = ['javascript', 'python'] -let g:vim_markdown_toc_autofit = 1 -let g:markdown_fenced_languages = ['vim', 'help'] -let g:vim_jsx_pretty_colorful_config = 1 -let g:jsx_ext_required = 1 + " }}} " Functions {{{ function! MyHighlights() abort @@ -163,6 +161,7 @@ if !exists('autocommands_loaded') && has('autocmd') au FileType help setlocal statusline=%!LocalStatusLine() au FileType json syntax match Comment +\/\/.\+$+ au FileType make setlocal noexpandtab + au FileType gitcommit,gitrebase,gitconfig set bufhidden=delete au BufNewFile,BufRead requirements*.txt set syntax=python aug END @@ -170,7 +169,7 @@ if !exists('autocommands_loaded') && has('autocmd') au BufWritePre * :%s/\s\+$//e au BufWritePost *xresources !xrdb % au BufWritePost *sxhkdrc !pkill -USR1 sxhkd - au BufWritePost $MYVIMRC nested source $MYVIMRC + au BufWritePost *.tex !pdflatex % au QuitPre * if empty(&buftype) | lclose | endif aug END endif @@ -213,6 +212,7 @@ let g:ale_linters = { \ 'bash': ['shellcheck'], \ 'sh': ['shellcheck'], \ 'vim': ['vint'], +\ 'tex': ['chktex'], \ 'python': ['pyls', 'flake8', 'pylint'] \} let g:ale_fixers = { @@ -289,10 +289,30 @@ endfunction nnoremap rn (coc-rename) "}}} " Wiki {{{ -let g:vimwiki_list = [{'path': '~/doc/notas', 'path_html': '~/doc/notas/web', 'auto_toc': 1, 'auto_tags': 1, 'auto_diary_index': 1}] +let g:vimwiki_list = [ + \{'path': '~/doc/chiptune', 'path_html': '~/doc/chiptune/web', 'template_path': '~/doc/chiptune/tpl', 'template_default': 'def', 'auto_toc': 1, 'auto_tags': 1}, + \{'path': '~/doc/notas', 'auto_toc': 1, 'auto_tags': 1}, + \{'path': '~/doc/blog', 'auto_toc': 1, 'auto_tags': 1, 'auto_diary_index': 1, 'diary_rel_path': '.', 'diary_index': 'blog', 'diary_header': 'Dailies' }] let g:vimwiki_hl_headers = 1 let g:vimwiki_hl_cb_checked = 1 -nnoremap VimwikiFollowLink +let g:vimwiki_listsyms = '✗○◐●✓' +let g:vimwiki_listsym_rejected = '✗' +"}}} +"{{{ Polyglot +let g:polyglot_disabled = ['javascript', 'python'] +let g:vim_markdown_toc_autofit = 1 +let g:markdown_fenced_languages = ['vim', 'help'] +let g:vim_jsx_pretty_colorful_config = 1 +let g:jsx_ext_required = 1 +let g:tex_flavor='latex' +let g:tex_conceal='abdmg' +let g:Tex_DefaultTargetFormat ='pdf' +let g:vimtex_motion_matchparen = 0 +let g:vimtex_complete_enable = 1 +let g:vimtex_compiler_progname = 'nvr' +let g:vimtex_view_use_temp_files = 2 +let g:vimtex_view_method = 'zathura' +let g:vimtex_quickfix_mode = 0 "}}} " Plugins {{{ call plug#begin(stdpath('data') . '/plugged') @@ -532,7 +552,6 @@ nnoremap ¿ G " Splits nnoremap T :call LaunchTerminal() -nnoremap v :vsplit nnoremap v :vnew nnoremap s :new diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index 1cfe8b8..aa7a066 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -51,11 +51,11 @@ super + {_,shift} + ntilde whid {hide,dmenu} # Run Applications -super + {b,q,m,s,v} - {$BROWSER,powermenu,monisel,dswitcher,pavucontrol} +super + {b,q,m,s,v,n} + {$BROWSER,powermenu,monisel,dswitcher,pavucontrol,notas} -super + {a,x,i,n,z} - alacritty {_,--class=flota,--class=flota -e connman-ncurses,--class=flota -e notas,--class=multi -e termux} +super + {a,x,i,z} + alacritty {_,--class=flota,--class=flota -e connman-ncurses,--class=multi -e termux} super + shift + x tmenux diff --git a/.config/zsh/.zprofile b/.config/zsh/.zprofile index 30e26d8..1ad3128 100644 --- a/.config/zsh/.zprofile +++ b/.config/zsh/.zprofile @@ -1 +1 @@ -[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx -- -keeptty -nolisten tcp \ No newline at end of file +# [ -z $DISPLAY ] && [ "$(fgconsole)" -eq 1 ] && exec startx -- -keeptty -nolisten tcp \ No newline at end of file diff --git a/.config/zsh/aliases.plugin.zsh b/.config/zsh/aliases.plugin.zsh index 67a7729..0c1141e 100644 --- a/.config/zsh/aliases.plugin.zsh +++ b/.config/zsh/aliases.plugin.zsh @@ -31,6 +31,7 @@ alias \ # LaTeX alias \ txs='tlmgr search --global' \ + txl='tlmgr search' \ txi='sudo tlmgr install' # Transmission @@ -100,8 +101,8 @@ alias \ # Comandos alias \ sudo='sudo ' \ - reboot='loginctl reboot' \ - shutdown='loginctl poweroff' \ + reboot='sudo reboot' \ + shutdown='sudo shutdown -h now' \ chau='bspc quit 1' \ path='echo -e ${PATH//:/\\n}' \ wp='sxiv-rifle ~/img/wallpaper >/dev/null 2>&1' \ diff --git a/.local/bin/cachetear b/.local/bin/cachetear index 6443bcb..5755534 100755 --- a/.local/bin/cachetear +++ b/.local/bin/cachetear @@ -3,4 +3,4 @@ set -euf -o pipefail notify-send -u critical -i ~/img/.icn/control.png "Tres meses han pasado..." "Es hora de limpiar el cache" & sleep 10s -floterm -e sudo xbps-remove -v -O +alacritty --class=flota -e sudo xbps-remove -vO diff --git a/.local/bin/fp b/.local/bin/fp new file mode 100755 index 0000000..55325fe --- /dev/null +++ b/.local/bin/fp @@ -0,0 +1,244 @@ +#!/usr/bin/env bash +# +# Siddharth Dushantha 2020 +# +# Dependencies: sxiv, imagemagick, xdotool, fzf + +VERSION=1.0.6 + +# 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(){}[]<>¿?ñÑ" + +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 +" +} + +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" +} + +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" +} + +main(){ + # Checkig if needed dependencies are installed + dependencies=(xdotool 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. + xdotool getactivewindow > "$TERMWIN_IDFILE" + + # 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 -p -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 + xdotool windowfocus "$(cat "$TERMWIN_IDFILE")" + + # 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" -p & + + # 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 + xdotool windowfocus "$(cat "$TERMWIN_IDFILE")" + + # Save the process ID so that we can kill + # sxiv when the user exits the script + echo $! >"$PIDFILE" + fi + + fi + done +} + +# 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 + ;; + esac + shift +done + + +# 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 +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/notas b/.local/bin/notas new file mode 100755 index 0000000..030915e --- /dev/null +++ b/.local/bin/notas @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +set -euf -o pipefail + +MAINDIR="$HOME/doc/" +NOTAS="notas" +DIARIO="blog" +CHIP="chiptune" + +DIRS=("$NOTAS" "$DIARIO" "$CHIP") + +SELPATH="$(printf '%s\n' "${DIRS[@]}" | dmenu -w 250 -p "Wiki ")" + +wiki () { + cd "$MAINDIR/$SELPATH" + if command -v fd >/dev/null 2>&1; then + sel=$(fd -d 1 -e wiki | dmenu -w 250 -p "Blog ") + else + sel=$(find . -maxdepth 1 -type f -printf '%P\n' | sort -M | dmenu -w 250 -p "File ") + fi + + if [[ $sel == "" ]]; then + exit 0 + else + alacritty --class=flota -e nvim "$sel" + fi +} + +wiki diff --git a/.local/bin/powermenu b/.local/bin/powermenu index afd60e6..ff9e975 100755 --- a/.local/bin/powermenu +++ b/.local/bin/powermenu @@ -15,6 +15,6 @@ case $chosen in "$reboot") loginctl reboot;; "$suspend") loginctl suspend;; "$lock") xset s activate;; - "$log_out") loginctl terminate-user 1000;; + "$log_out") loginctl terminate-user "$(id -u "$USER")";; *) exit 0;; esac diff --git a/.local/bin/upd b/.local/bin/upd index 6d96199..1396001 100755 --- a/.local/bin/upd +++ b/.local/bin/upd @@ -7,5 +7,5 @@ sudo updatedb echo "Actualizando manpages..." sudo makewhatis /usr/share/man echo "Actualizando la lista de paquetes..." -xbps-query -v -m > ~/doc/xbpaketes +xbps-query -vm > ~/doc/xbpaketes echo "Listo." diff --git a/.local/bin/volu b/.local/bin/volu deleted file mode 100755 index f794fff..0000000 --- a/.local/bin/volu +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -set -euf -o pipefail - -function send_notification { - icon="$HOME/.local/share/icons/Marwaita-Dark/24x24/actions/audio-on.svg" - dunstify -i "$icon" -r 5555 -u low " $(awk -F"[][]" '/dB/ { print $2 }' <(amixer sget Master))" -} - -case $1 in - up) - # increase volume by 5% - amixer sset Master 5%+ - send_notification - ;; - down) - # decrease volume by 5% - amixer sset Master 5%- - send_notification - ;; -esac diff --git a/.local/bin/zu b/.local/bin/zu new file mode 100755 index 0000000..9bc7eab --- /dev/null +++ b/.local/bin/zu @@ -0,0 +1,29 @@ +#!/bin/sh + +archive="$(readlink -f "$*")" && +directory="$(echo "$archive" | sed 's/\.[^\/.]*$//')" && +mkdir -p "$directory" && +cd "$directory" || exit + +[ "$archive" = "" ] && printf "Give archive to extract as argument.\\n" && exit + +if [ -f "$archive" ] ; then + case "$archive" in + *.tar.bz2|*.tbz2) tar xvjf "$archive" ;; + *.tar.xz) tar -xf "$archive" ;; + *.tar.gz|*.tgz) tar xvzf "$archive" ;; + *.lzma) unlzma "$archive" ;; + *.bz2) bunzip2 "$archive" ;; + *.rar) unrar x -ad "$archive" ;; + *.gz) gunzip "$archive" ;; + *.tar) tar xvf "$archive" ;; + *.zip) unzip "$archive" ;; + *.Z) uncompress "$archive" ;; + *.7z) 7z x "$archive" ;; + *.xz) unxz "$archive" ;; + *.exe) cabextract "$archive" ;; + *) printf "extract: '%s' - unknown archive method\\n" "$archive" ;; + esac +else + printf "File \"%s\" not found.\\n" "$archive" +fi diff --git a/.local/sv/runsvdir-deadguy/run b/.local/sv/runsvdir-deadguy/run index 660ab35..c47136e 100755 --- a/.local/sv/runsvdir-deadguy/run +++ b/.local/sv/runsvdir-deadguy/run @@ -1,8 +1,10 @@ #!/bin/sh -[ ! -d /run/runit.deadguy ] && \ - mkdir -p /run/runit.deadguy && \ - chown deadguy:deadguy /run/runit.deadguy +usuario=$(id -u "$USER") + +[ ! -d "/run/user/$usuario" ] && \ + mkdir -p "/run/user/$usuario" && \ + chown deadguy:deadguy "/run/user/$usuario" export HOME=/home/deadguy groups=$(id -Gn deadguy | tr ' ' ':') diff --git a/.zshenv b/.zshenv index 7a6f00c..0f6096d 100644 --- a/.zshenv +++ b/.zshenv @@ -24,7 +24,7 @@ export BAT_THEME="TwoDark" export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc-2.0" export QT_QPA_PLATFORMTHEME="gtk2" -export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" +# 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" diff --git a/doc/xbpaketes b/doc/xbpaketes index a101e78..078550f 100644 --- a/doc/xbpaketes +++ b/doc/xbpaketes @@ -17,21 +17,20 @@ broot-0.13.4_1 bspwm-0.9.9_2 cadence-0.9.1_1 chrony-3.5_2 -connman-1.38_1 +connman-1.38_2 connman-ncurses-1.0_3 cryptsetup-2.3.2_1 ctags-5.8_7 delta-0.0.17_1 dfc-3.1.1_1 dunst-1.4.1_1 -elogind-243.4_2 fd-8.0.0_1 ffmpeg-4.2.2_3 figlet-2.2.5_6 -firefox-75.0_2 +firefox-76.0_2 fzf-0.21.1_1 gallery-dl-1.13.4_1 -gcc-9.3.0_3 +gcc-9.3.0_5 git-2.26.2_1 git-extras-5.1.0_1 git-libsecret-2.26.2_1 @@ -55,7 +54,7 @@ libX11-devel-1.6.9_1 libXft-devel-2.3.3_1 libXinerama-devel-1.1.4_1 librsvg-2.47.1_1 -linux5.6-5.6.8_1 +linux5.6-5.6.11_1 lynx-2.8.9.1_3 maim-5.6.3_1 mdadm-4.1_2 @@ -69,6 +68,7 @@ mpv-0.32.0_2 ncmpcpp-0.8.2_9 ncurses-term-6.2_1 neovim-0.4.3_1 +neovim-remote-2.4.0_1 nfs-utils-2.4.3_2 nmap-7.80_2 nodejs-13.2.0_1 @@ -108,7 +108,7 @@ supercollider-3.10.4_1 sxhkd-0.6.1_1 sxiv-26_1 texlive-bin-2020_1 -tmux-3.1_1 +tmux-3.1b_1 toilet-0.3_2 transmission-2.94_5 tremc-0.9.1_1 @@ -130,7 +130,6 @@ xdo-0.5.7_1 xdotool-3.20160805.1_2 xdpyinfo-1.3.2_2 xev-1.2.3_2 -xf86-input-evdev-2.10.6_1 xf86-video-intel-2.99.917.899_2 xinput-1.6.3_1 xkill-1.0.5_1