Merge branch 'dev' of ssh://git.lyte.dev:2222/lytedev/dotfiles into dev

This commit is contained in:
Daniel Flanagan 2020-02-13 11:14:01 -06:00
commit 5ed58382a5
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4
26 changed files with 151 additions and 100 deletions

View file

@ -4,11 +4,11 @@ NUM_DESKTOPS="$(xrq bspwm.num_desktops)"
REVERSE_DESKTOP_ORDERING="$(xrq bspwm.reverse_desktop_ordering)"
REVERSE_MONITOR_DESKTOPS="$(xrq bspwm.reverse_monitor_desktops)"
BSPWM_MONITORS=$(bspc query -M)
MONITOR_COUNT=$(<<< "$BSPWM_MONITORS" wc -w | awk '{ printf $1 }')
MONITOR_COUNT=$(echo "$BSPWM_MONITORS" | wc -w | awk '{ printf $1 }')
PER_MONITOR=$((NUM_DESKTOPS / MONITOR_COUNT))
DESKTOPS=$(seq "$NUM_DESKTOPS")
[ $REVERSE_MONITOR_DESKTOPS -eq 1 ] && BSPWM_MONITORS=$(<<< "$BSPWM_MONITORS" tac)
[ "$REVERSE_MONITOR_DESKTOPS" -eq 1 ] && BSPWM_MONITORS=$(echo "$BSPWM_MONITORS" | tac)
bspc config normal_border_color "$(xrq bspwm.normal_border_color)"
bspc config focused_border_color "$(xrq bspwm.focused_border_color)"
@ -28,7 +28,7 @@ bspc rule -a "*" split_dir=right
i=1
for mon in $BSPWM_MONITORS; do
max=$((i + PER_MONITOR - 1))
screens=
screens=""
for j in $(seq $i $max); do
screens="${screens}${j} "
done
@ -36,7 +36,7 @@ for mon in $BSPWM_MONITORS; do
i=$((max + 1))
done
if [ $REVERSE_DESKTOP_ORDERING -eq 1 ]; then
if [ "$REVERSE_DESKTOP_ORDERING" -eq 1 ]; then
prev_mon=
for mon in ${BSPWM_MONITORS}; do
if [ ! -z $prev_mon ]; then

View file

@ -1,18 +1,17 @@
#!/usr/bin/env sh
. "$DOTFILES_PATH/apps/de/x/profile"
BAR_COMMAND="startbar"
BSPWM_STATE_FILE="$HOME/.bspwm_state"
if [ -e "$BSPWM_STATE" ] ; then
bspc wm -l "$BSPWM_STATE"
rm "$BSPWM_STATE"
fi
[ -e "$BSPWM_STATE" ] && bspc wm -l "$BSPWM_STATE" && rm "$BSPWM_STATE"
. "$DOTFILES_PATH/apps/de/bspwm/config"
[ -f "$HOME/.fehbg" ] && "$HOME/.fehbg" &
[ "$(xrq bspwm.start_compton)" = "true" ] && has_command compton && compton &
[ "$(xrq bspwm.start_bar)" = "true" ] && has_command "${BAR_COMMAND}" && "${BAR_COMMAND}" &
[ "$(xrq bspwm.start_compton)" -eq 1 ] && has_command compton && compton &
[ "$(xrq bspwm.start_bar)" -eq 1 ] && has_command "${BAR_COMMAND}" && "${BAR_COMMAND}" &
has_command urxvtd && urxvtd &
has_command dunst && dunst &
has_command sxhkd && sxhkd -m -1 &

View file

