Help us shape the future of Go! Take the 2026 Go Developer Survey

omarchy

package
v0.1.1495 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package omarchy is what magpie knows of Omarchy (omarchy.org), the Hyprland desktop: whether it runs on one, and the look its current theme gives every surface, so magpie's windows can take that look there and nowhere else.

Omarchy (4.x) keeps the current theme under ~/.local/state/omarchy/current/theme: colors.toml, the palette every app's theme is made from, and shell.toml, the tokens its own shell draws with (controls, popups, menus). The font is omarchy-font-current's, the corners Hyprland's decoration:rounding (0 unless changed) and the border its general:border_size in the colour of the active window's.

Index

Constants

View Source
const PanelGap = 6

PanelGap is how far a drop-down panel keeps from the bar and the screen's edge, as Omarchy's own popups do.

View Source
const WidgetID = "usemagpie.magpie"

The bar widget: magpie's icon in Omarchy's own bar, where Omarchy's widgets are, rather than in the tray's drawer, which Omarchy keeps tray icons behind until each is pinned. It is a third-party Omarchy plugin, put in by hand the way Omarchy's shell README says (the files under ~/.config/omarchy/plugins/<id>/, then rescanPlugins and plugin enable), and only when the user asks for it in Settings.

Variables

This section is empty.

Functions

func AddWidget

func AddWidget(exe string) error

AddWidget puts the widget in Omarchy's bar, running exe (magpie) when clicked, or brings it up to date.

func ClickedOutside

func ClickedOutside(title string) bool

ClickedOutside is whether the pointer, which has just clicked, is off the window titled title and below the bar: a click on the bar is left to the icon it lands on, so the panel's own icon toggles it rather than closing and reopening it.

func Detect

func Detect() bool

Detect reports whether magpie runs on Omarchy. MAGPIE_OMARCHY=1 says it does (with MAGPIE_OMARCHY_THEME the theme's folder), =0 that it doesn't.

func Hyprland

func Hyprland() bool

Hyprland is whether magpie runs under Hyprland, Omarchy's compositor or anyone else's. A Wayland window can't place itself there, so a tray panel that asks to go under its icon opens wherever Hyprland floats it (the middle of the screen), framed and dimmed like any other window.

func KeepWidget

func KeepWidget(exe string) error

KeepWidget brings a widget that is in the bar up to date with this magpie, which may have moved or been updated since it was put in.

func Niri added in v0.1.1201

func Niri() bool

Niri is whether magpie runs under niri. As under Hyprland, a Wayland window can't place itself, so the tray panel opened where niri floats a new window: the middle of the screen (#1670).

func PanelAt

func PanelAt(width int) (mon string, x, y, maxH int, ok bool)

PanelAt is where a drop-down panel width wide goes: under the bar, its middle at the cursor (which has just clicked the icon it drops from), kept PanelGap inside the monitor the cursor is on. mon is that monitor's name, and x, y are from its top left corner, as Hyprland's move rule takes them: it adds the monitor's own place to them, so a monitor not at 0,0 was counted twice and the panel opened off the screen (#1785). maxH is the room it has down to the bottom of that monitor's work area.

func Parse

func Parse(b []byte) map[string]string

Parse reads a TOML file's key = value lines, a section's keys as "section.key": the little of TOML the theme files use (strings, numbers, booleans, comments).

func PlacePanel

func PlacePanel(title, mon string, x, y int) error

PlacePanel gives the window titled title a rule of its own (replacing the last one, by name): floating, pinned to every workspace, on monitor mon at x, y from its corner, with no border and fully opaque — the page draws its own frame, in the border's colour. It is asked each time the panel opens, as where it goes follows the click, and a config reload drops rules made this way.

func RemoveWidget

func RemoveWidget() error

RemoveWidget takes it out of the bar again.

func ReportClicks

func ReportClicks() error

ReportClicks has Hyprland announce every left click, until StopClicks.

func StopClicks

func StopClicks() error

StopClicks takes the bind away again.

func ThemeDir

func ThemeDir() string

ThemeDir is the current theme's folder, or "" when there is none.

func Vars

func Vars(colors, shell map[string]string, font string, rounding, border int) (map[string]string, string)

Vars turns the theme's palette (colors.toml) and shell tokens (shell.toml) into magpie's CSS custom properties, the rest given: the font's family, the corners' radius and the border's width.

func WatchClicks

func WatchClicks(click func())

WatchClicks calls click on each click ReportClicks announces, for as long as magpie runs, reconnecting when Hyprland restarts.

func WidgetOn

func WidgetOn() bool

WidgetOn is whether the widget has been put in.

Types

type NiriPanel added in v0.1.1201

type NiriPanel struct {
	// contains filtered or unexported fields
}

NiriPanel puts the panel under niri's bar, beside the icon clicked, each time it opens. niri has no rule a program can add while it runs and doesn't tell where the pointer is, so the panel is found by its title among the windows niri announces, made floating and moved there; it still opens in the middle and slides up. A click on another window takes niri's focus from it, and Wails' HideOnFocusLost closes it then.

func (*NiriPanel) Opening added in v0.1.1201

func (p *NiriPanel) Opening(x *int)

Opening says the panel is about to open, from a click at x across the tray's bar (the tray host's Activate(x, y)), or with x nil from anything else, when it goes to the top right.

func (*NiriPanel) Watch added in v0.1.1201

func (p *NiriPanel) Watch(title string)

Watch places each window of this process titled title as it opens, for as long as magpie runs, reconnecting when niri restarts.

type Theme

type Theme struct {
	Name  string            `json:"name"`  // tokyo-night
	Mode  string            `json:"mode"`  // dark or light
	Stamp string            `json:"stamp"` // changes when any of it does
	Vars  map[string]string `json:"vars"`  // CSS custom properties
}

Theme is the current theme as magpie draws with it.

func Current

func Current() (Theme, bool)

Current is the theme as it is now: read again only when one of its files has changed, and those looked at no more than once a second.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL