This commit is contained in:
Alexander Navarro 2023-02-21 18:22:19 -03:00
parent 4524a86376
commit 0552ffdae8
37 changed files with 8770 additions and 49 deletions

View file

@ -15,6 +15,10 @@ alias \
rm='rm -iv' \
md='mkdir -pv';
# short long and common commands
alias \
mkexec='chmod +x';
# Exa for listing
alias \
ls='exa -lh --color=always --icons --git ' \

View file

@ -0,0 +1,22 @@
# Auto-generated aliases for Flatpak applications
alias junction='flatpak run re.sonny.Junction'
alias slack='flatpak run com.slack.Slack'
alias flatseal='flatpak run com.github.tchx84.Flatseal'
alias kid3='flatpak run org.kde.kid3'
alias client='flatpak run com.spotify.Client'
alias gdmsettings='flatpak run io.github.realmazharhussain.GdmSettings'
alias studio='flatpak run io.beekeeperstudio.Studio'
alias librewolf-community='flatpak run io.gitlab.librewolf-community'
alias czkawka='flatpak run com.github.qarmin.czkawka'
alias detwinner='flatpak run com.neatdecisions.Detwinner'
alias syncthingtk='flatpak run me.kozec.syncthingtk'
alias jellyfin-media-player='flatpak run com.github.iwalton3.jellyfin-media-player'
alias guiscrcpy='flatpak run in.srev.guiscrcpy'
alias browser='flatpak run com.brave.Browser'
alias amberol='flatpak run io.bassi.Amberol'
alias signal='flatpak run org.signal.Signal'
alias pikabackup='flatpak run org.gnome.World.PikaBackup'
alias megasync='flatpak run nz.mega.MEGAsync'
alias celeste='flatpak run com.hunterwittenborn.Celeste'

View file

@ -0,0 +1,2 @@
alias \
fzf-fp='fzf-flatpak-install-widget';

View file

@ -2,7 +2,7 @@ HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
setopt BANG_HIST
setopt EXTENDED_HISTORY
setopt EXTENDED_HISTORY
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_IGNORE_DUPS
setopt HIST_FIND_NO_DUPS

View file

@ -0,0 +1,89 @@
export FLATPAK_ALIAS_FILE="${DOTS:-$HOME/.config}/config/zsh/aliases/flatpak.zsh"
export FLATPAK_EXPORT_FILE="${DOTS:-$HOME/Desktop}/exports/flatpak-apps.txt"
fp() {
set -e
generate_flatpak_alias() {
local flatpak_alias_file=${1:-$FLATPAK_ALIAS_FILE}
[[ -f $flatpak_alias_file ]] && touch "$flatpak_alias_file"
local flatpak_binaries_dir="/var/lib/flatpak/exports/bin"
if [[ -d "$flatpak_binaries_dir" ]]; then
echo -e "\n# Auto-generated aliases for Flatpak applications\n" >> "${flatpak_alias_file}"
while read -r app; do
app_id=$(echo "$app" | awk -F'/' '{print $NF}')
alias_name=$(echo "$app_id" | awk -F'.' '{print $NF}' | tr '[:upper:]' '[:lower:]')
echo "alias $alias_name='flatpak run $app_id'" >> "${flatpak_alias_file}"
done < <(find "$flatpak_binaries_dir" -maxdepth 1 -mindepth 1)
echo "Done generating Flatpak aliases"
echo "Check ${BLD}${BLU}$flatpak_alias_file${RST} to modify auto-generated alias"
else
echo "${RED}${BLD}Error: ${YLW}$flatpak_binaries_dir${RST} directory does not exist"
fi
}
export_flatpak_apps() {
local flatpak_export_file=""${1:-$FLATPAK_EXPORT_FILE}
flatpak list --columns=application --app > "${flatpak_export_file}"
echo "${BLD}${BLU}Flatpak apps exported successfully${RST}"
}
import_flatpak_apps() {
local flatpak_export_file=${1:-$FLATPAK_EXPORT_FILE}
xargs flatpak install -y < "${flatpak_export_file}"
}
show_help() {
echo -e "${BLD}Usage: ${GRN}fp${RST}${YLW} [OPTION]${RST}"
echo -e ""
echo -e "${BLD} Options:${RST}"
echo -e "${YLW} -e, export ${RST}Export a list of installed Flatpak apps to a file"
echo -e "${YLW} -i, import ${RST}Install Flatpak apps from exported file"
echo -e "${YLW} -g, generate ${RST}Generate aliases for all installed Flatpak apps"
echo -e "${YLW} -h, --help ${RST}Show this help"
}
main() {
local action=$1
case $action in
"generate"|"-g")
echo -en "Enter the location to save the Flatpak alias file, \n(default: ${FLATPAK_ALIAS_FILE}): "
read -r user_alias_dir
if [[ -n "$user_alias_dir" ]]; then
FLATPAK_ALIAS_FILE="$user_alias_dir"
fi
generate_flatpak_alias "${FLATPAK_ALIAS_FILE}"
;;
"export"|"-e")
echo -en "Enter the location to save the Flatpak export file (default: ${FLATPAK_EXPORT_FILE}): "
read -r user_export_file
if [[ -n "$user_export_file" ]]; then
FLATPAK_EXPORT_FILE="$user_export_file"
fi
export_flatpak_apps "${FLATPAK_EXPORT_FILE}"
;;
"import"|"-i")
echo -en "Enter the location of the Flatpak export file to import (default: ${FLATPAK_EXPORT_FILE}): "
read -r user_export_file
if [[ -n "$user_export_file" ]]; then
FLATPAK_EXPORT_FILE="$user_export_file"
fi
import_flatpak_apps "${FLATPAK_EXPORT_FILE}"
;;
"--help"|"-h")
show_help
;;
*)
show_help
;;
esac
}
main "$@"
}

