taskbar

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2024 License: MIT Imports: 10 Imported by: 0

README

Go Taskbar package

Build workflow Go Report Card Go Reference

Set window hints like progress in taskbar on Linux.

go run example/taskbar-cli.go -desktop <desktop file name> -demo

Uses libunity Launcher API or Xapp window hints depending on desktop environment. No libs installed needed, Dbus calls and X11 properties are used instead.

Documentation

Overview

Package to set window hints like progress in taskbar on Linux.

You can enable progress bar, set an urgent state to an application ("pulse") or add a counter badge in taskbar. Take a note that you should not make your application rely on these features, as whether they will work depends on users desktop environments.

The package uses libunity Launcher API (https://wiki.ubuntu.com/Unity/LauncherAPI) by default, which is supported in KDE and in GNOME with extensions like Dash-to-Dock. On Cinnamon it uses Xorg hints, the same that are used in libxapp (https://github.com/linuxmint/xapp). Neither libunity nor libxapp don't need to be installed for this package to work, direct Dbus calls and Xorg hints are used instead.

There are 3 environment variables to enforce specific behaviour for this library:

  • GO_TASKBAR_BACKEND chooses specific backend no matter what should be selected automatically by code. Only useful for testing. Possible values: libunity, xapp
  • GO_TASKBAR_DESKTOP_NAME overwrites desktop file name passed to the library for libunity backend to work. This can be useful for packagers (especially for snaps, because desktop file names are changed there automaticaly) without the need to patch a program.
  • GO_TASKBAR_TEST_XID needs to be set to proper X11 window id to pass Xapp test.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Taskbar

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

Taskbar item data

func Connect

func Connect(desktopName string, xid int) (*Taskbar, error)

Creates Taskbar item. `desktopName` is a name of desktop file to be worked with using libunity Launcher API (".desktop" suffix can be omitted). `xid` is an xorg window ID used in case if taskbar item is modified using xapp window hints, set it to 0 if not used.

func (*Taskbar) Count

func (t *Taskbar) Count() int

Gets current counter value

func (*Taskbar) Disconnect

func (t *Taskbar) Disconnect() error

Resets all properties and gracefully disconnects from taskbar

func (*Taskbar) Progress

func (t *Taskbar) Progress() int

Gets current progress value

func (*Taskbar) Pulse

func (t *Taskbar) Pulse() bool

Gets current pulse value

func (*Taskbar) SetCount

func (t *Taskbar) SetCount(c int) error

Sets counter value (only supported by libunity Launcher API)

func (*Taskbar) SetProgress

func (t *Taskbar) SetProgress(p int) error

Sets progress value (0-100)

func (*Taskbar) SetPulse

func (t *Taskbar) SetPulse(p bool) error

Enables or disables pulse. This property highlights the item in taskbar, dragging user attention. If pulse is enabled, progress is not shown.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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