Heaven v0.1.0-1
C++ global-menu library for Wayland sessions
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Data Fields
HNBar Class Reference

Core class representing a bar application. More...

#include "HNBar.h"

Inheritance diagram for HNBar:
Inheritance graph
[legend]
Collaboration diagram for HNBar:
Collaboration graph
[legend]

Public Member Functions

HNCompositorcompositor () const noexcept
 Returns the currently bound compositor.
 
HNClientactiveClient () const noexcept
 Returns the currently active client.
 
HNClientgetClientById (const char *id) const noexcept
 Retrieves a client by its DBus identifier.
 

Static Public Member Functions

static std::shared_ptr< HNBarGetOrMake () noexcept
 Retrieves the singleton bar instance, creating it if necessary.
 
static std::shared_ptr< HNBarGet () noexcept
 Retrieves the existing bar instance.
 

Data Fields

CZSignal< HNBar * > onCompositorChanged
 Emitted when a compositor connection is established or lost.
 
CZSignal< HNBar * > onActiveClientChanged
 Emitted when the active client changes.
 
CZSignal< HNClient * > onClientCreated
 Emitted when a new client is connected.
 
CZSignal< HNClient * > onClientDestroyed
 Emitted when a client is disconnected.
 
CZSignal< HNClient * > onClientNameChanged
 Emitted when a client changes its application name.
 
CZSignal< HNClient * > onClientTopbarChanged
 Emitted when a client's active top bar changes.
 
CZSignal< HNObject * > onObjectCreated
 Emitted when a client creates a new object.
 
CZSignal< HNObject * > onObjectDestroyed
 Emitted when a client object is destroyed.
 
CZSignal< HNObject * > onObjectTitleChanged
 Emitted when a client object’s title changes.
 
CZSignal< HNObject * > onObjectParentChanged
 Emitted when a client object’s parent changes.
 
CZSignal< HNObject *, HNObject * > onObjectInsertedBefore
 Emitted after an object is inserted before a sibling.
 
Object property change signals
CZSignal< HNObject * > onObjectIconChanged
 Emitted when an object's icon changes (objects inheriting the HNWithIcon interface).
 
CZSignal< HNObject * > onObjectEnabledChanged
 Emitted when an object's enabled state changes (objects inheriting the HNWithEnabled interface)
 
CZSignal< HNObject * > onObjectShortcutChanged
 Emitted when an object's shortcut changes (objects inheriting the HNWithShortcut interface).
 
CZSignal< HNToggle * > onToggleCheckedChanged
 Emitted when a toggle object's checked state changes.
 

Detailed Description

Core class representing a bar application.

A bar application is responsible for displaying and managing UI bars associated with connected clients. It acts as a bridge between the compositor and multiple clients:

This class also exposes a set of signals to observe lifecycle changes, client state updates, and object hierarchy updates.

Member Function Documentation

◆ activeClient()

HNClient * activeClient ( ) const
inlinenoexcept

Returns the currently active client.

The active client is determined by the compositor.

Returns
Pointer to the active client, or nullptr if no client is active.

◆ compositor()

HNCompositor * compositor ( ) const
inlinenoexcept

Returns the currently bound compositor.

Returns
Pointer to the compositor, or nullptr if not yet bound.

◆ Get()

static std::shared_ptr< HNBar > Get ( )
staticnoexcept

Retrieves the existing bar instance.

Returns
Shared pointer to the bar instance, or nullptr if not yet created.

◆ getClientById()

HNClient * getClientById ( const char *  id) const
noexcept

Retrieves a client by its DBus identifier.

Parameters
idNull-terminated DBus identifier string.
Returns
Pointer to the client if found, otherwise nullptr.

◆ GetOrMake()

static std::shared_ptr< HNBar > GetOrMake ( )
staticnoexcept

Retrieves the singleton bar instance, creating it if necessary.

Returns
Shared pointer to the bar instance.

Field Documentation

◆ onActiveClientChanged

CZSignal<HNBar*> onActiveClientChanged

Emitted when the active client changes.

See also
activeClient()

◆ onClientDestroyed

CZSignal<HNClient*> onClientDestroyed

Emitted when a client is disconnected.

All objects belonging to the client are destroyed before this signal is emitted.

◆ onClientTopbarChanged

CZSignal<HNClient*> onClientTopbarChanged

Emitted when a client's active top bar changes.

Typically triggered when one of the client’s windows becomes active.

See also
HNClient::activeTopbar()

◆ onObjectCreated

CZSignal<HNObject*> onObjectCreated

Emitted when a client creates a new object.

The object's role/type remains constant during its lifetime.

◆ onObjectInsertedBefore

CZSignal<HNObject* , HNObject* > onObjectInsertedBefore

Emitted after an object is inserted before a sibling.

This signal is triggered once obj has been inserted into the hierarchy, immediately preceding sibling.

Parameters
objThe object being inserted.
siblingThe sibling before which obj is inserted.
  • If sibling belongs to a different parent, obj is reparented to match.
  • If sibling is nullptr, obj is appended to the end of its current parent's children list.
  • If obj has no parent and sibling is nullptr, the operation has no effect.

◆ onObjectParentChanged

CZSignal<HNObject*> onObjectParentChanged

Emitted when a client object’s parent changes.

The object is appended to the end of the new parent’s children list. This signal can also indicate that the object has been detached (no parent).

Objects inheriting the HNWithIcon interface.

◆ onObjectTitleChanged

CZSignal<HNObject*> onObjectTitleChanged

Emitted when a client object’s title changes.

Objects inheriting the HNWithTitle interface.


The documentation for this class was generated from the following file: