[xmonad] darcs patch: XMonad.Core: make spawn smarter
spencerjanssen at gmail.com
Sat Sep 27 13:50:24 EDT 2008
On Sat, Sep 27, 2008 at 11:15:10AM -0400, Gwern Branwen wrote:
> On 2008.09.26 21:38:54 -0400, "Brandon S. Allbery KF8NH" <allbery at ece.cmu.edu> scribbled 0.9K characters:
> > On 2008 Sep 26, at 21:11, Devin Mullins wrote:
> >> On Fri, Sep 26, 2008 at 06:04:54PM -0400, Gwern Branwen wrote:
> >>> A user's shell when invoked as /bin/sh throws away a lot of their
> >>> customizations and addons; I wrote this patch for a user on #xmonad
> >>> who was perplexed why some of his scripts and other shell things were
> >>> simply Not Working.
> >> Hrm, that makes sense. If you're used to some particular bash-only
> >> syntax, you might expect it to work inside spawn.
> > Traditional Unix behavior is that something spawned programmatically
> > should use /bin/sh to get a consistent environment, while something
> > spawned via user interaction should use the user's $SHELL. Quite
> > possibly the core spawn should stay as is and the prompt one should use a
> > new $SHELL-based spawn (note that this can be done as a wrapper around
> > the existing spawn).
> > --
> > brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
> Sticking to hardcore traditional Unix behavior would be fine if we were unpleasant Dwm developers.
> We could be all 'ROFL n00b, don't u know if you don't want /bin/sh you should write your own keybinding which uses "spawnObscure"? Why would you think the default spawn would act smart and work with your existing setup?'
> Or, we could be friendly & helpful & make a simple 1 or 2 line change and never have to discuss it again. I don't see any real upside to the 'consistent environment' of /bin/sh; if anything, going through $SHELL is what would provide a 'consistent environment', since what the user is actually using and running in is $SHELL.
Here is a keybinding in defaultConfig:
spawn "exe=`dmenu_path | dmenu` && eval \"exec $exe\""
I'm not an expert, but I believe there are shells where this is incorrect
syntax. This is why it is important to have a consistent environment -- we
ought to be able to write spawn expressions in the core and contrib and expect
them to work everywhere.
This is how I propose we move forward:
* reject this patch to the core
* document the fact that XMonad.spawn uses /bin/sh
* add spawnShell (or some better name) to XMonad.Util.Run which executes its
argument in $SHELL.
Also, this insinuation that we hate our users is not fair, and certainly
doesn't further discussion in any meaningful way.
More information about the xmonad