You are not logged in.
hi! im using urxvt and xterm, and i realized that everytime i restart X i open 3-4 terminals and then mirror my screen session wit lot of screens in it...
So i was wondering if there's some way to make a hotkey for use in say dwm to open a urxvt with screen mirrored to it
i have this in ~/.bashrc
### Screen Function Mirror/List :: sx ###
function sx {
if [[ $1 ]]; then
screen -x $1
else
screen -ls
fi
}
It shows me a thing like this when attached:
[aleyscha@aleyscha 1 ~]$ sx
There is a screen on:
4565.pts-3.aleyscha (Attached)
1 Socket in /tmp/screens/S-aleyscha.
and it shows me a thing like this when attached:
[aleyscha@aleyscha 1 ~]$ sx
There is a screen on:
4565.pts-3.aleyscha (Dettached)
1 Socket in /tmp/screens/S-aleyscha.
Thankyou 4 read
Last edited by leo2501 (2008-08-17 12:50:45)
Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
-- Antoine de Saint-Exupery
Offline
Not sure what you mean by 'mirror' in this context, but if you want to run screen, or any other command, when you launch urxvt, use the -e flag.
Offline
Not sure what you mean by 'mirror' in this context, but if you want to run screen, or any other command, when you launch urxvt, use the -e flag.
sorry, i mean, to start screen with this option:
-x Attach to a not detached screen session. (Multi display mode).
so when i open a terminal i need the screen session number, and i don't know how to get it in a script i get (with screen -ls) the attached and dettached sessions, and i have always only one, and that one i want to have attached with the -x session that allows you to have it attached to several terminals
Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
-- Antoine de Saint-Exupery
Offline
If I understand you correctly, something like this in your .bashrc could work:
case $TERM in
xterm*|rxvt*)
if screen -ls | grep -q Main; then
screen -xr Main
else
screen -S Main
fi
;;
esac
Last edited by flx (2008-08-16 12:24:48)
Offline
If I understand you correctly, something like this in your .bashrc could work:
case $TERM in xterm*|rxvt*) if screen -ls | grep -q Main; then screen -xr Main else screen -S Main fi ;; esac
Wow! that's perfect! the only thing is that i want to make it behave like a keybinding, so i can still have a non-screen terminal, so i think i need to make it a function, something like:
function scr {
case $TERM in
xterm*|rxvt*)
if screen -ls | grep -q Main; then
screen -xr Main
else
screen -S Main
fi
;;
esac
}
so i can add a keybinding in dwm to start a "urxvt -e scr" command isn't it?
Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
-- Antoine de Saint-Exupery
Offline
well it's done THANKYOU flx! i done it with this:
get_screen script:
#!/bin/bash
if screen -ls | grep -q Main; then
screen -xr Main
else
screen -S Main
fi
and this in dwm's config.h file:
...
/* commands */
static const char *termscreen[] = { "urxvt", "-e", "get_screen", NULL };;
...
static Key keys[] = {
{ MODKEY|ControlMask, XK_Return, spawn, {.v = termscreen } },
...
I love dwm and screen
Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
-- Antoine de Saint-Exupery
Offline