[yast-devel] how to determine GUI versus ncurses mode via YCP
Hello, how can I determine in a YaST module if it runs currently in GUI mode (Qt or Gtk) or in text-only (ncurses) mode? If it runs in text-only mode, how can I determine its current screen size (i.e. how many lines and characters per line)? Kind Regards Johannes Meixner -- SUSE LINUX Products GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany AG Nuernberg, HRB 16746, GF: Markus Rex -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
On Tue, Mar 25, 2008 at 03:48:24PM +0100, Johannes Meixner wrote:
Hello,
how can I determine in a YaST module if it runs currently in GUI mode (Qt or Gtk) or in text-only (ncurses) mode?
If it runs in text-only mode, how can I determine its current screen size (i.e. how many lines and characters per line)?
Use UI::GetDisplayInfo(). ciao Arvin -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
* Johannes Meixner <jsmeix@suse.de> [03-25-08 10:50]:
If it runs in text-only mode, how can I determine its current screen size (i.e. how many lines and characters per line)?
bash has env vars, $LINES and $COLUMNS, that will give screen size. -- Patrick Shanahan Plainfield, Indiana, USA HOG # US1244711 http://wahoo.no-ip.org Photo Album: http://wahoo.no-ip.org/gallery2 Registered Linux User #207535 @ http://counter.li.org -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
On Tue, Mar 25, 2008 at 10:56:37AM -0400, Patrick Shanahan wrote:
* Johannes Meixner <jsmeix@suse.de> [03-25-08 10:50]:
If it runs in text-only mode, how can I determine its current screen size (i.e. how many lines and characters per line)?
bash has env vars, $LINES and $COLUMNS, that will give screen size.
The variables are there, but they are not exported: $ echo $LINES,$COLUMNS; env | grep LINES; env | grep COLUMNS 60,178 $ -- Martin Vidner, YaST developer http://en.opensuse.org/User:Mvidner Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
On 25-Mar-08, Martin Vidner wrote:
On Tue, Mar 25, 2008 at 10:56:37AM -0400, Patrick Shanahan wrote:
* Johannes Meixner <jsmeix@suse.de> [03-25-08 10:50]:
If it runs in text-only mode, how can I determine its current screen size (i.e. how many lines and characters per line)?
bash has env vars, $LINES and $COLUMNS, that will give screen size.
The variables are there, but they are not exported:
$ echo $LINES,$COLUMNS; env | grep LINES; env | grep COLUMNS 60,178 $
Using "stty size" sounds better to me. Maybe sh@ knows a wrapper for this in YaST. Regards, -- Olaf Dabrunz (od/odabrunz), SUSE Linux Products GmbH, Nürnberg -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
Olaf Dabrunz napsal(a):
On 25-Mar-08, Martin Vidner wrote:
On Tue, Mar 25, 2008 at 10:56:37AM -0400, Patrick Shanahan wrote:
* Johannes Meixner <jsmeix@suse.de> [03-25-08 10:50]:
If it runs in text-only mode, how can I determine its current screen size (i.e. how many lines and characters per line)?
bash has env vars, $LINES and $COLUMNS, that will give screen size. The variables are there, but they are not exported:
$ echo $LINES,$COLUMNS; env | grep LINES; env | grep COLUMNS 60,178 $
Using "stty size" sounds better to me. Maybe sh@ knows a wrapper for this in YaST.
Use our documentation, please :) http://forgeftp.novell.com/yast/doc/SL11.0/tdg/Book-UIReference.html http://forgeftp.novell.com/yast/doc/SL11.0/tdg/YUI_builtins_GetDisplayInfo.h... Bye Lukas -- Lukas Ocilka, YaST Developer (xn--luk-gla45d) ----------------------------------------------------------------- Ano, ano. Moudry rozkaz. Sam jsem nemel v tech gratulacich jasno.
On Tuesday 25 March 2008 15:56, Patrick Shanahan wrote:
bash has env vars, $LINES and $COLUMNS, that will give screen size.
Shelling out to do SCR::Execute(.target.bash, ...) to get those environment variables is something I don't even want to think about... ;-) CU -- Stefan Hundhammer <sh@suse.de> Penguin by conviction. YaST2 Development SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) Nürnberg, Germany -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
On Tuesday 25 March 2008 15:48, Johannes Meixner wrote:
how can I determine in a YaST module if it runs currently in GUI mode (Qt or Gtk) or in text-only (ncurses) mode?
If it runs in text-only mode, how can I determine its current screen size (i.e. how many lines and characters per line)?
The layout units are the same regardless if it's GUI (Qt or Gtk) or NCurses: An 800x600 pixel main window corresponds to 80x25 layout units. Fractional sizes are permitted (but fractions may be rounded by the NCurses UI). Please note that it is generally not desirable to differentiate on the YCP application level between NCurses or GUI mode. The UI is intended to be the abstraction layer for that. As a general rule of thumb, if a layout does not fit into an NCurses 80x25 layout, it is very likely overcrowded and overly complex. So if you need to distinguish between GUI and NCurses, you might have that problem. CU -- Stefan Hundhammer <sh@suse.de> Penguin by conviction. YaST2 Development SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) Nürnberg, Germany -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
participants (7)
-
Arvin Schnell
-
Johannes Meixner
-
Lukas Ocilka
-
Martin Vidner
-
Olaf Dabrunz
-
Patrick Shanahan
-
Stefan Hundhammer