You can send a message to all consoles with the command wall.
For sending notifications under X there is notify-send which sends a notification to the current user on the current display. (From your question, I guess you already know this one.) You can build upon this with some bash scripting. Basically you have to find out which users are on which X-Displays. Once you got this info you can use notify-send like this:
DISPLAY=:0 sudo -u fschmitt notify-send "Message"
Where fschmitt is the user at display 0. You can parse the output of the "who" command to find all users and their displays. The output looks like this
[edinburgh:~]$ who
markmerk3 tty7 2010-09-23 10:59 (:0)
markmerk3 pts/1 2010-09-30 13:30 (:0.0)
fschmitt pts/2 2010-10-08 11:44 (ip-77-25-137-234.web.vodafone.de)
markmerk3 pts/0 2010-09-29 18:51 (:0.0)
seamonkey pts/6 2010-09-27 15:50 (:1.0)
markmerk3 pts/5 2010-09-27 14:04 (:0.0)
seamonkey tty8 2010-09-27 15:49 (:1)
markmerk3 pts/13 2010-09-28 17:23 (:0.0)
markmerk3 pts/3 2010-10-05 10:40 (:0.0)
You see, there are two users running X sessions, markmerk3 at display 0 and seamonkey at display 1. I think you need to grep for tty[0-9]* then assure that at the end of the line there is (:[0-9.]*) to get rid of console logins and extract the display id from the string between the parentheses.
When trying to use similar window managers (xwem, ratpoison) for the first time, I first also tried to follow the setup instructions involving xmodmap
to get a modifiier key for the window manager, but then I felt that using xmodmap
in my system causes some mess, because in my system (an ALTLinux distro) attention has always been paid to multilingual keyboard configuration via XKB, rather than via xmodmap
.
So, I found an XKB option to label the key I wanted as "Hyper", and then used the "Hyper" modifier in the configuration for xwem or ratpoison.
In my case, the option to setxkbmap
is:
-option altwin:hyper_win
and here is the comment I've saved on the occasion of adding it to my setup:
xemacs-xwem uses Hyper, so I found this predefined XKB map (in
xkb/symbols/altwin), which uses the WIN keys.
Perhaps later I'll make up another XKB map for me, say, using the
right Control as Hyper (that will force my hand to use the right
Control--now my hand just ignores it).
I thought it's a more clean way to get myself a Hyper key through XKB
rather than through xmodmap (as described in XWEM docs), because:
xmodmap configuration of modifier keys seems not to be nice w.r.t.
the way it forces one to present one's intentions: one must say
something about arbitrarily numbered modifier bits, but I don't want
to think about these technical things: I need merely a "Hyper"
modifier, not some obscure manipulations with the internals! In
xmodmap, I'd need to give 2 or even 3 obscure statements to achieve
the result, although logically this is a single wish and operation.
(One xmodmap statement would not be enough, cf. XEmacs' warnings
(FIXME: insert!) if you map Control_R to a modN; there are some
technical constraints.)
one is told stories that XKB and xmodmap don't play well together,
so that not all X programs will work nicely and coherently if you mix
them (I must give a link here, FIXME).
Here is the relevant definition from /usr/share/X11/xkb/symbols/altwin
, if someone is interested:
partial modifier_keys
xkb_symbols "hyper_win" {
key <LWIN> { [ Hyper_L ] };
key <RWIN> { [ Hyper_R ] };
modifier_map Mod4 { Hyper_L, Hyper_R };
};
Best Answer
You have to leave the original X server running. You can start another X server on another tty. So, on a typical system, do ctrl+alt+f1, then log in and run
startx -- :1
. You should end up with another X session on reachable by ctrl+alt+f8.Any number of X servers can be started by changing the number after the colon; if you use a number larger than 12, you can use
chvt
to change to it instead of the key combo.If you want, you can setup special
.xinitrc
files that start different desktop environments. So you might have a.xinitrc-kde
that starts a KDE session. In that file, you'd have something likeexec startkde
. And you'd start X like by doingstartx ./.xinitrc-kde -- :1
.If you plan on running Firefox on both the sessions, there may be some issues. Look into the "no-remote" and "ProfileManager" command line options for Firefox.