[dev] tabbed: Use PWD xprop to set workdir for spawned clients. Any clear cons?

From: Nikita Zlobin <nick87720z_AT_gmail.com>
Date: Fri, 2 Jul 2021 01:16:41 +0500

I use tabbed for multitab terminal emulator. But I lacked one feature,
presenting in at least some vte-based terminals: when new tab is
opened, it inherits workdir from previous active tab.

I tried to find, it same could be implemented with tabbed. I found
following solution, which would work independently of what exact
underlying terminal is used to be spawned. When spawning new tab, tabbed
checks for certain X property, where workdir is written (obviously, by
client itself). If found, then it uses this path as workdir for new
client. This seems simplest possible way for me. Since shells
(including dash, let alone bash) set PWD env var, containing current
workdir, I decided to use this name for new X prop too.

And to adapt unprepared terminals - appended snippet to ~/.bashrc:

workdir_to_xprop() {
  [ -v WINDOWID ] && \
  xprop -id "${WINDOWID}" -f PWD 8s -set "PWD" "${PWD}"
}

cd() {
  builtin cd "$_AT_" || return
  [ "$OLDPWD" = "$PWD" ] || {
      workdir_to_xprop
  }
}

workdir_to_xprop

(can't be sure, how correct it is, but usually it works, as even path
change from midnight commander is counted in this way too).

I tried to submit it to hackers ML for simple reason: this list is
described to be for patches, directed to upstream. As for my patches
(there were more patches, mostly with fixes) - I targeted them for
upstream, so sending them there was logical. Too bad - sending patches
in the way it's required was first ever time, so I wasted couple of
attempts, while finally sent them in most correct way (not sure if I
can do it again). Looks like, whoever checks this got tired from all of
this.

I hoped, in case if any deficiencies, get resonable arguments why. But
I got no replies besides two:
- one is argumentless -1 against this very feature: some claimed they
  don't use it, despite I have at least 1 example where it presents;
- second is simply that if has to go to dev
  (well, finally I got reason to subscribe here, but not for this yet).

https://lists.suckless.org/hackers/2006/17451.html

Main question is in topic.
I don't ask about pros, which are just obvious for me :)
There could be more of them, but for now I'm too lost to even
formulate something more specific. Did not expect such attitude, looks
like as if you have to deserve to even be replied. Or could be that
hackers only react if you proposal affects what's in their current
coding focus (yet another wild guess).
Received on Thu Jul 01 2021 - 22:16:41 CEST

This archive was generated by hypermail 2.3.0 : Thu Jul 01 2021 - 22:24:07 CEST