dotfiles/fish/.config/fish/conf.d/setup.fish
Sanchayan Maity 8a7567a8b1 Start tmux sessions using systemd
While starting the tmux sessions from fish worked some environment
variables were not getting picked up in tmux session.

For example DISPLAY is set after we log in and the graphical sway
session starts but since tmux sessions were started before that it
would be absent from the tmux session. We may be wrong about the
exact order and reasoning for this but atleast that is the observed
behaviour.

Fix this by defining a sway session target and making the tmux session
service dependent on it.
2022-04-04 18:07:50 +05:30

74 lines
2.5 KiB
Fish

function __fish_setup_on_tty_login --description "Set up environment on tty login"
set -qx XDG_CONFIG_HOME; or set -Ux XDG_CONFIG_HOME $HOME/.config
set -qx XDG_CACHE_HOME; or set -Ux XDG_CACHE_HOME $HOME/.cache
set -qx XDG_DATA_HOME; or set -Ux XDG_DATA_HOME $HOME/.local/share
set -qx XDG_STATE_HOME; or set -Ux XDG_STATE_HOME $HOME/.local/state
set -qx SSH_AUTH_SOCK; or set -Ux SSH_AUTH_SOCK $XDG_RUNTIME_DIR/ssh-agent.socket
# Wayland session
set -qx XDG_SESSION_TYPE; or set -Ux XDG_SESSION_TYPE wayland
set -qx XDG_SESSION_DESKTOP; or set -Ux XDG_SESSION_DESKTOP wayland
set -qx XDG_CURRENT_DESKTOP; or set -Ux XDG_CURRENT_DESKTOP wayland
# Firefox
set -qx MOZ_ENABLE_WAYLAND; or set -Ux MOZ_ENABLE_WAYLAND 1
set -qx MOZ_DBUS_REMOTE; or set -Ux MOZ_DBUS_REMOTE 1
# QT
set -qx QT_QPA_PLATFORM; or set -Ux QT_QPA_PLATFORM wayland
set -qx QT_QPA_PLATFORMTHEME; or set -Ux QT_QPA_PLATFORMTHEME qt5ct
for extra_path in ~/.{local,nix-profile,cargo,cabal,ghcup}/bin
if test -d "$extra_path"
set -gxp PATH "$extra_path"
end
end
if type -qf nvim
set -gx EDITOR nvim
set -gx VISUAL nvim
set -gx MANPAGER 'nvim +Man!'
else
if type -qf vim
set -gx EDITOR vim
set -gx VISUAL vim
end
end
if test -d {$HOME}/.nix-defexpr/channels
set -gx NIX_PATH {$HOME}/.nix-defexpr/channels
set -gx NIX_SSL_CERT_FILE '/etc/ssl/certs/ca-certificates.crt'
end
if test -d /var/lib/flatpak
# https://github.com/fish-shell/fish-shell/issues/7485#issuecomment-728984689
# https://wiki.archlinux.org/title/Flatpak#Adding_Flatpak_.desktop_files_to_your_menu
set -l xdg_data_home $XDG_DATA_HOME ~/.local/share
set -gx --path XDG_DATA_DIRS $xdg_data_home[1]/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share
for flatpakdir in ~/.local/share/flatpak/exports/bin /var/lib/flatpak/exports/bin
if test -d $flatpakdir
contains $flatpakdir $PATH; or set -a PATH $flatpakdir
end
end
end
if type -qf fnm
fnm env --shell=fish --log-level=quiet | source
end
set -gx CLICOLOR 1
set -gx LSCOLORS 'gxfxcxdxbxegedabaggxgx'
set -Ux GST_DEBUG_NO_COLOR 1
set -Ux GST_DEBUG_COLOR_MODE "off"
mkdir -p /tmp/gst-dot
set -Ux GST_DEBUG_DUMP_DOT_DIR /tmp/gst-dot
end
# Instead of tty check, we would have liked to do this using status is-login
# check but for some reason that does not work?
set --local TTY1 (tty)
[ "$TTY1" = "/dev/tty1" ] && __fish_setup_on_tty_login