1

I am getting a warning permanently while using gedit as text editor to compile code in C. I launched the text editor with gedit file& in the shell. I use Ubuntu 20.04.5 LTS. Here is what the warning says:

(gedit:915949): Gtk-WARNING **: 22:02:02.233: Negative content width -6 (allocation 18, extents 12x12) while allocating gadget (node label, owner GtkLabel).

What does this mean ? What should I do ?

Many thanks for any comment.

1 Answer 1

2

Something in gedit, or perhaps in whatever theme you're using, has specified an incorrect value for some widget. In this case, probably the width or height is slightly too small (6 pixels) for whatever its contents are.

It's only a warning. It's almost certainly harmless and you can ignore it.

GTK applications - in fact, most GUI apps - spew warnings like this all the time. Most users don't see them because apps launched via menus or by icons on the desktop typically have their STDERR output redirected to a file called ~/.xsession-errors.

They're almost always harmless (they're only warnings - serious problems will be labelled "Error" rather than "Warning", and fatal errors tend to either crash the program or trigger a clean exit), and they're mostly intended for use by the developers to debug their programs.

If you do notice more than minor cosmetic defects that you think might be caused by or related to this warning, then submit a bug report to the developer (or to the package maintainer if you're using a distro package).


If there are a lot of warnings printed, however, they can be an annoyance when programs are run from the command line. Especially when run in the background with &.

If they get too annoying, you can always redirect them. e.g. to ignore errors and warnings entirely (not recommended unless you're sure there will be no real errors, or you don't care if there are any):

gedit file 2> /dev/null &

If you want to redirect to .xsession-errors, same as programs launched by menu or icon, you should append with 2>> rather than just 2>:

gedit file 2>> ~/.xsession-errors &

You can even write a function or shell script to always do this for you:

gedit_quiet () { gedit "$@" 2>> ~/.xsession-errors & }

This function will run gedit in the background with whatever options and arguments you give it, and with stderr redirected to ~/.xsession-errors.

Save the function into your ~/.bash_profile so that it's always available in your login shells (note: new shells only - changes to bash's startup scripts don't affect currently running shells). You might want to rename it to something shorter, like gq - but make sure it doesn't conflict with an existing program name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.