views:

328

answers:

2

Is there any way to change the font size of terminal window(GNOME or KDE) from inside a shell script
Actually I want to display a file in a particular format on screens of all sizes.
Can i do it using scripts??

A: 

I for one would surely not want a shell script (or any other program for that matter) to change my terminal settings! If it were to find a way to do so, I would use it exactly once and them remove it from my machine.

Seriously: This is something you should not do, because the user will probably have set his or her screen size to the way it is for a reason that is probably better than yours for changing it. Consider handicapped people who might need a specific font or very large letters to be able to read the screen at all.

Better try and make your application suitable for any terminal layout - there are variables for telling you how many characters wide and how many lines high your current environment is.

Daniel Schneller
Did he ask if he should do it, or how to do it?
BryanH
Sometimes looking at things from a different angle helps, so I wrote this answer. I usually appreciate constructive criticism - so I offered some here.
Daniel Schneller
A: 

For KDE, you can use dcop to set your font size.

For example:

dcop konsole-8540 session-6 setFont Monospace,20,-1,5,50,0,0,0,0,0

(the 20 in the example above is the font size)

BryanH