diff --git a/.gitignore b/.gitignore index 8f822344..0d9495d4 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,6 @@ .zcomp* autojump/.local/bin/pip* autojump/.local/lib/ +backup/ config.local history diff --git a/.gitmodules b/.gitmodules index a8b29a94..7ea5e31d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -61,3 +61,12 @@ [submodule "vim-plugins/.config/vim/bundle/syntastic"] path = vim-plugins/.config/vim/bundle/syntastic url = https://github.com/vim-syntastic/syntastic.git +[submodule "vim-plugins/.config/vim/bundle/rainbow_csv"] + path = vim-plugins/.config/vim/bundle/rainbow_csv + url = git@github.com:mechatroner/rainbow_csv.git +[submodule "vim-plugins/.config/vim/bundle/rainbow_parentheses"] + path = vim-plugins/.config/vim/bundle/rainbow_parentheses + url = git@github.com:kien/rainbow_parentheses.vim.git +[submodule "vim-plugins/.config/vim/bundle/yaml"] + path = vim-plugins/.config/vim/bundle/yaml + url = https://github.com/stephpy/vim-yaml.git diff --git a/.requirements/configure.mk b/.requirements/configure.mk index 79288532..c5d7376d 100644 --- a/.requirements/configure.mk +++ b/.requirements/configure.mk @@ -2,6 +2,9 @@ .PHONY: configure.harden configure.harden: ## Harden local configuration sudo ufw enable || true + sudo ufw allow ssh comment 'ssh' || true + sudo ufw allow proto tcp from 192.168.0.0/24 port 24800 to 192.168.0.0/24 port 24800 comment 'barrier-kvm' || true + sudo ufw allow proto tcp from port 8123 to port 8123 comment 'home-assistant' || true sudo systemctl disable lightdm.service || true sudo systemctl disable lightdm || true sudo systemctl set-default multi-user.target || true diff --git a/.requirements/firefox.txt b/.requirements/firefox.txt index 9e44cc39..8ddb4d9f 100644 --- a/.requirements/firefox.txt +++ b/.requirements/firefox.txt @@ -1,14 +1,25 @@ -https://s3.amazonaws.com/onelogin-downloads/extensions/firefox/onelogin.xpi -https://addons.mozilla.org/firefox/downloads/file/3657084/lastpass_password_manager-4.58.0.4-an+fx.xpi -# https://addons.mozilla.org/firefox/downloads/file/3492484/tree_style_tab_-3.3.5-fx.xpi -# https://addons.mozilla.org/firefox/downloads/file/3484647/privacy_badger-2020.1.13-an+fx.xpi +# Broken +# https://addons.mozilla.org/firefox/downloads/file/3502765/vimium_ff-1.65.1-fx.xpi +# https://addons.mozilla.org/firefox/downloads/file/3500160/dark_reader-4.8.9-an+fx.xpi # https://addons.mozilla.org/firefox/downloads/file/3474268/ghostery_privacy_ad_blocker-8.4.6-an+fx.xpi -# https://addons.mozilla.org/firefox/downloads/file/3498086/ublock_origin-1.24.4-an+fx.xpi + +# Not installed +# https://s3.amazonaws.com/onelogin-downloads/extensions/firefox/onelogin.xpi +# https://addons.mozilla.org/firefox/downloads/file/3657084/lastpass_password_manager-4.58.0.4-an+fx.xpi # https://addons.mozilla.org/firefox/downloads/file/3054598/video_downloadhelper-7.3.7-fx.xpi # https://addons.mozilla.org/firefox/downloads/file/3442258/https_everywhere-2019.11.7-an+fx.xpi -# https://addons.mozilla.org/firefox/downloads/file/3500160/dark_reader-4.8.9-an+fx.xpi -# https://addons.mozilla.org/firefox/downloads/file/3401561/stylus-1.5.6-fx.xpi +# https://addons.mozilla.org/firefox/downloads/file/3384741/remove_fbclid_and_utm-1.0-fx.xpi + +# Installed +# https://addons.mozilla.org/firefox/downloads/file/3484647/privacy_badger-2020.1.13-an+fx.xpi +# https://addons.mozilla.org/firefox/downloads/file/3498086/ublock_origin-1.24.4-an+fx.xpi # https://addons.mozilla.org/firefox/downloads/file/3495605/noscript_security_suite-11.0.13-an+fx.xpi -# https://addons.mozilla.org/firefox/downloads/file/3502765/vimium_ff-1.65.1-fx.xpi # https://addons.mozilla.org/firefox/downloads/file/3401561/stylus-1.5.6-fx.xpi -# https://addons.mozilla.org/firefox/downloads/file/3384741/remove_fbclid_and_utm-1.0-fx.xpi +# https://addons.mozilla.org/firefox/downloads/file/3884195/sidebery-4.10.0-fx.xpi +# https://addons.mozilla.org/firefox/downloads/file/3594370/epubreader-2.0.13-fx.xpi +# https://addons.mozilla.org/firefox/downloads/file/3904618/dark_reader-4.9.45-an+fx.xpi +https://addons.mozilla.org/firefox/downloads/file/3811501/tab_reloader_page_auto_refresh-0.3.7-fx.xpi +https://addons.mozilla.org/firefox/downloads/file/3898202/vimium_ff-1.67.1-fx.xpi +https://addons.mozilla.org/firefox/downloads/file/3907697/firefox_multi_account_containers-8.0.6-fx.xpi +https://addons.mozilla.org/firefox/downloads/file/3723251/temporary_containers-1.9.2-fx.xpi +https://addons.mozilla.org/firefox/downloads/file/3897820/i_dont_care_about_cookies-3.3.6-an+fx.xpi diff --git a/display-manager/.local/bin/itsdm b/display-manager/.local/bin/itsdm index 5a96cdb7..c03a0d01 100755 --- a/display-manager/.local/bin/itsdm +++ b/display-manager/.local/bin/itsdm @@ -38,6 +38,22 @@ #h failure #h #h ENVIRONMENT: +#h ITSDM_PATH +#h A colon-separated list of paths which contain +#h available *.desktop* xsession files. +#h +#h ITSDM_VT1, ITSDM_VT2, ..., ITSDM_VT9 +#h A preferred desktop (x)session to be run +#h on the specified virtual terminal. +#h The string is passed directly to to `fzf` +#h (eg: `fzf --query "${ITSDM_VT1}"`), +#h so you can use any fuzzy text matching that it supports. +#h For example, from least specific to most: +#h - `i3` (matches any filename matching `i3`) +#h - `^i3` (matches any filename starting with `i3`) +#h - `^i3.desktop$` (matches only one file named `i3.desktop` +#h See *man fzf* for more details. +#h #h XDG_CACHE_HOME #h The base location for logs, default is *${HOME}/.cache*. #h @@ -45,9 +61,6 @@ #h The pager to be used when invoked with **-m**, **--manual**, #h defaults to **less**. #h -# If they exist, the list of available options will be pulled from -# *.desktop* files in the following directories: -#h #h FILES: #h #h ${XDG_CACHE_HOME}/itsdm/log @@ -80,13 +93,30 @@ while getopts ":hmM" option; do case ${option} in *) ;; esac; done +if [ -z "${ITSDM_PATH}" ] +then + ITSDM_PATH='' + if [ -d '/usr/share/xsessions' ] + then + ITSDM_PATH="/usr/share/xsessions:${ITSDM_PATH}" + fi + if [ -d "${NIX_PROFILE:-${HOME}/.nix-profile}/share/xsessions" ] + then + ITSDM_PATH="${NIX_PROFILE:-${HOME}/.nix-profile}/share/xsessions:${ITSDM_PATH}" + fi + if [ -d "${HOME}/.local/share/xsessions" ] + then + ITSDM_PATH="${HOME}/.local/share/xsessions:${ITSDM_PATH}" + fi +fi + log() { level=${1} message=${2} logfile=${XDG_CACHE_HOME}/itsdm/log test -e "${logfile}" || mkdir -p "$(dirname "${logfile}")" datestamp=$(date +'%Y-%m-%d %H:%M:%S') - echo "${datestamp} ${level} ${message}" >>"${logfile}" + echo "${datestamp} ${level} $$ ${message}" >>"${logfile}" } gather_choices() { grep_args= @@ -135,7 +165,11 @@ display_choices_sh() { return 1 } display_choices_fzf() { + default='' + eval "default=\${ITSDM_VT${XDG_VTNR}}" fzf \ + --query="${default}" \ + --select-1 \ --preview="grep \ '^\(Name\|Exec\|Comment\)=' \ {} \ @@ -194,15 +228,25 @@ check_choice() { } handle_choice() { choice=${1} - check_choice "${choice}" || return ${?} - check_exec "${choice}" || return ${?} - execute_app "${choice}" + if [ -n "${choice}" ] + then + log INFO "Attempting to exec choice: ${choice}" >&2 + check_choice "${choice}" || return ${?} + check_exec "${choice}" || return ${?} + execute_app "${choice}" + else + log INFO "Falling back to default sh(ell): ${SHELL:-sh}" >&2 + exec "${SHELL:-sh}" + fi } main() { + log DEBUG "Initialize" >&2 if command -v fzf >/dev/null 2>&1 then + log DEBUG "FZF available" >&2 choice=$(gather_choices | display_choices_fzf) else + log DEBUG "FZF not available" >&2 # shellcheck disable=SC2046 choice=$(display_choices_sh $(gather_choices)) fi diff --git a/display-manager/.local/etc/itsdm/startup b/display-manager/.local/etc/itsdm/startup index aee3122a..978037e7 100755 --- a/display-manager/.local/etc/itsdm/startup +++ b/display-manager/.local/etc/itsdm/startup @@ -79,6 +79,7 @@ if [ "${XDG_VTNR:-100}" -le 3 ]; then if command -v itsdm >/dev/null 2>&1; then # and not already running if [ -z "${ITSDM_PID}" ]; then + clear exec itsdm fi fi diff --git a/shells/.config/aptitude/.aptitude/config b/shells/.config/aptitude/.aptitude/config new file mode 100644 index 00000000..e69de29b diff --git a/shells/.config/aptitude/config b/shells/.config/aptitude/config new file mode 120000 index 00000000..bde264ec --- /dev/null +++ b/shells/.config/aptitude/config @@ -0,0 +1 @@ +.aptitude/config \ No newline at end of file diff --git a/shells/.config/dotfiles.d/interactive.d/less.sh b/shells/.config/dotfiles.d/interactive.d/less.sh index e78cde2f..894602da 100644 --- a/shells/.config/dotfiles.d/interactive.d/less.sh +++ b/shells/.config/dotfiles.d/interactive.d/less.sh @@ -1,2 +1,2 @@ #!/bin/sh -export LESS='--quit-if-one-screen --LONG-PROMPT --RAW-CONTROL-CHARS --HILITE-UNREAD --tabs=4 --no-init --window=-4' +export LESS='--quit-if-one-screen --LONG-PROMPT --RAW-CONTROL-CHARS --tabs=4 --no-init --window=-4' diff --git a/shells/.config/dotfiles.d/interactive.d/mnemonic.sh b/shells/.config/dotfiles.d/interactive.d/mnemonic.sh index 754354cb..8c15fdd2 100644 --- a/shells/.config/dotfiles.d/interactive.d/mnemonic.sh +++ b/shells/.config/dotfiles.d/interactive.d/mnemonic.sh @@ -18,8 +18,14 @@ fi alias h='head ' alias i='ipython ' # j -alias k='kill ' -alias k9='kill -9 ' +if command -v its-kill >/dev/null 2>&1 +then + alias k='its-kill ' + alias k9='its-kill -9 ' +else + alias k='kill ' + alias k9='kill -9 ' +fi # l _name= for _level in $(seq 1 5); do diff --git a/shells/.config/ssh/config b/shells/.config/ssh/config index ac8879d5..23a2fbea 100755 --- a/shells/.config/ssh/config +++ b/shells/.config/ssh/config @@ -1,5 +1,6 @@ Include ~/.local/share/ssh/config Host * - IdentityFile ~/.local/share/ssh/keys/id_rsa + AddKeysToAgent yes + IdentityFile ~/.config/ssh/keys/id_rsa UserKnownHostsFile ~/.cache/ssh_known_hosts diff --git a/shells/.config/user-dirs.dirs b/shells/.config/user-dirs.dirs index 1b51271d..570e2d72 100644 --- a/shells/.config/user-dirs.dirs +++ b/shells/.config/user-dirs.dirs @@ -11,8 +11,8 @@ XDG_DESKTOP_DIR="$HOME/.local/share/desktop" XDG_DOWNLOAD_DIR="$HOME/.local/share/downloads" XDG_TEMPLATES_DIR="$HOME/.config/templates" XDG_PUBLICSHARE_DIR="$HOME/.local/share/public" -XDG_DOCUMENTS_DIR="$HOME/media/documents" -XDG_MUSIC_DIR="$HOME/media/audio/music" -XDG_PICTURES_DIR="$HOME/media/pictures" +XDG_DOCUMENTS_DIR="$HOME/library/document" +XDG_MUSIC_DIR="$HOME/library/audio/music" +XDG_PICTURES_DIR="$HOME/library/image" XDG_STATE_HOME="$HOME/.local/var" -XDG_VIDEOS_DIR="$HOME/media/video" +XDG_VIDEOS_DIR="$HOME/library/video" diff --git a/shells/.local/bin/aptitude b/shells/.local/bin/aptitude new file mode 100755 index 00000000..258565cb --- /dev/null +++ b/shells/.local/bin/aptitude @@ -0,0 +1,10 @@ +#!/usr/bin/env sh +_command="$(command-shadowed -v "${0}")" +_HOME="${XDG_CONFIG_HOME:-${HOME}/.config}/aptitude" +CONFIG_BASE="${_HOME}/.aptitude" +CONFIG_FILE="${CONFIG_BASE}/config" + +[ -d "${CONFIG_BASE}" ] || mkdir -p "${CONFIG_BASE}" +[ -e "${CONFIG_FILE}" ] || touch "${CONFIG_FILE}" + +HOME="${_HOME}" "${_command}" "${@}" diff --git a/shells/.local/bin/firefox b/shells/.local/bin/firefox new file mode 100755 index 00000000..47f4f43d --- /dev/null +++ b/shells/.local/bin/firefox @@ -0,0 +1,5 @@ +#!/bin/sh +_command=$(command-shadowed -v "${0}") +private_directory="${XDG_CONFIG_HOME:-${HOME}/.config}/mozilla" +[ -d "${private_directory}" ] || mkdir -p "${private_directory}" +firejail --private="${private_directory}" "${_command}" "${@}" diff --git a/shells/.local/bin/thunderbird b/shells/.local/bin/thunderbird new file mode 100755 index 00000000..47f4f43d --- /dev/null +++ b/shells/.local/bin/thunderbird @@ -0,0 +1,5 @@ +#!/bin/sh +_command=$(command-shadowed -v "${0}") +private_directory="${XDG_CONFIG_HOME:-${HOME}/.config}/mozilla" +[ -d "${private_directory}" ] || mkdir -p "${private_directory}" +firejail --private="${private_directory}" "${_command}" "${@}" diff --git a/shells/.local/bin/grep-right b/utils/.local/bin/grep-right similarity index 99% rename from shells/.local/bin/grep-right rename to utils/.local/bin/grep-right index cdc23f85..2efcc97b 100755 --- a/shells/.local/bin/grep-right +++ b/utils/.local/bin/grep-right @@ -28,10 +28,8 @@ #h OVERVIEW: #h By setting **GREP_EXCLUDE_PATH**=; and **GREP_EXCLUDE_GLOB**=;, #h **grep-right** fallback -#h +#h #h TODO: More here... -#h -#h #h #h OPTIONS: #h **grep-right** acts as a proxy wrapper for **grep**, @@ -99,8 +97,6 @@ set -eau # o pipefail GREP_EXCLUDE_PATH=${GREP_EXCLUDE_PATH:-'.cvs:.git:.hg:.svn:__pycache__:test_root:dist:node_modules:coverage:htmlcov:cover'} GREP_EXCLUDE_GLOB=${GREP_EXCLUDE_GLOB:-'*.po:*.mo'} -_NAME=${0} - help() { grep '^#h' "${1}" | sed 's/^#h \?//g'; } usage() { echo "Usage:"; help "${@}" | awk 'BEGIN { inside=0 }; /^[^\t]/ { inside=0 } inside; /^SYNOPSIS/ { inside=1 };'; } diff --git a/shells/.local/bin/grep-right-doc b/utils/.local/bin/grep-right-doc similarity index 100% rename from shells/.local/bin/grep-right-doc rename to utils/.local/bin/grep-right-doc diff --git a/shells/.local/bin/grep-right-each b/utils/.local/bin/grep-right-each similarity index 100% rename from shells/.local/bin/grep-right-each rename to utils/.local/bin/grep-right-each diff --git a/shells/.local/bin/grep-right-edit b/utils/.local/bin/grep-right-edit similarity index 100% rename from shells/.local/bin/grep-right-edit rename to utils/.local/bin/grep-right-edit diff --git a/shells/.local/bin/grep-right-list-files b/utils/.local/bin/grep-right-list-files similarity index 100% rename from shells/.local/bin/grep-right-list-files rename to utils/.local/bin/grep-right-list-files diff --git a/shells/.local/bin/grep-right-list-files-null b/utils/.local/bin/grep-right-list-files-null similarity index 100% rename from shells/.local/bin/grep-right-list-files-null rename to utils/.local/bin/grep-right-list-files-null diff --git a/shells/.local/bin/grep-right-py b/utils/.local/bin/grep-right-py similarity index 100% rename from shells/.local/bin/grep-right-py rename to utils/.local/bin/grep-right-py diff --git a/shells/.local/bin/grep-right-www b/utils/.local/bin/grep-right-www similarity index 100% rename from shells/.local/bin/grep-right-www rename to utils/.local/bin/grep-right-www diff --git a/utils/.local/bin/its-kill b/utils/.local/bin/its-kill new file mode 100755 index 00000000..cfc0c1b9 --- /dev/null +++ b/utils/.local/bin/its-kill @@ -0,0 +1,32 @@ +#!/bin/sh +get_process_id() { + process_id="$( \ + pgrep \ + --list-name \ + --list-full \ + --euid "${USER}" \ + "${search}" \ + | fzf \ + --tac \ + --exact \ + ; + )" + if [ -n "${process_id}" ] + then + set -- ${process_id} + echo "${1}" + fi +} + +flag= +search="${1}" +if [ "${search}" = '-9' ] +then + search="${2}" + flag='-9' +fi +process_id="$(get_process_id "${search}")" +if [ -n "${process_id}" ] +then + kill ${flag} "${process_id}" +fi diff --git a/utils/.local/bin/its-terminal b/utils/.local/bin/its-terminal index 3f917dc2..8002f1e4 100755 --- a/utils/.local/bin/its-terminal +++ b/utils/.local/bin/its-terminal @@ -72,6 +72,15 @@ do fi done +# It's likely that this symlink (if it exists) +# points to a terminal we've already found above (see: *${terminals}*), +# so it's unlikely that this will be true, +# but let's check it anyway, to be sure (:shrug:). +if [ -e /etc/alternatives/x-terminal-emulator ] +then + exec /etc/alternatives/x-terminal-emulator "${@}" +fi + message="Could not find a terminal emulator; please install one: Suggestions: diff --git a/vim-plugins/.config/vim/bundle/rainbow_csv b/vim-plugins/.config/vim/bundle/rainbow_csv new file mode 160000 index 00000000..362e9929 --- /dev/null +++ b/vim-plugins/.config/vim/bundle/rainbow_csv @@ -0,0 +1 @@ +Subproject commit 362e99292e6c56e79bdf2230d6f44364b68d6d5f diff --git a/vim-plugins/.config/vim/bundle/rainbow_parentheses b/vim-plugins/.config/vim/bundle/rainbow_parentheses new file mode 160000 index 00000000..eb8baa54 --- /dev/null +++ b/vim-plugins/.config/vim/bundle/rainbow_parentheses @@ -0,0 +1 @@ +Subproject commit eb8baa5428bde10ecc1cb14eed1d6e16f5f24695 diff --git a/vim-plugins/.config/vim/bundle/yaml b/vim-plugins/.config/vim/bundle/yaml new file mode 160000 index 00000000..dce19542 --- /dev/null +++ b/vim-plugins/.config/vim/bundle/yaml @@ -0,0 +1 @@ +Subproject commit dce19542d5ec1663183b0f6844ec663b5d1f3d24 diff --git a/window-manager/.config/i3/config b/window-manager/.config/i3/config index b913eb2d..21577853 100644 --- a/window-manager/.config/i3/config +++ b/window-manager/.config/i3/config @@ -36,7 +36,7 @@ bindsym $mod+Shift+x exec i3lock --color=000000 && systemctl suspend # Startup default windows exec --no-startup-id thunderbird exec --no-startup-id discord -exec --no-startup-id i3-msg 'workspace 2; exec xfce4-terminal --hide-menubar --hide-toolbar -e "screen -UrxR wip"; workspace 2' +exec --no-startup-id i3-msg 'workspace 2; exec xfce4-terminal --hide-menubar --hide-toolbar -e "screens"; workspace 2' exec --no-startup-id firefox --new-instance exec --no-startup-id i3-msg 'workspace 4; exec cool-retro-term -e screen -UrxR focus; workspace 2'