Re: [dev] [dwm] [PATCH] spawn_cwd - spawn from current client's cwd

2011-11-25 Thread Troels Henriksen
Suraj N. Kurapati sun...@gmail.com writes:

 On Thu 24 Nov 2011 05:12:17 PM PST, Stephen Paul Weber wrote:
 Somebody signing messages as Suraj N. Kurapati wrote:
 the ability to open new programs in the currently focused client's
 workdir.  https://github.com/sunaku/.dwm/compare/tip...spawn_cwd
 
 Does this patch just work on xterm/rxvt windows that happen to have
 their CWD path in the title?

 Not just; it works for *any* window that has a file path in its title.

Alternative/additional idea: look for the process indicated by the
_NET_WM_PID property, then use the working directory of that process.

-- 
\  Troels
/\ Henriksen



Re: [dev] [dwm] [PATCH] spawn_cwd - spawn from current client's cwd

2011-11-25 Thread Kurt Van Dijck
On Fri, Nov 25, 2011 at 09:54:44AM +0100, Troels Henriksen wrote:
 Suraj N. Kurapati sun...@gmail.com writes:
 
  On Thu 24 Nov 2011 05:12:17 PM PST, Stephen Paul Weber wrote:
  Somebody signing messages as Suraj N. Kurapati wrote:
  the ability to open new programs in the currently focused client's
  workdir.  https://github.com/sunaku/.dwm/compare/tip...spawn_cwd
  
  Does this patch just work on xterm/rxvt windows that happen to have
  their CWD path in the title?
 
  Not just; it works for *any* window that has a file path in its title.
 
 Alternative/additional idea: look for the process indicated by the
 _NET_WM_PID property, then use the working directory of that process.

I don't understand the feature.
I appears to assume that all clients run on the same host?

Kurt



Re: [dev] [dwm] [PATCH] spawn_cwd - spawn from current client's cwd

2011-11-25 Thread Troels Henriksen
Kurt Van Dijck kurt.van.di...@eia.be writes:

 On Fri, Nov 25, 2011 at 09:54:44AM +0100, Troels Henriksen wrote:
 Suraj N. Kurapati sun...@gmail.com writes:
 
  On Thu 24 Nov 2011 05:12:17 PM PST, Stephen Paul Weber wrote:
  Somebody signing messages as Suraj N. Kurapati wrote:
  the ability to open new programs in the currently focused client's
  workdir.  https://github.com/sunaku/.dwm/compare/tip...spawn_cwd
  
  Does this patch just work on xterm/rxvt windows that happen to have
  their CWD path in the title?
 
  Not just; it works for *any* window that has a file path in its title.
 
 Alternative/additional idea: look for the process indicated by the
 _NET_WM_PID property, then use the working directory of that process.

 I don't understand the feature.
 I appears to assume that all clients run on the same host?

Yes, which is not guaranteed, but often the case.

-- 
\  Troels
/\ Henriksen



Re: [dev] [dwm] [PATCH] spawn_cwd - spawn from current client's cwd

2011-11-25 Thread Bastien Dejean
Troels Henriksen a écrit :

 Alternative/additional idea: look for the process indicated by the
 _NET_WM_PID property, then use the working directory of that process.

It seems the value of _NET_WM_PID is not always useful:
For urxvtc clients, it is equal to the pid of urxvtd.

-- 
Bastien



Re: [dev] [dwm] [PATCH] spawn_cwd - spawn from current client's cwd

2011-11-25 Thread Suraj N. Kurapati
On Fri 25 Nov 2011 01:00:58 PM PST, Bastien Dejean wrote:
 Troels Henriksen a écrit :

  look for the process indicated by the _NET_WM_PID property, then
  use the working directory of that process.

 It seems the value of _NET_WM_PID is not always useful: For urxvtc
 clients, it is equal to the pid of urxvtd.

Indeed, I already tried that approach[1] and found that it becomes
too complex (need to walk process tree) before patching DWM itself.

[1]: https://github.com/sunaku/home/blob/master/bin/xcd

-- 
Hackers are just a migratory lifeform with a tropism for computers.


signature.asc
Description: PGP signature


Re: [dev] [dwm] [PATCH] spawn_cwd - spawn from current client's cwd

2011-11-25 Thread Suraj N. Kurapati
On Fri 25 Nov 2011 10:11:35 AM PST, Kurt Van Dijck wrote:
 Suraj N. Kurapati wrote:
 the ability to open new programs in the currently focused
 client's workdir.
 https://github.com/sunaku/.dwm/compare/tip...spawn_cwd

 I don't understand the feature.

It's all about spatial locality.  When I'm editing some code in Vim,
I like to launch some new terminals (or file managers) in the same
working directory as the file I'm editing to do additional things.

