Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[rxvt] - How to make a run dialog out of rxvt - (Solved)
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10315
Location: Córdoba (Spain)

PostPosted: Sun Oct 23, 2005 3:38 am    Post subject: [rxvt] - How to make a run dialog out of rxvt - (Solved) Reply with quote

I want to find a way to autoclose a shell after launching a command. I don't know if this is even a factible thing (I can't think of any way to do this). Note that I want it to lauch the command and close the term in the same instant, not to close when the program that I launched ends, just like a graphical launcher would do (in the line of gmrun).

Any guidance to the right direction is wellcome.


Last edited by i92guboj on Wed Oct 26, 2005 5:33 am; edited 1 time in total
Back to top
View user's profile Send private message
codergeek42
Bodhisattva
Bodhisattva


Joined: 05 Apr 2004
Posts: 5142
Location: Anaheim, CA (USA)

PostPosted: Sun Oct 23, 2005 3:40 am    Post subject: Reply with quote

Code:
$ command; exit
?
_________________
~~ Peter: Programmer, Mathematician, STEM & Free Software Advocate, Enlightened Agent, Transhumanist, Fedora contributor
Who am I? :: EFF & FSF
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10315
Location: Córdoba (Spain)

PostPosted: Sun Oct 23, 2005 3:54 am    Post subject: Reply with quote

I should have been more specify. Yes, I can launch the programs that way, for example "sylpheed& exit" into an xterm. But what I want to do is to find a way to auto-attach "&exit" to the end of any arbitrary command. In other words, what I want is to make a launcher dialog out of an rxvt, since none of the available ones (in or outside portage) has anything to offer me. Gmrun is slow (yes, slower than a term emulator, dont ask me why), I dont like grun (the text in the buttons for my language goes out of the buttons) and appart from that two I dont know anything.

Im thinking about a way to automatically attach that string to any arbitrary command and seems that I will have to do some bash scripting, since I see no easy way around. But if I use a script to read it then I will lose the autocompletion feature. :cry:

Thanks for reading :)
Back to top
View user's profile Send private message
codergeek42
Bodhisattva
Bodhisattva


Joined: 05 Apr 2004
Posts: 5142
Location: Anaheim, CA (USA)

PostPosted: Sun Oct 23, 2005 4:25 am    Post subject: Reply with quote

hmm perhaps (if you're using Bash) you can make a function such as:
Code:
function cmd() {
    "$@" &;
}
then you could use something like
Code:
$ cmd app1
$ cmd app2
etc. Alternatively, you could try something like bbrun (the "Run..." dialog used by Blackbox and Fluxbox IIRC)
_________________
~~ Peter: Programmer, Mathematician, STEM & Free Software Advocate, Enlightened Agent, Transhumanist, Fedora contributor
Who am I? :: EFF & FSF
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10315
Location: Córdoba (Spain)

PostPosted: Sun Oct 23, 2005 5:06 am    Post subject: Reply with quote

bbrun, did not know about that one. Thanks, it seems a good replacement for gmrun. I can live without autocompletion. At least it loads fast. Anyway, I will continue investigating if I can make some hack to get my idea working. The memory consumption is much less if you use rxvt to simulate a launcher (nothing critical though...).

Thanks again, I think that for now bbrun will do the work. ;)
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10315
Location: Córdoba (Spain)

PostPosted: Wed Oct 26, 2005 5:30 am    Post subject: Reply with quote

I did! Well, I found it, someone did it before... :D :lol:

http://www.fvwmwiki.org/Tips/RxvtRunDialog


Basically, the script is this:

Code:

#!/bin/sh
rxvt +sb -font -*-fkp-*-*-*-*-*-*-*-*-*-*-*-* \
        -name fvwm-run-dialog -title "run" -g 80x1+224+360 \
        --keysym.0xFF0D: " &\n exit\n" -e bash \
        --init-file $HOME/.fvwm/scripts/run-dialog.bash-init

And the init-file for bash is:
Code:

export PS1="> "
export HISTCONTROL="ignorespace"

Of course, change the prompt for any other thing that you like, configure rxvt with the parameters that you preffer and bind it to a key. The most awesome run dialog ever, with history and autocompletion... Yeshhh!! Now I can really mark as solved. :wink:
Back to top
View user's profile Send private message
codergeek42
Bodhisattva
Bodhisattva


Joined: 05 Apr 2004
Posts: 5142
Location: Anaheim, CA (USA)

PostPosted: Wed Oct 26, 2005 5:41 am    Post subject: Reply with quote

Hmmm that's quite nifty.

Glad you got it working. :)
_________________
~~ Peter: Programmer, Mathematician, STEM & Free Software Advocate, Enlightened Agent, Transhumanist, Fedora contributor
Who am I? :: EFF & FSF
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10315
Location: Córdoba (Spain)

PostPosted: Wed Oct 26, 2005 5:01 pm    Post subject: Reply with quote

Yes, nice, overall in memory. This is the "improved" 6thpink's version:

Code:

#!/bin/sh
export PS1="[Exec]: "
export HISTCONTROL="ignorespace"

rxvt +sb -font "-*-bitstream vera sans mono-*-r-*-*-17-*-*-*-*-*-*-*" \
        -name fvwm-run-dialog -title "run" -g 40x3 \
        -fg lightsteelblue -bg '#336699' -cr white \
        --keysym.0xFF0D: " &\n exit\n" \
        --keysym.0xFF1B: " &\ ^C exit\n" \
        -e sh -s

I removed the ugly overlay file, since this all seems to work ok together. Also dropped bash in favour of sh (there is no need for bash just to lauch a command). Another improvement: I added another macro for the escape key, so, if you press it, a ^C is sent to the term (that is to prevent the execution of any valid command that is already in the box), the rest of the procedure is similar to the enter key one. ;) So, enter runs a command, and escape exits cleanly.

Another thing that Im trying to do is to use this as a kind of gksu (or whatever other graphical su frontend), so far, I did this:
Code:

#!/bin/sh
export PS1="[Exec]: "
export HISTCONTROL="ignorespace"

export COMMAND="$@ & exit"
rxvt +sb -font "-*-bitstream vera sans mono-*-r-*-*-*-*-*-*-*-*-*-*" \
   -name fvwm-run-dialog -title "run" -g 40x1 \
   --keysym.0xFF0D: " &\n exit\n" \
   -e sh -c "su -c '$@'"

But it refuses to let me in, I think it is because the whole string that the macro adds gets chained into the password, so, the pass is not valid. I dont know if I will be able to workaround this in any way... :( If I remove the macro line the thing works, but the term stays behind (just like a normal term would do).

That's all, just thought that I would better share this before I forget how I did it ;) Any idea about the su thingy is wellcome though :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum