summaryrefslogtreecommitdiff
path: root/user/zsh/zshrc-graphical.sh
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2024-12-12 08:14:18 +0100
committerMartin Fischer <martin@push-f.com>2024-12-12 08:14:18 +0100
commitd17efc051d99e27abd44655acaf508e360c41bac (patch)
treef83607c9378403270c9aca1f682a06cec7bb741b /user/zsh/zshrc-graphical.sh
parent2cac94f9c3aa9797a8b86921cb01c96eee013a7f (diff)
refactor: move part-specifics out of .zshrc
Diffstat (limited to 'user/zsh/zshrc-graphical.sh')
-rw-r--r--user/zsh/zshrc-graphical.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/user/zsh/zshrc-graphical.sh b/user/zsh/zshrc-graphical.sh
new file mode 100644
index 0000000..d60c15a
--- /dev/null
+++ b/user/zsh/zshrc-graphical.sh
@@ -0,0 +1,16 @@
+# This file is sourced by .zshrc if parts/graphical.nix was imported.
+
+if [ $TERM = foot ]; then
+ # Enable spawning of new terminal instances in the current working directory
+ function osc7-pwd() {
+ emulate -L zsh # also sets localoptions for us
+ setopt extendedglob
+ local LC_ALL=C
+ printf '\e]7;file://%s%s\e\' $HOST ${PWD//(#m)([^@-Za-z&-;_~])/%${(l:2::0:)$(([##16]#MATCH))}}
+ }
+
+ function chpwd-osc7-pwd() {
+ (( ZSH_SUBSHELL )) || osc7-pwd
+ }
+ add-zsh-hook -Uz chpwd chpwd-osc7-pwd
+fi