diff --git a/configs/alias_useful.fish b/configs/alias_useful.fish index 1eb2438..73a8150 100755 --- a/configs/alias_useful.fish +++ b/configs/alias_useful.fish @@ -208,3 +208,18 @@ end if test -e /usr/bin/sudo-rs alias sudo=sudo-rs end + +#### SOURCE of bash + +function smart_source + set file $argv[1] + + if string match -q "*.bash" -- $file + bass source $file + else if string match -q "*.fish" -- $file + builtin source $file + else + # fallback: try fish source by default + builtin source $file + end +end diff --git a/configs/arch_config.fish b/configs/arch_config.fish index 9694718..7d33d11 100755 --- a/configs/arch_config.fish +++ b/configs/arch_config.fish @@ -2,6 +2,8 @@ # ~/.config/fish/configs/arch_config.fish # +source $HOME/.config/fish/configs/uni.fish + alias git_update='$HOME/.config/fish/scripts/git-update.sh' alias mount_all='$HOME/.config/fish/scripts/mount.sh' @@ -12,9 +14,15 @@ alias print_cam='ssh honney@192.168.1.184' function updateall # Get current Discord version (if installed) if pacman -Q discord >/dev/null 2>&1 - set version_before (pacman -Q discord) + set discord_version_before (pacman -Q discord) else - set version_before "" + set discord_version_before "" + end + + if pacman -Q linux-zen >/dev/null 2>&1 + set kernel_version_before (pacman -Q linux-zen) + else + set kernel_version_before "" end # Run updates @@ -22,20 +30,39 @@ function updateall # Get new Discord version (if installed) if pacman -Q discord >/dev/null 2>&1 - set version_after (pacman -Q discord) + set discord_version_after (pacman -Q discord) else - set version_after "" + set discord_version_after "" end # Compare versions - if test "$version_before" != "$version_after" - echo "Discord version changed: $version_before -> $version_after" + if test "$discord_version_before" != "$discord_version_after" + echo "Discord version changed: $discord_version_before -> $discord_version_after" echo "Running extra command..." sh -c "$(curl -sS https://raw.githubusercontent.com/Vendicated/VencordInstaller/main/install.sh)" end flatpak update - yay -Sua --sudoloop + paru -Sua --sudoloop + + # Get new Discord version (if installed) + if pacman -Q linux-zen >/dev/null 2>&1 + set kernel_version_after (pacman -Q linux-zen) + else + set kernel_version_after "" + end + if test "$kernel_version_before" != "$kernel_version_after" + echo "Discord version changed: $kernel_version_before -> $kernel_version_after" + echo -n "Reboot now? [y/N]: " + + read answer + + if test "$answer" = "y" -o "$answer" = "Y" + reboot + else + echo "Skipping reboot." + end + end end alias big='expac -H M "%m\t%n" | sort -h | nl' # Sort installed packages according to size in MB (expac must be installed) diff --git a/configs/theme.fish b/configs/theme.fish index 0b5dc65..99123d9 100755 --- a/configs/theme.fish +++ b/configs/theme.fish @@ -1,5 +1,5 @@ # Load pywal colors (extract from ~/.cache/wal/colors.json) -if test -e $HOME/.cache/wal/colors.json +if test -e $HOME/.cache/wal/colors.json1 set -g theme_0 (jq -r '.colors.color0' ~/.cache/wal/colors.json) # Primary color set -g theme_1 (jq -r '.colors.color1' ~/.cache/wal/colors.json) # Secondary color (e.g., for git, @) set -g theme_2 (jq -r '.colors.color2' ~/.cache/wal/colors.json) # Third color (e.g., for hostname) diff --git a/configs/ubuntu_config.fish b/configs/ubuntu_config.fish index a0030d9..75e61f2 100755 --- a/configs/ubuntu_config.fish +++ b/configs/ubuntu_config.fish @@ -4,3 +4,5 @@ alias updateall='sudo apt upgrade -y && sudo apt update -y' alias uninstall='sudo apt purge -y' + +source $HOME/.config/fish/configs/uni.fish diff --git a/configs/uni.fish b/configs/uni.fish new file mode 100644 index 0000000..a0bbd4e --- /dev/null +++ b/configs/uni.fish @@ -0,0 +1,19 @@ +if test -x /usr/bin/pacman + if test -d ~/Nextcloud/UNI/26_TI/RISC-V + set -U fish_user_paths ~/mount/Storage/Nextcloud/UNI/26_TI/RISC-V/xpack-riscv-none-elf-gcc-15.2.0-1-linux-x64/xpack-riscv-none-elf-gcc-15.2.0-1/bin $fish_user_paths + set -U fish_user_paths ~/mount/Storage/Nextcloud/UNI/26_TI/RISC-V/verible-v0.0-4053-g89d4d98a-linux-static-x86_64/verible-v0.0-4053-g89d4d98a/bin $fish_user_paths + end + if test -d ~/projects/RISC-V + set -gx XILINX_VIVADO ~/projects/RISC-V/vivado/Vivado/2022.2 + set -U fish_user_paths ~/projects/RISC-V/vivado/Vivado/2022.2/bin $fish_user_paths + set -gx LM_LICENSE_FILE ~/projects/RISC-V/intel/LR-160568_License.dat + set -gx SALT_LICENSE_SERVER $LM_LICENSE_FILE + set -U fish_user_paths ~/projects/RISC-V/intel/questa_fse/bin $fish_user_paths + end +end + +set in_container (test -f /.dockerenv; or test -f /run/.containerenv; and echo yes; or echo no) + +if test "in_container" = yes + echo "In Container" +end diff --git a/fish_variables b/fish_variables index ad30507..a6034a1 100755 --- a/fish_variables +++ b/fish_variables @@ -4,4 +4,4 @@ SETUVAR __done_min_cmd_duration:5000 SETUVAR __done_notify_sound:1 SETUVAR __done_sway_ignore_visible:0 SETUVAR __fish_initialized:4300 -SETUVAR fish_user_paths:/home/honney/\x2ebin\x1e/home/honney/\x2elocal/bin +SETUVAR fish_user_paths:/home/honney/projects/RISC\x2dV/intel/questa_fse/bin\x1e/home/honney/projects/RISC\x2dV/vivado/Vivado/2022\x2e2/bin\x1e/home/honney/mount/Storage/Nextcloud/UNI/26_TI/RISC\x2dV/verible\x2dv0\x2e0\x2d4053\x2dg89d4d98a\x2dlinux\x2dstatic\x2dx86_64/verible\x2dv0\x2e0\x2d4053\x2dg89d4d98a/bin\x1e/home/honney/mount/Storage/Nextcloud/UNI/26_TI/RISC\x2dV/xpack\x2driscv\x2dnone\x2delf\x2dgcc\x2d15\x2e2\x2e0\x2d1\x2dlinux\x2dx64/xpack\x2driscv\x2dnone\x2delf\x2dgcc\x2d15\x2e2\x2e0\x2d1/bin\x1e/home/honney/projects/RISC\x2dV/intelFPGA_pro/22\x2e4/questa_fse/bin\x1e/home/honney/projects/vivado/Vivado/2022\x2e2/bin\x1e/home/honney/\x2ebin\x1e/home/honney/\x2elocal/bin\x1e/opt/rocm/bin diff --git a/functions/extract.fish b/functions/extract.fish index ca37545..db1471b 100755 --- a/functions/extract.fish +++ b/functions/extract.fish @@ -4,54 +4,69 @@ function extract return 1 end - set output_dir "." set archives $argv + set output_dir "." + set use_custom_dir 0 - # If there's more than one argument, check the last one for a directory - if test (count $argv) -gt 1 - set maybe_dir $argv[-1] - if not test -f $maybe_dir - set output_dir $maybe_dir - mkdir -p $output_dir - set archives $argv[1..-2] - end - else - # If only one argument and it's a file, create directory with same name as archive (without extension) - set archive $argv[1] - if test -f "$archive" - set output_dir (string replace -r '\.(tar\.gz|tgz|tar\.bz2|tbz2|tar\.xz|txz|gz|bz2|xz|zst|zip|7z|rar)$' '' (basename "$archive")) - mkdir -p $output_dir + # If exactly 2 args and second is a directory (or doesn't exist yet), treat it as output dir + if test (count $argv) -eq 2 + set maybe_dir $argv[2] + if test -d "$maybe_dir"; or not test -e "$maybe_dir" + set output_dir "$maybe_dir" + mkdir -p "$output_dir" + set archives $argv[1] + set use_custom_dir 1 end end + # Detect multiple archives + set multi 0 + if test (count $archives) -gt 1 + set multi 1 + end + for archive in $archives if not test -f "$archive" echo "extract: '$archive' is not a valid file" continue end + # Determine base name (strip extensions) + set base (string replace -r '\.(tar\.gz|tgz|tar\.bz2|tbz2|tar\.xz|txz|gz|bz2|xz|zst|zip|7z|rar)$' '' (basename "$archive")) + + # Decide target directory + if test $multi -eq 1 + set target_dir "$base" + else if test $use_custom_dir -eq 1 + set target_dir "$output_dir" + else + set target_dir "$base" + end + + mkdir -p "$target_dir" + set mime (file --mime-type -b "$archive") switch $mime case 'application/x-tar' - tar -xvf "$archive" -C "$output_dir" + tar -xvf "$archive" -C "$target_dir" case 'application/gzip' - tar xvzf "$archive" -C "$output_dir" + tar xvzf "$archive" -C "$target_dir" case 'application/x-bzip2' - tar xvjf "$archive" -C "$output_dir" + tar xvjf "$archive" -C "$target_dir" case 'application/x-xz' - tar xvJf "$archive" -C "$output_dir" + tar xvJf "$archive" -C "$target_dir" case 'application/zstd' - tar --zstd -xvf "$archive" -C "$output_dir" + tar --zstd -xvf "$archive" -C "$target_dir" case 'application/zip' - unzip "$archive" -d "$output_dir" + unzip "$archive" -d "$target_dir" case 'application/x-7z-compressed' - 7z x "$archive" -o"$output_dir" + 7z x "$archive" -o"$target_dir" case 'application/x-rar' 'application/vnd.rar' - unrar x -o+ "$archive" "$output_dir" + unrar x -o+ "$archive" "$target_dir" case '*' echo "extract: unknown file type for '$archive' ($mime)" continue end end -end +end \ No newline at end of file