Documentation
¶
Overview ¶
Package bar renders lys-shell's bar: the layer surfaces docked to the screen edges, one per output that the config gives a layout.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindLayout ¶
FindLayout resolves the layout for one output's connector name: the exact monitor match wins, then "*" as the fallback, and extends chains inherit the unset sections of their parent layout. A monitor with neither an exact entry nor a "*" entry gets no bar.
func Run ¶
func Run() error
Run hands the session's cursor to lys-login's display manager in the background, loads the user config and shows the bar. A config failure logs and falls back to defaults — the Rust shell's behavior — rather than refusing to start; a failed cursor record only logs, as the greeter then keeps its own cursor.
Types ¶
type Factory ¶
type Factory func(ctx ModuleContext) (Module, error)
Factory builds one module instance.
type Module ¶
Module is one bar module: a live widget tree plus whatever timers keep it current. The interface grows update/message plumbing as services land.
func Create ¶
func Create(name string, ctx ModuleContext) (Module, error)
Create builds the module named by a layout entry. Custom modules (custom-*) resolve through the [modules.custom] definitions; a name outside both is an error, logged by the caller while the rest of the bar builds - as the Rust factory warns "module not implemented" for a schema module without one (updates).
type ModuleContext ¶
type ModuleContext struct {
Config *config.Config
App *app.Application
Font render.Font
Style *barStyle
Hyprland *hyprland.Connection
Battery upower.Source
Brightness brightness.Source
Pulse pulse.Source
Media mpris.Source
Bluetooth bluetooth.Source
Network network.Source
Networking *network.Service // secret agent, VPNs, wifi; nil without NM
PowerProfiles powerprofiles.Source
IdleInhibit *idleinhibit.State
Treeman treeman.Source
Notifications *notifications.Service
Recorder *recorder.State
Mail *mail.Service
Bitwarden *bitwardenHost
SNI *sni.Store
Weather *weather.Service
// SetConfig writes a runtime override and persists it (the Rust
// ConfigService property set the dropdowns use); nil without a
// config service.
SetConfig func(path string, value any)
// Toast shows an OSD toast (the Rust ToastBus); nil without an OSD.
Toast func(label, icon string)
// Clipboard is the session clipboard history, nil when the
// compositor has no data-control protocol (the launcher's
// clipboard mode reads it).
Clipboard *clipboard.Clipboard
// Tray drives the tray items and their menus; nil without a host.
Tray TrayService
CustomUpdates *customUpdates
// PowerMenu is the native power menu the power module's :menu
// opens; nil without one.
PowerMenu *powermenu.Menu
// Dropdowns opens the dropdown:<name> popovers; RunWith owns one
// registry across outputs.
Dropdowns *dropdownRegistry
// Attachers collects modules that need the live layer surface
// (idle-inhibit binds its inhibitor to it); RunWith calls Attach
// on each once the layer exists.
Attachers *[]interface{ Attach(app.Host) }
// Connector is the output this bar instance sits on; per-output
// modules (workspaces) key their state on it.
Connector string
// Screenshot starts a capture on the in-process screenshot host
// (the `lys-shell screenshot ...` builtin); nil before the host is up.
Screenshot func(mode, target string)
// Theme is the bar stylesheet every bar root attaches; nil in
// headless construction, where the tree builds unstyled.
Theme *apptheme.Theme
// Alert replaces showAlert's modal dialog (tests answer it); nil
// asks through the application.
Alert func(spec alertSpec, answer func(accepted bool))
// contains filtered or unexported fields
}
ModuleContext carries what a module needs at construction time: the resolved bar style, the config, and the loop it schedules timers on. App is nil only in headless construction (tests): the module then builds its tree without scheduling updates. Hyprland is nil when the compositor is not Hyprland; Hyprland-only modules error in that case.
func (ModuleContext) Every ¶
func (c ModuleContext) Every(d time.Duration, fn func())
Every schedules fn on the application loop; a no-op when the context is headless.
func (ModuleContext) Invoke ¶
func (c ModuleContext) Invoke(fn func())
Invoke marshals fn onto the loop goroutine, or for a headless context runs it inline under headlessLoop. A retired generation's work is dropped either way.
func (ModuleContext) Life ¶
func (c ModuleContext) Life() context.Context
Life is the module's lifetime: canceled when its generation retires (a config reload), never for a context outside one. Module loops and subscriptions run under it.
func (ModuleContext) OnRetire ¶ added in v0.3.3
func (c ModuleContext) OnRetire(release func())
OnRetire runs release as the module's generation retires, before retire returns and so before the next generation mounts: for what only one holder can have, which the next generation's module would be refused. Call it on the loop, as mounting does. Outside a generation nothing retires.
type TrayService ¶
type TrayService interface {
Activate(ctx context.Context, it sni.Item) error
SecondaryActivate(ctx context.Context, it sni.Item) error
ContextMenu(ctx context.Context, it sni.Item) error
// OpenMenu is AboutToShow and the layout, once per showing.
OpenMenu(ctx context.Context, it sni.Item) (sni.MenuItem, error)
// MenuLayout re-reads an open menu's layout without AboutToShow.
MenuLayout(ctx context.Context, it sni.Item) (sni.MenuItem, error)
// SubmenuOpening is AboutToShow for a submenu as it opens; true asks
// for the layout to be read again.
MenuClicked(ctx context.Context, it sni.Item, id int32) error
// WatchMenu ticks on the item's menu changes until stop, which
// closes the feed and may be called more than once.
WatchMenu(key string) (<-chan struct{}, func())
// WantPixmapSize keeps the items' pixmaps for px device pixels
// until release.
WantPixmapSize(px int) (release func())
}
TrayService is what the tray module drives: the item controls, the DBusMenu calls, and the open-menu change feed. The shell wires the SNI host; tests fake it.
func NewTrayService ¶
func NewTrayService(h *sni.Host) TrayService
NewTrayService adapts a running SNI host.
Source Files
¶
- actions.go
- alertdialog.go
- audiodropdown.go
- bar.go
- battery.go
- batterydropdown.go
- bitwarden.go
- bitwardendropdown.go
- bitwardengenerator.go
- bitwardenlauncher.go
- bitwardensend.go
- bluetooth.go
- bluetooth_dropdown.go
- bluetooth_helpers.go
- bluetooth_notify.go
- bluetooth_pairing.go
- bluetooth_widgets.go
- brightness.go
- brightnessdropdown.go
- calendardropdown.go
- capture.go
- cava.go
- clock.go
- compositor.go
- compositorws.go
- configwrite.go
- cursorrecord.go
- custom.go
- cwsbackends.go
- cwsmodule.go
- cwswidgets.go
- daemons.go
- dashboard.go
- dashboarddropdown.go
- dropdown.go
- dropdown_builders.go
- dropdown_size.go
- dropdown_template.go
- hyprland.go
- icon.go
- idleinhibit.go
- keybindmode.go
- keyboardlayout.go
- lateservices.go
- launcherhost.go
- layout.go
- lockkeys.go
- mail.go
- maildropdown.go
- media.go
- mediadropdown.go
- microphone.go
- modulebutton.go
- modules.go
- netservice.go
- netstat.go
- network.go
- networkdropdown.go
- networkhelpers.go
- networksave.go
- networkvpn.go
- nightlight.go
- notificationdropdown.go
- notifications.go
- notifyservice.go
- offloop.go
- portals.go
- power.go
- powerprofiles.go
- recorder.go
- recorderdevices.go
- recorderdropdown.go
- reload.go
- ring.go
- screenshot.go
- secretentry.go
- separator.go
- style.go
- stylesheet.go
- sysinfo.go
- systray.go
- treeman.go
- treemandropdown.go
- usersession.go
- visibility.go
- volume.go
- weather.go
- weatherdropdown.go
- windowtitle.go
- worldclock.go