@ -102,20 +102,32 @@ format-mounted-prefix-foreground = ${colors.icon}
; ########################### ;
[module/bspwm]
ws-icon-0 = 1;
ws-icon-1 = 2;
ws-icon-2 = 3;
ws-icon-3 = 4;
ws-icon-4 = 5;
ws-icon-5 = 6;
ws-icon-6 = 7;
ws-icon-7 = 8;
ws-icon-8 = 9;
ws-icon-9 = 10;
ws-icon-default = ♟
; ws-icon-0 = 1;
; ws-icon-1 = 2;
; ws-icon-2 = 3;
; ws-icon-3 = 4;
; ws-icon-4 = 5;
; ws-icon-5 = 6;
; ws-icon-6 = 7;
; ws-icon-7 = 8;
; ws-icon-8 = 9;
; ws-icon-9 = 10;
; ws-icon-default = ♟
; misc icon: 
ws-icon-0 = 1;1
ws-icon-1 = 2;2
ws-icon-2 = 3;3
ws-icon-3 = 4;4
ws-icon-4 = 5;5
ws-icon-5 = 6;6
ws-icon-6 = 7;7
ws-icon-7 = 8;8
ws-icon-8 = 9;9
ws-icon-9 = 10;0
ws-icon-default = -
; misc icon: -
label-focused-font = 2
label-occupied-font = 2
label-urgent-font = 2

View file

@ -12,7 +12,7 @@ bar_monitor="$(xrq polybar.display_monitor)"
# TODO: if bspwm is the active window manager
if has_command bspc; then
if [ ! "$(xrq polybar.bottom_of_display)" = "true" ]; then
if [ ! "$(xrq polybar.bottom_of_display)" -eq 1 ]; then
bspc config -m "${bar_monitor}" top_padding "$eheight"
bspc config -m "${bar_monitor}" bottom_padding "0"
else

0
apps/de/x/profile Normal file → Executable file
View file

View file

@ -71,14 +71,14 @@ bspwm.num_desktops: 10
bspwm.reverse_desktop_ordering: 0
bspwm.reverse_monitor_desktops: 0
bspwm.split_ratio: 0.5
bspwm.start_compton: false
bspwm.start_bar: true
bspwm.start_compton: 0
bspwm.start_bar: 1
! polybar
polybar.primary_font: mono_font:pixelsize=bar_font_size;1
polybar.secondary_font: icon_font:style=Regular:pixelsize=icon_font_size;1
polybar.display_monitor: HDMI-1
polybar.bottom_of_display: true
polybar.bottom_of_display: 1
polybar.margin: window_margin
polybar.storage_volume: /
polybar.ethernet_interface: eth0

View file

@ -14,7 +14,6 @@
[core]
editor = nvim
pager = diff-so-fancy | less --tabs=2 -RFX
[http "https://gopkg.in"]
followRedirects = true
@ -48,7 +47,7 @@
prompt = false
[mergetool "nvimdiff"]
cmd = nvim -d $BASE $LOCAL $REMOTE $MERGED -c '$wincmd w' -c 'wincmd J'
cmd = nvimdiff $BASE $LOCAL $REMOTE $MERGED -c '$wincmd w' -c '$wincmd J'
[pager]
branch = false
@ -63,17 +62,3 @@
[gpg]
program = gpg2
[color]
ui = true
[color "diff-highlight"]
oldNormal = red bold
oldHighlight = red bold 52
newNormal = green bold
newHighlight = green bold 22
[color "diff"]
meta = 11
frag = magenta bold
commit = yellow bold
old = red bold
new = green bold
whitespace = red reverse

View file

@ -1,3 +1,2 @@
pinentry-program /usr/bin/pinentry-curses
max-cache-ttl 60480000
default-cache-ttl 60480000

View file

@ -1,4 +1,5 @@
/*
!/scripts/
!/ftplugin/
!/.gitignore
!/init.vim

View file

@ -1,11 +1,13 @@
scriptencoding utf-8
set fileencoding=utf8
let $vimdir = $HOME.'/.vim'
if has('nvim')
let $vimdir = $XDG_CONFIG_HOME.'/nvim'
endif
" load a per-environment file if one exists
if filereadable("$ENV_PATH/vim")
source "$ENV_PATH/vim"
if filereadable($ENV_PATH."/vim")
source $ENV_PATH."/vim"
endif
call plug#begin($vimdir.'/bundle')

View file

@ -43,7 +43,7 @@ let g:polyglot_disabled = ['cue', 'cuesheet']
" let g:fzf_layout = { 'window': 'enew' }
" check if we're using vim as the manpage viewer before loading session plugins
if exists('asmanviewer')
if exists('asmanviewer') || exists('nosession')
let g:prosession_dir = '/dev/null'
else
Plug 'tpope/vim-obsession' " session ease-of-use

View file

@ -0,0 +1,20 @@
edit $PIPELINE_IN
split $PIPELINE_TRANSFORM
split $PIPELINE_OUT
let s:refresh_output = {j, d, e -> execute('checktime')}
let s:refresh_output_job = {'spec': ['inotifywait', '-m', '-e', 'close_write,delete', $PIPELINE_OUT], 'opts': {'detach': 1, 'on_stdout': s:refresh_output}}
let s:refresh_output_job_id = jobstart(s:refresh_output_job['spec'], s:refresh_output_job['opts'])
function s:RunPipeline()
execute "!".g:pipeline_transform
endfunction
let s:refresh_output_job_id = jobstart(s:refresh_output_job['spec'], s:refresh_output_job['opts'])
set updatetime=250
" only autosave the input buffer
autocmd CursorHold,CursorHoldI <buffer> silent write
autocmd FileWritePost silent call s:RunPipeline()
autocmd VimLeavePre call jobstop(s:refresh_output_job_id)
autocmd VimLeavePre call jobstop(s:run_pipeline_job_id)

View file

@ -111,7 +111,7 @@ function g
end
alias gs "git status"
alias gd "git diff"
alias gds "git diff --staged"
alias gds "gd --staged"
# alias gdv "git dv" # TODO: what is this?
alias gpl "git pull"
alias gp "git push"
@ -156,6 +156,7 @@ alias wifi "sudo nmtui"
alias year 'cal (date +%Y)'
alias y year
alias pa pulsemixer
alias vd vdiff
# games aliases
# this sometimes fixes steam dynamic library issues?

View file

@ -1,5 +0,0 @@
#!/usr/bin/env moon
archive_name = "#{string.gsub arg[1], "(.*/)(.*)", "%2"}.tar.zstd"
os.execute "tar --zstd -cvf '#{archive_name}' '#{table.concat arg, "' '"}'"
print "Archive created at: #{archive_name}"

View file

@ -1,4 +1,4 @@
#!/usr/bin/env bash
# TODO: needs fixing...?
[ -f "$HOME/.fzf.bash" ] && source "$HOME/.fzf.bash" && $(__fzf_cd__)
cd "$(dirname "$(fzf)")"

24
bin/fsw
View file

@ -4,8 +4,8 @@ _VERSION="0.2.0"
function help() {
I=" "
cat <<USAGE
fsw - run a command when a file is modified
cat << USAGE
fsw - run a command when a file is modified - v$_VERSION
Usage:
${I}fsw <command> [filter] [dirs...]
@ -41,11 +41,17 @@ USAGE
}
dbg() {
if [[ ! -z ${FSW_DEBUG+x} ]]; then
echo -e "[debug] fsw: $@"
if [[ -n ${FSW_DEBUG+x} ]]; then
echo -e "[debug] fsw: $*"
fi
}
contains_element () {
local e match="$1"; shift
for e; do [[ "$e" == "$match" ]] && return 0; done
return 1
}
if [[ $1 = '-h' ]] || [[ $1 = '--help' ]] || [[ -z $1 ]]; then
help
exit 0
@ -64,16 +70,20 @@ if [[ -e $FILTER ]]; then
echo "It looks like your filter is an actual file. I'll just watch that for you."
DIRS=("${FILTER}")
fi
while [[ ! -z $1 ]] && $(realpath $1) &> /dev/null; do
while [[ -n $1 ]] && realpath "$1" &> /dev/null; do
dbg "Directory: ${1}"
DIRS+=("$1"); shift
done
inotifywait -m -e "${FSW_EVENTS}" -r "${DIRS[@]}" 2>&1 \
inotifywait -m -e "${FSW_EVENTS},delete,delete_self" -r "${DIRS[@]}" 2>&1 \
| grep --line-buffered -v ' Beware: since -r was given, this may take a while!' \
| while read -r dir events filename; do
if contains_element "$dir" "${DIRS[@]}" && [[ $events =~ "delete" ]]; then
echo "One of the watched directories (\"$dir\") was deleted. Exiting..."
exit 75
fi
if [[ "$dir $events" = "Watches established." ]]; then
echo "Ready."
dbg "Directory: ${DIRS[@]}"
dbg "Directory: ${DIRS[*]}"
else
export FSW_FILENAME="$filename"
export FSW_DIR="$dir"

