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
- func AddWidget(exe string) error
- func ClickedOutside(title string) bool
- func Detect() bool
- func Hyprland() bool
- func KeepWidget(exe string) error
- func PanelAt(width int) (x, y, maxH int, ok bool)
- func Parse(b []byte) map[string]string
- func PlacePanel(title string, x, y int) error
- func RemoveWidget() error
- func ReportClicks() error
- func StopClicks() error
- func ThemeDir() string
- func Vars(colors, shell map[string]string, font string, rounding, border int) (map[string]string, string)
- func WatchClicks(click func())
- func WidgetOn() bool
- type Theme
Constants ¶
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.
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 ¶
AddWidget puts the widget in Omarchy's bar, running exe (magpie) when clicked, or brings it up to date.
func ClickedOutside ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ReportClicks ¶
func ReportClicks() error
ReportClicks has Hyprland announce every left click, until StopClicks.
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.