fixed some stuff and made it compatable with fisher
This commit is contained in:
@@ -7,7 +7,40 @@ if test "$TERM" = "xterm-kitty"; or test "$TERM" = "alacritty"
|
||||
alias ssh='env TERM=xterm-256color ssh'
|
||||
end
|
||||
|
||||
if command -q zoxide
|
||||
zoxide init fish | source
|
||||
alias cd='z'
|
||||
# if command -q zoxide
|
||||
# zoxide init fish | source
|
||||
# alias cd='z'
|
||||
# end
|
||||
|
||||
set -gx fisher_path ~/.config/fisher
|
||||
|
||||
################ FIX STEAM ####################################################
|
||||
|
||||
function steam_fix
|
||||
if test -f /usr/share/applications/steam.desktop
|
||||
# Check if the credential helper is already in the file
|
||||
if ! grep -q "PrefersNonDefaultGPU=true" -q '/X-KDE-RunOnDiscreteGpu=true' /usr/share/applications/steam.desktop
|
||||
echo "Steam is allready fixed"
|
||||
else
|
||||
echo "Fixing Steam"
|
||||
# Remove the specific GPU lines using sudo and sed
|
||||
sudo sed -i -e '/PrefersNonDefaultGPU=true/d' -e '/X-KDE-RunOnDiscreteGpu=true/d' /usr/share/applications/steam.desktop
|
||||
echo "Steam has been fixed."
|
||||
end
|
||||
else
|
||||
echo "no /usr/share/applications/steam.desktop file"
|
||||
echo "could not fix steam"
|
||||
end
|
||||
end
|
||||
|
||||
################ FIX BRAVE ####################################################
|
||||
|
||||
function brave_fix
|
||||
if test -f ~/.config/BraveSoftware/Brave-Browser/SingletonLock
|
||||
# Check if the credential helper is already in the file
|
||||
rm ~/.config/BraveSoftware/Brave-Browser/SingletonLock
|
||||
else
|
||||
echo "Brave not blocked by SingletonLock"
|
||||
echo "could not fix brave"
|
||||
end
|
||||
end
|
||||
+74
-37
@@ -8,7 +8,14 @@ alias remount='sudo mount -a'
|
||||
alias mount_config='sudo nano /etc/fstab'
|
||||
alias own='sudo chown -R "$USER":"$USER"'
|
||||
alias right='sudo chmod -R 755'
|
||||
alias reload='clear && omf reload'
|
||||
function reload
|
||||
if command -q omf
|
||||
omf reload
|
||||
else
|
||||
clear
|
||||
exec fish
|
||||
end
|
||||
end
|
||||
alias fish_config='nano $HOME/.config/fish/config.fish'
|
||||
alias ip='ip -color'
|
||||
alias psmem='ps auxf | sort -nr -k 4'
|
||||
@@ -71,33 +78,82 @@ else
|
||||
end
|
||||
|
||||
function source --description "Source files with auto-detection (replaces builtin source)"
|
||||
if test (count $argv) -eq 0
|
||||
builtin source
|
||||
# --- 0. Handle standard input piping (Fixes background script sourcing) ---
|
||||
if not isatty stdin
|
||||
builtin source $argv
|
||||
return
|
||||
end
|
||||
|
||||
set file $argv[1]
|
||||
set -e argv[1]
|
||||
|
||||
if string match -q -- "--*" $file
|
||||
builtin source $file $argv
|
||||
# --- 1. Handle Flags First ---
|
||||
if test (count $argv) -gt 0; and string match -q -- "--*" $argv[1]
|
||||
builtin source $argv
|
||||
return
|
||||
end
|
||||
|
||||
if not test -f "$file"
|
||||
echo "source: No such file: '$file'" >&2
|
||||
return 1
|
||||
end
|
||||
# --- 2. Check: Is a file/argument given? ---
|
||||
if test (count $argv) -gt 0
|
||||
set file $argv[1]
|
||||
set -e argv[1]
|
||||
|
||||
if string match -q "*.bash" -- $file
|
||||
if command -q bass
|
||||
bass source $file $argv
|
||||
else
|
||||
echo "source: 'bass' is not installed. Install it to source .bash files." >&2
|
||||
# Check if the explicit path actually exists as a file
|
||||
if not test -f "$file"
|
||||
echo "source: No such file: '$file'" >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
# Logic: Is it .fish?
|
||||
if string match -q "*.fish" -- $file
|
||||
builtin source $file $argv
|
||||
return
|
||||
# Logic: Is it .bash?
|
||||
else if string match -q "*.bash" -- $file or string match -q "*.sh" -- $file
|
||||
if command -q bass
|
||||
bass source $file $argv
|
||||
return
|
||||
else
|
||||
echo "source: 'bass' is not installed. Install it to source bash files." >&2
|
||||
return 1
|
||||
end
|
||||
# Logic: Else (unknown file type)
|
||||
else
|
||||
echo "source: Unknown file extension for '$file'. Please specify a .fish or .bash file." >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
# --- 3. No file given: Check for local venv directories ---
|
||||
else
|
||||
builtin source $file $argv
|
||||
# Target directories to check in order of preference
|
||||
set venv_dirs .venv venv
|
||||
|
||||
for dir in $venv_dirs
|
||||
if test -d "$dir"
|
||||
# Check for .fish activator first
|
||||
if test -f "$dir/bin/activate.fish"
|
||||
builtin source "$dir/bin/activate.fish"
|
||||
return
|
||||
|
||||
# Check for .bash activator second
|
||||
else if test -f "$dir/bin/activate" or test -f "$dir/bin/activate.bash"
|
||||
# Resolve which bash file exists
|
||||
set bash_act "$dir/bin/activate"
|
||||
if test -f "$dir/bin/activate.bash"
|
||||
set bash_act "$dir/bin/activate.bash"
|
||||
end
|
||||
|
||||
if command -q bass
|
||||
bass source $bash_act
|
||||
return
|
||||
else
|
||||
echo "source: Found bash virtual env in '$dir', but 'bass' is not installed." >&2
|
||||
return 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Logic: Else error (No venv found and no args provided)
|
||||
echo "source: No file specified and no local venv or .venv directory found." >&2
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
@@ -306,23 +362,4 @@ function git_cred
|
||||
echo "no .git/config file"
|
||||
echo "could not add the credentials helper"
|
||||
end
|
||||
end
|
||||
|
||||
################ FIX STEAM ####################################################
|
||||
|
||||
function steam_fix
|
||||
if test -f /usr/share/applications/steam.desktop
|
||||
# Check if the credential helper is already in the file
|
||||
if ! grep -q "PrefersNonDefaultGPU=true" -q '/X-KDE-RunOnDiscreteGpu=true' /usr/share/applications/steam.desktop
|
||||
echo "Steam is allready fixed"
|
||||
else
|
||||
echo "Fixing Steam"
|
||||
# Remove the specific GPU lines using sudo and sed
|
||||
sudo sed -i -e '/PrefersNonDefaultGPU=true/d' -e '/X-KDE-RunOnDiscreteGpu=true/d' /usr/share/applications/steam.desktop
|
||||
echo "Steam has been fixed."
|
||||
end
|
||||
else
|
||||
echo "no /usr/share/applications/steam.desktop file"
|
||||
echo "could not fix steam"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user