From 481ff81c65c0b26ecafcefba39f484bc5ee2ba2f Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Fri, 15 Sep 2023 14:55:47 -0700 Subject: [PATCH] Make machine specific config better --- init.zsh | 12 ++++++++--- local/early-init.alexanders-desktop.zsh | 28 +++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 local/early-init.alexanders-desktop.zsh diff --git a/init.zsh b/init.zsh index 41834e5..d59232f 100644 --- a/init.zsh +++ b/init.zsh @@ -18,11 +18,17 @@ function cmd_exists { [[ -v ZSH_USER_DIR ]] || ZSH_USER_DIR="${HOME}/.zsh.d" # source_user_file function source_user_file { - [ -e "${ZSH_USER_DIR}/${1}" ] && source "${ZSH_USER_DIR}/${1}" + local machine_specific="${ZSH_CONFIG_DIR}/local/${1}.${HOST}.zsh" + local default="${ZSH_CONFIG_DIR}/local/${1}.zsh" + if [ -e "${machine_specific}" ]; then + source "${machine_specific}" + elif [ -e "${default}" ]; then + source "${default}" + fi } # Load user early init file -source_user_file "early-init.zsh" +source_user_file "early-init" # Some options setopt autocd extendedglob rm_star_silent completealiases @@ -249,7 +255,7 @@ zstyle ':fzf-tab:*' switch-group 'ctrl-h' 'ctrl-l' zstyle ':fzf-tab:*' fzf-bindings 'ctrl-a:toggle-all' # Load user init file -source_user_file 'local.zsh' +source_user_file 'init' # THE FOLLOWING PLUGINS MUST COME LAST diff --git a/local/early-init.alexanders-desktop.zsh b/local/early-init.alexanders-desktop.zsh new file mode 100644 index 0000000..b1ef259 --- /dev/null +++ b/local/early-init.alexanders-desktop.zsh @@ -0,0 +1,28 @@ +# Some extra environment variables +export PATH="${HOME}/.local/bin:${PATH}" +export JDK_JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dsun.java2d.opengl=true -Dsun.java2d.uiScale=3" +export _JAVA_AWT_WM_NONREPARENTING=1 + +add_ssh_keys() { + pass show ssh/personal_gitea | ssh-add ~/.ssh/personal_gitea + pass show ssh/personal_server | ssh-add ~/.ssh/personal_server + pass show ssh/gandi_vps | ssh-add ~/.ssh/gandi_vps + pass show ssh/notabug | ssh-add ~/.ssh/notabug + pass show ssh/aur | ssh-add ~/.ssh/aur + pass show ssh/github | ssh-add ~/.ssh/github +} + +# Because I use zsh to start X11 +if [[ -o login ]]; then + export LC_ALL=en_US.UTF-8 + + eval "$(gnome-keyring-daemon --start 2>/dev/null)" + eval "$(ssh-agent)" + SSH_ASKPASS_REQUIRE="force" \ + SSH_ASKPASS="/usr/local/bin/ssh-askpass-cat.sh" \ + add_ssh_keys & + + if ! [[ -v DISPLAY ]] && [ "${XDG_VTNR}" -eq 1 ]; then + exec startx + fi +fi