Allow custom theming of the headerbar
This merge request attempts to implement #239 (closed).
Currently it's still in an early stage and might require some refactoring, depending on the style-guide of Black Box.
The MR consists of 4 parts:
- Adding the ability to change the context coloring via
css
classes - Allowing to specify the context switching from outside the
BaseHeaderBar
class, so we can hook it up toTerminal
- Having a way to detect the different contexts (
normal, root & SSH
) - Hooking all parts together and listing for context switching
Example:
Normal mode:
Root mode:
SSH mode:
A few things to note:
The context switching correctly detects if a user is running a normal session, root session or is in ssh, however we are currently listening for context on the key_pressed
event, which is less than ideal.
A better approach would be to listen for child process events and see when one 'spawns' and 'exists' and update the context based on those.
I'm currently still looking for a way to do that with the VTE
api, but I'm not all to familiar with vala
so that might take some time.
The reason key_pressed is not ideal is the following:
- We listen for 'Enter' and then check the context which doesn't update the context on processes crashing or exiting
- Inherently the context could change independent of a key event e.g.
sleep 5 && sudo su
Since we check the context at the beginning we miss the context change later on
More details can be found in the individual commits.
FYI: If anything in this MR isn't idiomatic vala, please inform me and I will change it, as I'm not to familiar with the language and I'm a huge fan of the context being shown in the header.