usr

Modulate your userpace into POSIX-compliant shell scripts!
git clone git://clone.theohenson.com/usr.git
Log | Files | Refs | README

commit 6a2a92866f3658725d5c5e4d8801774f992548c6
parent b82016cd11dc150c4b501b01bab509adc05ae8a2
Author: Theo Henson <[email protected]>
Date:   Sat, 23 Jan 2021 14:13:22 -0500

Start on more portable dotfiles

Diffstat:
Mhome/.bash_profile | 13++++---------
Mhome/.bashrc | 19++++++++++++++-----
Mhome/.config/fish/config.fish | 7-------
Mhome/.config/gtk-2.0/gtkrc-2.0 | 6+++---
Mhome/.config/gtk-3.0/settings.ini | 6+++---
Mhome/.config/sxhkd/sxhkdrc | 32+++++++++++++++++---------------
Mhome/.profile | 43+++++++++++++++++++++++++++++++++++++------
Mhome/.xinitrc | 1-
8 files changed, 78 insertions(+), 49 deletions(-)

diff --git a/home/.bash_profile b/home/.bash_profile @@ -2,18 +2,13 @@ source "$HOME"/.profile if [[ -z $DISPLAY ]] ; then - # test for an existing bus daemon, just to be safe + # create bus daemon if it does not exist if [[ -z "$DBUS_SESSION_BUS_ADDRESS" ]] ; then - # if not found, launch a new one - eval "$(dbus-launch --sh-syntax)" - echo "D-Bus per-session daemon address is: $DBUS_SESSION_BUS_ADDRESS" + eval "$(runif dbus-launch --sh-syntax)" fi - - # system dependent - # startx if in tty1 also sets my PCs RGB (epic gamer) + + # startx if in tty1 if [[ $(tty) = /dev/tty1 ]] ; then - sudo cm-rgb-cli set logo --color='#ffffff' --brightness=10 ring --color='#ffffff' --brightness=10 - sudo msi-rgb 000000 000000 000000 -x exec startx fi fi diff --git a/home/.bashrc b/home/.bashrc @@ -1,18 +1,19 @@ -# start fish if fish is not the parent process -parent="$(ps --no-header --pid=$PPID --format=cmd)" -[ "$parent" != "fish" ] && [ "$parent" != "-fish" ] && exec fish +# ensure ssh authentication via gpg +export SSH_AUTH_SOCK="$(runif gpgconf --list-dirs agent-ssh-socket)" +runif gpgconf --launch gpg-agent > /dev/null # prompt if which git_status_prompt > /dev/null 2>&1 ; then - PS1="\[\033[96m\][bash] \[\033[94m\w\] \[\$(git_status_prompt)\]" + PS1="\[\033[94m\w\] \[\$(git_status_prompt)\]" else - PS1="\[\033[96m\][bash] \[\033[94m\w\] \033[0m$ " + PS1="\[\033[94m\w\] \033[0m$ " fi # aliases alias g="git" alias v="nvim" alias t="tmux" +alias s="sudo" alias p="sudo pacman" alias a="sudo apt" alias sus="sudo systemctl" @@ -20,3 +21,11 @@ alias cp="cp -iv" alias mv="mv -iv" alias rm="rm -v" alias ls="ls --color=auto" + +# tmux +cfile="$HOME/.tmux.conf" +if [ -f "$XDG_CONFIG_HOME/tmux/tmux.conf" ] ; then + cfile="$XDG_CONFIG_HOME/tmux/tmux.conf" +fi + +[ "$NOTMX" = "" ] && [ "$TMUX" = "" ] && [ "$TERM" != "linux" ] && exec tmux -f "$cfile" diff --git a/home/.config/fish/config.fish b/home/.config/fish/config.fish @@ -55,10 +55,6 @@ alias vimwiki='nvim -c VimwikiIndex -c \'cd $VIMWIKI\'' alias pcmn='pacman -Sl | cut -d" " -f2,3,4 | fzf -m --preview "pacman -Si {1}" --preview-window=right:66%:wrap | xargs -ro -n 1 sudo pacman -S' alias fzfcmd='set fzfcmd ( grep " cmd: " $XDG_DATA_HOME/fish/fish_history | sed "s/- cmd: //" | grep -v fzfcmd | tac | fzf -e --color=16 --no-sort ) && echo $fzfcmd && eval $fzfcmd' -# ensure ssh authentication via gpg -set -x SSH_AUTH_SOCK (gpgconf --list-dirs agent-ssh-socket) -gpgconf --launch gpg-agent - # make delete work in st switch $TERM case 'st-*' @@ -104,6 +100,3 @@ function sw set TMPFILE (mktemp) mv -f $argv[1] $TMPFILE && mv $argv[2] $argv[1] && mv $TMPFILE $argv[2] end - -# tmux -[ "$TMUX" = "" ] && [ "$TERM" != "linux" ] && exec tmux diff --git a/home/.config/gtk-2.0/gtkrc-2.0 b/home/.config/gtk-2.0/gtkrc-2.0 @@ -1,3 +1,3 @@ -gtk-icon-theme-name = "Gruvbox-Material-Dark" -gtk-theme-name = "Gruvbox-Material-Dark" -gtk-font-name = "DejaVu Sans 11" +gtk-icon-theme-name = "Papirus-Dark" +gtk-theme-name = "Breeze-Dark" +gtk-font-name = "Ubuntu 11" diff --git a/home/.config/gtk-3.0/settings.ini b/home/.config/gtk-3.0/settings.ini @@ -1,4 +1,4 @@ [Settings] -gtk-icon-theme-name = Gruvbox-Material-Dark -gtk-theme-name = Gruvbox-Material-Dark -gtk-font-name = DejaVu Sans 11 +gtk-icon-theme-name = Papirus-Dark +gtk-theme-name = Breeze-Dark +gtk-font-name = Ubuntu 11 diff --git a/home/.config/sxhkd/sxhkdrc b/home/.config/sxhkd/sxhkdrc @@ -1,9 +1,9 @@ # MISC # screenshots alt + s - maim -s $XDG_PICTURES_DIR/scrot/$(date +%s).png + maim -s "$XDG_PICTURES_DIR/scrot/$(date +%s).png" alt + f - maim $XDG_PICTURES_DIR/scrot/$(date +%s).png + maim "$XDG_PICTURES_DIR/scrot/$(date +%s).png" # volume alt + j amixer -D pulse sset Master 5%- && pkill -RTMIN+10 dwmblocks @@ -23,7 +23,7 @@ super + z lock # mixer alt + m - $TERMINAL -e pulsemixer + "$TERMINAL" -e pulsemixer # xkill alt + x pkill xkill || xkill @@ -34,46 +34,48 @@ control + Return # LAUNCH # python shell alt + shift + p - $TERMINAL -e tmux attach -t py || $TERMINAL -e tmux new -s py /usr/bin/ipython + "$TERMINAL" -e tmux attach -t py || "$TERMINAL" -e tmux new -s py "$INTPY" # persistant terminal alt + Return - $TERMINAL -e tmux attach -t subs || $TERMINAL -e tmux new -s subs + "$TERMINAL" -e tmux attach -t subs || "$TERMINAL" -e tmux new -s subs # ranger fm alt + shift + r - $TERMINAL -e ranger + "$TERMINAL" -e ranger # vimwiki alt + shift + w - $TERMINAL -e nvim -c VimwikiIndex -c 'cd $VIMWIKI' + "$TERMINAL" -e nvim -c VimwikiIndex -c 'cd $VIMWIKI' # firefox alt + shift + c - $BROWSER + "$BROWSER" # bloated spyware alt + shift + d discord # spotify alt + shift + s - $TERMINAL -e spt + "$TERMINAL" -e spt # thunar alt + shift + t thunar # htop alt + shift + h - $TERMINAL -e htop + "$TERMINAL" -e htop # nnn alt + shift + n - $TERMINAL -e nnn -de + "$TERMINAL" -e nnn -de # zathura alt + shift + z - $READER + "$READER" # terminal super + Return - $TERMINAL + "$TERMINAL" +# no tmux terminal +control + super + Return + NOTMX=true "$TERMINAL" # dmenu super + r dmenu_run -# rofi -theme gruvbox-dark -show run # intercept keybind from firefox control + q - echo + sleep 0 diff --git a/home/.profile b/home/.profile @@ -1,9 +1,18 @@ +# functions + +runif() { + if which "$1" > /dev/null 2>&1 ; then + [email protected] & + fi +} + # base directories export XDG_CONFIG_HOME="$HOME/.config" export XDG_DATA_HOME="$HOME/.local/share" export XDG_CACHE_HOME="$HOME/.cache" -# these are used in ~/.config/user-dirs.dirs to set locations +# these are the values used in ~/.config/user-dirs.dirs to set locations +# put here for clarity export XDG_DESKTOP_DIR="/home/theo" export XDG_DOCUMENTS_DIR="/home/theo/docs" export XDG_DOWNLOAD_DIR="/home/theo" @@ -19,11 +28,33 @@ export GOPATH="$XDG_DATA_HOME/go" export VIMWIKI="$XDG_DOCUMENTS_DIR/vimwiki" # set some default programs -export VISUAL=/usr/bin/nvim -export EDITOR=/usr/bin/nvim -export TERMINAL="$LOCAL_BIN/st" -export BROWSER=/usr/bin/firefox -export READER=/usr/bin/zathura +if which nvim > /dev/null 2>&1 ; then + export VISUAL="$(which nvim)" + export EDITOR="$(which nvim)" +else + export VISUAL="$(which vim)" + export EDITOR="$(which vim)" +fi + +export BROWSER="$(which firefox)" + +if which st > /dev/null 2>&1 ; then + export TERMINAL="$LOCAL_BIN/st" +else + if which alacritty > /dev/null 2>&1 ; then + export TERMINAL="$(which alacritty)" + fi +fi + +if which zathura > /dev/null 2>&1 ; then + export READER="$(which zathura)" +fi + +if which ipython3 > /dev/null 2>&1 ; then + export INTPY="$(which ipython3)" +else + export INTPY="$(which python3)" +fi # clean up ~ export SEST_DIR="$XDG_DATA_HOME/sest" diff --git a/home/.xinitrc b/home/.xinitrc @@ -1,5 +1,4 @@ #!/bin/sh -# configure monitors (system dependent) runif() { if which "$1" > /dev/null 2>&1 ; then