Without this feature, I have to *manually* navigate to that working
directory in the helper application (terminal or file manager) that
I launched.  This becomes tiresome and inefficient as time goes on.

 I appears to assume that all clients run on the same host?

Yes, and that's good enough for me.  However, in the case that the
remote client's title contains a path that also exists on the local
machine (perhaps network mounted on both local  remote machines)
then your newly launched program will start in your local directory.

-- 
On the eighth day, God created FORTRAN.


signature.asc
Description: PGP signature


Re: [dev] [dwm] [PATCH] spawn_cwd - spawn from current client's cwd

2011-11-25 Thread Connor Lane Smith
On 25 November 2011 20:39, Suraj N. Kurapati sun...@gmail.com wrote:
 Yes, and that's good enough for me.  However, in the case that the
 remote client's title contains a path that also exists on the local
 machine (perhaps network mounted on both local  remote machines)
 then your newly launched program will start in your local directory.

There is the WM_CLIENT_MACHINE property, if need be.

It would be nice if there were a more definitive way of doing this,
but I can't think of one.

cls



Re: [dev] [dwm] [PATCH] spawn_cwd - spawn from current client's cwd

2011-11-25 Thread Julian Dammann
 It's all about spatial locality.  When I'm editing some code in Vim,
 I like to launch some new terminals (or file managers) in the same
 working directory as the file I'm editing to do additional things.

Ever tried :!your_terminal  in vim? Maybe that's good enough for you if 
bound to some key.



Re: [dev] [dwm] [PATCH] spawn_cwd - spawn from current client's cwd

2011-11-25 Thread Suraj N. Kurapati
On Fri 25 Nov 2011 10:42:31 PM PST, Julian Dammann wrote:
  It's all about spatial locality.  When I'm editing some code in Vim,
  I like to launch some new terminals (or file managers) in the same
  working directory as the file I'm editing to do additional things.
 
 Ever tried :!your_terminal  in vim? Maybe that's good enough for
 you if bound to some key.
 
Thanks for the suggestion, but it's not as pleasant as being able to
press my app launching shortcut keys (for urxvt, thunar, gvim) in DWM
on any selected window and have those apps launched in its working dir.

This patch affects DWM's program menu (dmenu_run) too, for more power.

-- 
Certainly the game is rigged.

Don't let that stop you; if you don't bet, you can't win.
-- Robert Heinlein, Time Enough For Love


signature.asc
Description: PGP signature


Re: [dev] [dwm] [PATCH] spawn_cwd - spawn from current client's cwd

2011-11-25 Thread Patrick Haller
On 2011-11-25 22:42, Julian Dammann wrote:
  It's all about spatial locality.
 Ever tried :!your_terminal  in vim? Maybe that's good enough for you if 
 bound to some key.

autocmd BufEnter * cd %:p:h
for when you use multiple buffers in vim.



Re: [dev] [dwm] [PATCH] spawn_cwd - spawn from current client's cwd

2011-11-25 Thread Suraj N. Kurapati
On Sat 26 Nov 2011 08:28:26 AM PST, Patrick Haller wrote:
 autocmd BufEnter * cd %:p:h
 for when you use multiple buffers in vim.

set autochdir

-- 
Bus error -- please leave by the rear door.


signature.asc
Description: PGP signature


[dev] [dwm] [PATCH] spawn_cwd - spawn from current client's cwd

2011-11-24 Thread Suraj N. Kurapati
Hello,

I switched[1] to DWM from WMII recently (after 6 long years, yay!) and
one of the things I missed from my previous WMII configuration was the
ability to open new programs in the currently focused client's workdir.

So I ported this feature to DWM using just 27 SLOC in this[2] patch,
which I now humbly submit for expert review by the suckless community.

Thanks for your consideration.

[1]: https://bbs.archlinux.org/viewtopic.php?pid=1019589#p1019589
[2]: https://github.com/sunaku/.dwm/compare/tip...spawn_cwd

-- 
You can always pick up your needle and move to another groove.
-- Tim Leary


signature.asc
Description: PGP signature


Re: [dev] [dwm] [PATCH] spawn_cwd - spawn from current client's cwd

2011-11-24 Thread Stephen Paul Weber

Somebody signing messages as Suraj N. Kurapati wrote:

one of the things I missed from my previous WMII configuration was the
ability to open new programs in the currently focused client's workdir.

So I ported this feature to DWM using just 27 SLOC in this[2] patch,

[2]: https://github.com/sunaku/.dwm/compare/tip...spawn_cwd


Does this patch just work on xterm/rxvt windows that happen to have their 
CWD path in the title?


--
Stephen Paul Weber, @singpolyma
See http://singpolyma.net for how I prefer to be contacted
edition right joseph


signature.asc
Description: Digital signature