Monday, July 15th, 2013

Konsole internal border

linux

Some terminal emulators, such as xterm and urxvt, allow an internal border to be defined, offsetting the terminal text from the edge of the window. I find this to be very aesthetically pleasing. As urxvt was giving me issues with copy and paste I thought I’d try using Konsole. Unfortunately Konsole has no equivalent option to internalBorder so I thought all hope was lost.

However, recently I’ve been playing around with KDE and Qt and I happened upon this nugget of information: Qt applications can be styled with CSS and this can be applied by passing a stylesheet as a command-line option to the application:

1
konsole -stylesheet style.css

Then using the following stylesheet I can add a margin to the Konsole window and by setting the background colour to match the background colour Konsole uses for text I achieved the same effect as internalBorder on urxvt.

1
2
3
4
QWidget {
    margin: 9;
    background-color: #eeeeee;
}

Here’s what my urxvt looks like:

Figure 1: Screenshot of urxvt window with internalBorder

...and here’s what Konsole looks like:

Figure 2: Screenshot of konsole window with CSS stylsheet

Note also that I hide the tab bar and menu bar by default. Hope this helps someone.

Comments

comments powered by Disqus