You are not logged in.

#1 2007-10-25 12:26:22

finferflu
Forum Fellow
From: Manchester, UK
Registered: 2007-06-21
Posts: 1,899
Website

[SOLVED] Open apps in existing GNU Screen session in urxvt?

Hello,
I have recently come across a very cool Firefox extension, called Mozex, which allows you to use external programs to do a number of actions, including editing text areas. So I was planning to use Vim to edit all the text areas (I think it's very cool). Now, my current Window Manager is Ratpoison, and I would like to open up Vim in an existing urxvt terminal (so, I don't have to bother specifying all the settings I have indicated in .ratpoisonrc again, and have two terminals open). I also use GNU Screen, so I would like Vim to be opened in a new Screen session. In short I need to open Vim in a new Screen session in an existing urxvt terminal.

I am currently using Gvim to write this, but I would much prefer to use a terminal instead, do you think that would be possible?

Thanks for your time smile

Last edited by finferflu (2007-10-25 14:58:01)


Have you Syued today?
Free music for free people! | Earthlings

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery

Offline

#2 2007-10-25 13:12:17

chimeric
Member
From: Munich, Germany
Registered: 2007-10-07
Posts: 254
Website

Re: [SOLVED] Open apps in existing GNU Screen session in urxvt?

Hi,

I don't now how to start a new screen session in an existing terminal other as from the same terminal itself - but if you have an already running named screen session:

% screen -S mysession

you can open a vim instance in this particular screen session from any other script/terminal/you name it by using:

% screen -S mysession -X exec vim

Maybe this in combination with the "It's All Text" [1] firefox extension could give you what you want.

[1]https://addons.mozilla.org/de/firefox/addon/4125

Last edited by chimeric (2007-10-25 13:12:50)

Offline

#3 2007-10-25 13:13:22

DonVla
Member
From: Bonn, Germany
Registered: 2007-06-07
Posts: 997

Re: [SOLVED] Open apps in existing GNU Screen session in urxvt?

hi,

try something like:
"urxvt -c screen -dRR -S vim /usr/bin/vim"

for more details -> man screen.

vlad

ps: i don't thnk there is a way to open in an existing urxvt terminal. if yes i would also be interested.

Last edited by DonVla (2007-10-25 13:16:15)

Offline

#4 2007-10-25 13:41:53

finferflu
Forum Fellow
From: Manchester, UK
Registered: 2007-06-21
Posts: 1,899
Website

Re: [SOLVED] Open apps in existing GNU Screen session in urxvt?

@ chimeric
That command seems to work only from within a Screen session, but I need to run a command externally, namely from Mozex.
The Mozex extension does exatly what It's All Text does, and even more. wink

@ DonVla
Your command detaches the current Screen session and reattaches it to a new terminal, I think it's too messy. Also I have specified all my options for urxvt in .ratpoisonrc and I don't want to type them in every time. If I'll need to open a new window it's more convenient for me to keep using Gvim.


Thank you both for your help so far smile

Last edited by finferflu (2007-10-25 13:43:12)


Have you Syued today?
Free music for free people! | Earthlings

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery

Offline

#5 2007-10-25 13:54:56

chimeric
Member
From: Munich, Germany
Registered: 2007-10-07
Posts: 254
Website

Re: [SOLVED] Open apps in existing GNU Screen session in urxvt?

finferflu wrote:

@ chimeric
That command seems to work only from within a Screen session, but I need to run a command externally, namely from Mozex.
The Mozex extension does exatly what It's All Text does, and even more. wink

Hmmm, strange ... I tested it here on a headless server as follows and it's working for me:

# start a new screen session in terminal
Screen -S mysession
# detach session
# run that anywhere else
screen -S mysession -X exec vim
# attach screen session and vim is waiting for me

I'll give it another try when I am at home later today...

Offline

#6 2007-10-25 14:02:55

codemac
Member
From: Cliche Tech Place
Registered: 2005-05-13
Posts: 794
Website

Re: [SOLVED] Open apps in existing GNU Screen session in urxvt?

urxvt -c screen -x -S vim /usr/bin/vim

That will open the other screen session in a new urxvt...  I don't quite understand yet why you want it in your old screen session, though.  I figure you'd just want urxvt -c vim.  When you're done you can :wq and move on.  You really want to edit the file, quit vim, detach the screen session, exit urxvt every time you edit a text box online?

