I'm trying to do some things in zenity, and it's been driving me bonkers. To illustrate my problem, try running this:
zenity --info --text "Hello there friends."
Simple enough right. Now try this:
zenity --info --text " Hello there friends. Hello there friends. Hello there friends. Hello there friends."
Notice how the dialog box got considerably taller?
So you can resize the width of the dialog. In particular, notice what happens when you try to make the width as small as possible. This illustrates my next point: you can't resize the height DOWN at all–it appears to have a hard minimum which is based on the height that would be required if your dialog box was squeezed horizontally to the smallest size possible.
None of this matters for short messages, but what if you have a long message? You don't have to do very much typing in order to end up with a dialog box that is so tall that the ok button is off the screen — and that is a big problem for my users.
Here's a bug report:
FS#34164 : [zenity] – dialog size bug
https://bugs.archlinux.org/task/34164
But that patch doesn't do me any good. My end users are installing Zenity on their own computers and I can't patch their Zenity.
Is there any way around this? Any tricks with regard to the text or anything else?
Best Answer
I've not figured out a method to reduce it's size below the defaults either. You might want to give
gxmessage
a try instead. It can be reduced, though it too has a minimum size that it can be shrunken to. It does have better control surfaces, IMO, thanzenity
with respect to font size selection and window dimensions though.Example
.gtkrc-2.0
If you really want to control the look of GTK+ applications I believe the appropriate way is through the resource file
$HOME/.gtkrc-2.0
. You can add things like the font in here to override to say a monospace font. For experimentation purposes I made a copy of.gtkrc-2.0
and called it.gtkrc-20.mono8
.The following will make the default font monospace 8:
You can then control whether this file get's used by GTK+ applications like so:
So here's
zenity
using defaults:Here's
zenity
using our.gtkrc-2.0.mono8
resource file:NOTE: The command used above was this:
gtk-parasite
So you can see that we can control GTK+ applications through the
.gtkrc-2.0
file but what options can we put in this file. Well there's an app for that 8-), called gtk-parasite. It was in my Fedora repositories asgtkparasite
.Once installed you invoke it against a GTK+ application like so:
So let's invoke
zenity
:If you mess around with changing spacing in some of the sub-components and hiding the icon you can get the
zenity
down to a size of 440x65: