From: sev Date: Mon, 17 Jul 2023 07:50:51 +0000 (-0500) Subject: major rework X-Git-Url: https://git.sev.monster/~sev/dotfiles.git/commitdiff_plain/8d4a98e19ec40334ed8e8f2ce4e5a9f094bdbcaf?ds=inline major rework - remove unused configs, themes, icons, scripts - update installer - now respect xdg env vars - clean out old links from our source tree before reinstall - apply default permissions to created dirs - update vim - remove unused plugins - move vim dir to xdg config dir (zsh VIMINIT) - undo and backup dirs are autocreated and are moved to xdg - remove modeline support - add editorconfig plugin - update zsh - move zsh dotfiles to xdg config subdir - all zsh local dotfiles are now relative to ZDOTDIR - xdg env vars are now mostly default - better xdg handling in general - fixed xdg *_DIRS empty array index - redesign tmpdir generation method - ~/bin moved to ~/.local/bin per xdg - better broken TERM handling - ~/.gnupg moved to ~/.config/gnupg - gpgagent refresh is more usable now - preferred list of EDITORs, PAGERs, and TERMINALs - ~/.zcompdump moved to ~/.cache/zsh/.zcompdump - prompt_arrows_preexec removed because it's annoying - python - ~/.pythonrc moved to ~/.config/pythonrc (zshrc PYTHONSTARTUP) --- diff --git a/.gitignore b/.gitignore index 24e6eac..aa37e85 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,5 @@ -# tint2 config -etc/tint2/tint2rc.backup.* - -# sway site-local configs -etc/sway/config.d - # vim -base/.vim/.netrwhist +/etc/vim/.netrwhist *.swp *.swo diff --git a/.gitmodules b/.gitmodules index af0b418..8951e4c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,21 +1,18 @@ [submodule "todo.txt-vim"] - path = base/.vim/pack/todo.txt/start/todo.txt-vim + path = etc/vim/pack/todo.txt-vim/start/todo.txt-vim url = https://github.com/freitass/todo.txt-vim [submodule "vim-surround"] - path = base/.vim/pack/surround.vim/start/vim-surround + path = etc/vim/pack/vim-surround/start/vim-surround url = https://github.com/tpope/vim-surround [submodule "vim-commentary"] - path = base/.vim/pack/commentary.vim/start/vim-commentary + path = etc/vim/pack/vim-commentary/start/vim-commentary url = https://github.com/tpope/vim-commentary [submodule "vim-speeddating"] - path = base/.vim/pack/speeddating.vim/start/vim-speeddating + path = etc/vim/pack/vim-speeddating/start/vim-speeddating url = https://github.com/tpope/vim-speeddating [submodule "vim-repeat"] - path = base/.vim/pack/repeat.vim/start/vim-repeat + path = etc/vim/pack/vim-repeat/start/vim-repeat url = https://github.com/tpope/vim-repeat -[submodule "paper-icon-theme"] - path = gui/icons/paper-icon-theme - url = https://github.com/snwh/paper-icon-theme -[submodule "Blackbird"] - path = gui/themes/Blackbird - url = https://github.com/shimmerproject/Blackbird +[submodule "editorconfig-vim"] + path = etc/vim/pack/editorconfig-vim/start/editorconfig-vim + url = https://github.com/editorconfig/editorconfig-vim.git diff --git a/base/.Xresources b/base/.Xresources deleted file mode 100644 index f3ed5f7..0000000 --- a/base/.Xresources +++ /dev/null @@ -1,50 +0,0 @@ -! fonts -! X11 font server fontspec -*font: -windows-dina-medium-r-*-*-10-80-*-*-*-*-* -! xft/fontconfig -! NOTE: xterm etc. use faceName for Xft fonts. classic font server rendering is -! preferred so this is just in case the program doesn't support PCF. -*faceName: Dina -*faceSize: 8 -! matches font.conf, just in case -Xft.antialias: 1 -Xft.rgba: rgb -Xft.hinting: 1 -Xft.hintstyle: hintslight - -! theming -Xcursor.theme: Paper - -! colors -*background: #010812 -*foreground: #798699 -*fading: 40 -*fadeColor: #820ad5 -*cursorColor: #6408a4 -*pointerColorBackground: #6408a4 -*pointerColorForeground: #191c21 -*underlineColor: #d5820a -! black/grey -*color0: #191c21 -*color8: #3b434e -! red -*color1: #d51d0a -*color9: #f4321e -! green -*color2: #5dd50a -*color10: #75f41e -! yellow -*color3: #d5820a -*color11: #f49d1e -! blue -*color4: #0a5dd5 -*color12: #1e75f4 -! magenta -*color5: #820ad5 -*color13: #9d1ef4 -! cyan -*color6: #0ac2d5 -*color14: #1ee0f4 -! light grey/white -*color7: #bcc2cc -*color15: #e8ebee diff --git a/base/.dialogrc b/base/.dialogrc deleted file mode 100644 index db84b97..0000000 --- a/base/.dialogrc +++ /dev/null @@ -1,40 +0,0 @@ -use_colors = ON -use_shadow = ON -screen_color = (BLUE,BLACK,ON) -dialog_color = (WHITE,BLACK,OFF) -shadow_color = (BLACK,BLACK,OFF) -title_color = screen_color -border_color = (WHITE,BLACK,ON) -button_inactive_color = border_color -button_key_inactive_color = (BLUE,BLACK,ON) -button_label_inactive_color = button_inactive_color -button_active_color = (WHITE,BLUE,ON) -button_key_active_color = button_key_inactive_color -button_label_active_color = (WHITE,BLUE,ON) -inputbox_color = dialog_color -inputbox_border_color = dialog_color -searchbox_color = dialog_color -searchbox_title_color = title_color -searchbox_border_color = border_color -position_indicator_color = title_color -menubox_color = dialog_color -menubox_border_color = border_color -item_color = dialog_color -item_selected_color = button_active_color -tag_color = title_color -tag_selected_color = button_label_active_color -tag_key_color = button_key_inactive_color -tag_key_selected_color = (BLACK,BLUE,ON) -check_color = dialog_color -check_selected_color = button_active_color -uarrow_color = (GREEN,BLACK,ON) -darrow_color = uarrow_color -itemhelp_color = (WHITE,BLACK,OFF) -form_active_text_color = button_active_color -form_text_color = border_color -form_item_readonly_color = (BLACK,WHITE,ON) -gauge_color = title_color -border2_color = dialog_color -inputbox_border2_color = dialog_color -searchbox_border2_color = dialog_color -menubox_border2_color = dialog_color diff --git a/base/.gtkrc-2.0 b/base/.gtkrc-2.0 deleted file mode 100644 index 0cbe8e5..0000000 --- a/base/.gtkrc-2.0 +++ /dev/null @@ -1,5 +0,0 @@ -gtk-font-name="monospace-10" -gtk-theme-name="Blackbird" -gtk-icon-theme-name="Paper-Mono-Dark" -gtk-cursor-theme-name="Paper" -gtk-cursor-theme-size="24" diff --git a/base/.pythonrc b/base/.pythonrc deleted file mode 100644 index 35ef266..0000000 --- a/base/.pythonrc +++ /dev/null @@ -1,3 +0,0 @@ -def clear(): - import os - os.system('clear') diff --git a/base/.vim/pack/commentary.vim/start/vim-commentary b/base/.vim/pack/commentary.vim/start/vim-commentary deleted file mode 160000 index 627308e..0000000 --- a/base/.vim/pack/commentary.vim/start/vim-commentary +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 627308e30639be3e2d5402808ce18690557e8292 diff --git a/base/.vim/pack/speeddating.vim/start/vim-speeddating b/base/.vim/pack/speeddating.vim/start/vim-speeddating deleted file mode 160000 index 95da3d7..0000000 --- a/base/.vim/pack/speeddating.vim/start/vim-speeddating +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 95da3d72efc91a5131acf388eafa4b1ad6512a9b diff --git a/base/.vim/pack/surround.vim/start/vim-surround b/base/.vim/pack/surround.vim/start/vim-surround deleted file mode 160000 index baf89ad..0000000 --- a/base/.vim/pack/surround.vim/start/vim-surround +++ /dev/null @@ -1 +0,0 @@ -Subproject commit baf89ad26488f6a7665d51b986f5c7ad2d22b30b diff --git a/base/.vim/plugin/modeliner.vim b/base/.vim/plugin/modeliner.vim deleted file mode 100644 index 41b710c..0000000 --- a/base/.vim/plugin/modeliner.vim +++ /dev/null @@ -1,226 +0,0 @@ -" Modeliner -" -" Version: 0.3.0 -" Description: -" -" Generates a modeline from current settings. -" -" Last Change: 27-Jun-2008. -" Maintainer: Shuhei Kubota -" -" Usage: -" execute ':Modeliner'. -" Then a modeline is generated. -" -" The modeline will either be appended next to the current line or replace -" the existing one. -" -" If you want to customize option, modify g:Modeliner_format. - -if !exists('g:Modeliner_format') - let g:Modeliner_format = 'et ff= fenc= sts= sw= ts=' - " /[ ,:]/ delimited. - " - " if the type of a option is NOT 'boolean' (see :help 'option-name'), - " append '=' to the end of each option. -endif - - -"[text] vi: tw=80 noai -"[text] vim:tw=80 noai -" ex:tw=80 : noai: -" -"[text] vim: set tw=80 noai:[text] -"[text] vim: se tw=80 noai:[text] -"[text] vim:set tw=80 noai:[text] -" vim: set tw=80 noai: [text] -" vim:se tw=80 noai: - - -command! Modeliner call Modeliner_execute() - - -" to retrieve the position -let s:Modeline_SEARCH_PATTERN = '\svi:\|vim:\|ex:' -" to extract options from existing modeline -let s:Modeline_EXTRACT_PATTERN = '\v(.*)\s+(vi|vim|ex):\s*(set?\s+)?(.+)' " very magic -" first form -"let s:Modeline_EXTRACT_OPTPATTERN1 = '\v(.+)' " very magic -" second form -let s:Modeline_EXTRACT_OPTPATTERN2 = '\v(.+):(.*)' " very magic - - -function! s:Modeliner_execute() - let options = [] - - " find existing modeline, and determine the insert position - let info = s:SearchExistingModeline() - - " parse g:Modeliner_format and join options with them - let extractedOptStr = g:Modeliner_format . ' ' . info.optStr - let extractedOptStr = substitute(extractedOptStr, '[ ,:]\+', ' ', 'g') - let extractedOptStr = substitute(extractedOptStr, '=\S*', '=', 'g') - let extractedOptStr = substitute(extractedOptStr, 'no\(.\+\)', '\1', 'g') - let opts = sort(split(extractedOptStr)) - "echom 'opt(list): ' . join(opts, ', ') - - let optStr = '' - let prevO = '' - for o in opts - if o == prevO | continue | endif - let prevO = o - - if stridx(o, '=') != -1 - " let optExpr = 'ts=' . &ts - execute 'let optExpr = "' . o . '" . &' . strpart(o, 0, strlen(o) - 1) - else - " let optExpr = (&et ? '' : 'no') . 'et' - execute 'let optExpr = (&' . o . '? "" : "no") . "' . o . '"' - endif - - let optStr = optStr . ' ' . optExpr - endfor - - if info.lineNum == 0 - let modeline = s:Commentify(optStr) - else - let modeline = info.firstText . ' vim: set' . optStr . ' :' . info.lastText - endif - - - " insert new modeline - if info.lineNum != 0 - "modeline FOUND -> replace the modeline - - "show the existing modeline - let orgLine = line('.') - let orgCol = col('.') - call cursor(info.lineNum, 1) - normal V - redraw - - "confirm - "if confirm('Are you sure to overwrite this existing modeline?', "&Yes\n&No", 1) == 1 - echo 'Are you sure to overwrite this existing modeline? [y/N]' - if char2nr(tolower(nr2char(getchar()))) == char2nr('y') - call setline(info.lineNum, modeline) - - "show the modeline being changed - if (info.lineNum != line('.')) && (info.lineNum != line('.') + 1) - redraw - sleep 1 - endif - endif - - "back to the previous position - echo - execute "normal \" - call cursor(orgLine, orgCol) - else - "modeline NOT found -> append new modeline - call append('.', modeline) - endif - -endfunction - - -function! s:Commentify(s) - if exists('g:NERDMapleader') " NERDCommenter - let result = b:left . ' vim: set' . a:s . ' : ' . b:right - else - let result = substitute(&commentstring, '%s', ' vim: set' . a:s . ' : ', '') - endif - - return result -endfunction - - -function! s:SearchExistingModeline() - let info = {'lineNum':0, 'text':'', 'firstText':'', 'lastText':'', 'optStr':''} - - let candidates = [] - - " cursor position? - call add(candidates, line('.')) - " user may position the cursor to previous line... - call add(candidates, line('.') + 1) - let cnt = 0 - while cnt < &modelines - " header? - call add(candidates, cnt + 1) - " footer? - call add(candidates, line('$') - cnt) - let cnt = cnt + 1 - endwhile - - " search - for i in candidates - let lineNum = i - let text = getline(lineNum) - - if match(text, s:Modeline_SEARCH_PATTERN) != -1 - let info.lineNum = lineNum - let info.text = text - break - endif - endfor - - " extract texts - if info.lineNum != 0 - "echom 'modeline: ' info.lineNum . ' ' . info.text - - let info.firstText = substitute(info.text, s:Modeline_EXTRACT_PATTERN, '\1', '') - - let isSecondForm = (strlen(substitute(info.text, s:Modeline_EXTRACT_PATTERN, '\3', '')) != 0) - "echom 'form : ' . string(isSecondForm + 1) - if isSecondForm == 0 - let info.lastText = '' - let info.optStr = substitute(info.text, s:Modeline_EXTRACT_PATTERN, '\4', '') - else - let info.lastText = substitute( - \ substitute(info.text, s:Modeline_EXTRACT_PATTERN, '\4', ''), - \ s:Modeline_EXTRACT_OPTPATTERN2, - \ '\2', - \ '') - let info.optStr = substitute( - \ substitute(info.text, s:Modeline_EXTRACT_PATTERN, '\4', ''), - \ s:Modeline_EXTRACT_OPTPATTERN2, - \ '\1', - \ '') - endif - endif - - "echom 'firstText: ' . info.firstText - "echom 'lastText: ' . info.lastText - "echom 'optStr: ' . info.optStr - - return info -endfunction - - -function! s:ExtractOptionStringFromModeline(text) - let info = {} - - let info.firstText = substitute(a:text, s:Modeline_EXTRACT_PATTERN, '\1', '') - - let isSecondForm = (strlen(substitute(a:text, s:Modeline_EXTRACT_PATTERN, '\3', '') != 0) - if isSecondForm == 0 - let info.lastText = '' - let info.optStr = substitute(a:text, s:Modeline_EXTRACT_PATTERN, '\2', '') - else - let info.lastText = substitute( - \ substitute(a:text, s:Modeline_EXTRACT_PATTERN, '\4', ''), - \ s:Modeline_EXTRACT_OPTPATTERN2, - \ '\2', - \ '') - let info.optStr = substitute( - \ substitute(a:text, s:Modeline_EXTRACT_PATTERN, '\4', ''), - \ s:Modeline_EXTRACT_OPTPATTERN2, - \ '\1', - \ '') - endif - - return info -endfunction - -" vim: set et fenc=utf-8 ff=unix sts=4 sw=4 ts=4 : diff --git a/base/.zshenv b/base/.zshenv index 5142322..462fefd 100644 --- a/base/.zshenv +++ b/base/.zshenv @@ -1,29 +1,35 @@ +export ZDOTDIR=${XDG_CONFIG_HOME:-~/.config}/zsh + ### load site-specific -[[ -f ~/.zshenv.local ]] && source ~/.zshenv.local +[[ -f ${ZDOTDIR:-~}/.zshenv.local ]] && source ${ZDOTDIR:-~}/.zshenv.local ### fix broken term +if [[ ! -v TERM ]] { + TERM=xterm-256color >/dev/null 2>&1 +} if [[ -o interactive && $#terminfo -eq 0 ]] { _oldterm=$TERM - TERM=xterm-256color >/dev/null 2>&1 + export TERM=xterm >/dev/null 2>&1 print -P "%F{red}!!! Can't find terminfo for $_oldterm, using $TERM%f" unset _oldterm } if [[ -o login ]] { ### cd on login shell for convenience + # NOTE: we do this here and not in .zprofile since we occasionally might + # re-source .zprofile, and it's easier to just put the logic here... cd ~ } else { if [[ ! -v _sev_first_display && ( -v DISPLAY || -v WAYLAND_DISPLAY ) ]] { - # this is to allow gpg and pinentry env to be updated + ### update gpgagent to use graphical pinentry # XXX: will be sourced by every new child shell if zsh is not used to - # start the graphical session, but since .zprofile is light that - # shouldn't cause a noticeable performance impact - # NOTE: above happens with sway without a display manager or launcher + # start the graphical session and the _sev_first_disaply var isn't + # exported; for example, this happens with sway without a display + # manager or launcher in front of it export _sev_first_display= - source ${ZDOTDIR:-~}/.zprofile - export _sev_first_display=0 + _sev_refresh_gpgagent= source ${ZDOTDIR:-~}/.zprofile } elif [[ $SHLVL == 1 ]] { - ### early zprofile sourcing for first shell + ### early zprofile sourcing for first shell even if not a login shell # NOTE: ensure profile is loaded for toplevel shells; should hopefully be 1 # under some Xorg or cron implementations, which is where this would be most useful source ${ZDOTDIR:-~}/.zprofile diff --git a/bin/i3-mode b/bin/i3-mode deleted file mode 100755 index 7835670..0000000 --- a/bin/i3-mode +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -first=true -i3subscribe mode | while read -r x; do - if $first; then - first=false - x=default #XXX: i3 does not expose method to get mode, assume - fi - x=${x#mode:} - [ "$1" = "hide-default" -a "$x" = "default" ] && echo || echo "$x" -done diff --git a/bin/i3-printinfo b/bin/i3-printinfo deleted file mode 100755 index 4c3b8d1..0000000 --- a/bin/i3-printinfo +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env perl - -use strict; -use warnings; -use Text::Template 'fill_in_string'; -use AnyEvent::I3; -use v5.10; - -my $i3 = i3(); -$i3->connect->recv or die "Error connecting to i3"; - -my ($ev, $str) = @ARGV; -if (not defined $str) { - die "Error: Too few arguments\n" . - "Usage: $0 workspace|output|mode|window|barconfig_update|binding format_string\n" . - "Example: $0 window 'The window title is {\$name}'" -} - -$i3->subscribe({ - $ev => sub { - # XXX: there has to be a way to make this one line - my ($msg) = @_; - # XXX: not escaped - say Text::Template::fill_in_string($str, HASH=>$msg->{'container'}); - } -})->recv; - -AE::cv->recv; - -# vim: et:ts=4:sts=4:sw=4 diff --git a/bin/i3subscribe b/bin/i3subscribe deleted file mode 100755 index 76f2ff2..0000000 --- a/bin/i3subscribe +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env perl - -BEGIN { $| = 1 } # flush \n - -use strict; -use warnings; -use Data::Dumper; -use AnyEvent::I3; -use v5.10; - -my $i3 = i3(); -$i3->connect->recv or die "Error connecting to i3"; - -sub subscribe { - my $ev = $_[0]; - my $dump = $_[1]; - if($i3->subscribe({ - $ev => sub { - my ($msg) = @_; - say "$ev:$msg->{'change'}"; - if($dump) { - print Dumper($msg); - } - } - })->recv->{success}) { - say "Successfully subscribed to $ev event"; - } -} - -my $nextArg = shift; -if(!$nextArg) { - say "Subscribe to i3 events"; - say "Usage: $0 workspace|output|mode|window|barconfig_update|binding [dump]"; - say "Example: $0 workspace dump window binding dump"; - exit 1; -} -while($nextArg) { - my $arg = $nextArg; - $nextArg = shift; - my $dump = 0; - if($nextArg and $nextArg eq "dump") { - $dump = 1; - $nextArg = shift; - } - subscribe("$arg", $dump); -} -AE::cv->recv; - -# vim: et:ts=4:sts=4 diff --git a/bin/lck b/bin/lck deleted file mode 100755 index 87cfce8..0000000 --- a/bin/lck +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh - -# term lock -if [ -z "$DISPLAY" ]; then - if [ "$OSTYPE" = "freebsd" ]; then - lock -npv - else - lock -np - fi - exit -fi - -# xorg lock -img=~/tmp/lock.png -if [ -f "$img" ]; then - # rudimentary attempt to prevent multiple locks - # XXX: could block lock and replace with malicious locker to grab password - echo "Lock file exists at '$img', exiting" - exit 1 -fi -res="$(xdpyinfo | grep dimensions | awk '{print $2}')" -scale=0.07 -ffmpeg -y -loglevel 0 \ - -s "$res" -f x11grab -i $DISPLAY -i ~/share/lck/overlay.png \ - -filter_complex " - [0] - scale=iw * $scale:ih * $scale, - noise=alls=2, - scale=`echo $res | tr x :`:flags=neighbor, - noise=alls=5, - gblur=8 - [composite]; - [composite] - [1] overlay=x=(main_w - overlay_w) / 2 + 0.5: - y=(main_h - overlay_h) / 2 - [out]" \ - -map "[out]" -vframes 1 "$img" -# pause dunst -pkill -USR1 dunst -i3lock -nefi "$img" -rm "$img" -pkill -USR2 dunst diff --git a/bin/mpc-notify b/bin/mpc-notify deleted file mode 100755 index ceecca4..0000000 --- a/bin/mpc-notify +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh -#TODO: help -mpc=mpc -dest=org.freedesktop.Notifications -opath=/org/freedesktop/Notifications -meth=$dest.Notify -idfile=~/tmp/mpc-notify.id - -notify() { - replaces_id=0 - if [ -e $idfile ]; then - replaces_id=`cat $idfile` - fi - echo $(expr "$(gdbus call --session \ - --dest $dest --object-path $opath --method $meth \ - mpc $replaces_id audio-volume-high "${1:-$out1}" "${2:-$out2}" '[]' \ - '{"urgency": }' 3000)" : '(uint32 \([0-9]*\),)') > $idfile -} - -getoutput() { - #TODO test if not playing for some commands - #if mpc -f '' status | awk 'NR==2' | grep -v '^\[playing\]'; then - case "$1" in - current) - out1=`$mpc -f %artist% current` - out2="`$mpc -f %title% current`\n`mpc -f %album% current`";; - status) out1=`$mpc current` - out2=`$mpc -f '%album% (%date%)' status`;; - *) return 1;; - esac - if [ -z "$out1$out2" ]; then - out1='Stopped' - fi -} - -cmd=${1:-current} -case "$cmd" in - -d|--daemon|idle|idleloop) - cmd=${2:-current} - $mpc idleloop player | while read -r x; do - getoutput $cmd - notify "$out1" "$out2" - done - return;; - *) getoutput $cmd || return 1;; -esac -notify "$out1" "$out2" diff --git a/bin/redoff b/bin/redoff deleted file mode 100755 index 5b0cb03..0000000 --- a/bin/redoff +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -pkill redshift > /dev/null 2>&1 -redshift -m randr -x diff --git a/bin/redon b/bin/redon deleted file mode 100755 index 966f172..0000000 --- a/bin/redon +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -pkill redshift > /dev/null 2>&1 -redshift -l manual:lat=38:lon=-92 -m randr -t 6600:4000 -r & diff --git a/bin/rotate b/bin/rotate deleted file mode 100755 index 16e9eaf..0000000 --- a/bin/rotate +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh - -default_output=LVDS1 - -usage() { - echo "Usage: - rotate (left|right|invert) [output] - rotate set (normal|right|inverted|left) [output] -Examples: - rotate left LVDS1 - rotate set right HDMI2 - -Only the first letter of each command is checked (case-insensitive), so they -can be abbreviated or even cut to one letter each in lower or upper case. - -For example, the following commands do the same thing: - rotate set left - rotate SET LeFt - rotate s l - rotate salad lasagna" -} - -rot_to_num() { - case $1 in - # normal right invert left - # convert to numbers to allow math to rotate - [nN]*) rot0=0;; - [rR]*) rot0=1;; - [iI]*) rot0=2;; - [lL]*) rot0=3;; - *) usage; exit 2;; - esac -} -num_to_rot() { - case $1 in - # maps to rot_to_num output - 0) rot1=normal - rot2=none;; - 1) rot1=right - rot2=cw;; - 2) rot1=inverted - rot2=half;; - 3) rot1=left - rot2=ccw;; - esac -} - -case $1 in - [sS]*) - # set: rotate set (normal|right|inverted|left) [output] - output=${3:-$default_output} - rot_to_num $2 - ;; - *) - # rotate (left|right|invert) [output] - output=${2:-$default_output} - rot_to_num `xrandr --query --verbose | grep $output | awk '{print $5}'` - case $1 in - [lL]*) rot0=$(($rot0 - 1));; - [rR]*) rot0=$(($rot0 + 1));; - [iI]*) rot0=$(($rot0 + 2));; - *) usage; exit 1;; - esac - ;; -esac - -# add 4 modulo 4 to prevent negatives and overflows -num_to_rot $((($rot0 + 4) % 4)) - -xrandr --output $output --rotation $rot1 -# x220t -if command -v xsetwacom >/dev/null 2>&1; then - xsetwacom --set stylus Rotate $rot2 - xsetwacom --set eraser Rotate $rot2 - xsetwacom --set touch Rotate $rot2 -fi - -# reload bg -~/bin/wall diff --git a/bin/setup-perl5 b/bin/setup-perl5 index ce69beb..569fbba 100755 --- a/bin/setup-perl5 +++ b/bin/setup-perl5 @@ -1,2 +1,2 @@ #!/bin/sh -cpanm --local-lib=$XDG_DATA_HOME/perl5 local::lib +cpanm --local-lib=${XDG_DATA_HOME:-~/share}/perl5 local::lib diff --git a/bin/tint2-alsa b/bin/tint2-alsa deleted file mode 100755 index 1e851f2..0000000 --- a/bin/tint2-alsa +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -base=~/.icons/Paper-Mono-Dark/24x24/panel/audio-volume - high=$base-high.svg -medium=$base-medium.svg - low=$base-low.svg - muted=$base-muted.svg - -# TODO: doesn't work if no master mixer, eg usb dac -ident="iface=MIXER,name=Master Playback Volume" -eval $(amixer cget "$ident" | grep -o 'max=\d\+') - -while true; do - # XXX: assume mono, could be different - vol=$(amixer get Master | grep 'Mono:') - mute=$(echo "$vol" | cut -d ' ' -f 8) - vol=$(expr $(echo "$vol" | cut -d ' ' -f 5) \* 100 / $max \* 100 / 100) - if [ $mute = '[off]' ]; then - echo $muted - elif [ $vol -ge 75 ]; then - echo $high - elif [ $vol -ge 50 ]; then - echo $medium - elif [ $vol -ge 25 ]; then - echo $low - else - echo $muted - fi - sleep 2 -done diff --git a/bin/tint2-i3status b/bin/tint2-i3status deleted file mode 100755 index f655e6c..0000000 --- a/bin/tint2-i3status +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -. ~/bin/.check-busybox -u=-u -check-busybox sed && u='' -i3status -c ${XDG_CONFIG_HOME:-~/.config}/i3status/tint2-$1 | sed $u -e 's/fc=\(#[a-f0-9]\{3,6\}\)/span color="\1"/gi;s_/fc_/span_g' -unset check-busybox diff --git a/bin/tint2-wifi b/bin/tint2-wifi deleted file mode 100755 index 89df227..0000000 --- a/bin/tint2-wifi +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -base=~/.icons/Paper-Mono-Dark/24x24/panel/network-wireless -excellent=$base-signal-excellent.svg - good=$base-signal-good.svg - ok=$base-signal-ok.svg - low=$base-signal-low.svg - none=$base-signal-none.svg - no_route=$base-no-route.svg - offline=$base-offline.svg - -echo $base-acquiring.svg -while true; do - x=$(cat /proc/net/wireless | awk 'NR < 3 {next} {printf "%.0f", $4}') - if [ -z $x ]; then - echo $offline - elif [ $x -ge -55 ]; then - echo $excellent - elif [ $x -ge -65 ]; then - echo $good - elif [ $x -ge -75 ]; then - echo $ok - elif [ $x -ge -85 ]; then - echo $low - elif [ $x -ge -90 ]; then - echo $none - else - echo $no_route - fi - sleep 2 -done diff --git a/bin/wall b/bin/wall deleted file mode 100755 index ffd0628..0000000 --- a/bin/wall +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -wall="$HOME/var/tmp/wall.jpg" -res=$(xdpyinfo) -if [ $? -eq 0 ]; then - res=$(echo "$res" | awk '/dimensions:/{print $2}') -else - echo "ERROR: $res" - exit 1 -fi -wget -O "$wall" "https://source.unsplash.com/$res/?tunnel,architecture" && feh --no-fehbg --bg-fill "$wall" diff --git a/etc/Trolltech.conf b/etc/Trolltech.conf deleted file mode 100644 index e148896..0000000 --- a/etc/Trolltech.conf +++ /dev/null @@ -1,2 +0,0 @@ -[Qt] -style=GTK+ diff --git a/etc/cava/config b/etc/cava/config deleted file mode 100644 index c6a081a..0000000 --- a/etc/cava/config +++ /dev/null @@ -1,22 +0,0 @@ -[general] -framerate = 24 -autosens = 0 -sensitivity = 300 -bar_width = 1 -bar_spacing = 2 - -[input] -method = fifo -source = /var/mpd/fifo - -[output] -channels = stereo - -[color] -; background = black -foreground = 'yellow' - -[smoothing] -integral = 0 -monstercat = 0 -gravity = 85 diff --git a/etc/compton.conf b/etc/compton.conf deleted file mode 100644 index 3761d59..0000000 --- a/etc/compton.conf +++ /dev/null @@ -1,75 +0,0 @@ -# Shadow -shadow = true; -no-dnd-shadow = true; -no-dock-shadow = true; -clear-shadow = true; -shadow-radius = 8; -shadow-offset-x = -12; -shadow-offset-y = -12; -shadow-opacity = 0.3; -shadow-exclude = [ - # gtk3 fix - "_GTK_FRAME_EXTENTS@:c", - # i3 tabbed windows - "_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'", - # i3 titlebar - "class_g = 'i3-frame'", - # fullscreen/dmenu - "x = 0 && y = 0 && override_redirect = true", - # bg terminals - "class_i = 'TermBg1'", - "class_i = 'TermBg2'" -]; -shadow-ignore-shaped = true; - -# Opacity -menu-opacity = 0.9; -inactive-opacity = 0.875; -active-opacity = 1; -alpha-step = 0.01; -inactive-dim = 0.075; -# XXX: crashes on alpine??? -#blur-background = true; -blur-kern = "5,5,0.367879,0.535261,0.606531,0.535261,0.367879,0.535261,0.778801,0.882497,0.778801,0.535261,0.606531,0.882497,0.882497,0.606531,0.535261,0.778801,0.882497,0.778801,0.535261,0.367879,0.535261,0.606531,0.535261,0.367879," -opacity-rule = [ - # i3 tabbed windows - "0:_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'" -]; -blur-background-exclude = [ - # gtk3 fix - "_GTK_FRAME_EXTENTS@:c", - # i3 titlebar - "class_g = 'i3-frame'", - # ignore docks - "window_type = 'dock'", - "window_type = 'desktop'" -]; - -# Fading -fading = true; -fade-delta = 16; -fade-in-step = 0.05; -fade-out-step = 0.05; - -# Rendering -backend = "glx" -glx-no-stencil = true; -glx-no-rebind-pixmap = true; -paint-on-overlay = true; -refresh-rate = 0; -vsync = "opengl-swc"; - -# Other -mark-wmwin-focused = true; -mark-ovredir-focused = true; -use-ewmh-active-win = true; -detect-rounded-corners = true; -detect-client-opacity = true; -detect-transient = true; -detect-client-leader = true; - -# Window type settings -wintypes: -{ - tooltip = { fade = true; shadow = true; opacity = 0.9; focus = true; }; -}; diff --git a/etc/dunst/dunstrc b/etc/dunst/dunstrc deleted file mode 100644 index 65c4ee5..0000000 --- a/etc/dunst/dunstrc +++ /dev/null @@ -1,46 +0,0 @@ -[global] -geometry = "400x0-30-30" -follow = keyboard -sort = yes - -font = "monospace 9" -markup = no -format = "%s %p %a\n%b" -show_age_threshold = 5 - -frame_width = 1 -separator_height = 1 -separator_color = frame -padding = 4 -horizontal_padding = 4 -icon_position = left -# {~/.icons,/usr/share/icons,/usr/share/local/icons}/*/16x16/* -icon_path = "~/.icons/Paper/16x16/actions:~/.icons/Paper/16x16/apps:~/.icons/Paper/16x16/categories:~/.icons/Paper/16x16/devices:~/.icons/Paper/16x16/emblems:~/.icons/Paper/16x16/emotes:~/.icons/Paper/16x16/mimetypes:~/.icons/Paper/16x16/panel:~/.icons/Paper/16x16/places:~/.icons/Paper/16x16/status:~/.icons/Paper/16x16/web:/usr/share/icons/hicolor/16x16/actions:/usr/share/icons/hicolor/16x16/animations:/usr/share/icons/hicolor/16x16/apps:/usr/share/icons/hicolor/16x16/categories:/usr/share/icons/hicolor/16x16/devices:/usr/share/icons/hicolor/16x16/emblems:/usr/share/icons/hicolor/16x16/emotes:/usr/share/icons/hicolor/16x16/filesystems:/usr/share/icons/hicolor/16x16/intl:/usr/share/icons/hicolor/16x16/mimetypes:/usr/share/icons/hicolor/16x16/places:/usr/share/icons/hicolor/16x16/status:/usr/share/icons/hicolor/16x16/stock:/usr/share/icons/locolor/16x16/apps" - -dmenu = "~/bin/dmenu -p dunst:" -browser = /usr/bin/firefox - -close = mod4+shift+grave -#close_all = mod4+mod2+grave -history = mod4+grave -context = mod4+ctrl+grave - -[urgency_low] -background = "#110800" -foreground = "#93a1a1" -frame_color = "#884400" -timeout = 5 - -[urgency_normal] -background = "#221100" -foreground = "#eee8d5" -frame_color = "#268bd2" -timeout = 10 - -[urgency_critical] -background = "#dc332f" -foreground = "#000000" -frame_color = "#ff4400" -timeout = 0 - -# vim: ft=cfg diff --git a/etc/fontconfig/fonts.conf b/etc/fontconfig/fonts.conf index bf1ab78..972f7e4 100644 --- a/etc/fontconfig/fonts.conf +++ b/etc/fontconfig/fonts.conf @@ -1,38 +1,7 @@ - set up render settings; aliases for Source, Dina - - - - - rgb - - - - - - hintslight - - - - - - - und-zsye - - - true - - - false - - - false - - + aliases for Source, Dina diff --git a/base/.gitconfig b/etc/git/config similarity index 100% rename from base/.gitconfig rename to etc/git/config diff --git a/etc/gtk-3.0/settings.ini b/etc/gtk-3.0/settings.ini deleted file mode 100644 index 93c54c7..0000000 --- a/etc/gtk-3.0/settings.ini +++ /dev/null @@ -1,17 +0,0 @@ -[Settings] -gtk-font-name=monospace 10 -gtk-theme-name=Blackbird -gtk-icon-theme-name=Paper-Mono-Dark -gtk-application-prefer-dark-theme=true -gtk-cursor-theme-name=Paper -gtk-cursor-theme-size=24 -gtk-toolbar-style=GTK_TOOLBAR_BOTH_HORIZ -gtk-toolbar-icon-size=GTK_ICON_SIZE_SMALL_TOOLBAR -gtk-button-images=1 -gtk-menu-images=1 -gtk-enable-event-sounds=1 -gtk-enable-input-feedback-sounds=1 -gtk-xft-antialias=1 -gtk-xft-hinting=1 -gtk-xft-hintstyle=hintslight -gtk-xft-rgba=none diff --git a/etc/gtk-4.0/settings.ini b/etc/gtk-4.0/settings.ini deleted file mode 100644 index c164bcc..0000000 --- a/etc/gtk-4.0/settings.ini +++ /dev/null @@ -1,14 +0,0 @@ -[Settings] -gtk-font-name=monospace 10 -# TODO: Blackbird doesn't support gtk4 -#gtk-theme-name=Blackbird -gtk-icon-theme-name=Paper-Mono-Dark -gtk-application-prefer-dark-theme=true -gtk-cursor-theme-name=Paper -gtk-cursor-theme-size=24 -gtk-enable-event-sounds=1 -gtk-enable-input-feedback-sounds=1 -gtk-xft-antialias=1 -gtk-xft-hinting=1 -gtk-xft-hintstyle=hintslight -gtk-xft-rgba=none diff --git a/etc/i3status/config b/etc/i3status/config deleted file mode 100644 index 400bf22..0000000 --- a/etc/i3status/config +++ /dev/null @@ -1,47 +0,0 @@ -general { - output_format = "i3bar" - interval = 6 - color_good = "#85c000" - color_degraded = "#b58900" - color_bad = "#dc322f" -} - -order += "wireless wlan0" -order += "ethernet _first_" -order += "cpu_usage" -order += "load" -order += "battery 0" -order += "tztime local" - -wireless wlan0 { - format_up = "WLAN0 %essid %ip" - format_down = "" -} - -ethernet _first_ { - format_up = "ETH %ip" - format_down = "" -} - -cpu_usage { - format = "CPU %usage " - max_threshold = 90 - degraded_threshold = 50 - separator = false - separator_block_width = 0 -} - -load { - format = "%1min %5min %15min" - max_threshold = "1.5" -} - -battery 0 { - format = "%status %percentage %remaining" - format_down = "" - low_threshold = 20 -} - -tztime local { - format = "%a/%b %d/%m/%Y %H:%M:%S" -} diff --git a/etc/i3status/tint2-cpu-net b/etc/i3status/tint2-cpu-net deleted file mode 100644 index 73034b8..0000000 --- a/etc/i3status/tint2-cpu-net +++ /dev/null @@ -1,36 +0,0 @@ -general { - output_format = "xmobar" - interval = 2 - separator = "" - color_good = "#85c000" - color_degraded = "#b58900" - color_bad = "#dc322f" -} - -order += "cpu_usage" -order += "load" -order += "wireless wlan0" -order += "ethernet em0" - -cpu_usage { - format = "%usage " - max_threshold = 90 - degraded_threshold = 50 - separator = false - separator_block_width = 0 -} - -load { - format = "%1min %5min %15min\n" - max_threshold = "1.5" -} - -wireless wlan0 { - format_up = "%essid %ip" - format_down = "wlan down" -} - -ethernet em0 { - format_up = " %ip" - format_down = "" -} diff --git a/etc/pythonrc b/etc/pythonrc new file mode 100644 index 0000000..44641cd --- /dev/null +++ b/etc/pythonrc @@ -0,0 +1,5 @@ +# TODO: prevent ~/.python_history from being written? +# https://unix.stackexchange.com/q/630642 +def clear(): + import os + os.system('clear') diff --git a/etc/sway/config b/etc/sway/config deleted file mode 100644 index 626e9cd..0000000 --- a/etc/sway/config +++ /dev/null @@ -1,253 +0,0 @@ -### load system -include /etc/sway/config.d/* - -### daemons -exec pipewire -exec dunst -#exec mpc-notify -d -exec foot --server -exec swayidle timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' -# x220t -# TODO: check hostname to load auxillary things -# TODO: reformat for linux -#exec acpi_ac "0x0`sysctl -n hw.acpi.acline`" - -### Xorg config -xwayland force -exec xrdb -merge ~/.Xresources -exec '\ - find -L "$${XDG_DATA_HOME:-~/share}/fonts" -mindepth 1 -maxdepth 2 -type d | while read -r x; do \ - [ -f "$$x/fonts.dir" ] && xset +fp "$$x"; \ - done; \ - xset fp rehash' - -### inputs -input 1:1:AT_Translated_Set_2_keyboard { - xkb_layout us - xkb_options caps:super - xkb_numlock enable - repeat_delay 290 - repeat_rate 26 -} - -### binds -set $mod Mod4 - -bindsym $mod+Shift+r reload -bindsym $mod+Shift+e exec swaynag -t warning -m Exit? -b Yes 'swaymsg exit' - -## terminal -bindsym $mod+Return exec [ -n "$$TERMINAL" ] && exec $$TERMINAL || exec footclient -bindsym $mod+KP_Enter exec [ -n "$$TERMINAL" ] && exec $$TERMINAL || exec footclient - -## menu -bindsym $mod+d exec nwgdmenu -bindsym $mod+Shift+d exec nwggrid -bindsym $mod+Ctrl+d exec nwgbar - -## special -# mpc -#bindsym XF86AudioPlay exec mpc -h /var/mpd/socket play -#bindsym XF86AudioStop exec mpc -h /var/mpd/socket pause -#bindsym XF86AudioPrev exec mpc -h /var/mpd/socket cdprev -#bindsym XF86AudioNext exec mpc -h /var/mpd/socket next -# x220t bezel buttons -#bindcode 198 exec rotate set normal -#bindcode 204 exec rotate right - -## window management -set $up k -set $down j -set $left h -set $right l -set $up2 Up -set $down2 Down -set $left2 Left -set $right2 Right - -bindsym $mod+$left focus left -bindsym $mod+$down focus down -bindsym $mod+$up focus up -bindsym $mod+$right focus right -bindsym $mod+$left2 focus left -bindsym $mod+$down2 focus down -bindsym $mod+$up2 focus up -bindsym $mod+$right2 focus right -bindsym $mod+a focus parent -bindsym $mod+z focus child -bindsym $mod+Shift+$left move left -bindsym $mod+Shift+$down move down -bindsym $mod+Shift+$up move up -bindsym $mod+Shift+$right move right -bindsym $mod+Shift+$left2 move left -bindsym $mod+Shift+$down2 move down -bindsym $mod+Shift+$up2 move up -bindsym $mod+Shift+$right2 move right - -bindsym $mod+i split h -bindsym $mod+o split v - -floating_modifier $mod -bindsym $mod+Shift+space floating toggle -bindsym $mod+space focus mode_toggle - -bindsym $mod+f fullscreen toggle -bindsym $mod+Shift+f fullscreen toggle global - -bindsym $mod+s layout stacking -bindsym $mod+w layout tabbed -bindsym $mod+e layout toggle split - -bindsym $mod+Shift+q kill - -bindsym $mod+Shift+minus move scratchpad -bindsym $mod+minus scratchpad show - -bindsym $mod+1 workspace 1 -bindsym $mod+2 workspace 2 -bindsym $mod+3 workspace 3 -bindsym $mod+4 workspace 4 -bindsym $mod+5 workspace 5 -bindsym $mod+6 workspace 6 -bindsym $mod+7 workspace 7 -bindsym $mod+8 workspace 8 -bindsym $mod+9 workspace 9 -bindsym $mod+0 workspace 10 -workspace_auto_back_and_forth yes - -bindsym $mod+Shift+1 move container to workspace 1 -bindsym $mod+Shift+2 move container to workspace 2 -bindsym $mod+Shift+3 move container to workspace 3 -bindsym $mod+Shift+4 move container to workspace 4 -bindsym $mod+Shift+5 move container to workspace 5 -bindsym $mod+Shift+6 move container to workspace 6 -bindsym $mod+Shift+7 move container to workspace 7 -bindsym $mod+Shift+8 move container to workspace 8 -bindsym $mod+Shift+9 move container to workspace 9 -bindsym $mod+Shift+0 move container to workspace 10 - -mode "translate" { - bindsym $left resize shrink width 20 px - bindsym $down resize grow height 20 px - bindsym $up resize shrink height 20 px - bindsym $right resize grow width 20 px - bindsym $left2 resize shrink width 20 px - bindsym $down2 resize grow height 20 px - bindsym $up2 resize shrink height 20 px - bindsym $right2 resize grow width 20 px - - bindsym Shift+$left move left 20 px - bindsym Shift+$down move down 20 px - bindsym Shift+$up move up 20 px - bindsym Shift+$right move right 20 px - bindsym Shift+$left2 move left 20 px - bindsym Shift+$down2 move down 20 px - bindsym Shift+$up2 move up 20 px - bindsym Shift+$right2 move right 20 px - - # smaller movements - bindsym Control+$left resize shrink width 1 px or 1 ppt - bindsym Control+$down resize grow height 1 px or 1 ppt - bindsym Control+$up resize shrink height 1 px or 1 ppt - bindsym Control+$right resize grow width 1 px or 1 ppt - bindsym Control+$left2 resize shrink width 1 px or 1 ppt - bindsym Control+$down2 resize grow height 1 px or 1 ppt - bindsym Control+$up2 resize shrink height 1 px or 1 ppt - bindsym Control+$right2 resize grow width 1 px or 1 ppt - - bindsym Control+Shift+$left move left 1 px - bindsym Control+Shift+$down move down 1 px - bindsym Control+Shift+$up move up 1 px - bindsym Control+Shift+$right move right 1 px - bindsym Control+Shift+$left2 move left 1 px - bindsym Control+Shift+$down2 move down 1 px - bindsym Control+Shift+$up2 move up 1 px - bindsym Control+Shift+$right2 move right 1 px - - # focus - bindsym $mod+a focus parent - bindsym $mod+z focus child - - # floating - bindsym $mod+Shift+space floating toggle - bindsym $mod+space focus mode_toggle - - # exit - bindsym Return mode default - bindsym Escape mode default - bindsym $mod+r mode default -} -bindsym $mod+r mode "translate" - - -### appearance -font pango:monospace 10 -seat seat0 xcursor_theme Paper 16 -## borders -default_border pixel 1 -hide_edge_borders smart -gaps inner 6 -smart_gaps on -## colors -# generic -set $bg #110800 -set $fg #93a1a1 -# focused -set $f_bdr #cc6600 -set $f_bg #aa5500 -set $f_fg #eee8d5 -set $f_ind #4466ff -set $f_chb #cc6600 -# inactive -set $i_bdr #884400 -set $i_bg #221100 -set $i_fg $fg -set $i_ind #264bd2 -set $i_chb #884400 -# urgent -set $u_bdr #ff4444 -set $u_bg #dc322f -set $u_fg #000000 -set $u_ind #4466ff -set $u_chb #ff4444 -# blue -set $b_bdr #4466ff -set $b_bg #268bd2 -set $b_fg #fdf6e3 -set $b_ind #264db2 -set $b_chb #4466ff -# class border backgr. text indicator child_border -client.focused $f_bdr $f_bg $f_fg $f_ind $f_chb -client.focused_inactive $i_bdr $i_bg $i_fg $i_ind $i_chb -client.unfocused $i_bdr $i_bg $i_fg $i_ind $i_chb -client.urgent $u_bdr $u_bg $u_fg $u_ind $u_chb -client.placeholder $b_bdr $b_bg $b_fg $b_ind $b_chb -client.background #221100 -force_display_urgency_hint 2000 ms - -## bars -bar { - position top - tray_output primary - status_command i3status - separator_symbol "|" - - colors { - background $bg - statusline $fg - separator $b_ind - - # class border backgr. text - focused_workspace $f_bdr $f_bg $f_fg - active_workspace $i_bdr $i_bg $i_fg - inactive_workspace $i_bdr $i_bg $i_fg - urgent_workspace $u_bdr $u_bg $u_fg - binding_mode $b_bdr $b_bg $b_fg - } -} - -## criteria -for_window [app_id="pinentry-qt"] floating enable - -### load site-local -include config.d/* diff --git a/etc/tint2/tint2rc b/etc/tint2/tint2rc deleted file mode 100644 index 2ed82b1..0000000 --- a/etc/tint2/tint2rc +++ /dev/null @@ -1,326 +0,0 @@ -#---- Generated by tint2conf 7ffd ---- -# See https://gitlab.com/o9000/tint2/wikis/Configure for -# full documentation of the configuration options. -#------------------------------------- -# Gradients -# Gradient 1 -gradient = vertical -start_color = #110800 100 -end_color = #110800 1 - -#------------------------------------- -# Backgrounds -# Background 1: Inactive desktop name, Tooltip -rounded = 0 -border_width = 1 -border_sides = TBLR -border_content_tint_weight = 0 -background_content_tint_weight = 0 -background_color = #221100 100 -border_color = #884400 100 -background_color_hover = #000000 0 -border_color_hover = #000000 0 -background_color_pressed = #000000 0 -border_color_pressed = #000000 0 - -# Background 2: Urgent task -rounded = 0 -border_width = 1 -border_sides = TBLR -border_content_tint_weight = 0 -background_content_tint_weight = 0 -background_color = #dc322f 100 -border_color = #ff4444 100 -background_color_hover = #000000 0 -border_color_hover = #000000 0 -background_color_pressed = #000000 0 -border_color_pressed = #000000 0 - -# Background 3: Panel -rounded = 0 -border_width = 0 -border_sides = -border_content_tint_weight = 0 -background_content_tint_weight = 0 -background_color = #110800 0 -border_color = #000000 0 -gradient_id = 1 -background_color_hover = #000000 0 -border_color_hover = #000000 0 -background_color_pressed = #000000 0 -border_color_pressed = #000000 0 - -# Background 4: Active desktop name, Active task -rounded = 0 -border_width = 1 -border_sides = TBLR -border_content_tint_weight = 0 -background_content_tint_weight = 0 -background_color = #aa5500 100 -border_color = #cc6600 100 -background_color_hover = #000000 0 -border_color_hover = #000000 0 -background_color_pressed = #000000 0 -border_color_pressed = #000000 0 - -# Background 5: -rounded = 0 -border_width = 1 -border_sides = TBLR -border_content_tint_weight = 0 -background_content_tint_weight = 0 -background_color = #268bd2 100 -border_color = #4466ff 100 -background_color_hover = #000000 0 -border_color_hover = #000000 0 -background_color_pressed = #000000 0 -border_color_pressed = #000000 0 - -#------------------------------------- -# Panel -panel_items = ET:SLEEECB -panel_size = 100% 28 -panel_margin = 0 0 -panel_padding = 0 1 0 -panel_background_id = 3 -wm_menu = 1 -panel_dock = 1 -panel_pivot_struts = 0 -panel_position = top left horizontal -panel_layer = top -panel_monitor = all -panel_shrink = 0 -autohide = 0 -autohide_show_timeout = 0 -autohide_hide_timeout = 0.5 -autohide_height = 1 -strut_policy = follow_size -panel_window_name = tint2 -disable_transparency = 1 -mouse_effects = 0 -font_shadow = 0 -mouse_hover_icon_asb = 100 0 0 -mouse_pressed_icon_asb = 100 0 0 -scale_relative_to_dpi = 0 -scale_relative_to_screen_height = 0 - -#------------------------------------- -# Taskbar -taskbar_mode = multi_desktop -taskbar_hide_if_empty = 1 -taskbar_padding = 0 0 1 -taskbar_background_id = 0 -taskbar_active_background_id = 0 -taskbar_name = 1 -taskbar_hide_inactive_tasks = 0 -taskbar_hide_different_monitor = 1 -taskbar_hide_different_desktop = 0 -taskbar_always_show_all_desktop_tasks = 0 -taskbar_name_padding = 4 0 -taskbar_name_background_id = 1 -taskbar_name_active_background_id = 4 -taskbar_name_font = monospace 8 -taskbar_name_font_color = #93a1a1 100 -taskbar_name_active_font_color = #eee8d5 100 -taskbar_distribute_size = 1 -taskbar_sort_order = center -task_align = left - -#------------------------------------- -# Task -task_text = 1 -task_icon = 1 -task_centered = 0 -urgent_nb_of_blink = 10 -task_maximum_size = 150 0 -task_padding = 1 0 2 -task_font = monospace 8 -task_tooltip = 1 -task_thumbnail = 0 -task_thumbnail_size = 210 -task_font_color = #93a1a1 100 -task_active_font_color = #eee8d5 100 -task_urgent_font_color = #000000 100 -task_icon_asb = 80 -20 0 -task_active_icon_asb = 100 0 0 -task_urgent_icon_asb = 100 0 0 -task_iconified_icon_asb = 25 -100 0 -task_active_background_id = 4 -task_urgent_background_id = 2 -mouse_left = toggle -mouse_middle = close -mouse_right = toggle -mouse_scroll_up = next_task -mouse_scroll_down = prev_task - -#------------------------------------- -# System tray (notification area) -systray_padding = 0 0 1 -systray_background_id = 0 -systray_sort = ascending -systray_icon_size = 0 -systray_icon_asb = 100 0 0 -systray_monitor = primary -systray_name_filter = - -#------------------------------------- -# Launcher -launcher_padding = 0 0 1 -launcher_background_id = 0 -launcher_icon_background_id = 0 -launcher_icon_size = 0 -launcher_icon_asb = 100 0 0 -launcher_icon_theme_override = 0 -startup_notifications = 1 -launcher_tooltip = 1 -launcher_item_app = /usr/share/applications/xvkbd.desktop - -#------------------------------------- -# Clock -time1_format = %H:%M:%S -time2_format = %a %d/%m/%Y -time1_font = monospace 8 -time1_timezone = -time2_timezone = -time2_font = monospace 6 -clock_font_color = #93a1a1 100 -clock_padding = 6 0 -clock_background_id = 0 -clock_tooltip = %A, %B %d, %Y -clock_tooltip_timezone = -clock_lclick_command = gsimplecal -clock_rclick_command = -clock_mclick_command = -clock_uwheel_command = -clock_dwheel_command = - -#------------------------------------- -# Battery -battery_tooltip = 1 -battery_low_status = 5 -battery_low_cmd = notify-send -u critical -t 0 -a system -i battery-low 'Battery critical' -battery_full_cmd = notify-send -t 10000 -a system -i battery-full 'Battery full' -bat1_font = monospace 8 -bat2_font = monospace 6 -battery_font_color = #93a1a1 100 -bat1_format = %p %h:%m -bat2_format = %s -battery_padding = 0 0 -battery_background_id = 0 -battery_hide = 101 -battery_lclick_command = -battery_rclick_command = -battery_mclick_command = -battery_uwheel_command = -battery_dwheel_command = -ac_connected_cmd = compton -ac_disconnected_cmd = killall compton - -#------------------------------------- -# Separator 1 -separator = new -separator_background_id = 0 -separator_color = #264db2 100 -separator_style = line -separator_size = 1 -separator_padding = 5 0 - -#------------------------------------- -# Executor 1 -execp = new -execp_command = ~/bin/i3-mode hide-default -execp_interval = 0 -execp_has_icon = 0 -execp_cache_icon = 0 -execp_continuous = 1 -execp_markup = 1 -execp_tooltip = -execp_lclick_command = i3-msg mode default -execp_rclick_command = -execp_mclick_command = -execp_uwheel_command = -execp_dwheel_command = -execp_font = monospace 10 -execp_font_color = #fdf6e3 100 -execp_padding = 10 0 -execp_background_id = 5 -execp_centered = 0 -execp_icon_w = 0 -execp_icon_h = 0 - -#------------------------------------- -# Executor 2 -execp = new -execp_command = ~/bin/tint2-alsa -execp_interval = 0 -execp_has_icon = 1 -execp_cache_icon = 1 -execp_continuous = 1 -execp_markup = 0 -execp_tooltip = -execp_lclick_command = urxvtc -e alsamixer -execp_rclick_command = -execp_mclick_command = -execp_uwheel_command = amixer set Master 1%+ -execp_dwheel_command = amixer set Master 1%- -execp_font_color = #000000 100 -execp_padding = 0 0 -execp_background_id = 0 -execp_centered = 0 -execp_icon_w = 0 -execp_icon_h = 0 - -#------------------------------------- -# Executor 3 -execp = new -execp_command = ~/bin/tint2-wifi -execp_interval = 0 -execp_has_icon = 1 -execp_cache_icon = 1 -execp_continuous = 1 -execp_markup = 0 -execp_tooltip = -execp_lclick_command = sh -c 'wifimgr || urxvtc -e sudo wifish' -execp_rclick_command = -execp_mclick_command = -execp_uwheel_command = -execp_dwheel_command = -execp_font_color = #000000 100 -execp_padding = 0 0 -execp_background_id = 0 -execp_centered = 0 -execp_icon_w = 0 -execp_icon_h = 0 - -#------------------------------------- -# Executor 4 -execp = new -execp_command = ~/bin/tint2-i3status cpu-net -execp_interval = 0 -execp_has_icon = 0 -execp_cache_icon = 0 -execp_continuous = 2 -execp_markup = 1 -execp_tooltip = -execp_lclick_command = urxvtc -e sh -c 'htop || top' -execp_rclick_command = -execp_mclick_command = -execp_uwheel_command = -execp_dwheel_command = -execp_font = monospace 6 -execp_font_color = #93a1a1 100 -execp_padding = 0 0 -execp_background_id = 0 -execp_centered = 1 -execp_icon_w = 0 -execp_icon_h = 0 - -#------------------------------------- -# Tooltip -tooltip_show_timeout = 0 -tooltip_hide_timeout = 0 -tooltip_padding = 2 0 -tooltip_background_id = 1 -tooltip_font_color = #eee8d5 100 -tooltip_font = monospace 10 - diff --git a/etc/user-dirs.dirs b/etc/user-dirs.dirs index 376a40c..89d565d 100644 --- a/etc/user-dirs.dirs +++ b/etc/user-dirs.dirs @@ -1,4 +1,4 @@ -XDG_DESKTOP_DIR="$HOME" +XDG_DESKTOP_DIR="$HOME/desktop" XDG_DOWNLOAD_DIR="$HOME/dls" XDG_TEMPLATES_DIR="$HOME" XDG_PUBLICSHARE_DIR="$HOME/pub" diff --git a/base/.vimrc b/etc/vim/.vimrc similarity index 70% rename from base/.vimrc rename to etc/vim/.vimrc index 622e1af..f79a80b 100644 --- a/base/.vimrc +++ b/etc/vim/.vimrc @@ -1,19 +1,27 @@ source $VIMRUNTIME/defaults.vim -packadd matchit +let x = ($XDG_CONFIG_HOME??($HOME."/.config"))."/vim" +execute 'set runtimepath='.x.','.&runtimepath.','.x.'/after' +execute 'set packpath='.x.','.&packpath.','.x.'/after' +unlet x -set modeline "!!! +packadd matchit +if !isdirectory($HOME . "/.local/share/vim") + call mkdir($HOME . "/.local/share/vim", "p", 0700) +endif set backup -set backupdir=$HOME/var/tmp/vim// +set backupdir=$HOME/.local/share/vim// set backupcopy=yes +if !isdirectory($HOME . "/.local/state/vim") + call mkdir($HOME . "/.local/state/vim", "p", 0700) +endif set undofile -set undodir=$HOME/var/tmp/vim// +set undodir=$HOME/.local/state/vim// set autoindent set colorcolumn=80 highlight ColorColumn term=NONE ctermbg=0 -" filetype should be on from defaults.vim autocmd FileType python setlocal tabstop=4 shiftwidth=4 expandtab autocmd FileType markdown setlocal tabstop=4 shiftwidth=4 expandtab autocmd FileType javascript setlocal tabstop=2 shiftwidth=2 expandtab @@ -36,6 +44,4 @@ highlight WhiteSpaceMol ctermfg=Black match WhiteSpaceMol / / 2match WhiteSpaceBol /\(^ \+\)\|\( \+$\)/ -let g:Modeliner_format='ft= fenc= et ts= sts= sw= tw=' - " vim: set et fenc=utf-8 ft=vim sts=4 sw=4 ts=8 tw=79 : diff --git a/etc/vim/pack/editorconfig-vim/start/editorconfig-vim b/etc/vim/pack/editorconfig-vim/start/editorconfig-vim new file mode 160000 index 0000000..7f4e4df --- /dev/null +++ b/etc/vim/pack/editorconfig-vim/start/editorconfig-vim @@ -0,0 +1 @@ +Subproject commit 7f4e4dfc58c480d154116614e616d90aac77204d diff --git a/base/.vim/pack/todo.txt/start/todo.txt-vim b/etc/vim/pack/todo.txt-vim/start/todo.txt-vim similarity index 100% rename from base/.vim/pack/todo.txt/start/todo.txt-vim rename to etc/vim/pack/todo.txt-vim/start/todo.txt-vim diff --git a/etc/vim/pack/vim-commentary/start/vim-commentary b/etc/vim/pack/vim-commentary/start/vim-commentary new file mode 160000 index 0000000..e87cd90 --- /dev/null +++ b/etc/vim/pack/vim-commentary/start/vim-commentary @@ -0,0 +1 @@ +Subproject commit e87cd90dc09c2a203e13af9704bd0ef79303d755 diff --git a/base/.vim/pack/repeat.vim/start/vim-repeat b/etc/vim/pack/vim-repeat/start/vim-repeat similarity index 100% rename from base/.vim/pack/repeat.vim/start/vim-repeat rename to etc/vim/pack/vim-repeat/start/vim-repeat diff --git a/etc/vim/pack/vim-speeddating/start/vim-speeddating b/etc/vim/pack/vim-speeddating/start/vim-speeddating new file mode 160000 index 0000000..5a36fd2 --- /dev/null +++ b/etc/vim/pack/vim-speeddating/start/vim-speeddating @@ -0,0 +1 @@ +Subproject commit 5a36fd29df63ea3f65562bd2bb837be48a5ec90b diff --git a/etc/vim/pack/vim-surround/start/vim-surround b/etc/vim/pack/vim-surround/start/vim-surround new file mode 160000 index 0000000..3d188ed --- /dev/null +++ b/etc/vim/pack/vim-surround/start/vim-surround @@ -0,0 +1 @@ +Subproject commit 3d188ed2113431cf8dac77be61b842acb64433d9 diff --git a/etc/volumeicon/volumeicon b/etc/volumeicon/volumeicon deleted file mode 100644 index a5bd428..0000000 --- a/etc/volumeicon/volumeicon +++ /dev/null @@ -1,25 +0,0 @@ -[Alsa] -card=default - -[Notification] -show_notification=false -notification_type=0 - -[StatusIcon] -stepsize=5 -onclick=~/bin/xmixer -theme=Default -use_panel_specific_icons=false -lmb_slider=true -mmb_mute=true -use_horizontal_slider=true -show_sound_level=true -use_transparent_background=false - -[Hotkeys] -up_enabled=true -down_enabled=true -mute_enabled=false -up=XF86AudioRaiseVolume -down=XF86AudioLowerVolume -mute=XF86AudioMute diff --git a/base/.zlogin b/etc/zsh/.zlogin similarity index 62% rename from base/.zlogin rename to etc/zsh/.zlogin index a1175c7..471fc29 100644 --- a/base/.zlogin +++ b/etc/zsh/.zlogin @@ -1,6 +1,6 @@ # NOTE: all logic here moved to .zprofile, see comments there for rationale ### load site-specific -if [[ -f ~/.zlogin.local ]] { source ~/.zlogin.local } +if [[ -f ${ZDOTDIR:-~}/.zlogin.local ]] { source ${ZDOTDIR:-~}/.zlogin.local } # vim: et sts=4 sw=4 ts=8 tw=79 diff --git a/base/.zlogout b/etc/zsh/.zlogout similarity index 88% rename from base/.zlogout rename to etc/zsh/.zlogout index 64591b6..1ede4c5 100644 --- a/base/.zlogout +++ b/etc/zsh/.zlogout @@ -15,6 +15,6 @@ if [[ -o interactive ]] { } ### load site-specific -if [[ -f ~/.zlogout.local ]] { source ~/.zlogout.local } +if [[ -f ${ZDOTDIR:-~}/.zlogout.local ]] { source ${ZDOTDIR:-~}/.zlogout.local } # vim: et sts=4 sw=4 ts=8 tw=79 diff --git a/base/.zprofile b/etc/zsh/.zprofile similarity index 75% rename from base/.zprofile rename to etc/zsh/.zprofile index 2a26dbb..777e0fa 100644 --- a/base/.zprofile +++ b/etc/zsh/.zprofile @@ -1,8 +1,8 @@ # NOTE: -# our .zprofile is expensive, so we keep track of what has been run already, -# and only set up what is necessary. additionally, we want to ensure that our -# environment is set up as early as possible, so we also source .zprofile in -# .zshenv for new non-login shells. +# our .zprofile can be expensive, so we keep track of what has been run +# already, and only set up what is necessary. additionally, we want to ensure +# that our environment is set up as early as possible, so we also source +# .zprofile in .zshenv for new non-login shells. # # these issues are handled by using these methods: # * the parent shell that starts the user's session after logging in to some @@ -34,7 +34,7 @@ function _sev_zcleanup { # broken—in all 3 of these cases the best choice is remove it. p=$(basename $x) if {[[ -v _sev_gpg_forward_clean || $$ == $p ]] || - ! kill -0 $p 2>/dev/null} { + ! kill -0 $p 2>/dev/null} { find $x -mindepth 1 -maxdepth 1 | while {read -r y} { # XXX: real dirs will stop unlink, consider it a feature unlink $y @@ -58,7 +58,7 @@ function _sev_zcleanup { # NOTE: same rationale as above p=${$(basename $x)#.session.} if {[[ -v _sev_tmp_clean || $$ == $p ]] || - ! kill -0 $p 2>/dev/null} { + ! kill -0 $p 2>/dev/null} { rm -rf $x } } @@ -70,7 +70,6 @@ function _sev_zcleanup { ### lang export CHARSET=${CHARSET:-UTF-8} export LANG=${LANG:-en_US.UTF-8} -export LC_CTYPE=${LC_TYPE:-$LANG} ### path # NOTE: we utilize the fact that unique arrays keep the first occurrence and @@ -81,9 +80,11 @@ if [[ ! -v _sev_setup_path || -o login ]] { typeset -U path fpath # add as many generic paths as possible to keep the order we want # NOTE: /usr/{local,pkg,games} are unix/bsdisms - # XXX: PREFIX not validated, non-posix but Termux uses it + # XXX: PREFIX not validated, non-posix but Termux uses it, maybe others + # XXX: XDG specifies ~/.local/bin as the only user-writable dir for + # executables, but we specify more; technically this is against spec syspath=("$path[@]") - path=(~/{s,}bin + path=(~/{.local/,}{s,}bin {~/.local,{$PREFIX,}{,/opt,/usr{,/local,pkg}}}/sbin {~/.local,{$PREFIX,}{,/opt,/usr{,/local,pkg}}}/bin /usr/{X11R{7,6}/bin,games}) @@ -109,6 +110,13 @@ if [[ ! -v _sev_setup_path || -o login ]] { export _sev_setup_path= } +### xdg local dir +# NOTE: need this for tmp, so confirm it exists. +# XXX: perms are not specified for XDG dirs except runtime, but I think 760 +# makes the most sense. shouldn't break anything since no one else should +# be poking around in our dir. +[[ -e ~/.local ]] || mkdir -m760 ~/.local + ### tmp # NOTE: specs say that POSIX tmp and XDG runtime directories should exist # until the last session is logged out (POSIX can exist for longer). @@ -117,67 +125,101 @@ if [[ ! -v _sev_setup_path || -o login ]] { # toplevel session (i.e. SHLVL=1). this should placate most applications, # though it is not expressly spec compliant. if [[ ! -v _sev_tmp ]] { - _sev_tmp=~/tmp - # create personal tmp dir + _sev_tmp=~/.local/tmp + # NOTE: race condition/remove in use files + [[ -h $_sev_tmp ]] && unlink $_sev_tmp 2>/dev/null t=${TMPDIR:-${TEMP:-${TMP:-/tmp}}}/.home-$LOGNAME - [[ ! -e $t ]] && mkdir -m700 $t 2>/dev/null + # create personal tmp dir under system tmp + [[ -e $t ]] || mkdir -m700 $t 2>/dev/null if [[ ! -d $t ]] { [[ -o interactive ]] && - print -P "%F{red}!!! Can't create tmpdir $t%f" - # fallback bare directories - [[ -h $_sev_tmp ]] && unlink $_sev_tmp 2>/dev/null - [[ ! -e $_sev_tmp ]] && mkdir -m700 $_sev_tmp 2>/dev/null + print -P "%F{orange}*** Can't create TMPDIR $t, using $_sev_tmp%f" + # fallback bare directory + [[ -e $_sev_tmp ]] || mkdir -m700 $_sev_tmp 2>/dev/null + if [[ ! -d $_sev_tmp ]] { + [[ -o interactive ]] && + print -P "%F{red}!!! No usable TMPDIR%f" + unset _sev_tmp + } else { + t=$_sev_tmp + } + } elif [[ -e $_sev_tmp ]] { + [[ -o interactive ]] && + print -P "%F{orange}*** $_sev_tmp occluded, can't link to TMPDIR $t%f" + _sev_tmp=$t + } else { + ln -s $t $_sev_tmp 2>/dev/null + } + if [[ -v _sev_tmp ]] { + # ensure dir is clean + _sev_zcleanup tmp + # finally create our subdir for this session + t=$_sev_tmp/.session.$$ + if ! mkdir -m700 $t 2>/dev/null; then + [[ -o interactive ]] && + print -P "%F{red}!!! Can't create session subdir $t, using $_sev_tmp%f" + t=$_sev_tmp + fi + export _sev_tmp TMPDIR=$t TEMP=$t TMP=$t + unset t } - # link home tmp for convenience if there isn't anything meaningful there - [[ -h $_sev_tmp || ! -e $_sev_tmp ]] && ln -sfn $t $_sev_tmp 2>/dev/null - export _sev_tmp=$(realpath $_sev_tmp) - # ensure dir is clean - _sev_zcleanup tmp - # finally create our subdir for this session - h=$_sev_tmp/.session.$$ - mkdir -m700 $h 2>/dev/null - export TMPDIR=$h TEMP=$h TMP=$h - unset t h } ### xdg if [[ ! -v _sev_setup_xdg ]] { - # merge with any existing dirs and remove duplicates using unique arrays + ## merge with any existing dirs and remove duplicates using unique arrays + # NOTE: we are accepting whatever value might be set for CONFIG and DATA; + # if it wasn't set, we just use default and leave it unset # NOTE: include and then remove CONFIG_HOME and DATA_HOME to ensure they # are not present in the array if it was added before we got to it - typeset -UT XDG_CONFIG_DIRS xdg_config_dirs - export XDG_CONFIG_HOME=~/etc - mkdir $XDG_CONFIG_HOME 2>/dev/null - xdg_config_dirs=($XDG_CONFIG_HOME ~/.config - {/opt,/usr/local,/usr/pkg,}/etc/xdg - "${XDG_CONFIG_DIRS:+${xdg_config_dirs[@]}}") - export XDG_CONFIG_DIRS=${XDG_CONFIG_DIRS#$XDG_CONFIG_HOME} - typeset -UT XDG_DATA_DIRS xdg_data_dirs - export XDG_DATA_HOME=~/share - mkdir $XDG_DATA_HOME 2>/dev/null - xdg_data_dirs=($XDG_DATA_HOME ~/.local/share - /{opt,usr/local,usr/pkg,usr}/share + if [[ -v XDG_DATA_HOME ]] { + export XDG_DATA_HOME + } elif [[ ! -e ~/.local/share ]] { + mkdir -m760 ~/.local/share + } + xdg_data_dirs=($XDG_DATA_HOME /{opt,usr/local,usr/pkg,usr}/share "${XDG_DATA_DIRS:+${xdg_data_dirs[@]}}") - export XDG_DATA_DIRS=${XDG_DATA_DIRS#$XDG_DATA_HOME} + # XXX: if colons are not escaped, could remove unintended part of string + export XDG_DATA_DIRS=${XDG_DATA_DIRS#$XDG_DATA_HOME:} - mkdir ~/var 2>/dev/null - export XDG_STATE_HOME=~/var/lib - mkdir $XDG_STATE_HOME 2>/dev/null + typeset -UT XDG_CONFIG_DIRS xdg_config_dirs + if [[ -v XDG_CONFIG_HOME ]] { + export XDG_CONFIG_HOME + } elif [[ ! -e ~/.config ]] { + mkdir -m760 ~/.config + } + # I am of the belief .local should follow FHS /usr/local... + [[ -e ~/.local/etc ]] || ln -s ~/.config ~/.local/etc + xdg_config_dirs=($XDG_CONFIG_HOME ${XDG_CONFIG_DIRS:+"$xdg_config_dirs[@]"} + {/opt,/usr/local,/usr/pkg,}/etc/xdg) + # XXX: if colons are not escaped, could remove unintended part of string + export XDG_CONFIG_DIRS=${XDG_CONFIG_DIRS#$XDG_CONFIG_HOME:} - if [[ -v _sev_tmp ]] { - export XDG_CACHE_HOME=$_sev_tmp/.xdg.cache - mkdir $XDG_CACHE_HOME 2>/dev/null + if [[ -v XDG_STATE_HOME ]] { + export XDG_STATE_HOME + } elif [[ ! -e ~/.local/state ]] { + mkdir -m760 ~/.local/state + } - export XDG_RUNTIME_DIR=$TMPDIR/.xdg.runtime - # same as in tmpdir creation, ensure it doesn't exist - if [[ -h $XDG_RUNTIME_DIR ]]; then - unlink $XDG_RUNTIME_DIR 2>/dev/null - elif [[ -e $XDG_RUNTIME_DIR ]]; then - rm -rf $XDG_RUNTIME_DIR 2>/dev/null - fi - mkdir -m700 $XDG_RUNTIME_DIR 2>/dev/null + if [[ ! -v XDG_CACHE_HOME ]] { + if [[ -v _sev_tmp ]] { + export XDG_CACHE_HOME=$_sev_tmp/.xdg.cache + [[ -e $XDG_CACHE_HOME ]] || mkdir -m700 $XDG_CACHE_HOME + } elif [[ ! -e ~/.cache ]] { + mkdir -m700 ~/.cache + } + } + + # make runtime dir in our session-specific tmpdir + export XDG_RUNTIME_DIR=$TMPDIR/.xdg.runtime + # same as in tmpdir creation, ensure dir doesn't exist + if [[ -h $XDG_RUNTIME_DIR ]] { + unlink $XDG_RUNTIME_DIR 2>/dev/null + } elif [[ -e $XDG_RUNTIME_DIR ]] { + rm -rf $XDG_RUNTIME_DIR 2>/dev/null } + mkdir -m700 $XDG_RUNTIME_DIR 2>/dev/null # source user dirs after other vars [[ -e $XDG_CONFIG_HOME/user-dirs.dirs ]] && @@ -193,9 +235,9 @@ if [[ ! -v DBUS_SESSION_BUS_ADDRESS && -v commands[dbus-launch] ]] { ### gpg home if [[ ! -v GNUPGHOME ]] { - export GNUPGHOME=~/etc/gnupg + export GNUPGHOME=${XDG_CONFIG_HOME:-~/.config}/gnupg if [[ -d ~/.gnupg ]] { - mv ~/.gnupg ~/etc/gnupg + mv ~/.gnupg ${XDG_CONFIG_HOME:-~/.config}/gnupg } } @@ -224,13 +266,14 @@ if [[ ! -v GNUPGHOME ]] { # remote host before opening a shell, so that we can have the host # communicate back to the client where it wants a socket created or ask # the host if the path the client wants to use is writable. however, this -# would open up too many edge cases where it wouldn't work or be clunky -# (e.g. asking for password twice) to make it worth it. +# would open up too many edge cases where it wouldn't work or be too +# clunky (e.g. asking for password twice) to make it worth it. function _gpg_socketpath { # dirs are percent-encoded: https://stackoverflow.com/a/64312099 echo ${1//(#b)%([[:xdigit:]](#c2))/${(#):-0x$match[1]}} } if [[ ! -v _sev_setup_gpg_forward && -v commands[gpg] ]] { + # XXX: assuming /tmo exists and is writable on destination export _GNUPG_SOCK_DEST_BASE=/tmp/.gpg-agent-forward export _GNUPG_SOCK_DEST_EXT=$(date +%s).$RANDOM export _GNUPG_SOCK_DEST=$_GNUPG_SOCK_DEST_BASE.$_GNUPG_SOCK_DEST_EXT @@ -279,8 +322,8 @@ if [[ ! -v _sev_setup_gpg_forward && -v commands[gpg] ]] { } ### gpg agent -if [[ -v commands[gpg-connect-agent] && ( ! -v _sev_setup_gpgagent || - ( -v _sev_first_display && -z $_sev_first_display ) ) ]] { +if [[ -v commands[gpg-connect-agent] && + ( ! -v _sev_setup_gpgagent || -v _sev_refresh_gpgagent ) ]] { # avoid printing if we have already set up tty before [[ ! -v _sev_setup_gpgagent && -o interactive ]] && p=true || p=false if {$p} { @@ -318,7 +361,7 @@ if [[ -v commands[gpg-connect-agent] && ( ! -v _sev_setup_gpgagent || } export _sev_setup_gpgagent= } - unset p + unset p _sev_refresh_gpgagent } ### ssh agent @@ -387,6 +430,6 @@ unfunction _gpg_socketpath ### load site-specific -if [[ -f ~/.zprofile.local ]] { source ~/.zprofile.local } +if [[ -f ${ZDOTDIR:-~}/.zprofile.local ]] { source ${ZDOTDIR:-~}/.zprofile.local } # vim: et sts=4 sw=4 ts=8 tw=79 diff --git a/base/.zshrc b/etc/zsh/.zshrc similarity index 91% rename from base/.zshrc rename to etc/zsh/.zshrc index 4ee5000..5ca4858 100644 --- a/base/.zshrc +++ b/etc/zsh/.zshrc @@ -13,8 +13,8 @@ autoload -Uz zmathfunc && zmathfunc ### exports ## common -export EDITOR=vim -export PAGER=less +export EDITOR=${$(whence -p nvim vim vi micro nano emacs)[(f)1]} +export PAGER=${$(whence -p less micro nano more)[(f)1]:s/micro/& -readonly true -multiopen tab/:s/nano/& --view} ## grep # XXX: deprecated in GNU export GREP_OPTIONS=--color=auto @@ -23,14 +23,16 @@ export HISTFILE=~/.histfile export HISTSIZE=1000 export SAVEHIST=1000 ## python -export PYTHONSTARTUP=~/.pythonrc +export PYTHONSTARTUP=${XDG_CONFIG_HOME:-~/.config}/pythonrc +## vim +export VIMINIT='execute "source" ($XDG_CONFIG_HOME??($HOME."/.config"))."/vim/.vimrc"' ## wayland/sway # XXX: only do this if we're actually in wayland, but without a start script export XDG_SESSION_TYPE=wayland export QT_QPA_PLATFORM=wayland-egl export QT_WAYLAND_DISABLE_WINDOWDECORATION=-1 export SDL_VIDEODRIVER=wayland -export TERMINAL=footclient +export TERMINAL=${$(whence -p konsole footclient urxvt xterm)[(f)1]} ### keys bindkey -v @@ -39,7 +41,7 @@ KEYTIMEOUT=10 if (( $#terminfo == 0 )) { # terminfo is not set or empty function find_keymap { - for f in ${ZDOTDIR:-$HOME}/.zkbd/$TERM{-${DISPLAY:-$VENDOR-$OSTYPE},} + for f in ${ZDOTDIR:-~}/.zkbd/$TERM{-${DISPLAY:-$VENDOR-$OSTYPE},} [[ -f $f ]] && keymap=$f && break } find_keymap @@ -132,7 +134,7 @@ done unset a k v ### abbreviation aliases -alias h='history -25' +alias h='fc -l -25' alias j='jobs -l' alias l='ls -AF' if [[ "$OSTYPE" =~ '^(free|net)bsd' ]] { @@ -140,8 +142,8 @@ if [[ "$OSTYPE" =~ '^(free|net)bsd' ]] { } else { alias ll='ls -lAFh' } -alias p=${PAGER:-more} # TODO: make sure more is there or use alternate -alias e=${EDITOR:-vi} # TODO: make sure vi is there or use alternate +alias p=$PAGER +alias e=$EDITOR alias se=sudoedit # be paranoid alias cp='cp -ip' @@ -153,11 +155,12 @@ if [[ "$OSTYPE" =~ '^freebsd' ]] { # TODO: similar behavior for non-freebsd, or impliment in zsh alias rm='rm -i' } +[[ -v commands[trash-put] ]] && alias t=trash-put ## py venv alias va='source bin/activate' alias vd=deactivate ## ps -source ~/bin/.check-busybox +source ~/.local/bin/.check-busybox if [[ -v commands[pstree] ]] && ! check-busybox pstree; then # use pstree, but NOT busybox pstree because it kinda sucks ps="pstree -wg3" @@ -273,7 +276,7 @@ case $OSTYPE; in };; *) ## sound - # TODO: test alsa/oss/sndio/portaudio/pulse in order of importance + # TODO: test alsa/oss/sndio/portaudio/pulse/pipewire in order of importance function s {} function vol {} esac @@ -301,13 +304,16 @@ zstyle ':completion:*' menu select=1 zstyle ':completion:*' original false zstyle ':completion:*' select-prompt '%B%l%b' zstyle ':completion:*' verbose true -autoload -Uz compinit && compinit +autoload -Uz compinit +cache=${XDG_CACHE_HOME:-~/.cache}/zsh +[[ -d $cache ]] || mkdir -p $cache +compinit -d $cache/.zcompdump ### prompt autoload -Uz promptinit && promptinit prompt arrows ### load site-specific -if [[ -f ~/.zshrc.local ]] { source ~/.zshrc.local } +if [[ -f ${ZDOTDIR:-~}/.zshrc.local ]] { source ${ZDOTDIR:-~}/.zshrc.local } # vim: et sts=4 sw=4 ts=8 tw=79 diff --git a/base/.zsh/functions/Prompts/prompt_arrows_setup b/etc/zsh/functions/Prompts/prompt_arrows_setup similarity index 96% rename from base/.zsh/functions/Prompts/prompt_arrows_setup rename to etc/zsh/functions/Prompts/prompt_arrows_setup index 3fdba6c..64590b2 100644 --- a/base/.zsh/functions/Prompts/prompt_arrows_setup +++ b/etc/zsh/functions/Prompts/prompt_arrows_setup @@ -27,7 +27,7 @@ function prompt_arrows_setup() { # XXX: no checks for color terminal or if escapes work, except for echotc local m n p s r c d u - #TODO remove n? + #TODO: remove n? m=${1:-2line} # Mode n=${2:-white} # Normal p=${3:-green} # Prompt @@ -80,7 +80,6 @@ function prompt_arrows_setup() { # add-zsh-hook should have already been autoloaded by promptinit add-zsh-hook precmd prompt_arrows_precmd - add-zsh-hook preexec prompt_arrows_preexec autoload -Uz add-zle-hook-widget add-zle-hook-widget line-init prompt_arrows_keymap_select add-zle-hook-widget keymap-select prompt_arrows_keymap_select @@ -96,10 +95,6 @@ function prompt_arrows_precmd { vcs_info } -function prompt_arrows_preexec { - print -Pn "%F{red}<<<%f " -} - function prompt_arrows_preview { if (( ! $#* )); then prompt_preview_theme arrows 2line diff --git a/gui/icons/paper-icon-theme b/gui/icons/paper-icon-theme deleted file mode 160000 index aa3e8af..0000000 --- a/gui/icons/paper-icon-theme +++ /dev/null @@ -1 +0,0 @@ -Subproject commit aa3e8af7a1f0831a51fd7e638a4acb077a1e5188 diff --git a/gui/themes/Blackbird b/gui/themes/Blackbird deleted file mode 160000 index a1c5674..0000000 --- a/gui/themes/Blackbird +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a1c5674c0ec38b4cc8ba41d2c0e6187987ae7eb4 diff --git a/install.sh b/install.sh index 2be3651..b33d374 100755 --- a/install.sh +++ b/install.sh @@ -1,10 +1,22 @@ #!/bin/sh -#NOTE: .zshenv XDG paths are hardcoded to allow non-zsh install - +# install location and source files : ${DEST:=$(realpath "$HOME")} : ${SRC:=$(dirname "$(realpath "$0")")} +# confirm XDG vars we care about are set up +: ${LOCAL:=.local} # NOTE: needed for bin, which has no xdg var +: ${XDG_DATA_HOME:=$DEST/$LOCAL/share} +: ${XDG_CONFIG_HOME:=$DEST/.config} +: ${XDG_STATE_HOME:=$DEST/$LOCAL/state} +: ${XDG_CACHE_HOME:=$DEST/.cache} + +# these are the vars we actually use +share="${XDG_DATA_HOME#$DEST/}" +etc="${XDG_CONFIG_HOME#$DEST/}" +state="${XDG_STATE_HOME#$DEST/}" +cache="${XDG_CACHE_HOME#$DEST/}" + # test devnull=/dev/null if [ "$1" = "test" ]; then @@ -12,8 +24,7 @@ if [ "$1" = "test" ]; then devnull=/dev/stdout _cd() { cd $*; - echo " cd $*"; - echo "\$PWD=$PWD"; + echo "-- cd $* --> $PWD"; } alias cd="_cd" alias mkdir="echo -- mkdir" @@ -22,24 +33,41 @@ if [ "$1" = "test" ]; then alias sh="echo -- sh" fi -# create preferred folder structure -cd $DEST -mkdir -p bin etc share/fonts share/themes share/icons >$devnull 2>&1 -command -v vim >$devnull 2>&1 && mkdir -pm 700 var/tmp/vim >$devnull 2>&1 -cd $SRC >$devnull - # ensure ostype +# NOTE: copied from .zshenv if [ -z "$OSTYPE" ]; then OSTYPE=$(uname -s | tr '[:upper:]' '[:lower:]') fi # accomodate multiple userlands +# XXX: assuming GNU by default +# TODO: test for GNU, fallback to POSIX instead (no -n) lnargs=-sfnv case "$OSTYPE" in freebsd*) lnargs=-sFhv;; netbsd|openbsd*) lnargs=-sfhv;; esac +cd "$DEST" + +# create preferred folder structure +mkdir -pm 760 "$share" "$etc" "$state" "$cache" +ln $lnargs "$DEST/$etc" "$LOCAL/etc" +mkdir -p "$LOCAL/bin" "$share/fonts" "$share/themes" "$share/icons" + +# clean out old links +# TODO: doesn't remove dead links if realpath fails; this happens if the link +# target doesn't exist under busybox +find . "$share" "$etc" \ + "$LOCAL/bin" "$share/fonts" "$share/themes" "$share/icons" \ + "$etc/gnupg" .ssh .termux \ + -xdev -mindepth 1 -maxdepth 1 -type l -exec sh -c ' + r="$(realpath "{}")" + [ "${r#'"$SRC"'/}" != "$r" ] && + '"$([ "$1" = test ] && echo 'echo +++ ')"'unlink "{}"' \; + +cd "$SRC" >$devnull + l() { # TODO: use install? d="$DEST/${1:-$x}" @@ -48,8 +76,10 @@ l() { } # generic links -find base -mindepth 1 -maxdepth 1 | while read -r x; do l "${x#base/}"; done -find bin etc share -mindepth 1 -maxdepth 1 | while read -r x; do l; done +find base -mindepth 1 -maxdepth 1 | while read -r x; do l "${x#base/}"; done +find bin -mindepth 1 -maxdepth 1 | while read -r x; do l "$LOCAL/$x"; done +find share -mindepth 1 -maxdepth 1 | while read -r x; do l "$share${x#share}"; done +find etc -mindepth 1 -maxdepth 1 | while read -r x; do l "$etc${x#etc}"; done # xorg/wayland resources find gui -mindepth 1 -maxdepth 1 | while read -r y; do @@ -59,7 +89,7 @@ find gui -mindepth 1 -maxdepth 1 | while read -r y; do [ ! -e "$x/index.theme" ] && continue command -v gtk-update-icon-cache >$devnull 2>&1 && gtk-update-icon-cache -f "$x" - l "share${y#gui}/$(basename "$x")" + l "$share${y#gui}/$(basename "$x")" done ;; fonts) @@ -70,12 +100,12 @@ find gui -mindepth 1 -maxdepth 1 | while read -r y; do rm "$x/fonts.scale" [ "$(head -1 "$x/fonts.dir" >$devnull 2>&1)" = 0 ] && rm "$x/fonts.dir" - l "share${y#gui}/$(basename "$x")" + l "$share${y#gui}/$(basename "$x")" done ;; *) find "$y" -mindepth 1 -maxdepth 1 | while read -r x; do - l "share${x#gui}" + l "$share${x#gui}" done ;; esac @@ -83,9 +113,9 @@ done # gpg if command -v gpg >$devnull 2>&1; then - mkdir -p "$DEST/etc/gnupg" + mkdir -pm 700 "$DEST/$etc/gnupg" find gnupg -mindepth 1 -maxdepth 1 \! -name '*.gpg' | while read -r x; do - l "etc/$x" + l "$etc/$x" done find gnupg -mindepth 1 -maxdepth 1 -name '*.gpg' | while read -r x; do gpg --import "$x" @@ -99,9 +129,8 @@ find ssh -mindepth 1 -maxdepth 1 | while read -r x; do # termux, assume it if android if [ $(uname -o) = 'Android' ]; then mkdir -p "$DEST/.termux" - find termux -mindepth 1 -maxdepth 1 | while read -r x; do - l ".$x"; done - l ".termux/font.ttf" 'share/fonts/Dina-ttf/Dina.ttf' + find termux -mindepth 1 -maxdepth 1 | while read -r x; do l ".$x"; done + l '.termux/font.ttf' "$share/fonts/Dina-ttf/Dina.ttf" fi # vim: sts=4 sw=4 et diff --git a/share/lck/overlay.png b/share/lck/overlay.png deleted file mode 100644 index 99afd9b..0000000 Binary files a/share/lck/overlay.png and /dev/null differ diff --git a/src/lck/share/overlay.xcf b/src/lck/share/overlay.xcf deleted file mode 100644 index cae18d5..0000000 Binary files a/src/lck/share/overlay.xcf and /dev/null differ