diff options
28 files changed, 102 insertions, 129 deletions
@@ -186,3 +186,4 @@ /less/less /mutt/filters/markdown-to-html /urxvt/ext/select +/X/xsession @@ -41,7 +41,9 @@ install-pyenv \ install-rbenv \ install-readline \ + install-redshift \ install-sh \ + install-sxhkd \ install-subversion \ install-systemd \ install-terminfo \ @@ -274,7 +276,8 @@ all: $(BINS) \ $(GIT_TEMPLATE_HOOKS) \ git/config \ gnupg/profile.d/gnupg.sh \ - less/less + less/less \ + X/xsession clean distclean: rm -f -- \ @@ -293,7 +296,7 @@ clean distclean: less/less \ mutt/filters/markdown-to-html \ urxvt/ext/select \ - vim/dist/* + X/xsession .awk: sh bin/shb.sh awk -f < $< > $@ @@ -415,6 +418,7 @@ install-dillo: dillo/dillorc install-x install-dunst: install-x mkdir -p -- $(XDG_CONFIG_HOME)/dunst cp -p -- dunst/dunstrc $(XDG_CONFIG_HOME)/dunst + cp -p -- dunst/xsession.d/* $(HOME)/.xsession.d install-emacs: emacs/bin/emacsm install-sh mkdir -p -- $(HOME)/.local/bin @@ -550,6 +554,15 @@ install-rbenv: install-sh install-readline: cp -p -- readline/inputrc $(HOME)/.inputrc +install-redshift: install-x + cp -p -- redshift/redshift.conf $(XDG_CONFIG_HOME) + cp -p -- redshift/xsession.d/* $(HOME)/.xsession.d + +install-sxhkd: install-x install-urxvt + mkdir -p -- $(XDG_CONFIG_HOME)/sxhkd + cp -p -- sxhkd/sxhkdrc $(XDG_CONFIG_HOME)/sxhkd + cp -p -- sxhkd/xsession.d/* $(HOME)/.xsession.d + install-sh: check-sh mkdir -p -- $(HOME)/.profile.d $(HOME)/.shrc.d cp -p -- sh/profile $(HOME)/.profile @@ -588,9 +601,11 @@ install-tidy: install-sh install-tmux: tmux/tmux.conf install-terminfo cp -p -- tmux/tmux.conf $(HOME)/.tmux.conf -install-urxvt: urxvt/ext/select +install-urxvt: urxvt/ext/select install-x mkdir -p -- $(HOME)/.urxvt/ext - cp -- urxvt/ext/select $(HOME)/.urxvt/ext + cp -p -- urxvt/ext/select $(HOME)/.urxvt/ext + cp -p -- urxvt/Xresources.d/* $(HOME)/.Xresources.d + cp -p -- urxvt/xsession.d/* $(HOME)/.xsession.d VIM = vim VIMDIR = $(HOME)/.vim @@ -629,15 +644,11 @@ install-wget: install-sh mkdir -p -- $(XDG_CACHE_HOME)/wget $(XDG_CONFIG_HOME)/wget cp -p -- wget/wgetrc $(XDG_CONFIG_HOME)/wget/wgetrc -install-x: check-xsession +install-x: X/xsession check-xsession mkdir -p -- \ - $(XDG_CONFIG_HOME)/sxhkd \ $(HOME)/.xsession.d \ $(HOME)/.Xresources.d - cp -p -- X/redshift.conf $(XDG_CONFIG_HOME) - cp -p -- X/sxhkdrc $(XDG_CONFIG_HOME)/sxhkd cp -p -- X/xsession $(HOME)/.xsession - cp -p -- X/xsession.d/*.sh $(HOME)/.xsession.d cp -p -- X/Xresources $(HOME)/.Xresources cp -p -- X/Xresources.d/* $(HOME)/.Xresources.d @@ -685,7 +696,7 @@ check-sh: check-urxvt: urxvt/ext/select sh check/urxvt.sh -check-xsession: +check-xsession: X/xsession sh check/xsession.sh check-zsh: @@ -1,2 +1,2 @@ -tejr dotfiles v11.20.0 -Wed, 27 Apr 2022 09:50:29 +0000 +tejr dotfiles v11.21.0 +Sat, 30 Apr 2022 13:02:16 +0000 diff --git a/X/xsession b/X/xsession deleted file mode 100644 index b8fdcce6..00000000 --- a/X/xsession +++ /dev/null @@ -1,15 +0,0 @@ -# If a file ~/.xrandrrc exists for monitor setup, source that first -# shellcheck disable=SC1091 -[ -e "$HOME"/.xrandrrc ] && . "$HOME"/.xrandrrc - -# Faster mouse acceleration with a natural threshold -xset mouse 5/2 0 - -# Load all supplementary scripts in ~/.xsession.d -for sh in "$HOME"/.xsession.d/*.sh ; do - [ -e "$sh" ] && . "$sh" -done -unset -v sh - -# Start i3 window manager -exec i3 diff --git a/X/xsession.d/background.sh b/X/xsession.d/background.sh deleted file mode 100644 index 85a40889..00000000 --- a/X/xsession.d/background.sh +++ /dev/null @@ -1,7 +0,0 @@ -# If there's a ~/.fehbg, just run that; otherwise, try to apply a random -# background image, if the relevant dir exists -if [ -e "$HOME"/.fehbg ] ; then - sh -- "$HOME"/.fehbg -elif [ -d "${XBACKGROUNDS:-"$HOME"/.xbackgrounds}" ] ; then - xrbg -fi diff --git a/X/xsession.d/browser.sh b/X/xsession.d/browser.sh deleted file mode 100644 index 024075d6..00000000 --- a/X/xsession.d/browser.sh +++ /dev/null @@ -1,26 +0,0 @@ -# Choose a GUI browser with some rough heuristics - -# If LibreWolf or failing that Firefox is available, start by assuming that -if command -v librewolf >/dev/null 2>&1 ; then - BROWSER=librewolf -elif command -v firefox >/dev/null 2>&1 ; then - BROWSER=firefox -fi - -# Consider a switch to Dillo... -if ( - # No output, please - exec >/dev/null 2>&1 - # Don't switch if it's not there - command -v dillo || exit 1 - # Do switch if neither LibreWolf nor Firefox are there - command -v librewolf || command -v firefox || exit 0 - # Do switch if procfs says we have less than 2GB of RAM - awk '$1=="MemTotal:"&&$2<2^20{m++}END{exit!m}' < /proc/meminfo -) ; then - BROWSER=dillo -fi - -# Export our choice of browser, if it isn't empty -[ -n "$BROWSER" ] || return -export BROWSER diff --git a/X/xsession.d/redshift.sh b/X/xsession.d/redshift.sh deleted file mode 100644 index d5d58d8a..00000000 --- a/X/xsession.d/redshift.sh +++ /dev/null @@ -1,3 +0,0 @@ -# Start redshift(1) -command -v redshift >/dev/null 2>&1 || return -redshift & diff --git a/X/xsession.d/ssh.sh b/X/xsession.d/ssh.sh deleted file mode 100644 index 005743fe..00000000 --- a/X/xsession.d/ssh.sh +++ /dev/null @@ -1,4 +0,0 @@ -# Set SSH_ASKPASS if we can find one -command -v ssh-askpass >/dev/null 2>&1 || return -SSH_ASKPASS=$(command -v ssh-askpass) -export SSH_ASKPASS diff --git a/X/xsession.d/sxhkd.sh b/X/xsession.d/sxhkd.sh deleted file mode 100644 index 132d8f8a..00000000 --- a/X/xsession.d/sxhkd.sh +++ /dev/null @@ -1,3 +0,0 @@ -# Start sxhkd(1) -command -v sxhkd >/dev/null 2>&1 || return -sxhkd & diff --git a/X/xsession.d/urxvt.sh b/X/xsession.d/urxvt.sh deleted file mode 100644 index a5eb0940..00000000 --- a/X/xsession.d/urxvt.sh +++ /dev/null @@ -1,3 +0,0 @@ -# Start urxvtd(1) -command -v urxvtd >/dev/null 2>&1 || return -urxvtd -o -q & diff --git a/X/xsession.d/xkb.sh b/X/xsession.d/xkb.sh deleted file mode 100644 index a5142398..00000000 --- a/X/xsession.d/xkb.sh +++ /dev/null @@ -1,5 +0,0 @@ -# Map Caps Lock as a Ctrl key, use right alt as Compose, kill X server with -# Ctrl+Alt+Backspace -# <https://en.wikipedia.org/wiki/Compose_key#Common_compose_combinations> -command -v setxkbmap >/dev/null 2>&1 || return -setxkbmap -option compose:ralt,ctrl:nocaps,terminate:ctrl_alt_bksp diff --git a/X/xsession.sh b/X/xsession.sh new file mode 100644 index 00000000..9c0dcab7 --- /dev/null +++ b/X/xsession.sh @@ -0,0 +1,52 @@ +# Custom i3wm X session to fit into Debian's way of doing things + +# Monitor and wallpaper setup is very machine-specific, and isn't versioned in +# here. Neither xrandr(1) nor xwallpaper(1) have config files, so we fake it +# with xargs and looking for a file with argument tokens to read in +# XDG_CONFIG_HOME, which will almost always be: +# +# - ~/.config/xrandr/config +# - ~/.config/xwallpaper/config +# +# We figure each one out in a subshell, so that we can use a temporary variable +# for the configuration path without polluting the namespace of the rest of +# this script. +# +for program in xrandr xwallpaper ; do ( + command -v "$program" >/dev/null 2>&1 || exit + config=${XDG_CONFIG_HOME:-"$HOME"/.config}/"$program"/config + [ -e "$config" ] || exit + xargs "$program" < "$config" +) ; done + +# Set a few keyboard map options +# - Remap right Alt as a Compose key +# - Remap Caps Lock as another Control key +# - Kill X server with Ctrl+Alt+Backspace +setxkbmap \ + -option compose:ralt \ + -option ctrl:nocaps \ + -option terminate:ctrl_alt_bksp & + +# Set fast mouse acceleration with a natural threshold +xset mouse 5/2 0 & + +# Pick a GUI browser, depending on availability +if command -v librewolf >/dev/null 2>&1 ; then + BROWSER=librewolf +elif command -v firefox >/dev/null 2>&1 ; then + BROWSER=firefox +fi +if [ -n "$BROWSER" ] ; then + export BROWSER +fi + +# Load all supplementary scripts in ~/.xsession.d +for sh in "$HOME"/.xsession.d/*.sh ; do + [ -e "$sh" ] || continue + . "$sh" +done +unset -v sh + +# Start i3 window manager now that everything's ready +exec i3 diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash index 86691a9c..bdea7ace 100644 --- a/bash/bashrc.d/prompt.bash +++ b/bash/bashrc.d/prompt.bash @@ -7,7 +7,7 @@ prompt() { # Turn complex, colored PS1 and debugging PS4 prompts on on) # Set up pre-prompt command - PROMPT_COMMAND='history -a' + PROMPT_COMMAND='PROMPT_RETURN=$?;history -a' # If Bash 4.0 is available, trim very long paths in prompt if ((BASH_VERSINFO[0] >= 4)) ; then @@ -31,7 +31,7 @@ prompt() { ## Preload libraries as prefix PS1='$(prompt preload)'$PS1 ## VCS, job, and return status checks as suffixes - PS1=$PS1'$(ret=$?;prompt vcs;prompt job;prompt ret)' + PS1=$PS1'$(prompt vcs;prompt job;prompt ret)' # Add prefix and suffix PS1='${PROMPT_PREFIX}'$PS1'${PROMPT_SUFFIX}' @@ -267,8 +267,8 @@ prompt() { # Show return status of previous command in angle brackets, if not zero ret) # shellcheck disable=SC2154 - ((ret)) || return - printf '<%u>' "${ret//\\/\\\\}" + ((PROMPT_RETURN)) || return + printf '<%u>' "${PROMPT_RETURN//\\/\\\\}" ;; # Show the count of background jobs in curly brackets, if not zero diff --git a/bin/gscr.sh b/bin/gscr.sh index 2fbee05a..26eafb12 100644..100755 --- a/bin/gscr.sh +++ b/bin/gscr.sh @@ -16,11 +16,16 @@ for arg in "${@:-.}" ; do ( ;; esac + # Remove any original refs from a prior rewrite + if [ -e refs/original ] ; then + rm -r -- refs/original || exit + fi + # Check for bad references or other integrity/sanity problems - git fsck || exit + git fsck --full --no-reflogs || exit # Expire dangling references - git reflog expire --expire=now || exit + git reflog expire --all --expire=now --expire-unreachable=now || exit # Remove dangling references git gc --prune=now --aggressive || exit diff --git a/check/xsession.sh b/check/xsession.sh index 0e8db668..66ed611f 100644 --- a/check/xsession.sh +++ b/check/xsession.sh @@ -1,6 +1 @@ -set \ - X/xsession \ - X/xsession.d/*.sh -for xsession do - sh -n -- "$xsession" || exit -done +sh -n -- X/xsession diff --git a/cpanm/profile.d/cpanm.sh b/cpanm/profile.d/cpanm.sh index a7854e40..a860162e 100644 --- a/cpanm/profile.d/cpanm.sh +++ b/cpanm/profile.d/cpanm.sh @@ -1,2 +1,3 @@ +# Set home directory for cpanm files to be XDG-conformant PERL_CPANM_HOME=${XDG_CACHE_HOME:-$HOME/.cache}/cpanm export PERL_CPANM_HOME diff --git a/X/xsession.d/dunst.sh b/dunst/xsession.d/dunst.sh index bddaa1fe..6aad0c86 100644 --- a/X/xsession.d/dunst.sh +++ b/dunst/xsession.d/dunst.sh @@ -1,3 +1,2 @@ # Start dunst(1) to display libnotify messages -command -v dunst >/dev/null 2>&1 || return dunst & diff --git a/git/config.mi5 b/git/config.mi5 index 78616077..cc7456b5 100644 --- a/git/config.mi5 +++ b/git/config.mi5 @@ -34,6 +34,9 @@ [status] short = true +[tag] + sort = -taggerdate + [user] name = <% NAME %> email = <% EMAIL %> diff --git a/ksh/kshrc.d/prompt.ksh b/ksh/kshrc.d/prompt.ksh index efc5c4e3..b0023670 100644 --- a/ksh/kshrc.d/prompt.ksh +++ b/ksh/kshrc.d/prompt.ksh @@ -31,8 +31,6 @@ function prompt { esac # Add sub-commands: - ## Preload libraries as prefix - PS1='$(prompt preload)'$PS1 ## VCS, job, and return status checks as suffixes PS1=$PS1'$(ret=$?;jobc=$(jobs -p|sed -n '\''$='\'');prompt pwd;prompt vcs;prompt job;prompt ret;:)' @@ -208,21 +206,6 @@ function prompt { fi ;; - # Analyze LD_PRELOAD to see if we should report anything loaded - preload) - printf '%s:' "$LD_PRELOAD" | - while read -d : -r ; do - case $REPLY in - (*/libip2unix.so) - printf '[IP2Unix]' - ;; - (*/libtorsocks.so) - printf '[Tor]' - ;; - esac - done - ;; - # Abbreviated working directory pwd) case $PWD in diff --git a/lint/xsession.sh b/lint/xsession.sh index fd60c864..4aa5c7ca 100644 --- a/lint/xsession.sh +++ b/lint/xsession.sh @@ -1,4 +1 @@ -set \ - X/xsession \ - X/xsession.d/*.sh -shellcheck -e SC1090 -s sh -- "$@" +shellcheck -e SC1090 -s sh -- X/xsession diff --git a/X/redshift.conf b/redshift/redshift.conf index 1e1de4ee..1e1de4ee 100644 --- a/X/redshift.conf +++ b/redshift/redshift.conf diff --git a/redshift/xsession.d/redshift.sh b/redshift/xsession.d/redshift.sh new file mode 100644 index 00000000..929f564e --- /dev/null +++ b/redshift/xsession.d/redshift.sh @@ -0,0 +1,2 @@ +# Start redshift(1) +redshift & diff --git a/X/sxhkdrc b/sxhkd/sxhkdrc index c277855b..c277855b 100644 --- a/X/sxhkdrc +++ b/sxhkd/sxhkdrc diff --git a/sxhkd/xsession.d/sxhkd.sh b/sxhkd/xsession.d/sxhkd.sh new file mode 100644 index 00000000..1b286c1f --- /dev/null +++ b/sxhkd/xsession.d/sxhkd.sh @@ -0,0 +1,2 @@ +# Start sxhkd(1) +sxhkd & diff --git a/X/Xresources.d/URxvt b/urxvt/Xresources.d/URxvt index f4c30d54..f4c30d54 100644 --- a/X/Xresources.d/URxvt +++ b/urxvt/Xresources.d/URxvt diff --git a/urxvt/xsession.d/urxvt.sh b/urxvt/xsession.d/urxvt.sh new file mode 100644 index 00000000..34b9f904 --- /dev/null +++ b/urxvt/xsession.d/urxvt.sh @@ -0,0 +1,2 @@ +# Run urxvtd(1) in the background +urxvtd --fork --opendisplay --quiet diff --git a/vim/filetype.vim b/vim/filetype.vim index c461e503..15603885 100644 --- a/vim/filetype.vim +++ b/vim/filetype.vim @@ -370,6 +370,9 @@ augroup filetypedetect \,profile \,shinit \,shrc + \,xinitrc + \,xsession + \,xsessionrc \,/etc/X11/xinit \,/etc/X11/Xreset \,/etc/X11/Xsession diff --git a/zsh/zshrc.d/prompt.zsh b/zsh/zshrc.d/prompt.zsh index 317aba56..eb43484f 100644 --- a/zsh/zshrc.d/prompt.zsh +++ b/zsh/zshrc.d/prompt.zsh @@ -22,8 +22,6 @@ prompt() { esac # Add sub-commands: - ## Preload libraries as prefix - PS1='$(prompt preload)'$PS1 ## VCS, job, and return status checks as suffixes PS1=$PS1'$(ret=$?;prompt vcs;prompt job;prompt ret)' @@ -56,21 +54,6 @@ prompt() { fi ;; - # Analyze LD_PRELOAD to see if we should report anything loaded - preload) - printf '%s:' "$LD_PRELOAD" | - while read -d : -r ; do - case $REPLY in - (*/libip2unix.so) - printf '[IP2Unix]' - ;; - (*/libtorsocks.so) - printf '[Tor]' - ;; - esac - done - ;; - git) # Wrap as compound command; we don't want to see output from any of |