diff --git a/zsh/.profile.d/cargo.sh b/zsh/.profile.d/cargo.sh new file mode 100644 index 0000000..f6ec644 --- /dev/null +++ b/zsh/.profile.d/cargo.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +if [ -e "$HOME/.cargo" ]; then + source "$HOME/.cargo/env" +fi diff --git a/zsh/.profile.d/golang.sh b/zsh/.profile.d/golang.sh new file mode 100644 index 0000000..d4a357a --- /dev/null +++ b/zsh/.profile.d/golang.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +if command -v go > /dev/null 2>&1; then + export GOPATH="$HOME/.local/share/Go" + export GOBIN="$GOPATH/bin" +fi diff --git a/zsh/.profile.d/java.sh b/zsh/.profile.d/java.sh new file mode 100644 index 0000000..f6ad239 --- /dev/null +++ b/zsh/.profile.d/java.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +if command -v java > /dev/null 2>&1; then + export JAVA_HOME="$(dirname $(mise bin-paths | grep -i java))" +fi diff --git a/zsh/.profile.d/mise.sh b/zsh/.profile.d/mise.sh new file mode 100644 index 0000000..1af6721 --- /dev/null +++ b/zsh/.profile.d/mise.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +if command -v mise > /dev/null 2>&1; then + eval "$(mise activate zsh)" +fi diff --git a/zsh/.profile.d/runwm.sh b/zsh/.profile.d/runwm.sh index 659dd45..497b177 100755 --- a/zsh/.profile.d/runwm.sh +++ b/zsh/.profile.d/runwm.sh @@ -2,54 +2,6 @@ if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then if [ -n "$DBUS_SESSION_BUS_ADDRESS" ]; then - # 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 - - # SSH socket - export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/gcr/ssh" - exec dbus-launch --exit-with-session sway else echo "Cannot found dbus session: Sway don't work" diff --git a/zsh/.profile.d/zoxide.sh b/zsh/.profile.d/zoxide.sh new file mode 100644 index 0000000..758fbf6 --- /dev/null +++ b/zsh/.profile.d/zoxide.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +if command -v zoxide > /dev/null 2>&1; then + eval "$(zoxide init zsh)" +fi diff --git a/zsh/.zlogout b/zsh/.zlogout deleted file mode 100644 index de4f5f7..0000000 --- a/zsh/.zlogout +++ /dev/null @@ -1,7 +0,0 @@ -# ~/.bash_logout: executed by bash(1) when login shell exits. - -# when leaving the console clear the screen to increase privacy - -if [ "$SHLVL" = 1 ]; then - [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q -fi diff --git a/zsh/.zprofile b/zsh/.zprofile index 22c63a2..7d04e7b 100644 --- a/zsh/.zprofile +++ b/zsh/.zprofile @@ -1,7 +1,74 @@ -# Load profiles from /etc/profile.d -if test -d $HOME/.profile.d/; then - for profile in $HOME/.profile.d/*.sh; do - test -r "$profile" && . "$profile" - done - unset profile -fi +case ":$PATH:" in + *":$HOME/.local/bin:"*) ;; + *) export PATH="$HOME/.local/bin:$PATH" ;; +esac + +# XDG variables +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 +export XDG_CURRENT_DESKTOP=sway # Required for tray icons on waybar +export XDG_SESSION_TYPE=wayland # Session Type for later screensharing + +# Enable GTK themes +export GTK2_RC_FILES=${XDG_CONFIG_HOME}/gtk-2.0/gtkrc-2.0 + +# 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 + +export ZSH_HOME="$HOME/.zsh" +export DOTFILES="$HOME/.dotfiles" +export EDITOR=nvim +export HELPDIR=/usr/share/zsh/"${ZSH_VERSION}"/help + +# Reduces crashs for some gdk apps, like evolution +# ! Do not set as global variable. Electron Apps will not start ! +# export GDK_BACKEND=wayland + +# SDL +export SDL_VIDEODRIVER=wayland + +# Java under Xwayland +export _JAVA_AWT_WM_NONREPARENTING=1 + +# SSH socket +export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/gcr/ssh" + +export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" +export FZF_ALT_C_COMMAND="fd --hidden --type directory --strip-cwd-prefix --exclude .git" +# Export Catppuccin Mocha theme for FZF +export FZF_DEFAULT_OPTS=" \ +--height 60% --layout=reverse --border \ +--color=bg+:#313244,bg:#1E1E2E,spinner:#F5E0DC,hl:#F38BA8 \ +--color=fg:#CDD6F4,header:#F38BA8,info:#CBA6F7,pointer:#F5E0DC \ +--color=marker:#B4BEFE,fg+:#CDD6F4,prompt:#CBA6F7,hl+:#F38BA8 \ +--color=selected-bg:#45475A \ +--color=border:#313244,label:#CDD6F4" +export FZF_TMUX_OPTS=" -p90%,70%" +export VIRTUAL_ENV_DISABLE_PROMPT=1 + +source "$HOME/.profile.d/mise.sh" +source "$HOME/.profile.d/cargo.sh" +source "$HOME/.profile.d/golang.sh" +source "$HOME/.profile.d/java.sh" +source "$HOME/.profile.d/zoxide.sh" +source "$HOME/.profile.d/runwm.sh" diff --git a/zsh/.zshenv b/zsh/.zshenv deleted file mode 100644 index ffc2d1d..0000000 --- a/zsh/.zshenv +++ /dev/null @@ -1,57 +0,0 @@ -# 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 -export DOTFILES="$HOME/.dotfiles" -export EDITOR=nvim -export HELPDIR=/usr/share/zsh/"${ZSH_VERSION}"/help -export MISE_HOME=$HOME/.local/share/mise/installs - -# fzf -export FZF_DEFAULT_COMMAND="fd --hidden --type file --strip-cwd-prefix --exclude .git" -export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" -export FZF_ALT_C_COMMAND="fd --hidden --type directory --strip-cwd-prefix --exclude .git" -# Export Catppuccin Mocha theme for FZF -export FZF_DEFAULT_OPTS=" \ ---height 60% --layout=reverse --border \ ---color=bg+:#313244,bg:#1E1E2E,spinner:#F5E0DC,hl:#F38BA8 \ ---color=fg:#CDD6F4,header:#F38BA8,info:#CBA6F7,pointer:#F5E0DC \ ---color=marker:#B4BEFE,fg+:#CDD6F4,prompt:#CBA6F7,hl+:#F38BA8 \ ---color=selected-bg:#45475A \ ---color=border:#313244,label:#CDD6F4" -export FZF_TMUX_OPTS=" -p90%,70%" - -case ":$PATH:" in - *":$HOME/.local/bin:"*) ;; - *) export PATH="$HOME/.local/bin:$PATH" ;; -esac - -# Zoxide -if command -v zoxide >/dev/null 2>&1; then - eval "$(zoxide init zsh)" -fi - -# Mise -if command -v mise >/dev/null 2>&1; then - eval "$(mise activate zsh)" -fi - -# Golang -if command -v go >/dev/null 2>&1; then - export GOPATH="$HOME/.local/share/Go" - export GOBIN="$GOPATH/bin" -fi - -# Load cargo envs -if [ -e "$HOME/.cargo" ]; then - source "$HOME/.cargo/env" -fi - -# Java -if command -v java >/dev/null 2>&1; then - export JAVA_HOME="$(dirname $(mise bin-paths | grep -i java))" -fi - -# Python -export VIRTUAL_ENV_DISABLE_PROMPT=1 diff --git a/zsh/.zshrc b/zsh/.zshrc index 2aca5ac..976de00 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -1,8 +1,3 @@ -export ZSH_HOME="$HOME/.zsh" - -# source global shell alias & variables files -[[ ! -f ~/.zshenv ]] || source ~/.zshenv - # load modules zmodload zsh/complist autoload -U compinit && compinit