hypr

package
v0.161.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package hypr gives the shared Chrome window a drawn surface for a browse turn under Hyprland and puts it back after: Chrome draws nothing in a window the compositor does not show (on a workspace not shown, under a special workspace shown over its own, behind the front window of a monocle workspace), and a turn's draw checks, screenshots and clicks fail there. The surface is a headless output of its own, placed where no edge touches the person's monitors: the window is drawn there and never appears on the person's screen, and their monitors, workspaces and focus stay as they are. Every window Chrome opens while the turn runs and the person does not work at the desktop (a sign-in pop-up, a new window) maps there too, silently and without the focus, and goes back with the shared window after; one the person opens stays on their screen. It never changes Hyprland's configuration files: the output's monitor, workspace and window rules are set at runtime only.

Index

Constants

View Source
const (
	Output    = "BEEKEEPER-BROWSE"
	Surface   = "beekeeper-browse"
	SurfaceID = 31337
)

Output is the headless output a turn draws the window on, and Surface its workspace's name. The workspace has the number SurfaceID, far above the person's: a re-created output shows the workspace with the number it last showed, and a named workspace's number is the next free one below -1337, which a named workspace the person creates between turns takes.

Variables

View Source
var Size = [2]int{1280, 800}

Size is the output's mode: big enough for a page's screenshot.

Functions

func Hyprctl

func Hyprctl(ctx context.Context, args ...string) ([]byte, error)

Hyprctl is the Ctl of the running compositor.

func InView added in v0.159.6

func InView(ctx context.Context, ctl Ctl) (string, error)

InView says how a Chrome browser window is in the person's view, "" when none is (layout.inView).

func Running

func Running() bool

Running reports whether the session is a Hyprland one.

Types

type Ctl

type Ctl func(ctx context.Context, args ...string) ([]byte, error)

Ctl runs hyprctl with args and returns what it prints; tests replace it.

type Monitor

type Monitor struct {
	ID               int       `json:"id"`
	Name             string    `json:"name"`
	X                int       `json:"x"`
	Y                int       `json:"y"`
	Width            int       `json:"width"`
	Height           int       `json:"height"`
	ActiveWorkspace  Workspace `json:"activeWorkspace"`
	SpecialWorkspace Workspace `json:"specialWorkspace"`
	Focused          bool      `json:"focused"`
}

Monitor is a monitor as hyprctl monitors names it: X and Y in layout coordinates, Width and Height in pixels.

type Shown

type Shown struct {
	// Before is the window as it was; Where says where that was when the
	// compositor did not show it, "" when it did.
	Before Window `json:"before"`
	Where  string `json:"where"`
	// Moved says the placement moved the window onto the output.
	Moved bool `json:"moved"`
	// Created says the placement created the output, which Restore removes.
	Created bool `json:"created"`
	// Left says why Restore left the window where it was: closed, or moved
	// by the person to another workspace; "" when it put it back.
	Left string `json:"left,omitempty"`
	// Opened counts the other windows Restore moved off the output: ones
	// Chrome opened during the turn and still open after it.
	Opened int `json:"opened,omitempty"`
	// contains filtered or unexported fields
}

Shown is the shared window of a turn's placement, with what it was before. It is kept as JSON while the turn runs, so a browse that died mid-turn still puts the window back and ends the redirect.

func Show

func Show(ctx context.Context, ctl Ctl, hold time.Duration) (*Shown, error)

Show readies the headless output for a browse turn, creating it when there is none, and redirects every window a browser class maps until Restore, Redirect off or hold at the latest: a pop-up the turn's page opens is drawn there, never on the person's screen, and takes no focus. It moves Chrome's browser window onto the output when the compositor does not show it, the focus left where it is. An output that changed the person's view (their monitors' place, shown workspaces or focus) or took a numbered workspace is removed again and the window left where it is. It returns nil without a browser window; a step that fails is undone and its error names where the window is.

func (*Shown) Redirect added in v0.159.6

func (s *Shown) Redirect(ctx context.Context, ctl Ctl, on bool, hold time.Duration) error

Redirect turns the redirect of the windows Chrome opens on, until hold at the latest, or off: off while the person works at the desktop, so a window they open stays on their screen. A redirect already so is left.

func (*Shown) Restore

func (s *Shown) Restore(ctx context.Context, ctl Ctl) error

Restore ends the redirect, then puts the window back on its own workspace, and every other window on the output's workspace with it (one Chrome opened during the turn); then it removes the output, unless a window failed to move off it, which removing the output would put on the person's screen. One closed since, or moved by the person to a third workspace, is left where it is, and Left says so.

func (*Shown) Turned added in v0.159.6

func (s *Shown) Turned(ctx context.Context, ctl Ctl) (string, error)

Turned says how the person turned to the shared window during the turn, "" when they did not: one of their monitors shows the window's own workspace, where it was moved from or is drawn on, a special workspace shown over it or not.

type Window

type Window struct {
	Address        string    `json:"address"`
	Class          string    `json:"class"`
	Workspace      Workspace `json:"workspace"`
	Floating       bool      `json:"floating"`
	Fullscreen     int       `json:"fullscreen"`
	Monitor        int       `json:"monitor"`
	FocusHistoryID int       `json:"focusHistoryID"`
	Pid            int       `json:"pid"`
}

Window is a client as hyprctl clients names it.

type Workspace

type Workspace struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

Workspace is a workspace as hyprctl names it.

Jump to

Keyboard shortcuts

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