Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: cherry-pick changes from laptop WIP branch #127

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b93748b
refactor(xdg)!: move multimedia data to ~/library/...
Apr 22, 2022
aac6635
feat(ufw): add basic firewall rules
May 5, 2022
ddd8180
chore: update firefox extensions
May 5, 2022
191b160
feat(i3): add separate config for py3status
May 5, 2022
b9487fe
feat(xdg): move firefox/thunderbird config to ${XDG_CONFIG_HOME}
May 5, 2022
dac4deb
fix(ssh)!: update ssh config settings
May 5, 2022
15fc88e
feat(py3status): launch pavucontrol on sound bar click
May 6, 2022
b3d8baa
fixup! fix: move grep helper to executable, grep-right
May 6, 2022
018e922
fixup! fixup! fix: move grep helper to executable, grep-right
May 6, 2022
2bb05c1
feat(xdg): force aptitude to be XDG-compliant
May 11, 2022
d8bfe8a
temp: wip rainbows and apt
Jun 13, 2022
e35254d
build: ignore backup files
Jun 25, 2022
496c36f
fix(i3): run custom screen wrapper instead of screen w/ options
Jun 25, 2022
f38e998
feat(kill): add its-kill helper
Jun 25, 2022
512a1c8
fix(less): remove line hilighter when paging
Jun 25, 2022
36fef2a
fix(its-terminal): add fallback option to terminal selection
Jun 25, 2022
c1fbcd3
feat(itsdm): add new ITSDM_PATH variable to customize xsession locations
Jul 12, 2022
ff7ff82
feat(itsdm): customize preferred xsession via ENVIRONMENT
Jul 12, 2022
da85bce
feat(itsdm): fall back to a safe shell if none selected
Jul 12, 2022
ea1c64a
build(itsdm): include process ID in log messages
Jul 12, 2022
6b6312f
build(itsdm): add more logging to ease debugging
Jul 12, 2022
ea397c1
fix(itsdm): clear screen before exec'ing itsdm on startup
Jul 12, 2022
866fc08
feat: add vim yaml plugin
Dec 27, 2023
f44f3d4
fixup! feat(kill): add its-kill helper
Nov 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
.zcomp*
autojump/.local/bin/pip*
autojump/.local/lib/
backup/
config.local
history
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions .requirements/configure.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 20 additions & 9 deletions .requirements/firefox.txt
Original file line number Diff line number Diff line change
@@ -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
58 changes: 51 additions & 7 deletions display-manager/.local/bin/itsdm
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,29 @@
#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
#h PAGER
#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
Expand Down Expand Up @@ -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=
Expand Down Expand Up @@ -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\)=' \
{} \
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions display-manager/.local/etc/itsdm/startup
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Empty file.
1 change: 1 addition & 0 deletions shells/.config/aptitude/config
2 changes: 1 addition & 1 deletion shells/.config/dotfiles.d/interactive.d/less.sh
Original file line number Diff line number Diff line change
@@ -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'
10 changes: 8 additions & 2 deletions shells/.config/dotfiles.d/interactive.d/mnemonic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion shells/.config/ssh/config
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions shells/.config/user-dirs.dirs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
10 changes: 10 additions & 0 deletions shells/.local/bin/aptitude
Original file line number Diff line number Diff line change
@@ -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}" "${@}"
5 changes: 5 additions & 0 deletions shells/.local/bin/firefox
Original file line number Diff line number Diff line change
@@ -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}" "${@}"
5 changes: 5 additions & 0 deletions shells/.local/bin/thunderbird
Original file line number Diff line number Diff line change
@@ -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}" "${@}"
6 changes: 1 addition & 5 deletions shells/.local/bin/grep-right → utils/.local/bin/grep-right
Original file line number Diff line number Diff line change
Expand Up @@ -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**,
Expand Down Expand Up @@ -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 };'; }

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
32 changes: 32 additions & 0 deletions utils/.local/bin/its-kill
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions utils/.local/bin/its-terminal
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions vim-plugins/.config/vim/bundle/rainbow_csv
Submodule rainbow_csv added at 362e99
1 change: 1 addition & 0 deletions vim-plugins/.config/vim/bundle/rainbow_parentheses
Submodule rainbow_parentheses added at eb8baa
1 change: 1 addition & 0 deletions vim-plugins/.config/vim/bundle/yaml
Submodule yaml added at dce195
2 changes: 1 addition & 1 deletion window-manager/.config/i3/config
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
Loading