You are not logged in.

#1 2017-09-08 17:14:06

mouseman
Member
From: Outta nowhere
Registered: 2014-04-04
Posts: 291

[Solved] xterm gnu screen and herbstluftwm

In .bashrc I have this line

[ -z "$STY" ] && exec screen -Rd

Herbstluftwm has a hotkey, SUPER+enter to open a new xterm.

Once an xterm is open, it won't allow me to open a second one. If I switch to another virtual desktop and hit SUPER+enter, the one from desktop 1 is moved automatically to desktop 2.

When I remove the 'screen' line from .bashrc, it will open new terminal.

With screen I don't often need muliple xterm windows, but sometimes I want 2 side by side to easier read/copy/paste/etc.

Any ideas how I can have 2 xterms open without having to remove the screen line?

Thanks!

Last edited by mouseman (2017-09-08 18:18:38)

Offline

#2 2017-09-08 17:19:01

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,449
Website

Re: [Solved] xterm gnu screen and herbstluftwm

mouseman wrote:

IIf I switch to another virtual desktop and hit SUPER+enter, the one from desktop 1 is moved automatically to desktop 2.

Not quite.  A new xterm is opened and it starts a new screen session triggering the closing of the other screen session's connection - as that was launched with exec, that in turn closes the first xterm.

Do you want to maintain that behavior?  Would you want a *different* key binding for launching a non-screen xterm?  Or do you just want to launch screen once and be able to still launch other xterms?

If you want a single key binding that only launches screen in the first xterm, and plain xterms after that, just change the conditional to check for socket/temp-files that screen creates while it is running.  It's been ages since I used screen, but for tmux that might be the following:

[[ ! -d /tmp/tmux-1000 ]] && exec tmux ...

Alternatively, if you want separate key bindings, then take the conditional out of the shellrc completely and just launch screen from the keybinding: bind one key to `xterm -e screen ...` and the other to `xterm`.

Last edited by Trilby (2017-09-08 17:27:57)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2017-09-08 18:18:04

mouseman
Member
From: Outta nowhere
Registered: 2014-04-04
Posts: 291

Re: [Solved] xterm gnu screen and herbstluftwm

Trilby wrote:

Not quite.  A new xterm is opened and it starts a new screen session triggering the closing of the other screen session's connection - as that was launched with exec, that in turn closes the first xterm.

Aah that is cool, smart man you are! I didn't think of that tongue.

Trilby wrote:

Do you want to maintain that behavior?  Would you want a *different* key binding for launching a non-screen xterm?  Or do you just want to launch screen once and be able to still launch other xterms?

Let me think about this .... Actually what I would like, is simply remove the 'd' from '-Rd', as that detaches screens attached elsewhere (doh!).

It is now working properly smile. Bit silly I didn't see that before but oh well.

Thanks Trilby!

Offline

Board footer

Powered by FluxBB