quobar

package module
v0.0.0-...-139f653 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2016 License: MIT Imports: 17 Imported by: 0

README

Quobar -- X11 status bar

The Quo is not Status

Quobar is a fairly minimalist status bar. It's greatest difference from dzen2, xmobar and such is that it is completely and from the ground up explicitly graphical, and aims to take advantage of this fact.

It's still pretty early in development.

A screenshot of the status bar

Why use raw X11?

Because QML wouldn't let me set strut hints.

The widgets are still abstracted away from the details, and use Go idioms for drawing.

Documentation

Overview

Package quobar manages status bar widgets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Main

func Main(defaultConfig Config) error

Main runs the main loop for quobar. It is available in library form to keep github.com/tv42/quobar/cmd/quobar short and easy to copy for editing.

func Register

func Register(p Plugin)

Register a plugin. The plugin name will be derived from the import path and the local type name.

As all Register errors are programmer errors, and it is intended to be used at init time, Register panics on errors.

Types

type Config

type Config struct {
	// Desired height of the status bar.
	HeightMillimeters float32

	// Truetype font file (*.ttf) to use by default
	FontPath string

	Foreground color.RGBA
	Background color.RGBA
}

Config contains configuration common to all plugins.

type Drawer

type Drawer interface {
	Draw(img draw.Image) error
}

Drawer is a widget that knows how to draw itself.

type Image

type Image interface {
	draw.Image
	// SubImage provides a sub image of Image without copying image
	// data. The underlying type returned is expected to implement
	// draw.Image.
	SubImage(r image.Rectangle) image.Image
}

type Plugin

type Plugin interface {
	// New returns a new instance of this plugin.
	//
	// In addition to methods required by the interface, the returned
	// value must support JSON unmarshaling.
	New(*State) (Drawer, error)
}

Plugin is implemented by all status bar widget plugins.

TODO layout negotiation, something like flexbox

type Resolution

type Resolution float32

Resolution maps physical measurements to pixels. This is useful for drawing widgets at a suitable size regardless to display pixel density.

func NewResolution

func NewResolution(pixels uint16, mm uint32) Resolution

NewResolution computes the resolution of a screen with the given dimensions.

func (Resolution) Pixels

func (p Resolution) Pixels(mm float32) int

Pixels converts millimeter measurements into pixels.

type State

type State struct {
	// Global configuration, as loaded from the configuration file.
	Config Config

	// The detected resolution of the display.
	Resolution Resolution
}

State contains runtime state visible to the plugins.

Directories

Path Synopsis
cmd
quobar
Command quobar is an X11 status bar.
Command quobar is an X11 status bar.
Package draw provides helpers for common drawing needs.
Package draw provides helpers for common drawing needs.
sparkline
Package sparkline draws small charts of timeseries data.
Package sparkline draws small charts of timeseries data.
truetype
Package truetype draws a textual message.
Package truetype draws a textual message.
internal
Package plugin contains status bar widget plugins.
Package plugin contains status bar widget plugins.
battery
Package battery provides a status bar widget that displays battery status.
Package battery provides a status bar widget that displays battery status.
clock
Package clock provides a status bar widget that displays the current time.
Package clock provides a status bar widget that displays the current time.
diskfree
Package diskfree provides a status bar widget that displays disk free in the users home directory.
Package diskfree provides a status bar widget that displays disk free in the users home directory.
meminfo
Package diskfree provides a status bar widget that display disk free in the users home directory.
Package diskfree provides a status bar widget that display disk free in the users home directory.

Jump to

Keyboard shortcuts

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