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 Niri() bool
- func PanelAt(width int) (mon string, x, y, maxH int, ok bool)
- func Parse(b []byte) map[string]string
- func PlacePanel(title, mon 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 NiriPanel
- 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 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 ¶
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 ¶
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, 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 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.
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.