View file

@ -1,7 +1,7 @@
#!/usr/bin/zsh
update_path() {
export PATH="$PATH:$1"
export PATH="$PATH:$1"
}
# Set manually
@ -27,7 +27,7 @@ update_path "/usr/local/bin"
update_path "$HOME/.local/bin"
update_path "$HOME/.cargo/bin/"
update_path "$HOME/.spicetify"
update_path "$HOME/Repos/Private/scripts"
update_path "$DOTS/scripts"
update_path "$HOME/bin"
update_path "$NPM_PACKAGES/bin"
update_path "$PNPM_HOME"

View file

@ -1,6 +1,6 @@
# Start mesuring bottlenecks
if [[ "$ZPROF" = true ]]; then
zmodload zsh/zprof
zmodload zsh/zprof
fi
## Stuff I don't know what they're for
@ -53,33 +53,33 @@ zstyle ':omz:plugins:nvm' lazy true
ZSHZ_TILDE=1
plugins=(
nvm
alias-finder
archlinux
bgnotify
colored-man-pages
cp # alias to use rsync to copy files
docker
docker-compose
fd
fzf
git
git-prompt
npm
ripgrep
rsync
safe-paste # don't run code when pasting
systemd
tmux
# vi-mode
yarn
z
zsh-autocomplete
zsh-autopair
zsh-autosuggestions
zsh-completions
zsh-syntax-highlighting
zsh-interactive-cd
nvm
alias-finder
# archlinux
bgnotify
colored-man-pages
cp # alias to use rsync to copy files
docker
docker-compose
fd
fzf
git
git-prompt
npm
ripgrep
rsync
safe-paste # don't run code when pasting
systemd
# tmux
# vi-mode
yarn
z
zsh-autocomplete
zsh-autopair
zsh-autosuggestions
zsh-completions
zsh-syntax-highlighting
zsh-interactive-cd
)
# If not running interactively, don't do anything
@ -87,6 +87,11 @@ plugins=(
export HISTCONTROL=ignoreboth:erasedups
# autocomplete: https://github.com/marlonrichert/zsh-autocomplete/blob/main/.zshrc
zstyle ':autocomplete:*' fzf-completion yes
zstyle ':autocomplete:*' min-input 1
zstyle ':autocomplete:*' widget-style menu-select # Tab select instead of autocomplete
source $ZSH/oh-my-zsh.sh
#--------------------------------------------------------------------#
@ -95,20 +100,22 @@ source $ZSH/oh-my-zsh.sh
# File directory that are needed to source
files=(
# zsh
$DOTS/config/zsh/**/*.zsh
)
# zsh
$DOTS/config/zsh/**/*.zsh
# fzf scripts that need to be sourced
$DOTS/scripts/fzf-flatpak
)
for file in $files; do
if [[ -f $file ]]; then
emulate -L zsh
source $file
fi
if [[ -f $file ]]; then
emulate -L zsh
source $file
fi
done
if [[ "$ZPROF" = true ]]; then
zprof
zprof
fi
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm