summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bash_profile16
-rw-r--r--.bashrc33
-rw-r--r--.config/sxhkd/sxhkdrc2
-rwxr-xr-x.config/sxiv/exec/key-handler2
-rwxr-xr-x.local/bin/cfgc2
-rwxr-xr-x.local/bin/cfgl2
-rwxr-xr-x.local/bin/shufwall2
7 files changed, 39 insertions, 20 deletions
diff --git a/.bash_profile b/.bash_profile
index 54538100..6cd46928 100644
--- a/.bash_profile
+++ b/.bash_profile
@@ -2,12 +2,26 @@
# ~/.bash_profile
#
-[[ -f ~/.bashrc ]] && . ~/.bashrc
+# here `. ~/.bashrc` same as `source ~/.bashrc`, see `source filename` in `man bash`, and `. file` in `man dash`
+# `. file` is POSIX compliant, while `source file` is not
+# https://github.com/koalaman/shellcheck/wiki/SC3046
+#[[ -f ~/.bashrc ]] && . ~/.bashrc
+[ -f ~/.bashrc ] && . ~/.bashrc
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
+. "$XDG_CONFIG_HOME/user-dirs.dirs"
+export XDG_DESKTOP_DIR="$XDG_DESKTOP_DIR"
+export XDG_DOWNLOAD_DIR="$XDG_DOWNLOAD_DIR"
+export XDG_TEMPLATES_DIR="$XDG_TEMPLATES_DIR"
+export XDG_PUBLICSHARE_DIR="$XDG_PUBLICSHARE_DIR"
+export XDG_DOCUMENTS_DIR="$XDG_DOCUMENTS_DIR"
+export XDG_MUSIC_DIR="$XDG_MUSIC_DIR"
+export XDG_PICTURES_DIR="$XDG_PICTURES_DIR"
+export XDG_VIDEOS_DIR="$XDG_VIDEOS_DIR"
+
export PATH="$(find ~/.local/bin -type d -printf %p:)$PATH"
export HISTSIZE=5000
export HISTFILESIZE=5000
diff --git a/.bashrc b/.bashrc
index 2d4fd688..0a48fb88 100644
--- a/.bashrc
+++ b/.bashrc
@@ -2,11 +2,17 @@
# ~/.bashrc
#
+# $- meaning see https://stackoverflow.com/questions/42757236/what-does-mean-in-bash
# If not running interactively, don't do anything
-[[ $- != *i* ]] && return
+#[[ $- != *i* ]] && return
+# https://github.com/westscz/.dotfiles/blob/master/system/bashrc
+case $- in
+ *i*) ;;
+ *) return;;
+esac
-source /usr/share/fzf/completion.bash
-source /usr/share/fzf/key-bindings.bash
+. /usr/share/fzf/completion.bash
+. /usr/share/fzf/key-bindings.bash
# default PS1
#PS1='[\u@\h \W]\$ '
@@ -17,16 +23,15 @@ source /usr/share/fzf/key-bindings.bash
# need \[ and \] around color codes so bash ignore color codes when calculating line wraps
PS1="\[\e[0;91m\][\u@\h \W]\$ \[\e[0m\]"
-alias ls="ls --color=auto"
-alias rm="rm -vI"
-alias sdcv="sdcv --color"
-alias grep="grep --color=auto"
-alias diff="diff --color=auto"
-alias absolutely-proprietary="absolutely-proprietary -f"
-
-alias ll="ls -lAh --color=auto --group-directories-first"
-
-alias v="$EDITOR"
-alias g=git
+alias \
+absolutely-proprietary="absolutely-proprietary -f" \
+diff="diff --color=auto" \
+grep="grep --color=auto" \
+ls="ls --color=auto" \
+rm="rm -vI" \
+sdcv="sdcv --color" \
+g=git \
+ll="ls -lAh --color=auto --group-directories-first" \
+v="$EDITOR"
eval "$(zoxide init bash)"
diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc
index 421e4ec6..528ddcdc 100644
--- a/.config/sxhkd/sxhkdrc
+++ b/.config/sxhkd/sxhkdrc
@@ -1,7 +1,7 @@
# vim: ft=sh
alt + Print
- ffmpeg -f x11grab -i "$DISPLAY" -vframes 1 "$HOME/pictures/screenshots/$(time.uuid)".png
+ ffmpeg -f x11grab -i "$DISPLAY" -vframes 1 "$XDG_PICTURES_DIR/screenshots/$(time.uuid)".png
XF86Audio{RaiseVolume,LowerVolume,Mute}
amixer set Master {5%+,5%-,toggle}
diff --git a/.config/sxiv/exec/key-handler b/.config/sxiv/exec/key-handler
index bfad867f..1077b731 100755
--- a/.config/sxiv/exec/key-handler
+++ b/.config/sxiv/exec/key-handler
@@ -38,7 +38,7 @@ flip() {
linkwall() {
tr '\n' '\0' | xargs -0 realpath | sort | uniq | while read -r file; do
- walldir="$HOME/pictures/wallpapers/"
+ walldir="$XDG_PICTURES_DIR/wallpapers/"
name=$(basename "$file")
if [ ! -e "$walldir$name" ]; then
convwall "$file" "$walldir$name" || ln -s "$file" "$walldir"
diff --git a/.local/bin/cfgc b/.local/bin/cfgc
index 06c4aeff..a10c02e1 100755
--- a/.local/bin/cfgc
+++ b/.local/bin/cfgc
@@ -1,3 +1,3 @@
#!/bin/sh
-/usr/bin/git --git-dir="$HOME"/.mycfg_cross_platform/ --work-tree="$HOME" "$@"
+/usr/bin/git --git-dir="$HOME/.mycfg_cross_platform/" --work-tree="$HOME" "$@"
diff --git a/.local/bin/cfgl b/.local/bin/cfgl
index f5fa4f33..35a9df73 100755
--- a/.local/bin/cfgl
+++ b/.local/bin/cfgl
@@ -1,3 +1,3 @@
#!/bin/sh
-/usr/bin/git --git-dir="$HOME"/.mycfg_local/ --work-tree="$HOME" "$@"
+/usr/bin/git --git-dir="$HOME/.mycfg_local/" --work-tree="$HOME" "$@"
diff --git a/.local/bin/shufwall b/.local/bin/shufwall
index 33ec7269..4703125f 100755
--- a/.local/bin/shufwall
+++ b/.local/bin/shufwall
@@ -1,7 +1,7 @@
#!/bin/sh
if [ -z "$1" ]; then
- file=$(find -L ~/pictures/wallpapers -type f | shuf -n 1)
+ file=$(find -L "$XDG_PICTURES_DIR/wallpapers" -type f | shuf -n 1)
else
file=$(find -L "$@" -maxdepth 1 -type f | shuf -n 1)
fi