diff --git a/README.md b/README.md index 2624105..0081163 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,8 @@ To get started, clone this repo and link the relevant files/directories ```shell -git clone https://github.com/frebib/dotfiles.git ~/.config/dotfiles -ln -sfv .config/dotfiles/* .config/ -ln -sfv .config/dotfiles/profile .zprofile +git clone https://github.com/frebib/dotfiles.git ~/.config +ln -sfv .config/zsh/.zshenv ~ +# if it is not already "enabled", make sure the systemd-environment.d generator is active +sudo ln -sfv /lib/systemd/user-environment-generators/30-systemd-environment-d-generator /lib/systemd/user-generators/ ``` diff --git a/environment.d/10-profile.conf b/environment.d/10-profile.conf new file mode 100644 index 0000000..5651d37 --- /dev/null +++ b/environment.d/10-profile.conf @@ -0,0 +1,34 @@ +LC_ALL="en_GB.UTF-8" +LANG="en_GB.UTF-8" +LC_NUMERIC="en_GB" + +XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}" +XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}" +XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}" + +EDITOR="vim" +VISUAL="vim" + +# Override paths for non-compliant programs +# https://wiki.archlinux.org/index.php/XDG_Base_Directory_support + +ADOTDIR="$XDG_DATA_HOME/zsh/antigen" +CARGO_HOME="$XDG_DATA_HOME/cargo" +GNUPGHOME="$XDG_CONFIG_HOME/gnupg" +GOPATH="$XDG_DATA_HOME/go" +NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc" +#PASSWORD_STORE_DIR="$XDG_DATA_HOME/pass" +PYTHONHISTFILE="$XDG_DATA_HOME/python/histfile" +RUSTUP_HOME="$XDG_DATA_HOME/rustup" +TERMINFO="$XDG_DATA_HOME/terminfo" +TERMINFO_DIRS="$XDG_DATA_HOME/terminfo:/usr/share/terminfo" +VIMDIR="$XDG_CONFIG_HOME/vim" +VIMRC="$VIMDIR/vimrc" +VIMINIT=":so $VIMRC" +WEECHAT_HOME="$XDG_CONFIG_HOME/weechat" +XINITRC="$XDG_CONFIG_HOME/X11/xinitrc" +ZDOTDIR="$XDG_CONFIG_HOME/zsh" + +PATH="${PATH}:/sbin:/usr/sbin:${XDG_CONFIG_HOME}/scripts:${GOPATH}/bin" + +# vim: ft=sh diff --git a/profile b/profile deleted file mode 100644 index 0e3673f..0000000 --- a/profile +++ /dev/null @@ -1,56 +0,0 @@ -export LC_ALL=en_GB.UTF-8 -export LANG=en_GB.UTF-8 -export LC_NUMERIC=en_GB - -export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}" -export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}" -export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}" -export XDG_LOCAL_HOME="$HOME/.local" - -mkdir -p "$XDG_CONFIG_HOME" "$XDG_CACHE_HOME" "$XDG_DATA_HOME" "$XDG_LOCAL_HOME" - -case "$(basename "$(readlink -f /proc/$$/exe)")" in - zsh) thisfile="$(readlink -f "${(%):-%N}")";; - bash) thisfile="$(readlink -f "${BASH_SOURCE[0]}")";; - *) thisfile="$(find /proc/$$/fd/ | xargs -n1 -r readlink -f | grep profile | head -n1)";; -esac - -export EDITOR="vim" -export VISUAL="vim" - -# Override paths for non-compliant programs -# https://wiki.archlinux.org/index.php/XDG_Base_Directory_support - -export ADOTDIR="$XDG_DATA_HOME/zsh/antigen" -export CARGO_HOME="$XDG_DATA_HOME/cargo" -export GNUPGHOME="$XDG_CONFIG_HOME/gnupg" -export GOPATH="$XDG_DATA_HOME/go" -export NPM_CONFIG_USERCONFIG=$XDG_CONFIG_HOME/npm/npmrc -export PASSWORD_STORE_DIR="$XDG_DATA_HOME/pass" -export PYTHONHISTFILE="$XDG_DATA_HOME/python/histfile" -export RUSTUP_HOME="$XDG_DATA_HOME/rustup" -export TERMINFO="$XDG_DATA_HOME/terminfo" -export TERMINFO_DIRS="$XDG_DATA_HOME/terminfo:/usr/share/terminfo" -export VIMDIR="$XDG_CONFIG_HOME/vim" -export VIMRC="$VIMDIR/vimrc" -export VIMINIT=":so $VIMRC" -export WEECHAT_HOME="$XDG_CONFIG_HOME/weechat" -export XINITRC="$XDG_CONFIG_HOME/X11/xinitrc" -export ZDOTDIR="$XDG_CONFIG_HOME/zsh" - -export DOTFILES="$(dirname "${thisfile:-$XDG_CONFIG_HOME/dotfiles/.profile}")" -export PATH="${PATH}:/sbin:/usr/sbin:$DOTFILES/scripts:$GOPATH/bin" - -exists() { which $@ 0<&- 1>/dev/null 2>/dev/null; } - -if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && exists dbus-launch; then - eval $(dbus-launch --sh-syntax --exit-with-session) -fi - -# Execute this after updating dbus/systemd environment -# Source secret keys and values into environment -if [ -f "$XDG_CONFIG_HOME/secrets" ]; then - set -o allexport - source $XDG_CONFIG_HOME/secrets - set +o allexport -fi diff --git a/systemd/user/basic.target.wants/profile.service b/systemd/user/basic.target.wants/profile.service deleted file mode 120000 index a975817..0000000 --- a/systemd/user/basic.target.wants/profile.service +++ /dev/null @@ -1 +0,0 @@ -/home/frebib/.config/systemd/user/profile.service \ No newline at end of file diff --git a/systemd/user/i3.service b/systemd/user/i3.service index f22f18b..e0150be 100644 --- a/systemd/user/i3.service +++ b/systemd/user/i3.service @@ -2,7 +2,7 @@ Description=i3 - an improved dynamic, tiling window manager Requires=xorg.target Before=graphical-session.target -After=profile.service xprofile.service xorg.target +After=xprofile.service xorg.target [Service] ExecStart=/usr/bin/i3 diff --git a/systemd/user/profile.service b/systemd/user/profile.service deleted file mode 100644 index 22b8e82..0000000 --- a/systemd/user/profile.service +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=Load profile environment into session -Before=graphical-session-pre.target - -[Service] -Type=oneshot -ExecStart=/bin/sh -c '. $HOME/.config/dotfiles/profile && systemctl --user import-environment' - -[Install] -WantedBy=basic.target diff --git a/systemd/user/xbindkeys.service b/systemd/user/xbindkeys.service index ef3b4c7..cf778b1 100644 --- a/systemd/user/xbindkeys.service +++ b/systemd/user/xbindkeys.service @@ -1,7 +1,5 @@ [Unit] Description=XBindKeys -Requires=profile.service -After=profile.service [Service] ExecStart=/usr/bin/xbindkeys -n -f $XDG_CONFIG_HOME/X11/xbindkeysrc diff --git a/systemd/user/xprofile.service b/systemd/user/xprofile.service index 63eaf40..ea01ed0 100644 --- a/systemd/user/xprofile.service +++ b/systemd/user/xprofile.service @@ -1,13 +1,12 @@ [Unit] Description=Load Xorg configuration PartOf=xorg.target -Requires=profile.service -After=xorg.target profile.service +After=xorg.target [Service] Type=oneshot RemainAfterExit=yes -ExecStart=/usr/bin/bash -c '. $XDG_CONFIG_HOME/X11/xprofile; systemctl --user import-environment' +ExecStart=/bin/sh -c '. $XDG_CONFIG_HOME/X11/xprofile; systemctl --user import-environment' [Install] WantedBy=xorg.target diff --git a/systemd/user/xsettingsd.service b/systemd/user/xsettingsd.service index a547e88..bfc91b3 100644 --- a/systemd/user/xsettingsd.service +++ b/systemd/user/xsettingsd.service @@ -1,7 +1,7 @@ [Unit] Description=xsettingsd - provide settings to X11 applications Requires=xorg.target -After=xorg.target profile.service +After=xorg.target [Service] ExecStart=/bin/sh -c 'xsettingsd -c $XDG_CONFIG_HOME/xsettingsd/xsettingsd.local' diff --git a/zsh/.gitignore b/zsh/.gitignore index 3faf4dd..5e1c288 100644 --- a/zsh/.gitignore +++ b/zsh/.gitignore @@ -1,4 +1 @@ -/antigen/ -/log/ -/histfile /.zcompdump* diff --git a/zsh/.zshenv b/zsh/.zshenv new file mode 100644 index 0000000..cdffe65 --- /dev/null +++ b/zsh/.zshenv @@ -0,0 +1,5 @@ +set -o allexport +. ~/.config/environment.d/*.conf +set +o allexport + +# vim: ft=sh diff --git a/zsh/.zshrc b/zsh/.zshrc index 2032a7e..cccd269 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -149,7 +149,7 @@ ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]='fg=cyan' ZSH_HIGHLIGHT_STYLES[assign]='fg=green' ZSH_HIGHLIGHT_STYLES[redirection]='fg=cyan,bold' -source "$DOTFILES/aliases" +source "$XDG_CONFIG_HOME/aliases" # Source secret keys and values into environment if [ -f "$XDG_CONFIG_HOME/secrets" ]; then