From 62e81fd47847b0a43eeaef52619057ebfd66906b Mon Sep 17 00:00:00 2001 From: Andre Ramnitz Date: Fri, 5 Sep 2025 02:01:50 +0200 Subject: [PATCH] bash: prepare .profile for openrc user services --- dot-bashrc | 64 ++++++++++++++++++++++++++--------------------------- dot-profile | 4 ++++ 2 files changed, 36 insertions(+), 32 deletions(-) diff --git a/dot-bashrc b/dot-bashrc index a8c18bba..970ffcaf 100644 --- a/dot-bashrc +++ b/dot-bashrc @@ -10,7 +10,8 @@ alias cdg='cd "$(git rev-parse --show-toplevel)"' alias df='/usr/bin/df -h --output=target,fstype,used,avail,pcent,source | sort -n' alias du='du -h' alias fastfetch='fastfetch -c "$HOME/.config/fastfetch/default.jsonc"' -alias grep='command grep -si --color=auto' +alias ff='fastfetch' +alias grep='command grep -sil --color=auto' alias gdi='git diff ' alias gg='cd "$(git rev-parse --show-toplevel)"' alias gco='git checkout' @@ -64,20 +65,6 @@ fi # No double entries in the shell history. export HISTCONTROL="$HISTCONTROL erasedups:ignoreboth" -# Wrap the following commands for interactive use to avoid accidental file overwrites. -rm() { command rm -i "${@}"; } -cp() { command cp -i "${@}"; } -mv() { command mv -i "${@}"; } - -# enable moving between directories without cd -shopt -s autocd -# enable spelling correction -shopt -s dirspell -# enable case-insensitivity -shopt -s nocaseglob -# expand filename patterns without match to a null string -shopt -s nullglob - # Change working dir in shell to last dir in lf on exit (adapted from ranger). lfcd () { # `command` is needed in case `lfcd` is aliased to `lf` @@ -85,22 +72,35 @@ lfcd () { } # Put your fun stuff here. -# -# just set a minimal prompt in bash and use starship instead -PS1='\u@\h \w \$ ' -command -v starship > /dev/null 2>&1 && eval "$(starship init bash)" +if [ -t 0 ]; then + # Wrap the following commands for interactive use to avoid accidental file overwrites. + rm() { command rm -i "${@}"; } + cp() { command cp -i "${@}"; } + mv() { command mv -i "${@}"; } -# apply base16 theme in X/Wayland session only, or flavours' plasma-hook hangs: -case $(tty) in - /dev/tty[0-9]*) - command -v ttyscheme > /dev/null 2>&1 && ttyscheme onedark - clear - test -e /usr/bin/fastfetch && command fastfetch -c "$HOME/.config/fastfetch/default.jsonc" || true - ;; - /dev/pts/[0-9]*) - command -v base16-flavours > /dev/null 2>&1 && ~/.local/bin/base16-flavours || true - clear - test -e /usr/bin/fastfetch && command fastfetch -c "$HOME/.config/fastfetch/default.jsonc" || true - ;; -esac + # enable moving between directories without cd + shopt -s autocd + # enable spelling correction + shopt -s dirspell + # enable case-insensitivity + shopt -s nocaseglob + # expand filename patterns without match to a null string + shopt -s nullglob + + # just set a minimal prompt in bash and use starship instead + PS1='\u@\h \w \$ ' + command -v starship > /dev/null 2>&1 && eval "$(starship init bash)" + + # apply base16 theme in X/Wayland session only, or flavours' plasma-hook hangs: + case $(tty) in + /dev/tty[0-9]*) + command -v ttyscheme > /dev/null 2>&1 && ttyscheme c64 + test -e /usr/bin/fastfetch && command fastfetch -c "$HOME/.config/fastfetch/default.jsonc" || true + ;; + /dev/pts/[0-9]*) + # command -v base16-flavours > /dev/null 2>&1 && ~/.local/bin/base16-flavours || true + test -e /usr/bin/fastfetch && command fastfetch -c "$HOME/.config/fastfetch/default.jsonc" || true + ;; + esac +fi diff --git a/dot-profile b/dot-profile index 4ff47c87..9ff90683 100644 --- a/dot-profile +++ b/dot-profile @@ -29,3 +29,7 @@ if test -z "$XDG_RUNTIME_DIR"; then export XDG_RUNTIME_DIR=$(mktemp -d /tmp/$(id -u)-runtime-dir.XXX) fi +if [ -t 0 ]; then + # interactive commands here +fi + -- 2.51.2