mirror of
https://codeberg.org/gigirassy/niri-dotfiles
synced 2026-08-30 15:19:32 +00:00
Add rice/fish/config.fish
This commit is contained in:
@@ -0,0 +1,114 @@
|
||||
if status is-interactive
|
||||
# Commands to run in interactive sessions can go here
|
||||
end
|
||||
|
||||
set -gx sudo "sudo"
|
||||
|
||||
source ~/.config/fish/secrets.fish
|
||||
|
||||
# Created by `pipx` on 2026-02-13 06:11:42
|
||||
set PATH $PATH ~/.local/bin
|
||||
|
||||
alias pkg "./cbuild --update-check pkg"
|
||||
alias pu "./cbuild prepare-upgrade"
|
||||
|
||||
alias ls "eza --icons=never -Hh"
|
||||
alias la "eza --icons=never -ah"
|
||||
alias ll "eza --icons=never -lgh"
|
||||
alias lh "eza --icons=never -lAgh"
|
||||
alias tree "eza --icons=never -Th"
|
||||
|
||||
function rsplit
|
||||
grep -Fv "ASIN" $argv[1] | split -l 20 -d --additional-suffix=.csv - output_
|
||||
end
|
||||
|
||||
function update-system
|
||||
echo "Updating XBPS..."
|
||||
while not $sudo xbps-install -Syu
|
||||
echo "xbps-install failed; retrying..."
|
||||
sleep 2
|
||||
end
|
||||
|
||||
echo "Updating Flatpaks..."
|
||||
flatpak update -y
|
||||
|
||||
echo "Updating Cargo packages..."
|
||||
cargo install-update -a
|
||||
|
||||
echo "Updating pipx packages..."
|
||||
pipx upgrade-all
|
||||
end
|
||||
|
||||
function fix-wifi
|
||||
|
||||
if test (count $wifi_name) -eq 0
|
||||
echo "No active Wi-Fi connection found."
|
||||
return 1
|
||||
end
|
||||
|
||||
nmcli connection modify "$wifi_name" 802-11-wireless.band a
|
||||
nmcli connection down "$wifi_name"
|
||||
nmcli connection up "$wifi_name"
|
||||
end
|
||||
|
||||
|
||||
function drive-test
|
||||
set -l device /dev/sda
|
||||
|
||||
if test (count $argv) -gt 0
|
||||
set device $argv[1]
|
||||
end
|
||||
|
||||
if not test -b "$device"
|
||||
echo "Device not found: $device"
|
||||
return 1
|
||||
end
|
||||
|
||||
echo "Drive: $device"
|
||||
echo "Checking SMART capabilities..."
|
||||
|
||||
set -l duration ($sudo smartctl -c "$device" 2>/dev/null | \
|
||||
awk '/Extended self-test routine/{found=1; next} found && /recommended polling time/ {match($0, /\([[:space:]]*[0-9]+/); value=substr($0, RSTART+1, RLENGTH-1); gsub(/[[:space:]]/, "", value); print value; exit}')
|
||||
|
||||
if test -z "$duration"
|
||||
echo "Could not determine the extended-test duration."
|
||||
$sudo smartctl -c "$device"
|
||||
return 1
|
||||
end
|
||||
|
||||
echo "Estimated test duration: $duration minutes"
|
||||
echo "Starting extended SMART self-test..."
|
||||
|
||||
$sudo smartctl -t long "$device"
|
||||
|
||||
if test $status -ne 0
|
||||
echo "Failed to start SMART self-test."
|
||||
return 1
|
||||
end
|
||||
|
||||
set -l wait_seconds (math "$duration * 60 + 15")
|
||||
|
||||
echo "Test started. Waiting approximately $duration minutes..."
|
||||
echo
|
||||
|
||||
while test $wait_seconds -gt 0
|
||||
set -l minutes (math "floor($wait_seconds / 60)")
|
||||
set -l seconds (math "$wait_seconds % 60")
|
||||
|
||||
printf "\rTime remaining: %02d:%02d" $minutes $seconds
|
||||
sleep 10
|
||||
set wait_seconds (math "$wait_seconds - 10")
|
||||
end
|
||||
|
||||
echo
|
||||
echo
|
||||
echo "Test should now be complete."
|
||||
echo "Running smartctl -x..."
|
||||
echo
|
||||
|
||||
$sudo smartctl -x "$device"
|
||||
end
|
||||
|
||||
if command -q zoxide
|
||||
zoxide init --cmd cd fish | source
|
||||
end
|
||||
Reference in New Issue
Block a user