omarchy

package
v0.1.708 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 15 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 PanelAt

func PanelAt(width int) (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. 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 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, at x, y, 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 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