hyprsunset

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 14 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 hyprsunset is the hyprsunset module's service side: the blue-light filter process and its control socket, the sunrise/sunset schedule (NOAA sunrise equation, no network), the GeoClue location lookup, and the manual-override record that survives restarts (crates/wayle-bar-workspaces/src/modules/hyprsunset).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearOverride

func ClearOverride(dir string)

ClearOverride drops the record (a sunrise/sunset crossing ends it).

func SaveOverride

func SaveOverride(dir string, o Override, now time.Time)

SaveOverride records a toggle made at now (persist.rs save); write failures are quiet, as the record is a convenience.

func SocketPath

func SocketPath() (string, bool)

SocketPath is hyprsunset's control socket, $XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.hyprsunset.sock; false without either variable.

Types

type Filter

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

Filter owns the hyprsunset child lys-shell spawned. One per process, like the Rust CHILD static: stopping signals exactly that child instead of every hyprsunset on the system.

func NewFilter

func NewFilter() *Filter

NewFilter returns the driver for the real hyprsunset binary.

func (*Filter) Running

func (f *Filter) Running() bool

Running reports whether a child is tracked (tests).

func (*Filter) Start

func (f *Filter) Start(temp, gamma int) error

Start spawns hyprsunset at temp and gamma, terminating any previous child first so none leaks (helpers.rs start).

func (*Filter) Stop

func (f *Filter) Stop() error

Stop terminates the tracked child; a no-op without one.

type Location

type Location struct {
	Latitude  float64
	Longitude float64
}

Location is a resolved position in decimal degrees.

func QueryLocation

func QueryLocation(ctx context.Context, conn *dbus.Conn) (Location, error)

QueryLocation resolves the position once over GeoClue2 on conn (the system bus in the shell): get a client, set DesktopId and the city accuracy, start it, and take the first LocationUpdated. Any failure (no daemon, no agent, denied, timeout) is an error the caller treats as "use the configured coordinates".

type Override

type Override struct {
	Phase   Phase
	Enabled bool
}

Override is a manual toggle remembered across restarts: the filter state it chose and, when the auto-schedule ran, the solar phase it was made in (zero Phase for none).

func LoadOverride

func LoadOverride(dir string, now time.Time) (Override, bool)

LoadOverride reads the record; false when absent, malformed, or stale.

type Phase

type Phase uint8

Phase is whether the sun is up at a place and time.

const (
	PhaseDay Phase = iota + 1
	PhaseNight
)

Solar phases.

func PhaseAt

func PhaseAt(now time.Time, latitude, longitude float64) Phase

PhaseAt is solar.rs phase_at: day between sunrise and sunset of now's UTC date, night otherwise; polar day is day and polar night is night. Latitude and longitude are decimal degrees, north and east positive.

func (Phase) String

func (p Phase) String() string

String is the persist-record spelling.

type State

type State struct {
	Temp  int
	Gamma int
}

State is the running filter's live values.

func QueryState

func QueryState(socket string) (State, bool)

QueryState asks a running hyprsunset for its temperature and gamma (helpers.rs query_state); false when none answers, which is how the module learns the filter is off.

Jump to

Keyboard shortcuts

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