how to switch session as X window workspace?

View: New views
9 Messages — Rating Filter:   Alert me  

how to switch session as X window workspace?

by CHEN Cheng-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi folks,

Is it possible to switch between sessions by pressing
Ctrl-Alt-Left or Ctrl-Alt-Right, like what we do in
Gnome (or KDE)?

Because I think it's safer to seperate root's windows
from a normal user's windows, which can also be done by
running multiple instances of putty or gnome-terminal,
but with less convenience.

I've googled a lot with no luck.


Thanks in advance,
Cheng



_______________________________________________
screen-users mailing list
screen-users@...
http://lists.gnu.org/mailman/listinfo/screen-users

Re: how to switch session as X window workspace?

by Gerald Young :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thursday 24 September 2009 04:40:25 CHEN Cheng wrote:
> Hi folks,
>
> Is it possible to switch between sessions by pressing
> Ctrl-Alt-Left or Ctrl-Alt-Right, like what we do in
> Gnome (or KDE)?

Hi Cheng,

To use multiple screen sessions, I run a main screen session that inside
contains windows running other screen sessions.

For example:
* main session
   - window 1: misc session
   - window 2: coding session
   - window 3: ssh session

And then each nested session has their own set of windows:
* misc session
   - window 1: bash
   - window 2: etc
* coding session
   - window 1: vim file1
   - window 2: make
* ssh session
   - window 1: ssh server1
   - window 2: ssh server2

The main session has Ctrl+S as the screen command key (instead of Ctrl+A).  
That way I control either the main session or any of the other sessions by
using Ctrl+S or Ctrl+A respectively. The "Ctrl+S 1" sequence would take me to
the misc session, for example.

I run the main session with something like:
screen -e ^Ss -S main_session

And on the shell that pops up I run my other sessions (each on their own
window):
screen -t misc_session screen -mS misc_session
screen -t coding_session screen -mS coding_session
screen -t ssh_session screen -mS ssh_session

Hope this helps,
Gerald Young


_______________________________________________
screen-users mailing list
screen-users@...
http://lists.gnu.org/mailman/listinfo/screen-users

Re: how to switch session as X window workspace?

by Yuki (aka Rubén Gómez) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Sep 24, 2009 at 18:16, Gerald Young <gerald.young@...> wrote:
> Hi Cheng,
Hello everybody. That's my first mail :p

> To use multiple screen sessions, I run a main screen session that inside
> contains windows running other screen sessions.
That's what I want to know how to do, thanks!

> I run the main session with something like:
> screen -e ^Ss -S main_session
It doesn't work for me, but it works "screen -e ^Hh -S main_session".
I'm not sure way. I'm using gnome-terminal in debian with the default
/etc/screenrc and in my .screenrc I have:
startup_message off
caption always
caption string "%{kw}%-w%{wr}%n %t%{-}%+w"

Apart of those lines, do you know other usefull options for it? Any
wiki where appears all the best options like
http://vim.wikia.com/wiki/Best_Vim_Tips for Vim?

Thanks!


_______________________________________________
screen-users mailing list
screen-users@...
http://lists.gnu.org/mailman/listinfo/screen-users

Re: how to switch session as X window workspace?

by Jesús Guerrero-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 24 Sep 2009 11:16:00 -0500, Gerald Young <gerald.young@...>
wrote:

> On Thursday 24 September 2009 04:40:25 CHEN Cheng wrote:
>> Hi folks,
>>
>> Is it possible to switch between sessions by pressing
>> Ctrl-Alt-Left or Ctrl-Alt-Right, like what we do in
>> Gnome (or KDE)?
>
> Hi Cheng,
>
> To use multiple screen sessions, I run a main screen session that inside

> contains windows running other screen sessions.

Or you could use "layouts", which are not well documented, but do
basically that. I've used them in the past but right now I have no example
on how to use them, the only thing I can do is to point you in that
direction. I don't know from which version they are included, so you might
need to use the lastest live code to be able to use layouts.

