From baa26603efd0b759aa59682dd09c8a4b1186c970 Mon Sep 17 00:00:00 2001 From: surtur Date: Mon, 10 Jul 2023 05:37:57 +0200 Subject: [PATCH] home-manager: update+manage .zshrc and .zprofile --- .zprofile | 28 +++++++++++++++++---------- .zshrc | 51 ++++++++++++++++++++++++++++++++++++------------- home-surtur.nix | 6 ++++++ 3 files changed, 62 insertions(+), 23 deletions(-) diff --git a/.zprofile b/.zprofile index 572c728..f32077e 100644 --- a/.zprofile +++ b/.zprofile @@ -21,10 +21,11 @@ add_to_path "/opt/metasploit-framework/bin" add_to_path "$HOME/.local/share/flatpak/exports/bin" add_to_path "/var/lib/flatpak/exports/bin" add_to_path "$HOME/.local/share/JetBrains/Toolbox/bin" +add_to_path "$HOME/.local/share/JetBrains/Toolbox/scripts" export EDITOR='vim' export TERM='xterm-256color' -export kee="surtur" +export kee="$HOSTNAME" export SSH_KEY_PATH="$HOME/.ssh/$kee" if [ ! -S ~/.ssh/ssh_auth_sock ]; then @@ -33,10 +34,6 @@ if [ ! -S ~/.ssh/ssh_auth_sock ]; then fi -if [ ! -S $HOME/.ssh/ssh_auth_sock ]; then - eval `ssh-agent` > /dev/null - ln -sf "$SSH_AUTH_SOCK" $HOME/.ssh/ssh_auth_sock -fi export SSH_AUTH_SOCK=$HOME/.ssh/ssh_auth_sock if ! [ -f /run/.containerenv ]; then @@ -59,6 +56,8 @@ unfunction add_to_path if [[ -z $DISPLAY ]]; then export QT_QPA_PLATFORMTHEME=wayland + # proper theme support? + # export QT_QPA_PLATFORMTHEME=qt5ct export QT_QPA_PLATFORM=wayland export QT_AUTO_SCREEN_SCALE_FACTOR=0 export MOZ_DBUS_REMOTE=1 @@ -70,17 +69,26 @@ if [[ -z $DISPLAY ]]; then export NO_AT_BRIDGE=1 export TDESKTOP_USE_PORTAL=1 export XDG_SESSION_TYPE=wayland - export LIBVA_DRIVER_NAME="i965" + if [[ "${HOSTNAME}" == "surtur" ]]; then + export LIBVA_DRIVER_NAME="i965" + fi - . ~/.zsh/bemenu-dracula/bemenu-dracula + test -f ~/.zsh/bemenu-dracula/bemenu-dracula && . ~/.zsh/bemenu-dracula/bemenu-dracula - if [[ $(tty) == /dev/tty1 ]]; then + # if [[ $(tty) == /dev/tty1 ]]; then + if [ -z "${WAYLAND_DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then export GTK_IM_MODULE=ibus export QT_IM_MODULE=ibus export XMODIFIERS=@im=ibus + export SAL_USE_VCLPLUGIN=gtk3 # for libreoffice export XDG_CURRENT_DESKTOP=sway - exec systemd-cat --identifier=sway sway > $XDG_RUNTIME_DIR/sway.log 2>&1 - elif [[ $(tty) == /dev/tty2 ]]; then + if [[ "${HOSTNAME}" == "leo" ]]; then + # needs vulkan libs. + export WLRRENDERER=vulkan + fi + # exec systemd-cat --identifier=sway sway > /var/tmp/sway.log 2>&1 + sway -d -V >> /var/tmp/sway.log 2>&1 + elif [ "${XDG_VTNR}" -eq 2 ]; then export MOZ_ENABLE_WAYLAND=1 export XDG_SESSION_TYPE=wayland exec systemd-cat --identifier=gnome-session gnome diff --git a/.zshrc b/.zshrc index d6ef153..3f68aef 100644 --- a/.zshrc +++ b/.zshrc @@ -1,4 +1,10 @@ +# zmodload zsh/zprof +# autoload -U compinit && compinit +# zstyle ':omz:update' mode auto + [ ! -d ~/.oh-my-zsh ] && sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" + + ZSH_DISABLE_COMPFIX=true ZSH=$HOME/.oh-my-zsh ZSH_CACHE_DIR="$ZSH/cache" @@ -6,11 +12,10 @@ # necessary to include "/usr/share/zsh/"$(zsh --version| cut -d ' ' -f2)/functions" # due to a breakage on fedora zsh version 5.8.1 (zsh.x86_64 5.8.1-1.fc35 @updates) fpath=( - ~/.zfunc - ~/.local/share/zsh/site-functions - ${ASDF_DIR}/completions - /usr/share/zsh/"$(zsh --version| cut -d ' ' -f2)/functions" - $fpath + ~/.zfunc + ${ASDF_DIR}/completions + /usr/share/zsh/"$(zsh --version| cut -d ' ' -f2)/functions" + $fpath ) eval "$(sheldon source)" @@ -57,18 +62,27 @@ # keep backgroud processess at full speed setopt NOBGNICE - setopt inc_append_history - setopt extended_history -# Uncomment the following line if you want to change the command execution time -# stamp shown in the history command output. -# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" + # Uncomment the following line if you want to change the command execution time + # stamp shown in the history command output. + # The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" HIST_STAMPS="dd.mm.yyyy" + HISTSIZE=10000000 + SAVEHIST=10000000 + setopt inc_append_history + setopt extended_history # write the history file in the ":start:elapsed;command" format setopt share_history + setopt hist_expire_dups_first # expire duplicate entries first when trimming history setopt hist_ignore_dups setopt hist_ignore_all_dups setopt hist_save_no_dups setopt hist_ignore_space - HISTCONTROL=ignoredups:erasedups + setopt hist_reduce_blanks # remove superfluous blanks before recording entry + setopt hist_verify # don't execute immediately after expansion + # HISTCONTROL=ignoredups:erasedups + + # don't expand aliases _before_ completion has finished + # like: git comm-[tab] + # setopt complete_aliases # THIS HAS ISSUES # Would you like to use another custom folder than $ZSH/custom? # ZSH_CUSTOM=/path/to/new-custom-folder @@ -120,10 +134,19 @@ export FZF_DEFAULT_OPTS="--height=60% --inline-info --color=fg:#f8f8f2,bg:#282a36,hl:#bd93f9 --color=fg+:#f8f8f2,bg+:#44475a,hl+:#bd93f9 --color=info:#ffb86c,prompt:#50fa7b,pointer:#ff79c6 --color=marker:#ff79c6,spinner:#ffb86c,header:#6272a4" export FZF_CTRL_T_OPTS="--preview 'bat --style=numbers --color=always --line-range :200 {}'" - zvm_after_init_commands+=('[ -f /usr/share/fzf/shell/key-bindings.zsh ] && source /usr/share/fzf/shell/key-bindings.zsh') + # if [[ "$(hostnamectl hostname)" == "leo" ]]; then + if [[ "$(hostname -s)" == "leo" ]]; then + local fzf_bindings="/usr/share/fzf/key-bindings.zsh" + else + local fzf_bindings="/usr/share/fzf/shell/key-bindings.zsh" + fi + zvm_after_init_commands+=("[ -f $fzf_bindings ] && source $fzf_bindings") + unset fzf_bindings + # ZVM_INSERT_MODE_CURSOR=$ZVM_CURSOR_BLINKING_BLOCK # User configuration source ~/.dotenv + source ${XDG_RUNTIME_DIR}/secrets/envs source ~/.zsh/aliases.zsh source ~/.zsh/functions.zsh @@ -144,15 +167,17 @@ export VISUAL='vim' export SYSTEMD_EDITOR='vim --clean' export TERM='xterm-256color' + # export TERM='xterm-kitty' export GTK_IM_MODULE=ibus export QT_IM_MODULE=ibus export XMODIFIERS=@im=ibus # export ARCHFLAGS="-arch x86_64" - export kee="surtur" + export kee=${kee:-$(hostname -s)} SSH_KEY_PATH="$HOME/.ssh/$kee" eval $(TERM=xterm-kitty dircolors) + # pretend we're dockerd for rootless podman. export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/podman/podman.sock diff --git a/home-surtur.nix b/home-surtur.nix index d34e5cc..899b99e 100644 --- a/home-surtur.nix +++ b/home-surtur.nix @@ -139,9 +139,15 @@ in { }; # begin zsh-related. + ".zshrc" = { + source = ./.zshrc; + }; ".zshenv" = { source = ./.zshenv; }; + ".zprofile" = { + source = ./.zprofile; + }; ".zsh" = { source = ./.zsh; recursive = true;