summaryrefslogtreecommitdiffstats
path: root/tv/2configs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2022-12-09 04:42:09 +0100
committertv <tv@krebsco.de>2022-12-09 04:42:48 +0100
commit3a0d3fed99265617503236e573733cb5c27e7139 (patch)
tree7968bb163f315dc6930c6e868a5fd965e2e5d3d5 /tv/2configs
parent3220cc238afcf393278d85a2a849a0926adbc3d1 (diff)
tv: XMONAD_SPAWN_WORKSPACE → _CURRENT_DESKTOP_NAME
Diffstat (limited to 'tv/2configs')
-rw-r--r--tv/2configs/bash/default.nix16
-rw-r--r--tv/2configs/default.nix2
2 files changed, 15 insertions, 3 deletions
diff --git a/tv/2configs/bash/default.nix b/tv/2configs/bash/default.nix
index c0855bb26..e38566b78 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
;;
diff --git a/tv/2configs/default.nix b/tv/2configs/default.nix
index 5710f28f4..9babb92c2 100644
--- a/tv/2configs/default.nix
+++ b/tv/2configs/default.nix
@@ -37,7 +37,7 @@ with import ./lib;
{
i18n.defaultLocale = mkDefault "C.UTF-8";
security.sudo.extraConfig = ''
- Defaults env_keep+="SSH_CLIENT XMONAD_SPAWN_WORKSPACE"
+ Defaults env_keep+="SSH_CLIENT _CURRENT_DESKTOP_NAME"
Defaults mailto="${config.krebs.users.tv.mail}"
Defaults !lecture
'';