--
Jesús Guerrero


_______________________________________________
screen-users mailing list
screen-users@...
http://lists.gnu.org/mailman/listinfo/screen-users

Re: how to switch session as X window workspace?

by CHEN Cheng-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Sep 24, 2009 at 11:16:00AM -0500, Gerald Young wrote:

> To use multiple screen sessions, I run a main screen session that inside
> contains windows running other screen sessions.
>
> For example:
> * main session
>    - window 1: misc session
>    - window 2: coding session
>    - window 3: ssh session
>
> And then each nested session has their own set of windows:
> * misc session
>    - window 1: bash
>    - window 2: etc
> * coding session
>    - window 1: vim file1
>    - window 2: make
> * ssh session
>    - window 1: ssh server1
>    - window 2: ssh server2
>
> The main session has Ctrl+S as the screen command key (instead of Ctrl+A).  
> That way I control either the main session or any of the other sessions by
> using Ctrl+S or Ctrl+A respectively. The "Ctrl+S 1" sequence would take me to
> the misc session, for example.
>
> I run the main session with something like:
> screen -e ^Ss -S main_session
>
> And on the shell that pops up I run my other sessions (each on their own
> window):
> screen -t misc_session screen -mS misc_session
> screen -t coding_session screen -mS coding_session
> screen -t ssh_session screen -mS ssh_session
>

Hi Gerald, thanks so much for your enlightenment. The '-m' option
seems to be the key to nested sessions.

Below are my configurations (snippets) that I'd love to share
with you:

.screenrc:
escape \377\377         # disable C-a
bindkey -k k6 command
bind c screen screen -m -c $HOME/.screen.sub.rc
screen 0 screen -m -c $HOME/.screen.sub.rc

.screen.sub.rc
escape \377\377         # disable C-a
bindkey -k k7 command
bindkey -k k8 prev
bindkey -k k9 next

With function keys k6, k7, k8 and k9, I'm able to switch very
conveniently between sessions and windows within nested sessions.
To create a new session, I press f6 and c; to create a new
window, I press f7 and c; to switch to the next window within the
same session, I press f9; to switch to the next session, I press
f6 and n, and so on.

I also considered to use Ctrl-Alt-Left/Right keys, but it seems
they are not distinguished from Left/Right keys, or at least
under linux console terminal. So finally, I give them up.

Thanks again for your kind help,
Cheng



_______________________________________________
screen-users mailing list
screen-users@...
http://lists.gnu.org/mailman/listinfo/screen-users

Re: how to switch session as X window workspace?

by CHEN Cheng-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Sep 24, 2009 at 08:40:48PM +0200, Yuki (aka Rubén Gómez) wrote:
> Hello everybody. That's my first mail :p
Hello, Yuki.

> > screen -e ^Ss -S main_session
> It doesn't work for me, but it works "screen -e ^Hh -S main_session".
> I'm not sure way. I'm using gnome-terminal in debian with the default
> /etc/screenrc and in my .screenrc I have:
> startup_message off
> caption always
> caption string "%{kw}%-w%{wr}%n %t%{-}%+w"

I googled it and find that ^Q and ^S are software flow control commands.

http://en.wikipedia.org/wiki/Software_flow_control

David Keech has suggestion:
     If you want to stop ctrl-s and ctrl-q working at all, put this in
     your .profile (or.bash_profile or whatever you use):

     stty -ixon -ixoff

     You can also run "stty -a" to see a list of control characters
     that your terminal supports.

     <http://www.wolerized.com/?q=blog/remi-woler/unlocking-your-
      ssh-session-after-pressing-ctrl-s>

Maybe Gerald has disabled them so that he can use ^S in screen.


Best,
Cheng



_______________________________________________
screen-users mailing list
screen-users@...
http://lists.gnu.org/mailman/listinfo/screen-users

Re: how to switch session as X window workspace?

by CHEN Cheng-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Sep 24, 2009 at 08:48:09PM +0200, Jesús Guerrero wrote:
> Or you could use "layouts", which are not well documented, but do
> basically that. I've used them in the past but right now I have no example
> on how to use them, the only thing I can do is to point you in that
> direction. I don't know from which version they are included, so you might
> need to use the lastest live code to be able to use layouts.
>
Thanks for the direction. I git cloned the newest screen source tree,
and read part of the code (comm.c, process.c).

It seems that the undocumented command `layout' has some arguments:
  layout new                        # to create a new layout
  layout title                      # to show the current layout title
  layout title "new title"          # to set the current layout title
  layout next
  layout prev
  layout select
  ...

But, in my tests later, I was not able to differentiate a layout from
a normal window.

Is there architectural documents about screen? It would be helpful if
someone wants to get a deeper view in a quick way.


Best,
Cheng



_______________________________________________
screen-users mailing list
screen-users@...
http://lists.gnu.org/mailman/listinfo/screen-users

Re: how to switch session as X window workspace?

by Jean-Yves Levesque :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

This is an example given to me when layouts came
out. I used this in order to understand layouts
and it has been useful to me. Hope it works for
you.

jy




On 9/26/09, CHEN Cheng <chen.js.cheng@...> wrote:

> On Thu, Sep 24, 2009 at 08:48:09PM +0200, Jesús Guerrero wrote:
>> Or you could use "layouts", which are not well documented, but do
>> basically that. I've used them in the past but right now I have no example
>> on how to use them, the only thing I can do is to point you in that
>> direction. I don't know from which version they are included, so you might
>> need to use the lastest live code to be able to use layouts.
>>
> Thanks for the direction. I git cloned the newest screen source tree,
> and read part of the code (comm.c, process.c).
>
> It seems that the undocumented command `layout' has some arguments:
>   layout new                        # to create a new layout
>   layout title                      # to show the current layout title
>   layout title "new title"          # to set the current layout title
>   layout next
>   layout prev
>   layout select
>   ...
>
> But, in my tests later, I was not able to differentiate a layout from
> a normal window.
>
> Is there architectural documents about screen? It would be helpful if
> someone wants to get a deeper view in a quick way.
>
>
> Best,
> Cheng
>
>
>
> _______________________________________________
> screen-users mailing list
> screen-users@...
> http://lists.gnu.org/mailman/listinfo/screen-users
>

--
Je ne parle qu'en mon nom.
I am only speaking for myself.


_______________________________________________
screen-users mailing list
screen-users@...
http://lists.gnu.org/mailman/listinfo/screen-users

.screenrc.example (3K) Download Attachment

Re: how to switch session as X window workspace?

by CHEN Cheng-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Sep 29, 2009 at 06:27:38AM +1800, Jean-Yves Levesque wrote:
> This is an example given to me when layouts came
> out. I used this in order to understand layouts
> and it has been useful to me. Hope it works for
> you.
>

Hi,

Thank you so much. It provides me a show case, from which I get
the following:

1. A layout consists of one or more frames.

2. Each frame has zero or one window.

3. The frames are effect of command `split'. Or `layout new'?

4. The frames in each layout can be tranversed by command `focus'.
    If a frame is focused, all the commands like `split', `screen',
    `caption`, and so on would happen in this frame.

5. Each window has zero or one group.

6. If a window has a group, then `prev' and `next' would only switch
    among all the windows of this group.

7. If a window has no group, then `prev' and `next' would switch
    among all the windows of screen.

8. The point is to create groups of windows, which is done by,
    first `layout new', then `screen //group', finally
    `layout save'.

9. The group window can be created without `layout new', but
    without it, later created groups are children of the first
    group, instead of sibling of the first group.

I wonder if the above are true. But I'm sure it is the begin of
the try-and-error process.


Thanks again,
Cheng



_______________________________________________
screen-users mailing list
screen-users@...
http://lists.gnu.org/mailman/listinfo/screen-users