I would like to add some padding in the editing area in Gedit. Here is an illustration of the desired result:

illustration of the desired result

I have the intuition it should be easy to do with a trick similar to this one I already use to add padding in Gnome Terminal:

increase padding in gnome terminal

However I cannot find the proper CSS selectors to do this.

Here is what I found so far:

GTK_DEBUG=interactive gedit

After poking around I found the selector that works with gedit in Ubuntu 18.04:

.gedit-view {
    padding: 10px;
  • Can you explain where (file location) you found .gedit-view property?
    – mature
    Feb 14 '19 at 9:35
  • The selector isn't documented anywhere or explicitly included in any CSS. I discovered it using GtkInspector that is part of gtk included with Ubuntu -- I mentioned the command to launch it in my answer. If you drop this snippet of CSS into ~/.local/gtk-3.0/gtk.css you'll pick up the change. You'll need to create this file first if you don't already have any user CSS overrides of your own and the file doesn't yet exist. Alternately you can more permanently and widely make the change by adding the snippet to /user/share/themes/<THEME>/gtk-3.20/apps/gedit.css.
    – Steve
    Feb 14 '19 at 15:10
  • FWIW you can also select the numbers well to the left using: .gedit-view border.left { } to slightly alter that as well. You're more limited here and I've found that I can only effect a change to the background. I personally like #f8f1de when used in conjunction with a white editor pane.
    – Steve
    Feb 14 '19 at 15:12
  • For those that are unfamiliar with GtkInspector, if you use the selection tool within the inspector -- looks like a bullseye -- and then select the corresponding gtk component of the open app that you would like to inspect, you'll be able to drill down into the component hierarchy of the application. The key elements you're looking for are application-specific style attributes that can then be references in CSS. With some applications you may find that there aren't any application-specific selectors and the only way to effect changes to style are with globally recognized selectors.
    – Steve
    Feb 14 '19 at 15:46

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.