View file

@ -1,4 +1,4 @@
#!/usr/bin/env bash
eval "${1}"
fsw "$@"
exec fsw "$@"

View file

@ -55,6 +55,7 @@ pacaur --needed -S \
swaks `# SMTP CLI` \
time `# GNU time` \
fortune-mod fortune-mod-archlinux `# Fortune` \
diff-so-fancy `# Fancy Diffs` \
--noconfirm --noedit
# install rxvt-unicode script for resizing font on-the-fly

View file

@ -48,5 +48,5 @@ rofi.color-urgent: base00,base05,base00,base0D,base00
bspwm.normal_border_color: base00
bspwm.focused_border_color: base0D
bspwm.active_border_color: base0D
bspwm.active_border_color: base00
bspwm.presel_feedback_color: base0D

2
bin/nvimdiff Executable file
View file

@ -0,0 +1,2 @@
#!/usr/bin/env sh
nvim -d "$@"

View file

@ -8,7 +8,7 @@ if [ -n "${1+x}" ]; then
mkdir -p "$pdir"
if [ -z ${1+x} ]; then
td="$(mktemp -p "$pdir" -d "tmp_pipeline.XXXXXXXX")"
cleanup_trap="rm -rf \"$td\""
trap "rm -rf '$td'" EXIT
else
td="$pdir/$1"; shift
mkdir -p "$td"
@ -17,48 +17,23 @@ if [ -n "${1+x}" ]; then
else
td="$(mktemp --tmpdir -d pipeline.XXXXXXXX)"
transform="$td/transform"
cleanup_trap="rm -rf \"$td\""
trap "rm -rf '$td'" EXIT
fi
[ ! -e "$transform" ] && \
printf "#!/usr/bin/env bash\n# for %s\n\nbase64" "${td}" > "$transform"
printf "#!/usr/bin/env bash\n# you must save this buffer manually\n# for %s\n
base64" "${td}" > "$transform"
in="$td/in"
[ -n "${1+x}" ] && in="${1}" && shift
out="$td/out"
[ -n "${1+x}" ] && out="${1}" && shift
in="$td/in"; [ -n "${1+x}" ] && in="${1}" && shift
out="$td/out"; [ -n "${1+x}" ] && out="${1}" && shift
# TODO: if no logging, log="/dev/null"
log="$td/log"
chmod +x "$transform"
echo "Hello World" > "$in"
touch "$log"
fswi \
"bash -c 'cd \"$td\" && < \"$in\" \"$transform\" | tee \"$out\"'" \
'in$|transform$' \
"$td" "$pdir" > "$log" 2>&1 &
chmod +x "$transform"
watcher="$!"
# TODO: saved inputs?
echo "Hello World" > "$in"
if [ -z "${cleanup_trap+x}" ]; then
trap "kill \"$watcher\"" EXIT
else
trap "${cleanup_trap}; kill \"$watcher\"" EXIT
fi
job="$(echo "let g:pipeline_job_id = jobstart(['inotifywait', '-m', '-e', 'close_write', '${out}'], {'detach':1,'on_stdout':{j,d,e->execute('checktime')}})" | tr "'" '"')"
echo $job >> "$log"
# this will only autosave (and therefore autoreload) for the out buffer (since
# it was opened last) - autosaving (and therefore autorunning) is potentially
# very scary
nvim -V9"$td/vimlog" \
-o "$in" "$transform" "$out" \
--cmd "$job" \
--cmd 'set updatetime=250' \
--cmd 'autocmd CursorHold,CursorHoldI <buffer> silent write' \
--cmd 'autocmd VimLeave call jobstop(g:pipeline_job_id)' \
--cmd "$job"
env PIPELINE_IN="$id" PIPELINE_TRANSFORM="$transform" PIPELINE_OUT="$out" nvim --cmd "source $DOTFILES_PATH/apps/neovim/scripts/pipeline.vim"

