Document tab size in Geany
I have been using Geany for years to edit code. Mostly for JavaScript and PHP and lately for Lua. It gives great productivity as you can search code with a shortcut. It searches for function definitions, but you can also search for any text. And you can click results to quickly navigate there.
The only problem is that all files need to be opened to get included in the search. So I use the Project feature to organize open files and simply open all my Lua files. For the game I'm currently making, that's around 20 files. It works fine on Mac, but on Linux the default GTK theme makes the file tabs very big and 20 cannot fit on the screen. So I have to navigate between Files/Documents and Symbols tab all the time instead of having it all on one screen.
I have googled a lot to find the way to reduce the size of tabs because Geany itself doesn't have an option. Even if you reduce the font size, there's just too much padding with blank space.
Today I discovered GTK Inspector. A tool that allows you to run any GTK application and inspect it's elements. Just run Geany like this:
GTK_DEBUG=interactive geany
Then press Ctrl+Shift+D and Alt+tab into inspector.
After some fiddling, I managed to find the notebook tab elements that control the font and spacing. I was still a mystery how to write proper CSS as the one shown in Gtk Inspector seemed strange and had a lot of text that you cannot copy/paste. Then I noticed it shows the .css file from the theme. In my case, it was gtk-contained-dark.css. And in that file I finally found the CSS responsible for layout. I typed the following custom CSS into Gtk Inspector:
notebook > header tab { min-height: 5px; padding: 0px 12px; }
And suddenly I can see 30+ files.
The next step was to make this permanent. I added the same CSS line into ~/.config/gtk-3.0/gtk.css file in my home directory and finally I can get full productivity with Geany.
Tweet to @mbabuskov Tweet Milan Babuškov, 2024-09-03