diff --git a/.config/aliasrc b/.config/aliasrc index 38906b0b..9425c1a9 100644 --- a/.config/aliasrc +++ b/.config/aliasrc @@ -33,11 +33,8 @@ alias \ v="$EDITOR" \ p="sudo pacman" \ -# This alias is important. It enables the `pauseallmpv` command. -alias mpv="mpv --input-ipc-server=/tmp/mpvsoc$(date +%s)" - # Some other stuff alias \ magit="nvim -c MagitOnly" \ - ref="shortcuts >/dev/null; source ~/.config/shortcutrc" \ - weath="less -S ~/.local/share/weatherreport" \ + ref="shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/zshnameddirrc" \ + weath="less -S ${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" \ diff --git a/.config/directories b/.config/directories index f4cb1212..58421165 100644 --- a/.config/directories +++ b/.config/directories @@ -1,10 +1,10 @@ # You can add comments to these files with # -cf ~/.config +cf ${XDG_CONFIG_HOME:-$HOME/.config} d ~/downloads gh ~/github h ~/ -lb ~/.local/bin +lb ~/.local/bin mn /mnt -psc ~/.local/bin/polybar_scripts +psc ~/.local/bin/polybar_scripts pp ~/pictures sc ~/.local/bin diff --git a/.config/files b/.config/files index dc34501d..021eb991 100644 --- a/.config/files +++ b/.config/files @@ -1,11 +1,8 @@ -bd ~/.config/directories -bf ~/.config/files -bw ~/.config/bookmarks -cfa ~/.config/aliasrc -cfd ~/.Xdefaults -cfi ~/.config/i3/config -cfm ~/.config/mutt/muttrc -cfp ~/.config/polybar/config -cft ~/.tmux.conf -cfv ~/.config/nvim/init.vim -cfz ~/.config/zsh/.zshrc +bf ${XDG_CONFIG_HOME:-$HOME/.config}/files +bd ${XDG_CONFIG_HOME:-$HOME/.config}/directories +cfa ${XDG_CONFIG_HOME:-$HOME/.config}/aliasrc +cfz $ZDOTDIR/.zshrc +cfv ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/init.vim +cfi ${XDG_CONFIG_HOME:-$HOME/.config}/i3/config +cft $~/.tmux.conf +cfp $~/.config/polybar/config diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index a4b6f555..eac55eec 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -1,13 +1,13 @@ let mapleader ="," -if ! filereadable(expand('~/.config/nvim/autoload/plug.vim')) +if ! filereadable(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim"')) echo "Downloading junegunn/vim-plug to manage plugins..." - silent !mkdir -p ~/.config/nvim/autoload/ - silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ~/.config/nvim/autoload/plug.vim + silent !mkdir -p ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/ + silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim autocmd VimEnter * PlugInstall endif -call plug#begin('~/.config/nvim/plugged') +call plug#begin(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/plugged"')) Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'tpope/vim-surround' Plug 'scrooloose/nerdtree' diff --git a/.config/ranger/commands.py b/.config/ranger/commands.py index 71fd2a24..c1c74193 100755 --- a/.config/ranger/commands.py +++ b/.config/ranger/commands.py @@ -38,7 +38,7 @@ class my_edit(Command): # reference to the currently selected file. target_filename = self.fm.thisfile.path - # This is a generic function to print text in ranger. + # This is a generic function to print text in ranger. self.fm.notify("Let's edit the file " + target_filename + "!") # Using bad=True in fm.notify allows you to print error messages: diff --git a/.config/ranger/rc.conf b/.config/ranger/rc.conf index 89b4b8c2..ba5ec84f 100644 --- a/.config/ranger/rc.conf +++ b/.config/ranger/rc.conf @@ -5,7 +5,7 @@ set column_ratios 1,3,4 set hidden_filter ^\.|\.(?:pyc|vrb|pyo|lof|bak|swp|aux|log|nav|out|snm|toc|bcf|run\.xml|synctex\.gz|blg|bbl)$|^lost\+found$|^__(py)?cache__$ set show_hidden false set confirm_on_delete multiple -set preview_script ~/.config/ranger/scope.sh +set preview_script ${XDG_CONFIG_HOME:-$HOME/.config}/ranger/scope.sh set use_preview_script true set automatically_count_files true set open_all_images true @@ -505,4 +505,4 @@ map Tn eval fm.open_console('shell eyeD3 -n "" ' + fm.thisfile.relative_path, po #Downloading map ytv console shell youtube-dl -ic%space map yta console shell youtube-dl -xic%space -source ~/.config/ranger/shortcuts.conf +source ${XDG_CONFIG_HOME:-$HOME/.config}/ranger/shortcuts.conf diff --git a/.config/ranger/rifle.conf b/.config/ranger/rifle.conf index 97410d99..8f661b2a 100644 --- a/.config/ranger/rifle.conf +++ b/.config/ranger/rifle.conf @@ -101,7 +101,7 @@ ext s[wmf]c, has snes9x-gtk,X = snes9x-gtk "$1" ext nes, has fceux, X = fceux "$1" ext exe = wine "$1" name ^[mM]akefile$ = make -ext asf, has mpv, X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -- "$@" +ext asf, has mpv, X, flag f = mpv -- "$@" #-------------------------------------------- # Code @@ -118,11 +118,11 @@ ext php = php -- "$1" #------------------------------------------- mime ^video|audio, has gmplayer, X, flag f = gmplayer -- "$@" mime ^video|audio, has smplayer, X, flag f = smplayer "$@" -mime ^video, has mpv, X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -- "$@" -mime ^video, has mpv, X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --no-video -- "$@" -mime ^video, has mpv, X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --fs -- "$@" -mime ^video, has mpv, X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --loop -- "$@" -mime ^video, has mpv, X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --title="obs" --autofit=1050x700 -- "$@" +mime ^video, has mpv, X, flag f = mpv -- "$@" +mime ^video, has mpv, X, flag f = mpv --no-video -- "$@" +mime ^video, has mpv, X, flag f = mpv --fs -- "$@" +mime ^video, has mpv, X, flag f = mpv --loop -- "$@" +mime ^video, has mpv, X, flag f = mpv --title="obs" --autofit=1050x700 -- "$@" mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@" mime ^video, has mplayer2, X, flag f = mplayer2 -fs -- "$@" mime ^video, has mplayer, X, flag f = mplayer -- "$@" @@ -135,16 +135,16 @@ mime ^video|audio, has totem, X, flag f = totem --fullscreen -- "$@" #------------------------------------------- mime ^audio|ogg$, terminal, has mplayer = mplayer -- "$@" mime ^audio|ogg$, terminal, has mplayer2 = mplayer2 -- "$@" -mime ^audio|ogg$, terminal, has mpv = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --no-audio-display -- "$@" +mime ^audio|ogg$, terminal, has mpv = mpv --no-audio-display -- "$@" mime ^audio|ogg$ = tag "$@" -mime ^audio|ogg$, terminal, has mpv = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -- "$@" +mime ^audio|ogg$, terminal, has mpv = mpv -- "$@" ext midi?, terminal, has wildmidi = wildmidi -- "$@" #-------------------------------------------- # Video without X: #------------------------------------------- -mime ^video, terminal, !X, has mpv = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -- "$@" +mime ^video, terminal, !X, has mpv = mpv -- "$@" mime ^video, terminal, !X, has mplayer2 = mplayer2 -- "$@" mime ^video, terminal, !X, has mplayer = mplayer -- "$@" diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 2a589de4..c64c8e52 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -1,22 +1,31 @@ -autoload -U colors && colors +# Config for the Zoomer Shell + +# Enable colors and change prompt: +autoload -U colors && colors # Load colors PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b " +setopt autocd # Automatically cd into typed directory. +stty stop undef # Disable ctrl-s to freeze terminal. -# Attempt to load ~/.config/aliases and ~/.config/shortcuts -[ -f "$HOME/.config/shortcutrc" ] && source "$HOME/.config/shortcutrc" -[ -f "$HOME/.config/aliasrc" ] && source "$HOME/.config/aliasrc" +# History in cache directory: +HISTSIZE=10000 +SAVEHIST=10000 +HISTFILE=~/.cache/zsh/history -# History -HISTSIZE=1000 -SAVEHIST=1000 -HISTFILE=$ZDOTDIR/.history +# Load aliases and shortcuts if existent. +[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc" +[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/aliasrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/aliasrc" +[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/zshnameddirrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/zshnameddirrc" +# Basic auto/tab complete: autoload -U compinit zstyle ':completion:*' menu select zmodload zsh/complist compinit +_comp_options+=(globdots) # Include hidden files. -# Include hidden files in autocomplete: -_comp_options+=(globdots) +# vi mode +bindkey -v +export KEYTIMEOUT=1 # Use vim keys in tab complete menu: bindkey -M menuselect 'h' vi-backward-char @@ -25,14 +34,11 @@ bindkey -M menuselect 'l' vi-forward-char bindkey -M menuselect 'j' vi-down-line-or-history bindkey -v '^?' backward-delete-char -export KEYTIMEOUT=1 - # Change cursor shape for different vi modes. function zle-keymap-select { if [[ ${KEYMAP} == vicmd ]] || [[ $1 = 'block' ]]; then echo -ne '\e[1 q' - elif [[ ${KEYMAP} == main ]] || [[ ${KEYMAP} == viins ]] || [[ ${KEYMAP} = '' ]] || @@ -41,12 +47,13 @@ function zle-keymap-select { fi } zle -N zle-keymap-select - zle-line-init() { zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere) echo -ne "\e[5 q" } zle -N zle-line-init +echo -ne '\e[5 q' # Use beam shape cursor on startup. +preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt. # Use beam shape cursor on startup. echo -ne '\e[5 q' diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..4f7c5dd1 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule ".config/mpv/scripts/mpvSockets"] + path = .config/mpv/scripts/mpvSockets + url = https://github.com/wis/mpvSockets.git diff --git a/.local/bin/cron/crontog b/.local/bin/cron/crontog index 67f620b9..8168012e 100755 --- a/.local/bin/cron/crontog +++ b/.local/bin/cron/crontog @@ -3,4 +3,4 @@ # Toggles all cronjobs off/on. # Stores disabled crontabs in ~/.consaved until restored. -([ -f ~/.config/cronsaved ] && crontab - < ~/.config/cronsaved && rm ~/.config/cronsaved && notify-send "🕓 Cronjobs re-enabled.") || ( crontab -l > ~/.config/cronsaved && crontab -r && notify-send "🕓 Cronjobs saved and disabled.") +([ -f ${XDG_CONFIG_HOME:-$HOME/.config}/cronsaved ] && crontab - < ${XDG_CONFIG_HOME:-$HOME/.config}/cronsaved && rm ${XDG_CONFIG_HOME:-$HOME/.config}/cronsaved && notify-send "🕓 Cronjobs re-enabled.") || ( crontab -l > ${XDG_CONFIG_HOME:-$HOME/.config}/cronsaved && crontab -r && notify-send "🕓 Cronjobs saved and disabled.") diff --git a/.local/bin/dmenu_handler b/.local/bin/dmenu_handler index c7e27400..8ada2f42 100755 --- a/.local/bin/dmenu_handler +++ b/.local/bin/dmenu_handler @@ -6,11 +6,11 @@ case "$(printf "copy url\\nmpv\\nmpv (loop)\\nqueue download\\n\\nqueue youtube-dl\\nfeh\\nbrowser\\nw3m\\nmpv (float)" | dmenu -i -p "Open link with what program?")" in "copy url") echo "$1" | xclip -selection clipboard ;; mpv) setsid mpv -quiet "$1" >/dev/null 2>&1 & ;; - "mpv (loop)") setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -quiet --loop "$1" >/dev/null 2>&1 & ;; + "mpv (loop)") setsid mpv -quiet --loop "$1" >/dev/null 2>&1 & ;; "queue download") tsp curl -LO "$1" >/dev/null 2>&1 ;; "queue youtube-dl") tsp youtube-dl --write-metadata -ic "$1" >/dev/null 2>&1 ;; browser) setsid "$BROWSER" "$1" >/dev/null 2>&1 & ;; feh) setsid feh "$1" >/dev/null 2>&1 & ;; w3m) w3m "$1" >/dev/null 2>&1 ;; - "mpv (float)") setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" >/dev/null 2>&1 & ;; + "mpv (float)") setsid mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" >/dev/null 2>&1 & ;; esac diff --git a/.local/bin/dmenu_unicode b/.local/bin/dmenu_unicode index 12240e74..15799a36 100755 --- a/.local/bin/dmenu_unicode +++ b/.local/bin/dmenu_unicode @@ -5,7 +5,7 @@ # Must have xclip installed to even show menu. xclip -h 2>/dev/null || exit 1 -chosen=$(cut -d ';' -f1 ~/.local/share/larbs/emoji | dmenu -i -l 20 | sed "s/ .*//") +chosen=$(cut -d ';' -f1 ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/emoji | dmenu -i -l 20 | sed "s/ .*//") [ "$chosen" != "" ] || exit diff --git a/.local/bin/getkeys b/.local/bin/getkeys index 8871d414..0a0e86e1 100755 --- a/.local/bin/getkeys +++ b/.local/bin/getkeys @@ -1,5 +1,5 @@ #!/bin/sh -cat ~/.local/share/larbs/getkeys/"$1" 2>/dev/null && exit +cat ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/getkeys/"$1" 2>/dev/null && exit echo "Run command with one of the following arguments for info about that program:" -ls ~/.local/share/larbs/getkeys +ls ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/getkeys diff --git a/.local/bin/linkhandler b/.local/bin/linkhandler index 2c64dcbc..06600115 100755 --- a/.local/bin/linkhandler +++ b/.local/bin/linkhandler @@ -11,7 +11,7 @@ case "$1" in *mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*) - setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -quiet "$1" >/dev/null 2>&1 & ;; + setsid mpv -quiet "$1" >/dev/null 2>&1 & ;; *png|*jpg|*jpe|*jpeg|*gif) curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 & ;; *mp3|*flac|*opus|*mp3?source*) diff --git a/.local/bin/shortcuts b/.local/bin/shortcuts index 3cc83ca0..fbb10185 100755 --- a/.local/bin/shortcuts +++ b/.local/bin/shortcuts @@ -1,13 +1,20 @@ #!/usr/bin/env bash # Output locations. Unactivated progs should go to /dev/null. -shell_shortcuts="$HOME/.config/shortcutrc" +shell_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc" +zsh_named_dirs="${XDG_CONFIG_HOME:-$HOME/.config}/zshnameddirrc" +ranger_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/ranger/shortcuts.conf" # Remove, prepare files +rm -f "$ranger_shortcuts" "$zsh_named_dirs" 2>/dev/null printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts" # Format the `directories` file in the correct syntax and sent it to all three configs. -sed "s/\s*#.*$//;/^\s*$/d" "$HOME/.config/directories" | tee >(awk '{print $1"=\"cd "$2" && ls -a\" \\"}' >> "$shell_shortcuts") +sed "s/\s*#.*$//;/^\s*$/d" "${XDG_CONFIG_HOME:-$HOME/.config}/directories" | tee >(awk '{print $1"=\"cd "$2" && ls -a\" \\"}' >> "$shell_shortcuts") \ + >(awk '{print "hash -d "$1"="$2}' >> "$zsh_named_dirs") \ + | awk '{print "map g"$1" cd "$2"\nmap t"$1" tab_new "$2"\nmap m"$1" shell mv -v %s "$2"\nmap Y"$1" shell cp -rv %s "$2}' >> "$ranger_shortcuts" # Format the `files` file in the correct syntax and sent it to both configs. -sed "s/\s*#.*$//;/^\s*$/d" "$HOME/.config/files" | tee >(awk '{print $1"=\"$EDITOR "$2"\" \\"}' >> "$shell_shortcuts") +sed "s/\s*#.*$//;/^\s*$/d" "${XDG_CONFIG_HOME:-$HOME/.config}/files" | tee >(awk '{print $1"=\"$EDITOR "$2"\" \\"}' >> "$shell_shortcuts") \ + >(awk '{print "abbr", $1, "\"$EDITOR "$2"\""}' >> "$fish_shortcuts") \ + | awk '{print "map "$1" shell $EDITOR "$2}' >> "$ranger_shortcuts" diff --git a/.profile b/.profile index e0a31b58..97e1cab5 100644 --- a/.profile +++ b/.profile @@ -18,10 +18,13 @@ eval "$(sed 's/^[^#].*/export &/g;t;d' ~/.config/user-dirs.dirs)" export NOTMUCH_CONFIG="$HOME/.config/notmuch-config" export GTK2_RC_FILES="$HOME/.config/gtk-2.0/gtkrc-2.0" export LESSHISTFILE="-" -export WGETRC="$HOME/.config/wget/wgetrc" -export INPUTRC="$HOME/.config/inputrc" -export ZDOTDIR="$HOME/.config/zsh" -export PASSWORD_STORE_DIR="$HOME/.local/share/password-store" +export WGETRC="${XDG_CONFIG_HOME:-$HOME/.config}/wget/wgetrc" +export INPUTRC="${XDG_CONFIG_HOME:-$HOME/.config}/inputrc" +export ZDOTDIR="${XDG_CONFIG_HOME:-$HOME/.config}/zsh" +export PASSWORD_STORE_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/password-store" +export TMUX_TMPDIR="$XDG_RUNTIME_DIR" +export ANDROID_SDK_HOME="${XDG_CONFIG_HOME:-$HOME/.config}/android" +export CARGO_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/cargo" # Other program settings: export SUDO_ASKPASS="$HOME/.local/bin/dmenupass" @@ -35,10 +38,10 @@ export LESS_TERMCAP_se="$(printf '%b' '')" export LESS_TERMCAP_us="$(printf '%b' '')" export LESS_TERMCAP_ue="$(printf '%b' '')" -[ ! -f ~/.config/shortcutrc ] && shortcuts >/dev/null 2>&1 +[ ! -f ${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc ] && shortcuts >/dev/null 2>&1 # Start graphical server on tty1 if not already running. [ "$(tty)" = "/dev/tty1" ] && ! pgrep -x Xorg >/dev/null && exec startx # Switch escape and caps if tty and no passwd required: -sudo -n loadkeys ~/.local/share/larbs/ttymaps.kmap 2>/dev/null +sudo -n loadkeys ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/ttymaps.kmap 2>/dev/null diff --git a/.xprofile b/.xprofile index c2e2ac96..680ee86f 100644 --- a/.xprofile +++ b/.xprofile @@ -7,6 +7,5 @@ remaps & # run the remaps script, switching caps/esc and more; chec setbg & # set the background with the `setbg` script xcompmgr & # xcompmgr for transparency dunst & # dunst for notifications -#imwheel & # imwheel for disabling scroll issues in st xset r rate 300 50 & # Speed xrate up -unclutter & # Remove mouse when idle +unclutter & # Remove mouse when idle \ No newline at end of file