diff --git a/.Xresources.env b/.Xresources.env deleted file mode 100644 index 771f1ca..0000000 --- a/.Xresources.env +++ /dev/null @@ -1,5 +0,0 @@ -#define primaryfont xft:Monaco-12 - -*font: primaryfont -*faceName: primaryfont -*boldFont: primaryfont diff --git a/env/sh/aliases b/env/sh/aliases index 1f0aa30..13da6b0 100644 --- a/env/sh/aliases +++ b/env/sh/aliases @@ -39,7 +39,7 @@ alias tmux='TERM=screen-256color-bce tmux' # syntax higlighting for vim in tmux alias tmnew="tmux new -s" alias tmls="tmux list-sessions" alias tmatt="tmux attach -t" -alias tU="tmux attach -t utils || tmux new -s utils" +alias tu="tmux attach -t utils || tmux new -s utils" alias tdf="tmux attach -t df || tmux new -s utils -c \"$DOTFILES_PATH\"" # git aliases diff --git a/env/sh/prompt b/env/sh/prompt index 3ab815d..9ae0879 100644 --- a/env/sh/prompt +++ b/env/sh/prompt @@ -5,13 +5,11 @@ PROMPT_SUCCESS_COLOR='\[\e[0;34m\]' PROMPT_FAILURE_COLOR='\[\e[0;31m\]' DIR_COLOR='\[\e[0;33m\]' -export ACTUAL_HOME=$(realpath "$HOME/..") - # prompt rendering functions preprocess_pwd() { name="$PWD" # if we're in the home directory, replace it with tilde - [[ "$name" =~ ^"$ACTUAL_HOME"(/|$) ]] && name="~${name#$ACTUAL_HOME}" + [[ "$name" =~ ^"$NICE_HOME"(/|$) ]] && name="~${name#$NICE_HOME}" # replace all non-basename parts of the PWD with only the first two letters curdir=$(echo "$PWD" | sed -r 's|.*/(.+)$|\1|g') diff --git a/env/wm/extras/bar/formatter.bash b/env/wm/extras/bar/formatter.bash index 0a7a2e7..676a066 100755 --- a/env/wm/extras/bar/formatter.bash +++ b/env/wm/extras/bar/formatter.bash @@ -12,6 +12,9 @@ reload_colors() { # trap reload_colors SIGUSR1 LAUNCHER_BUTTONS="%{F$COLOR_DARK}%{A3:launcher2:}%{A:launcher:}!%{A}%{A} %{A3:close:}%{A:kill:}X%{A}%{A}%{F-}" +if [ "$NO_LAUNCHER_BUTTONS" -eq 1 ]; then + LAUNCHER_BUTTONS="" +fi export MODULE_MATCH=() export MODULE_CALLBACK=() @@ -69,7 +72,7 @@ while read -r line; do fi done - printf "%s\n" "%{l} $l_content $LAUNCHER_BUTTONS %{c}$c_content %{r}$r_content " + printf "%s\n" "%{l}$BAR_LEFT_CHARS$l_content $LAUNCHER_BUTTONS %{c}$c_content %{r}$r_content$BAR_RIGHT_CHARS" done # echo -e "\nEND BAR LOG" >> "$BAR_LOG" diff --git a/env/wm/extras/bar/modules/bspwm-bm.bash b/env/wm/extras/bar/modules/bspwm-bm.bash index ee85779..ce5a7b2 100644 --- a/env/wm/extras/bar/modules/bspwm-bm.bash +++ b/env/wm/extras/bar/modules/bspwm-bm.bash @@ -9,7 +9,7 @@ PID_PREFIX="bspwm" MATCH_PREFIX="W" MATCH="$MATCH_PREFIX*" -DESKTOP_SPACER=" " +DESKTOP_SPACER="" SWITCH_DESKTOP_COMMAND="switch_desktop" @@ -29,25 +29,25 @@ bar_module_bspwm() { item=$1 name=${item#?} cname="$name" - bname="%{A:$SWITCH_DESKTOP_COMMAND $cname:}${cname}%{A}" + bname=" %{A:$SWITCH_DESKTOP_COMMAND $cname:}${cname}%{A} " case $item in O*) # focused occupied desktop - content="${content}%{F$COLOR_HIGHLIGHT}%{U$COLOR_HIGHLIGHT}%{+${ul}}${bname}%{-${ul}}%{U-}%{F-}$DESKTOP_SPACER" + content="${content}%{B$COLOR_HIGHLIGHT}%{F$COLOR_BACKGROUND}%{U$COLOR_HIGHLIGHT}%{+${ul}}${bname}%{-${ul}}%{U-}%{F-}%{B-}$DESKTOP_SPACER" ;; F*) # focused free desktop - content="${content}%{F$COLOR_DARK}%{U$COLOR_DARK}%{+${ul}}${bname}%{-${ul}}%{U-}%{F-}$DESKTOP_SPACER" + content="${content}%{B$COLOR_DARK}%{F$COLOR_BACKGROUND}%{U$COLOR_HIGHLIGHT}%{+${ul}}${bname}%{-${ul}}%{U-}%{F-}%{B-}$DESKTOP_SPACER" ;; - U*) # focused occupied desktop - content="${content}%{F$COLOR_URGENT}%{U$COLOR_URGENT}%{+${ul}}${bname}%{-${ul}}%{U-}%{F-}$DESKTOP_SPACER" + U*) # urgent focused desktop + content="${content}%{B$COLOR_URGENT}%{F$COLOR_BACKGROUND}%{U$COLOR_HIGHLIGHT}%{+${ul}}${bname}%{-${ul}}%{U-}%{F-}%{B-}$DESKTOP_SPACER" ;; - o*) # occupied desktop + o*) # occupied unfocused desktop content="${content}%{F$COLOR_FOREGROUND}${bname}%{F-}$DESKTOP_SPACER" ;; f*) # free desktop content="${content}%{F$COLOR_DARK}${bname}%{F-}$DESKTOP_SPACER" ;; u*) # urgent desktop - content="${content}%{F$COLOR_URGENT}${bname}%{F-}$DESKTOP_SPACER" + content="${content}%{B$COLOR_URGENT}%{F$COLOR_BACKGROUND}%{U$COLOR_HIGHLIGHT}%{+${ul}}${bname}%{-${ul}}%{U-}%{F-}%{B-}$DESKTOP_SPACER" ;; esac shift diff --git a/env/wm/extras/bar/start.bash b/env/wm/extras/bar/start.bash index 27a91e9..dae015e 100755 --- a/env/wm/extras/bar/start.bash +++ b/env/wm/extras/bar/start.bash @@ -34,16 +34,21 @@ if [ -z "$BAR_MONITOR" -o "$BAR_MONITOR" -eq 0 ]; then BAR_MONITOR="$LAST_BSPWM_MONITOR" fi +export POS_Y=0 +EHEIGHT=$((BAR_HEIGHT + BAR_TOP_PADDING + BAR_BOTTOM_PADDING)) if [ $BAR_TOP -eq 1 ]; then - bspc config -m ${BAR_MONITOR} top_padding "$BAR_HEIGHT" + export POS_Y="$BAR_TOP_PADDING" + bspc config -m ${BAR_MONITOR} top_padding "$EHEIGHT" else - bspc config -m ${BAR_MONITOR} bottom_padding "$BAR_HEIGHT" + export POS_Y="$BAR_BOTTOM_PADDING" + bspc config -m ${BAR_MONITOR} bottom_padding "$EHEIGHT" fi # get width of our main monitor WIDTH=`xrandr -q | egrep '(^| )connected( |$)' | tr 'x' '\n' | head -n 1 | awk '{print $NF}'` WIDTH=$((WIDTH-BAR_MARGIN-BAR_MARGIN)) OFFSET=$((BAR_MARGIN+BAR_OFFSET)) +echo "w$WIDTH by o$OFFSET m$BAR_MARGIN e$EHEIGHT bh, tp, bp" BAR_B="" if [ $BAR_TOP -eq 1 ]; then @@ -55,6 +60,6 @@ fi source "$BAR_PATH/colors.bash" cat "$BAR_FIFO" | "$BAR_PATH/formatter.bash" | \ - lemonbar -a 14 $BAR_B -g "$WIDTH"x"$BAR_HEIGHT"+"$OFFSET"+"$POS_Y" -u "$BAR_BORDER_WIDTH" -f "$BAR_FONT_FAMILY" -F "$COLOR_FOREGROUND" -B"$COLOR_BACKGROUND" -n "$BAR_WID" | \ + lemonbar -a 50 $BAR_B -g "$WIDTH"x"$BAR_HEIGHT"+"$OFFSET"+"$POS_Y" -u "$BAR_BORDER_WIDTH" -f "$BAR_FONT_FAMILY" -F "$COLOR_FOREGROUND" -B"$COLOR_BACKGROUND" -n "$BAR_WID" | \ "$BAR_PATH/bar_commands.bash" diff --git a/env/wm/extras/bar/variables.bash b/env/wm/extras/bar/variables.bash new file mode 100644 index 0000000..5abe54a --- /dev/null +++ b/env/wm/extras/bar/variables.bash @@ -0,0 +1,60 @@ +#!/usr/bin/env bash + +# the path to the bar stuff +export BAR_PATH="$DOTFILES_PATH/env/wm/extras/bar" + +# where to put the file that contains the bar's pid +export BAR_PID_FILE="$BAR_PATH/wm_bar.pid" + +# whether or not to start the bar when X starts +export BAR_ON_XINIT=1 + +# the path to the bar's FIFO +export BAR_FIFO="$BAR_PATH/wm_bar_fifo.lock" + +# the monitor on which to display the bar (see BSPWM(1)) +export BAR_MONITOR=0 # detect monitor automatically + +# the bar's log file +export BAR_LOG="$BAR_PATH/wm_bar.log" + +# whether or not the bar is anchored to the top of the monitor (or the bottom if +# not) +export BAR_TOP=0 + +# the pixel height of the bar +export BAR_HEIGHT=24 + +# the bar's underline line width +export BAR_BORDER_WIDTH=0 + +# the bar's font +export BAR_FONT_FAMILY="$PRIMARY_FONT_FAMILY_WITH_SIZE" + +# whether or not the "underline" appears above or below the desktop names on +# lemonbar +export BAR_UNDERLINE=0 + +# the bar's spacing on the left and right sides +export BAR_MARGIN=0 +# export BAR_MARGIN=$WINDOW_GAP + +# how far left the display the bar note that the margin will be used to attempt +# to center the bar on the monitor it is being displayed on +export BAR_OFFSET=0 + +# the window ID to give to bar so that other scripts may raise or lower it in +# bspwm +export BAR_WID="wmpanel" + +# the amount of pixel padding space to place above the bar +export BAR_TOP_PADDING=0 + +# the amount of pixel padding space to place below the bar +export BAR_BOTTOM_PADDING=0 + +# the characters to always print on the left-most side of the bar +export BAR_LEFT_CHARS="" + +# the characters to always print on the right-most side of the bar +export BAR_RIGHT_CHARS=" " diff --git a/env/x/xresources b/env/x/xresources index 7f828f4..ad4d86c 100755 --- a/env/x/xresources +++ b/env/x/xresources @@ -5,6 +5,18 @@ #define emacspfont Monaco 9 +# I like this font on my desktop (use in `~/.Xresources.env`!) +##define primaryfont xft:lemon-11 +##define primaryletterspace 0 + +# I like this font on my desktop for code streaming +##define primaryfont xft:Monaco-9 +##define primaryletterspace -2 + +# I like this font on my laptop +#define primaryfont xft:Monaco-11 +##define primaryletterspace -1 + *font: primaryfont *faceName: primaryfont *boldFont: primaryfont diff --git a/scripts/get_x_fonts.sh b/scripts/get_x_fonts.sh index 6439c5b..bb3b24f 100644 --- a/scripts/get_x_fonts.sh +++ b/scripts/get_x_fonts.sh @@ -5,17 +5,17 @@ if [ -a "$HOME/.Xresources.env" ]; then XRES_FILE="$HOME/.Xresources.env" fi -PRIMARY_FONT_XRESOURCES=$(grep "#define primaryfont xft:" "$XRES_FILE" | grep -v "/\*" | head -n 1) +PRIMARY_FONT_XRESOURCES=$(grep "^#define primaryfont xft:" "$XRES_FILE" | grep -v "/\*" | head -n 1) export PRIMARY_FONT_FAMILY_WITH_SIZE=${PRIMARY_FONT_XRESOURCES:24} export PRIMARY_FONT_FAMILY=$(echo $PRIMARY_FONT_FAMILY_WITH_SIZE | sed 's/\-.*//') export PRIMARY_FONT_SIZE=$(echo $PRIMARY_FONT_FAMILY_WITH_SIZE | sed 's/.*\-//') -SECONDARY_FONT_XRESOURCES=$(grep "#define secondaryfont xft:" "$XRES_FILE" | grep -v "/\*" | head -n 1) +SECONDARY_FONT_XRESOURCES=$(grep "^#define secondaryfont xft:" "$XRES_FILE" | grep -v "/\*" | head -n 1) export SECONDARY_FONT_FAMILY_WITH_SIZE=${SECONDARY_FONT_XRESOURCES:26} export SECONDARY_FONT_FAMILY=$(echo $SECONDARY_FONT_FAMILY_WITH_SIZE | sed 's/\-.*//') export SECONDARY_FONT_SIZE=$(echo $SECONDARY_FONT_FAMILY_WITH_SIZE | sed 's/.*\-//') -ICON_FONT_XRESOURCES=$(grep "#define iconfont xft:" "$XRES_FILE" | grep -v "/\*" | head -n 1) +ICON_FONT_XRESOURCES=$(grep "^#define iconfont xft:" "$XRES_FILE" | grep -v "/\*" | head -n 1) export ICON_FONT_FAMILY_WITH_SIZE=${ICON_FONT_XRESOURCES:21} export ICON_FONT_FAMILY=$(echo $ICON_FONT_FAMILY_WITH_SIZE | sed 's/\-.*//') export ICON_FONT_SIZE=$(echo $ICON_FONT_FAMILY_WITH_SIZE | sed 's/.*\-//') diff --git a/variables.bash b/variables.bash index d8942a5..061fb61 100755 --- a/variables.bash +++ b/variables.bash @@ -3,40 +3,42 @@ # This script will seriously nuke your home directory. You should really read # each of the scripts that will be executed in those process. +# the path to the dotfiles directory/repository export DOTFILES_PATH="$HOME/.dotfiles" + +# this variable controls whether or not we have a separate dir we like to +# actually use as home instead of $HOME in order to avoid dotfiles clutter +# for all user-facing purposes, we try to use this as the home directory while +# programs will still use $HOME (which in my case is usually /home/username/usr) +export NICE_HOME=$(realpath "$HOME/..") + +# this prevents different bar modules from being loaded you should probably +# avoid setting them here and set them in "$HOME/.bashrc_env" export BLACKLISTED_BAR_MODULES="" -export REPOSITORY_PATH="$HOME/../code/open-source" + +# in some cases (mainly OS provisioning) we clone repositories or download code +# for later use +# as I'm writing this, I realize I should almost certainly be using /tmp and am more +# than a little bit ashamed +# TODO: use /tmp ? +export REPOSITORY_PATH="$NICE_HOME/code/open-source" + +# the width of the border around the bspwm windows export BORDER_WIDTH=1 + +# the gap between bspwm windows export WINDOW_GAP=5 +# load our font variables source "$DOTFILES_PATH/scripts/get_x_fonts.sh" + +# load our color info source "$DOTFILES_PATH/scripts/get_color.sh" -export BAR_PATH="$DOTFILES_PATH/env/wm/extras/bar" -export BAR_PID_FILE="$BAR_PATH/wm_bar.pid" -export BAR_ON_XINIT=1 -export BAR_FIFO="$BAR_PATH/wm_bar_fifo.lock" -export BAR_MONITOR=0 # detect monitor automatically -export BAR_LOG="$BAR_PATH/wm_bar.log" -export BAR_TOP=0 -export BAR_HEIGHT=30 -export BAR_BORDER_WIDTH=1 -export BAR_FONT_FAMILY="$PRIMARY_FONT_FAMILY_WITH_SIZE" -export BAR_UNDERLINE=0 -# export BAR_MARGIN=$WINDOW_GAP -export BAR_MARGIN=700 -export BAR_OFFSET=0 -export BAR_WID="wmpanel" - -export TOP_BAR_PADDING=0 -export BOTTOM_BAR_PADDING=0 - -if [[ $BAR_TOP -eq 0 ]]; then - export BOTTOM_BAR_PADDING=$BAR_HEIGHT -else - export TOP_BAR_PADDING=$BAR_HEIGHT -fi +# load our bar variables +source "$DOTFILES_PATH/env/wm/extras/bar/variables.bash" +# this lets our window gap account for the border width export WINDOW_GAP=$(expr $WINDOW_GAP - $BORDER_WIDTH) # load per-device bashrc_env if it exists