39
bin/vdiff Executable file
View file

@ -0,0 +1,39 @@
#!/usr/bin/env bash
repo_root="$(git rev-parse --show-toplevel)"
if ! pushd "$repo_root" &> /dev/null; then
echo "Repo doesn't exist!"
exit 2
fi
td="$(mktemp -p "$pdir" -d "vdiff.XXXXXXXX")"
trap "rm -rf \"$td\"" EXIT
files="$(git diff --name-only "$@")"
args=()
vcmd=""
for f in $files; do
d="$(dirname "$td/$f")"
rfn="$(basename "$f")"
fn="$rfn._@HEAD"
cfn="$rfn"
mkdir -p "$d"
git --no-pager show HEAD:"$f" > "$d/$fn" 2>/dev/null || \
echo "<FILE CREATED>" > "$d/$fn"
cp "$f" "$d/$cfn" 2>/dev/null || echo "<FILE DELETED>" > "$d/$cfn"
if [ -z "$args" ]; then
args+=($d/$fn -c)
vcmd="vert diffsplit $d/$cfn"
else
vcmd="$vcmd | tabnew | e $d/$fn | vert diffsplit $d/$cfn"
fi
done
remaps="nnoremap <leader>k :tabnext<CR> | nnoremap <leader>j :tabprev<CR>"
nvim "${args[@]}" "$vcmd | tabnext | $remaps"
if ! popd &> /dev/null; then
echo "Could not return to original directory"
exit 4
fi

View file

@ -1,6 +1,7 @@
#!/usr/bin/env sh
nvim \
-c 'let nosession=1' \
-c 'silent setlocal nobuflisted buftype=nofile bufhidden=wipe noswapfile' \
"$@" \
-

View file

@ -1,2 +1,6 @@
bspwm.reverse_desktop_ordering: 1
#define bar_font_size 12
# TODO: this needs fixing
polybar.primary_font: Iosevka Term:pixelsize=bar_font_size;1
bspwm.reverse_desktop_ordering: 0
bspwm.reverse_monitor_desktops: 1
polybar.display_monitor: DisplayPort-0

View file

@ -2,6 +2,7 @@
autorandr --change
xrandr --output eDP1 --scale-from 1600x900 --filter nearest --mode 3200x1800
"${DOTFILES_PATH}/apps/de/x/loadresources"
xrdb -merge "$ENV_PATH/x/docked.resources"
"${DOTFILES_PATH}/apps/de/bspwm/rc"
restartbar

View file

@ -1,4 +1,7 @@
#define mono_font iosevka-lyte
#define bar_font_size 12
#define icon_font Font Awesome 5 Free Solid
#define icon_font_size 12
*.font: xft:Iosevka Nerd Font Mono:pixelsize=12,xft:Noto Emoji,xft:Font Awesome 5 Free:pixelsize=14,xft:FreeSans:pixelsize=14
*.boldFont: xft:Iosevka Nerd Font Mono:style=bold:pixelsize=12,xft:Font Awesome 5 Free:pixelsize=14,xft:FreeSans:pixelsize=14
@ -13,4 +16,5 @@ Xft.dpi: 190
polybar.height: 70
polybar.display_monitor: eDP1
polybar.primary_font: iosevka-lyte:pixelsize=bar_font_size;1
polybar.primary_font: mono_font:pixelsize=bar_font_size;1
polybar.secondary_font: icon_font:style=Regular:pixelsize=icon_font_size;1