An easy way to do this is to use the
LPDEST environment variable.
If you want all applications to go to a specific printer, you can set
LPDEST in a little executable shell program in
/etc/profile.d, something like this
Code:
#!/bin/sh
export LPDEST=printer2
Then, to set
LPDEST to
printer1 for program1, you can create a little "launcher"
Code:
#!/bin/sh
export LPDEST=print1; program1
You would execute this from a command line in a terminal window.
And, of course, you can set a system-wide default printer in CUPS to avoid the above but it's worth knowing that you can do it this way too.
You may also, if your application has a
config file, put the
export line in there (maybe, maybe not).
Another approach might be the properties of the desktop icon you launch
program1 with, perhaps
Code:
LPDEST=print1; program1
Doing that would vary by whatever window manager you're using (GNOME, KDE, XFCE) and you'd probably need to dig into the documentation (or just try it!).
The nice thing about using
LPDEST is that it will only be in effect for
program1; when
program1 dies, so does the environment setting.
Hope this helps some.