Compare commits

...

2 Commits

Author SHA1 Message Date
f180772509
fish: move right prompt stuff into left prompt
alacritty's reflowing is weird only when fish has a right prompt
2024-01-13 17:57:33 -05:00
a7218a2a4e
fish: automatic swallow on common programs 2024-01-13 17:05:37 -05:00
2 changed files with 26 additions and 30 deletions

View File

@ -1,11 +1,20 @@
# dynamic swallow (dwm patch)
function swal
if command -v dwmswallow > /dev/null
dwmswallow "$WINDOWID" $argv
end
end
alias mpv='swal -c mpv; command mpv'
# run this before opening, e.g., mpv or zathura
abbr -a -- ds dwmswallow \$WINDOWID\;
abbr -a -- ds swal;
# zathura
function thur; zathura $argv; end
alias thur='swal -c Zathura; zathura'
# stricter sandbox zathura
function zathsec; /usr/bin/zathura -c ~/.config/zathura-sec $argv; end
alias zathsec='/usr/bin/zathura -c ~/.config/zathura-sec'
# tmux with 256-color and UTF-8
function tmx; tmux -u -2 $argv; end
@ -43,12 +52,9 @@ function bk; $EDITOR ~/dox/not/bk.txt; end
function rem; $EDITOR ~/dox/not/rem; end
function ldg; $EDITOR ~/dox/not/journal.ldg; end
# pocket calculator
function calc; calcpy $argv; end
# disable history on units
alias units='units -H ""'
alias sxiv='nsxiv'
alias sxiv='swal; nsxiv'
# music recognition
# an alternative is available at ~/.local/bin/msrec

View File

@ -1,24 +1,6 @@
function fish_right_prompt
if test $SYSTEM_PROFILE = "MINIMAL"
return
end
set -l duration "$cmd_duration$CMD_DURATION"
if test $duration -gt 100
set duration (math $duration / 1000)s" // "
else
set duration
end
printf '%s%s%s%s%s' \
(set_color brgrey) \
$duration \
(date +"%H:%M") \
(set_color normal)
printf '%s ' \
(fish_git_prompt)
end
function fish_prompt
set -l cmd_status $status
if fish_is_root_user
set letter '#'
else
@ -27,11 +9,19 @@ function fish_prompt
set -l usercolor (set_color brgrey)
printf '%s%s@%s%s '\
set -l stat_code ""
if test $cmd_status -ne 0
set stat_code " "(set_color red)(fish_status_to_signal $cmd_status)
end
printf '%s%s@%s%s%s%s '\
$usercolor \
(echo $USER | string shorten -m 5 -c '') \
(echo $hostname | string shorten -m 1 -c '') \
(set_color normal)
(echo $hostname | string shorten -m 3 -c '') \
$stat_code \
(set_color normal) \
(fish_git_prompt)
printf '%s%s%s%s ' (set_color $fish_color_cwd) (prompt_pwd) (set_color normal) $letter
end