Hyprland version
Hyprland 0.51.1 built from branch at commit 71a1216abcc7031776630a6d88f105605c4dc1c9 ([gha] Nix: update inputs).
Date: Mon Sep 22 20:54:03 2025
Tag: v0.51.1, commits: 6436
built against:
aquamarine 0.9.5
hyprlang 0.6.3
hyprutils 0.10.0
hyprcursor 0.1.13
hyprgraphics 0.2.0
no flags were set
Describe your issue / feature…
How do I define a key bind for exec that passes the active window’s current working directory in the command? I’m trying to use $PWD to do it, but none of my attempts work.
I’m running Arch, using uwsm/systemd setup.
Specifically I’m trying to launch yazi via key bind (but in this case, I want to be specific regarding the location.) I can launch yazi just fine if I don’t care about the starting location; I got another key bind for that, looks like this:
bind = $mainMod, E, exec, uwsm app –- $terminal -e $fileManager
(I’m using ghostty for terminal.)
In theory I just need to pass the location to yazi (the fileManager) when I run it, to tell it the starting location i.e.:
yazi ~/Applications or yazi ${PWD} or (if PWD were home dir) yazi ${PWD}/Applications …all valid commands.
So I tried this (and various attempts of the same idea, like using ghostty’s –-comand= instead of -e .):
uwsm app –- $terminal -e $fileManager “${PWD}”
Many of my tried commands worked if I run them from the terminal, but not when executed via the bind. It seems that maybe for some reason $PWD is always my home dir, when using the key bind? If I do this, it starts correctly at the ~/Applications dir:
uwsm app –- $terminal -e $fileManager ‘${PWD}/Applications’
Or, if I do this command:
uwsm app –- $terminal --command=“printf ${PWD}; read -n 1”
I get my home dir.
So I think it’s all technically working, just that PWD value is always home dir. So I guess the real question would then be how do I get the active window’s current working directory so I can pass it that path, in the key bind definition? I feel like it should be pretty simple and I’m just missing something. Anyone can help? Thanks