From 5f0fa76a67db2e933faf6bcc158e89b14e778112 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Mon, 20 Jan 2020 10:49:06 -0600 Subject: [PATCH] More updates for fish migration --- Makefile | 2 +- apps/de/bspwm/config | 22 ++++++++++------------ apps/de/bspwm/rc | 23 +++++++---------------- apps/de/bspwm/{fehbg => wallpapers} | 0 apps/de/polybar/run | 10 +++++----- apps/de/sxhkd/rc | 8 ++++---- apps/de/x/loadresources | 6 ++---- apps/shell/bash/rc | 3 ++- apps/shell/fish/aliases.fish | 2 +- apps/shell/fish/config.fish | 10 ++++++++-- apps/shell/fish/paths.fish | 2 -- bin/app-launcher | 4 ++-- bin/dotfiles-make-env | 2 ++ bin/gcwd | 9 ++++----- bin/prelude | 1 - bin/scwd | 7 ++----- bin/startbar | 2 +- bin/tmuxswitcher | 2 +- bin/workdock | 12 ------------ env/desktop/bash | 3 +++ env/desktop/bspwm | 4 ++++ env/desktop/config.fish | 6 ++++++ env/desktop/x/resources | 16 ++++++++++++++++ env/laptop/app-launcher | 0 env/laptop/bar | 7 ------- env/laptop/bash | 3 --- env/laptop/{ => bin}/workdock | 9 ++++++++- env/laptop/bspwm | 3 --- readme.md | 2 +- setup => setup.bash | 2 +- 30 files changed, 91 insertions(+), 91 deletions(-) rename apps/de/bspwm/{fehbg => wallpapers} (100%) delete mode 100755 bin/workdock create mode 100755 env/desktop/bash create mode 100755 env/desktop/bspwm create mode 100755 env/desktop/config.fish create mode 100755 env/desktop/x/resources delete mode 100755 env/laptop/app-launcher delete mode 100755 env/laptop/bar delete mode 100755 env/laptop/bash rename env/laptop/{ => bin}/workdock (55%) delete mode 100755 env/laptop/bspwm rename setup => setup.bash (98%) diff --git a/Makefile b/Makefile index 617ff50..7b43b4f 100644 --- a/Makefile +++ b/Makefile @@ -3,4 +3,4 @@ MAKEFILE_PATH ?= $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) default: install install: - ${MAKEFILE_PATH}/setup + ${MAKEFILE_PATH}/setup.bash diff --git a/apps/de/bspwm/config b/apps/de/bspwm/config index 9f6c4b5..8deecdc 100755 --- a/apps/de/bspwm/config +++ b/apps/de/bspwm/config @@ -1,14 +1,13 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh -BORDER_WIDTH=5 # change in bspwmrc -export WINDOW_GAP=25 -DESKTOPS=$(seq 10) +export WINDOW_GAP=0 +NUM_DESKTOPS=10 +DESKTOPS=$(seq "$NUM_DESKTOPS") BSPWM_MONITORS=$(bspc query -M | tac) -MONITOR_COUNT=$(<<< "${BSPWM_MONITORS}" wc -w | awk '{ printf $1 }') -NUM_DESKTOPS=${#DESKTOPS[@]} +MONITOR_COUNT=$(<<< "$BSPWM_MONITORS" wc -w | awk '{ printf $1 }') PER_MONITOR=$((NUM_DESKTOPS / MONITOR_COUNT)) -REVERSE_DESKTOP_ORDERING=0 +REVERSE_DESKTOP_ORDERING=${REVERSE_DESKTOP_ORDERING:-0} . maybe_source_env_file bspwm @@ -28,21 +27,20 @@ bspc config window_gap "$WINDOW_GAP" bspc rule -a "*" split_dir=right i=1 -for mon in ${BSPWM_MONITORS}; do +for mon in $BSPWM_MONITORS; do max=$((i + PER_MONITOR - 1)) screens= for j in $(seq $i $max); do - ind=${DESKTOPS[$((j - 1))]} - screens="${screens}${ind} " + screens="${screens}${j} " done bspc monitor "$mon" -d $screens 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 + if [ ! -z $prev_mon ]; then bspc monitor "$mon" --swap "$prev_mon" fi prev_mon="$mon" diff --git a/apps/de/bspwm/rc b/apps/de/bspwm/rc index 84d1c33..1aa721f 100755 --- a/apps/de/bspwm/rc +++ b/apps/de/bspwm/rc @@ -1,18 +1,8 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh -source "$HOME/.bashrc" - -# NO_COMPTON=1 -BORDER_WIDTH=5 # change in bspwm_config, here for launcher +NO_COMPTON=1 START_BAR=1 -BAR_COMMAND="$DOTFILES_PATH/apps/de/polybar/run" - -if [[ -z "$XDG_CONFIG_HOME" ]]; then - export XDG_CONFIG_HOME="$HOME/.config" -fi -if [[ -z "$DOTFILES_PATH" ]]; then - export DOTFILES_PATH="$XDG_CONFIG_HOME/dotfiles" -fi +BAR_COMMAND="startbar" BSPWM_STATE_FILE="$HOME/.bspwm_state" @@ -21,15 +11,16 @@ if [ -e "$BSPWM_STATE" ] ; then rm "$BSPWM_STATE" fi -source "$DOTFILES_PATH/apps/de/bspwm/config" +export BORDER_WIDTH=5 +. "$DOTFILES_PATH/apps/de/bspwm/config" [ -f "$DOTFILES_PATH/apps/de/x/loadresources" ] && "$DOTFILES_PATH/apps/de/x/loadresources" [ -f "$HOME/.fehbg" ] && "$HOME/.fehbg" & +[ "$NO_COMPTON" -ne 1 ] && has_command compton && compton & +[ "$START_BAR" -eq 1 ] && has_command "${BAR_COMMAND}" && "${BAR_COMMAND}" & has_command urxvtd && urxvtd & has_command dunst && dunst & has_command sxhkd && sxhkd -m -1 & has_command unclutter && unclutter & -[[ "$NO_COMPTON" -ne 1 ]] && has_command compton && compton & -[[ $START_BAR -eq 1 ]] && ${BAR_COMMAND} & bspc wm -o diff --git a/apps/de/bspwm/fehbg b/apps/de/bspwm/wallpapers similarity index 100% rename from apps/de/bspwm/fehbg rename to apps/de/bspwm/wallpapers diff --git a/apps/de/polybar/run b/apps/de/polybar/run index feebe63..7561ad4 100755 --- a/apps/de/polybar/run +++ b/apps/de/polybar/run @@ -1,12 +1,12 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh export BAR_MONITOR="$(polybar --list-monitors | tail -n 1 | sed -n 's/^\s*\(.*\):.*$/\1/p')" # export BAR_MONITOR="$(polybar --list-monitors | tail -n 2 | head -n 1 | sed -n 's/^\s*\(.*\):.*$/\1/p')" export BAR_HEIGHT=40 export BAR_ON_TOP=0 -export BAR_SIDE_MARGIN=200 +export BAR_SIDE_MARGIN=0 -export BAR_FONT="${BAR_FONT:-$(xrdb -query | sed -ne 's/.*font:\s*xft:\([^:]*\)\:.*$/\1/p' | head -n 1)}" +export BAR_FONT="${BAR_FONT:-$(xrdb -query | sed -ne 's/.*font:\s*xft:\([^:]*\)\:.*$/\1/p' | head -n 1)}" export BAR_ICON_FONT="${BAR_ICON_FONT:-"Font Awesome 5 Free"}" export BAR_FONT_SIZE="${BAR_FONT_SIZE:-$(xrdb -query | sed -ne 's/.*font:\s*xft:[^-,]*\=\([0-9]*\).*$/\1/p' | head -n 1)}" export BAR_ICON_FONT_SIZE="${BAR_ICON_FONT_SIZE:-$((BAR_FONT_SIZE))}" @@ -41,12 +41,12 @@ fi if [ "$BAR_ON_TOP" -eq 1 ]; then export BAR_BOTTOM="false" - export POS_Y=$GAP + export POS_Y="$GAP" bspc config -m "${BAR_MONITOR}" top_padding "$EHEIGHT" bspc config -m "${BAR_MONITOR}" bottom_padding "0" else export BAR_BOTTOM="true" - export POS_Y=$GAP + export POS_Y="$GAP" bspc config -m "${BAR_MONITOR}" top_padding "0" bspc config -m "${BAR_MONITOR}" bottom_padding "$EHEIGHT" fi diff --git a/apps/de/sxhkd/rc b/apps/de/sxhkd/rc index 1f01c0d..57d74df 100755 --- a/apps/de/sxhkd/rc +++ b/apps/de/sxhkd/rc @@ -152,7 +152,7 @@ super + ctrl + b # spawn a transparent node super + alt + t - urxvtc && compton-trans -c -o 0 + "$TERMINAL" && compton-trans -c -o 0 # make current node transparent super + t @@ -168,7 +168,7 @@ super + shift + t # spawn a terminal super + Return - urxvtc + "$TERMINAL" # spawn a rock-solid and reliable terminal for when I break things super + alt + Return @@ -176,7 +176,7 @@ super + alt + Return # spawn a floating terminal super + shift + Return - bspc rule -a '*' -o state=floating && "urxvtc" + bspc rule -a '*' -o state=floating && "$TERMINAL" # spawn the app launcher super + space @@ -256,7 +256,7 @@ super + d xdotool key super+4 && sleep 0.1 && xdotool key shift+4 && xdotool key shift+4 && xdotool key shift+4 && sleep 0.2 && xdotool key super+1 && xdotool key super+3 super + ctrl + c - bspc rule -a '*' -o state=floating && urxvtc --geometry 64x9 -e sh -c "cal -n 3 && bash" + bspc rule -a '*' -o state=floating && urxvt --geometry 64x9 -e sh -c "cal -n 3 && bash" super + shift + v kill -USR1 $(cat "/var/run/user/$UID/polybar-mic-script.pid") diff --git a/apps/de/x/loadresources b/apps/de/x/loadresources index 6391302..f5d849d 100755 --- a/apps/de/x/loadresources +++ b/apps/de/x/loadresources @@ -1,9 +1,7 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh -echo "xload init" > /tmp/xload -echo "ep: $ENV_PATH" > /tmp/xload xqm() { - f="$1"; shift; [ -f "$f" ] && xrdb -merge "$f" "$@" &>/dev/null && echo "xqm LOADING $f" >> /tmp/xload + f="$1"; shift; [ -f "$f" ] && xrdb -merge "$f" "$@" &>/dev/null } xqm "/etc/X11/xinit/.Xresources" diff --git a/apps/shell/bash/rc b/apps/shell/bash/rc index 14ba3cf..13998a1 100644 --- a/apps/shell/bash/rc +++ b/apps/shell/bash/rc @@ -52,7 +52,8 @@ if has_command nvim; then fi # load a per-device config last so anything can be overridden -. maybe_source_env_file bash +. maybe_source_env_file bashrc +. maybe_source_env_file .hidden/bashrc # create paths we kind of expect to exist in some scripts mkdir -p "${NOTES_PATH}" diff --git a/apps/shell/fish/aliases.fish b/apps/shell/fish/aliases.fish index 844feae..7f0812a 100755 --- a/apps/shell/fish/aliases.fish +++ b/apps/shell/fish/aliases.fish @@ -131,7 +131,7 @@ alias btctl "bt" alias btctl "sudo bluetoothctl" alias pbcopy "clip" alias pt "htop -t" # experimental htop tree-view-by-default -alias resrc "source $HOME/.bashrc" +alias resrc "source $XDG_CONFIG_HOME/fish/config.fish" alias redshift "redshift -r -l 39.0997:-94.5786 -t 6500K:2500K" alias gpmdpe "electron --app=/usr/share/gpmdp/resources/app.asar" alias t "task" diff --git a/apps/shell/fish/config.fish b/apps/shell/fish/config.fish index af8c693..8382bdd 100755 --- a/apps/shell/fish/config.fish +++ b/apps/shell/fish/config.fish @@ -5,6 +5,7 @@ set -U DOTFILES_PATH $XDG_CONFIG_HOME/dotfiles set -U ENV_PATH $HOME/.env $DOTFILES_PATH/bin/lib/colors/shell +$DOTFILES_PATH/bin/prelude function source_if_exists test -f $ENV_PATH/$argv[1] && source $argv[1] @@ -46,7 +47,7 @@ source $DOTFILES_PATH/apps/shell/fish/aliases.fish set -U _JAVA_AWT_WM_NONREPARENTING 1 # set -U LS_COLORS 'ow=01;36;40' set -U LESS -x2 # less tab size of 2 spaces -set -U TERMINAL urxvtc +set -U TERMINAL kitty set -U BROWSER firefox-developer-edition set -U ERL_AFLAGS "-kernel shell_history enabled -kernel shell_history_file_bytes 1024000" # iex history @@ -58,7 +59,12 @@ if command -v nvim 2>&1 >/dev/null set -U EDITOR nvim end -_make_paths +# load a per-device config last so anything can be overridden +# TODO: this does not work quite right for fish? +maybe_source_env_file config.fish +maybe_source_env_file .hidden/config.fish + +mkdir -p $NOTES_PATH command -v fd 2>&1 >/dev/null && set -U FZF_DEFAULT_COMMAND 'fd --type f --hidden --follow --exclude .git' diff --git a/apps/shell/fish/paths.fish b/apps/shell/fish/paths.fish index 3599f48..d966800 100755 --- a/apps/shell/fish/paths.fish +++ b/apps/shell/fish/paths.fish @@ -8,5 +8,3 @@ command -v python 2>&1 >/dev/null && set -U fish_user_paths (python -m site --us command -v ruby 2>&1 >/dev/null && set -U fish_user_paths (ruby -e 'print Gem.user_dir')"/bin" $fish_user_paths set -U NOTES_PATH $NICE_HOME/doc/notes - -function _make_paths; mkdir -p $NOTES_PATH; end diff --git a/bin/app-launcher b/bin/app-launcher index 7a628d4..ca31cc6 100755 --- a/bin/app-launcher +++ b/bin/app-launcher @@ -1,6 +1,6 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh -source "$DOTFILES_PATH/apps/de/polybar/run" --just-vars +. "$DOTFILES_PATH/apps/de/polybar/run" --just-vars LAUNCHER_FONT="$BAR_FONT" LAUNCHER_FONT_SIZE="$BAR_FONT_SIZE" diff --git a/bin/dotfiles-make-env b/bin/dotfiles-make-env index 133898e..ca07e0a 100755 --- a/bin/dotfiles-make-env +++ b/bin/dotfiles-make-env @@ -1,5 +1,7 @@ #!/usr/bin/env bash +echo "Not implemented yet!"; exit 1 + edfp="$ENV_PATH/$1" mkdir -p "$edfp/" mkdir -p "$edfp/.hidden/bash.d/" diff --git a/bin/gcwd b/bin/gcwd index 6ab9002..daa9bce 100755 --- a/bin/gcwd +++ b/bin/gcwd @@ -1,7 +1,6 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh -addon="" -if [[ -n $1 ]]; then - addon="-${1}" -fi +# TODO: must be sourced so as to not run in subshell? + +addon=""; [ -n "$1" ] && addon="-${1}" cd "$(cat "${DOTFILES_PATH}/.cwd${addon}.tmp")" || return diff --git a/bin/prelude b/bin/prelude index ed464c5..b00a70a 100755 --- a/bin/prelude +++ b/bin/prelude @@ -17,4 +17,3 @@ NICE_HOME="$HOME" export NICE_HOME . "$DOTFILES_PATH/bin/paths" - diff --git a/bin/scwd b/bin/scwd index 2341e03..7363f62 100755 --- a/bin/scwd +++ b/bin/scwd @@ -1,7 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh -addon="" -if [[ -n $1 ]]; then - addon="-${1}" -fi +addon=""; [ -n "$1" ] && addon="-${1}" echo "${PWD}" > "${DOTFILES_PATH}/.cwd${addon}.tmp" diff --git a/bin/startbar b/bin/startbar index e21e849..c1c1bc1 100755 --- a/bin/startbar +++ b/bin/startbar @@ -1,3 +1,3 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh "${DOTFILES_PATH}/apps/de/polybar/run" diff --git a/bin/tmuxswitcher b/bin/tmuxswitcher index 360826c..7fb87f4 100755 --- a/bin/tmuxswitcher +++ b/bin/tmuxswitcher @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh fmt='#{session_id}:|#S|(#{session_attached} attached)' { tmux display-message -p -F "$fmt" && tmux list-sessions -F "$fmt"; } \ diff --git a/bin/workdock b/bin/workdock deleted file mode 100755 index ef3f2fa..0000000 --- a/bin/workdock +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -# TODO: move to laptop env -resrc -. maybe_source_env_file workdock -"${DOTFILES_PATH}/apps/de/x/loadresources" lodpi -autorandr --change -"${DOTFILES_PATH}/apps/de/bspwm/bspwmrc" -"${DOTFILES_PATH}/apps/de/x/loadresources" lodpi -restartbar -"${HOME}/.fehbg" -. maybe_source_env_file workdock diff --git a/env/desktop/bash b/env/desktop/bash new file mode 100755 index 0000000..19daabb --- /dev/null +++ b/env/desktop/bash @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +. "$ENV_PATH/.hidden/bash" diff --git a/env/desktop/bspwm b/env/desktop/bspwm new file mode 100755 index 0000000..0cf4f40 --- /dev/null +++ b/env/desktop/bspwm @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# TODO: this doesn't quite work all the time +export REVERSE_DESKTOP_ORDERING=1 diff --git a/env/desktop/config.fish b/env/desktop/config.fish new file mode 100755 index 0000000..b155199 --- /dev/null +++ b/env/desktop/config.fish @@ -0,0 +1,6 @@ +#!/usr/bin/env fish + +echo whee +function I_AM_HELP + help +end diff --git a/env/desktop/x/resources b/env/desktop/x/resources new file mode 100755 index 0000000..dedd736 --- /dev/null +++ b/env/desktop/x/resources @@ -0,0 +1,16 @@ +## *.font: xft:scientifica:size=11 +## *.faceName: xft:scientifica:size=11 +## URxvt.font: xft:scientifica:size=11 +## URxvt.faceName: xft:scientifica:size=11 + +*.font: xft:Iosevka Term:pixelsize=14,xft:Noto Emoji,xft:Font Awesome 5 Free:pixelsize=14,xft:FreeSans:pixelsize=14 +*.boldFont: xft:Iosevka Term Semibold:pixelsize=14 + +## *.font: xft:curie:pixelsize=10,xft:Noto Emoji,xft:Font Awesome 5 Free,xft:FreeSans +## *.boldFont: xft:curie:pixelsize=10,xft:Noto Emoji,xft:Font Awesome 5 Free,xft:FreeSans + +## *.font: xft:scientifica:size=11 +## *.faceName: xft:scientifica:size=11 +## URxvt.font: xft:scientifica:size=11 +## URxvt.faceName: xft:scientifica:size=11 + diff --git a/env/laptop/app-launcher b/env/laptop/app-launcher deleted file mode 100755 index e69de29..0000000 diff --git a/env/laptop/bar b/env/laptop/bar deleted file mode 100755 index c173cf3..0000000 --- a/env/laptop/bar +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -export BAR_SIDE_MARGIN=0 -export BAR_HEIGHT=80 - -[[ -v OVERRIDE_BAR_MONITOR ]] && export BAR_MONITOR="$OVERRIDE_BAR_MONITOR" -[[ -v OVERRIDE_BAR_HEIGHT ]] && export BAR_HEIGHT="$OVERRIDE_BAR_HEIGHT" diff --git a/env/laptop/bash b/env/laptop/bash deleted file mode 100755 index 4be8608..0000000 --- a/env/laptop/bash +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -. maybe_source_env_file .hidden/bash diff --git a/env/laptop/workdock b/env/laptop/bin/workdock similarity index 55% rename from env/laptop/workdock rename to env/laptop/bin/workdock index b473ba2..ca418f6 100755 --- a/env/laptop/workdock +++ b/env/laptop/bin/workdock @@ -1,9 +1,16 @@ #!/usr/bin/env bash +resrc + export OVERRIDE_BAR_MONITOR="DP1" export OVERRIDE_BAR_HEIGHT="24" export BAR_ICON_FONT_SIZE="9" +"${DOTFILES_PATH}/apps/de/x/loadresources" lodpi +autorandr --change +"${DOTFILES_PATH}/apps/de/bspwm/bspwmrc" +restartbar +"${HOME}/.fehbg" +"${DOTFILES_PATH}/apps/de/x/loadresources" lodpi xrdb -merge "$ENV_PATH/lodpi-resource" - xrandr --output eDP1 --scale-from 1600x900 --filter nearest --mode 3200x1800 diff --git a/env/laptop/bspwm b/env/laptop/bspwm deleted file mode 100755 index 2cdb35e..0000000 --- a/env/laptop/bspwm +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -export WINDOW_GAP=0 diff --git a/readme.md b/readme.md index 67087df..5909a39 100644 --- a/readme.md +++ b/readme.md @@ -13,7 +13,7 @@ myself when setting up a new machine. ## Setup * Clone the repo into `~/.config/dotfiles` -* Run `~/.config/dotfiles/setup` +* Run `~/.config/dotfiles/setup.bash` * Read the warning, obey it, backup your files, *then* agree * **Optional**: Reboot once the script finishes diff --git a/setup b/setup.bash similarity index 98% rename from setup rename to setup.bash index 98227c9..ead2fac 100755 --- a/setup +++ b/setup.bash @@ -19,7 +19,7 @@ done links=( # desktop environment files "$dfp/apps/de/bspwm/rc" "$XDG_CONFIG_HOME/bspwm/bspwmrc" - "$dfp/apps/de/bspwm/fehbg" "$HOME/.fehbg" + "$dfp/apps/de/bspwm/wallpapers" "$HOME/.fehbg" "$dfp/apps/de/sway/config" "$XDG_CONFIG_HOME/sway/config" "$dfp/apps/de/sxhkd/rc" "$XDG_CONFIG_HOME/sxhkd/sxhkdrc" "$dfp/apps/de/x/resources" "$HOME/.Xresources"