Change ZSH configuration

- Enable keychain
- Fix ls alias
- Added sway startup script
This commit is contained in:
Fabio Scotto di Santolo
2025-07-26 13:56:22 +02:00
parent 9c739533e3
commit 27ac457068
4 changed files with 57 additions and 45 deletions

View File

@@ -15,7 +15,7 @@ is_debian_based() {
return 1 # NO Debian-based return 1 # NO Debian-based
} }
alias ls="eza --color=always --group-directories-first --icons" alias ls="eza --color=always --group-directories-first --icons=always"
# Replace some more things with better alternatives # Replace some more things with better alternatives
if is_debian_based; then if is_debian_based; then

View File

@@ -2,8 +2,54 @@
if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
if [ -n "$DBUS_SESSION_BUS_ADDRESS" ]; then if [ -n "$DBUS_SESSION_BUS_ADDRESS" ]; then
exec sway
else # XDG Settings Basic
export XDG_CONFIG_HOME=${HOME}/.config
export XDG_DATA_HOME=${HOME}/.local/share
export XDG_CACHE_HOME=${HOME}/.local/cache
export XDG_STATE_HOME=${HOME}/.local/state
# XDG_CONFIG_HOME
export GTK2_RC_FILES=${XDG_CONFIG_HOME}/gtk-2.0/gtkrc-2.0
# Reduces crashs for some gdk apps, like evolution
# ! Do not set as global variable. Electron Apps will not start !
# export GDK_BACKEND=wayland
# Required for tray icons on waybar
export XDG_CURRENT_DESKTOP=sway
# Enable QT apps to have gtk theme
export QT_QPA_PLATFORMTHEME=qt5ct
# Force wayland on qt apps
export QT_QPA_PLATFORM=wayland
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
# Explicitly set to '96' instead of 'physical' because some apps have problems
# Looking at you nextcloud client!
# https://github.com/nextcloud/desktop/issues/1079
# https://github.com/swaywm/sway/issues/2424
export QT_WAYLAND_FORCE_DPI=96
# Make Qt apps honour DPI settings.
export QT_AUTO_SCREEN_SCALE_FACTOR=1
# Mozilla Wayland support + hardware video decoding
export MOZ_ENABLE_WAYLAND=1
export MOZ_WAYLAND_USE_VAAPI=1
# SDL
export SDL_VIDEODRIVER=wayland
# Java under Xwayland
export _JAVA_AWT_WM_NONREPARENTING=1
# Session Type for later screensharing
export XDG_SESSION_TYPE=wayland
exec dbus-launch --exit-with-session sway exec dbus-launch --exit-with-session sway
else
echo "Cannot found dbus session: Sway don't work"
fi fi
fi fi

View File

@@ -1,10 +1,3 @@
[ -f "$HOME/.ghcup/env" ] && . "$HOME/.ghcup/env"
if [ -f "/home/linuxbrew/.linuxbrew/bin/brew" ]; then
# Initialize Homebrew
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
fi
if command -v starship > /dev/null 2>&1; then if command -v starship > /dev/null 2>&1; then
# Initialize Starship # Initialize Starship
eval "$(starship init zsh)" eval "$(starship init zsh)"

View File

@@ -78,6 +78,7 @@ plugins=(
command-not-found command-not-found
fzf fzf
gitignore gitignore
keychain
mise mise
zoxide zoxide
zsh-autosuggestions zsh-autosuggestions
@@ -122,35 +123,7 @@ fpath=(~/.zsh $fpath)
autoload run-help autoload run-help
autoload -Uz compinit && compinit -u autoload -Uz compinit && compinit -u
# Key bindings using bindkey and fzf-tmux where possible export FZF_HOME=$HOME/.oh-my-zsh/custom/plugins/fzf
# Ctrl+R: Enhanced reverse history search source <(fzf --zsh)
bindkey '^R' fzf-history-widget source "$FZF_HOME/shell/key-bindings.zsh"
source "$FZF_HOME/shell/completion.zsh"
# Ctrl+T: Fuzzy find file
bindkey '^T' fzf-file-widget
# Alt+C: Fuzzy change directory
bindkey '^[c' fzf-cd-widget
# Additional useful bindings
# Alt+H: Search and insert from history
fzf-history-widget() {
BUFFER=$(fc -l 1 | fzf --tac +s --no-sort --preview 'echo {}' | sed 's/^[ 0-9]*//')
CURSOR=$#BUFFER
zle reset-prompt
}
zle -N fzf-history-widget
fzf-file-widget() {
local file
file=$(fzf --preview 'bat --style=numbers --color=always --line-range :500 {}' 2> /dev/null) && LBUFFER+="$file"
zle reset-prompt
}
zle -N fzf-file-widget
fzf-cd-widget() {
local dir
dir=$(fd --type d | fzf --preview 'tree -a -C {} | head -100') && cd "$dir"
zle reset-prompt
}
zle -N fzf-cd-widget