diff options
author | tv <tv@krebsco.de> | 2022-12-09 04:42:09 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2022-12-09 04:42:48 +0100 |
commit | be9274b6c2b213c376bf9f0efeefb6275d0224fd (patch) | |
tree | e6c1c720752abbd2b8e780b84abb7b5167b3f0ba /tv/2configs/bash | |
parent | c82942bb7b872765d109d5cc5fccec5f945f1200 (diff) |
tv: XMONAD_SPAWN_WORKSPACE → _CURRENT_DESKTOP_NAME
Diffstat (limited to 'tv/2configs/bash')
-rw-r--r-- | tv/2configs/bash/default.nix | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tv/2configs/bash/default.nix b/tv/2configs/bash/default.nix index c0855bb..e38566b 100644 --- a/tv/2configs/bash/default.nix +++ b/tv/2configs/bash/default.nix @@ -14,8 +14,20 @@ with import ./lib; case $UID in ${shell.escape (toString config.krebs.users.tv.uid)}) - if test ''${SHLVL-1} = 1; then - case ''${XMONAD_SPAWN_WORKSPACE-} in + if test ''${SHLVL-1} = 1 && test -n "''${DISPLAY-}"; then + _CURRENT_DESKTOP_NAME=''${_CURRENT_DESKTOP_NAME-$( + ${pkgs.xorg.xprop}/bin/xprop -notype -root \ + 32i _NET_CURRENT_DESKTOP \ + 8s _NET_DESKTOP_NAMES \ + | + ${pkgs.gnused}/bin/sed -r 's/.* = //;s/"//g;s/, /\a/g' | + { + read -r _NET_CURRENT_DESKTOP + IFS=$'\a' read -ra _NET_DESKTOP_NAMES + echo "''${_NET_DESKTOP_NAMES[$_NET_CURRENT_DESKTOP]}" + } + )} + case $_CURRENT_DESKTOP_NAME in stockholm) cd ~/stockholm ;; |