You have a different workflow than I do.

Offline

#7 2007-10-25 14:45:40

finferflu
Forum Fellow
From: Manchester, UK
Registered: 2007-06-21
Posts: 1,899
Website

Re: [SOLVED] Open apps in existing GNU Screen session in urxvt?

@ chimeric
I think you're right. I don't know what I did before, but it was not working. So I gave it another go this time, and it's actually working quite well. It's exactly what I needed, invaluable help, since I couldn't find this by googling extensively. Thanks a lot!

@ codemac
What I need is only one terminal open. I keep a terminal running Screen always open, and I don't want to have too many windows opening, especially while using Ratpoison. So, the only way of having multiple "tabs" in an urxvt terminal is by using Screen.

By the way, is there any way I can set the default session name in .screenrc?

Last edited by finferflu (2007-10-25 14:52:25)


Have you Syued today?
Free music for free people! | Earthlings

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery

Offline

#8 2007-10-25 15:28:25

chimeric
Member
From: Munich, Germany
Registered: 2007-10-07
Posts: 254
Website

Re: [SOLVED] Open apps in existing GNU Screen session in urxvt?

finferflu wrote:

@ chimeric
I think you're right. I don't know what I did before, but it was not working. So I gave it another go this time, and it's actually working quite well. It's exactly what I needed, invaluable help, since I couldn't find this by googling extensively. Thanks a lot!

np - I am glad I could help smile.

finferflu wrote:

By the way, is there any way I can set the default session name in .screenrc?

Not that I know of - however - I think that would get in your way solving your idea anyway - well - unless you intend to only have one screen session ever - because screen allows you to start more session with the same session name.

screen -list
There are screens on:
        25998.chi       (Detached)
        26652.chi       (Detached)
        26659.chi       (Detached)

The aforementioned command to execute vim inside one of these session would then require to use the full session identifier ie:

screen -S 25998.chi -X exec vim

Anyway - a simple way to set a default session name would be to set an alias in the .rc file of your preferred shell:

alias newscreen="screen -S defaultsession"

Offline

#9 2007-10-25 15:38:21

finferflu
Forum Fellow
From: Manchester, UK
Registered: 2007-06-21
Posts: 1,899
Website

Re: [SOLVED] Open apps in existing GNU Screen session in urxvt?

Yes, I thought about the alias, but I was wondering what would have happened if I opened a new screen session, using the alias, but you have answered my question. Anyway, I was thinking that I usually open a new screen session only by mistake. One should be enough. Thanks for your help smile


Have you Syued today?
Free music for free people! | Earthlings

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery

Offline

#10 2011-02-12 03:00:38

matt.woelk
Member
Registered: 2010-03-15
Posts: 2

Re: [SOLVED] Open apps in existing GNU Screen session in urxvt?

If you want your screen session to open vim in a new screen window (in an already-running screen session) editing a specific file you can do the following:

screen -S mysession -X screen vim ~/.vimrc

where "mysession" is the name of your vim session (which you can specify by starting screen with "screen -S mysession", and "~/.vimrc" is the location of the file that you want to edit.

    This means that if you're running a program like "top" for instance, it won't try to load vim on top of top (like my mac just tried to do using the -X exec method and went all crazy).

      Now It's time for me to see if I can get pentadactyl (vimperator branch (firefox plugin)) to do exactly this for it's external editor feature. big_smile

Last edited by matt.woelk (2011-02-12 03:01:17)

Offline

#11 2011-02-12 04:11:46

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Re: [SOLVED] Open apps in existing GNU Screen session in urxvt?

matt.woelk wrote:

If you want your screen session to open vim in a new screen window (in an already-running screen session) editing a specific file you can do the following:

screen -S mysession -X screen vim ~/.vimrc

where "mysession" is the name of your vim session (which you can specify by starting screen with "screen -S mysession", and "~/.vimrc" is the location of the file that you want to edit.

    This means that if you're running a program like "top" for instance, it won't try to load vim on top of top (like my mac just tried to do using the -X exec method and went all crazy).

      Now It's time for me to see if I can get pentadactyl (vimperator branch (firefox plugin)) to do exactly this for it's external editor feature. big_smile

Yes, let's all find 3+ year old threads and bump them by providing EXACTLY the same information which has already been provided initially....

Closing. Don't do that again.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

Board footer

Powered by FluxBB