Re: Blanking the tmux window.

2010-07-31 Thread Nicholas Marriott
Committed with some tweaks, thanks.

Are you sure read -n is sh and not bash? I've just said bash for now.


On Fri, Jul 30, 2010 at 09:19:10AM +0100, Thomas Adam wrote:
> On Fri, Jul 30, 2010 at 08:18:47AM +0100, Nicholas Marriott wrote:
> > You could write an FAQ entry if you like :-).
> 
> Something like the diff attached?  ;)
> 
> -- Thomas Adam



--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
___
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users


Re: Blanking the tmux window.

2010-07-30 Thread Thomas Adam
On Fri, Jul 30, 2010 at 08:18:47AM +0100, Nicholas Marriott wrote:
> You could write an FAQ entry if you like :-).

Something like the diff attached?  ;)

-- Thomas Adam
? blank
? foo.patch
? lock-clients.patch
? lock-nm.patch
? multi-colour-statusbar2.patch
? tmux-blank-window-faq.patch
? tmux-no-fork.patch
Index: FAQ
===
RCS file: /cvsroot/tmux/tmux/FAQ,v
retrieving revision 1.36
diff -u -r1.36 FAQ
--- FAQ	4 Feb 2010 21:01:59 -	1.36
+++ FAQ	30 Jul 2010 08:19:57 -
@@ -239,4 +239,23 @@
 
 Note that this will only work in tmux 1.2 and above.
 
+* How can I blank the tmux window?
+
+GNU Screen has a feature whereby it will blank the screen after a period of
+inactivity.  Tmux can do the same thing by using the lock-command setting:
+
+set -g lock-command 'tput civis && read -s -n1'
+
+Which will remove the cursor, and tell the shell to quit once a key has been
+pressed.
+
+In addition, it's possible to have both blanking by default, and locking in
+the usual way (via lock(1) or vlock(1) for instance) by using the following:
+
+bind x set lock-command '/usr/bin/vlock' \; lock-client \; set lock-command 'tput civis && read -s -n1'
+
+Note that the read builtin above is Bourne-specific.  Zsh users will have to use:
+
+read -s -k 1
+
 $Id: FAQ,v 1.36 2010/02/04 21:01:59 nicm Exp $
--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm___
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users


Re: Blanking the tmux window.

2010-07-30 Thread Nicholas Marriott
You could write an FAQ entry if you like :-).


On Fri, Jul 30, 2010 at 06:24:21AM +0100, Thomas Adam wrote:
> Hi,
> 
> Someone in #tmux was asking about how to blank the tmux window after a
> timeout -- a feature apparently which GNU Screen has.  Here's how I do it,
> in case anyone else is interested:
> 
> set -g lock-server off
> set -g lock-after-time 1800
> set -g lock-command 'tput civis && read -s -n1'
> 
> Thankfully, any lock-command is ran directly through system() so I can
> literally put shell commands here, and have /bin/sh run them.
> 
> This works quite nicely, but what if you wanted to have this feature *and*
> still be able to lock the client manually?
> 
> bind x set lock-command '/usr/bin/vlock' \; lock-client \; set lock-command 
> 'tput civis && read -s -n1'
> 
> (That should all be on one line.)
> 
> Hope it's useful.  :)
> 
> -- Thomas Adam
> 
> -- 
> "Deep in my heart I wish I was wrong.  But deep in my heart I know I am
> not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.)
> 
> --
> The Palm PDK Hot Apps Program offers developers who use the
> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
> of $1 Million in cash or HP Products. Visit us here for more details:
> http://p.sf.net/sfu/dev2dev-palm
> ___
> tmux-users mailing list
> tmux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tmux-users

--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
___
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users


Blanking the tmux window.

2010-07-29 Thread Thomas Adam
Hi,

Someone in #tmux was asking about how to blank the tmux window after a
timeout -- a feature apparently which GNU Screen has.  Here's how I do it,
in case anyone else is interested:

set -g lock-server off
set -g lock-after-time 1800
set -g lock-command 'tput civis && read -s -n1'

Thankfully, any lock-command is ran directly through system() so I can
literally put shell commands here, and have /bin/sh run them.

This works quite nicely, but what if you wanted to have this feature *and*
still be able to lock the client manually?

bind x set lock-command '/usr/bin/vlock' \; lock-client \; set lock-command 
'tput civis && read -s -n1'

(That should all be on one line.)

Hope it's useful.  :)

-- Thomas Adam

-- 
"Deep in my heart I wish I was wrong.  But deep in my heart I know I am
not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.)

--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
___
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users