modules

package
v0.0.0-...-fb663c4 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package modules provides functions meant to be used in package config. Every function must accept a single string argument and return a string.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BatPerc

func BatPerc(b string) string

BatPerc returns battery remaining percentage of b.

Ex: BAT0

func BatState

func BatState(b string) string

BatState returns battery state of b.

Ex: BAT0

func BatTime

func BatTime(b string) string

BatTime returns battery time remaining of b in 0h 0m format.

Ex: BAT0

func CPUFreq

func CPUFreq(_ string) string

CPUFreq returns CPU frequency in human readable format.

func CPUPerc

func CPUPerc(_ string) string

CPUPerc returns CPU used percentage since CPUPerc last ran.

Do not run CPUPerc more than once.

func Cat

func Cat(p string) string

Cat returns first line of the file in path p.

Ex: /sys/class/backlight/intel_backlight/brightness

func Date

func Date(f string) string

Date returns current date formatted according to f.

Run go doc time.Format for other formats.

Ex: Jan 2 2006 (Mon) 3:04 PM

func DirFiles

func DirFiles(d string) string

DirFiles returns number of files in directory d.

Ex: /home/foo

func DiskFree

func DiskFree(m string) string

DiskFree returns human readable free disk space in mount point m.

Ex: /

func DiskPerc

func DiskPerc(m string) string

DiskPerc returns disk used percentage in mount point m.

Ex: /

func DiskTotal

func DiskTotal(m string) string

DiskTotal returns human readable total disk space in mount point m.

Ex: /

func DiskUsed

func DiskUsed(m string) string

DiskUsed returns human readable used disk space in mount point m.

Ex: /

func Entropy

func Entropy(_ string) string

Entropy returns available entropy.

func Hostname

func Hostname(_ string) string

Hostname returns hostname.

func Ipv4

func Ipv4(i string) string

Ipv4 returns Ipv4 address of interface i.

Ex: wlan0

func Ipv6

func Ipv6(i string) string

Ipv6 returns Ipv6 address of interface i.

Currently does not work.

Ex: wlan0

func Kernel

func Kernel(_ string) string

Kernel returns kernel release.

func LoadAvg

func LoadAvg(_ string) string

LoadAvg returns system average load.

func Music

func Music(_ string) string

Music returns music currently on MPD.

func NetName

func NetName(i string) string

NetName returns SSID of the network interface i is connected to.

Ex: wlan0

func NetReceive

func NetReceive(i string) string

NetReceive returns bytes received in interface i since NetReceive last ran.

Do not run this function more than once.

Ex: wlan0

func NetTransfer

func NetTransfer(i string) string

NetTransfer returns bytes transferred in interface i since NetTransfer ran.

Do not run this function more than once.

Ex: wlan0

func RAMFree

func RAMFree(_ string) string

RAMFree returns human readable free memory.

func RAMPerc

func RAMPerc(_ string) string

RAMPerc returns memory used percentage.

func RAMTotal

func RAMTotal(_ string) string

RAMTotal returns human readable total memory.

func RAMUsed

func RAMUsed(_ string) string

RAMUsed returns human readable used memory.

func Shell

func Shell(c string) string

Shell executes command c prefixed with 'sh -c'.

Ex: brightnessctl -m | awk 'BEGIN { FS = "," }; 1 { print $4; exit }

func SwapFree

func SwapFree(_ string) string

SwapFree returns human readable free swap.

func SwapPerc

func SwapPerc(_ string) string

SwapPerc returns swap used percentage.

func SwapTotal

func SwapTotal(_ string) string

SwapTotal returns human readable total swap.

func SwapUsed

func SwapUsed(_ string) string

SwapUsed returns human readable used swap.

func Temp

func Temp(p string) string

Temp returns temperature in sensor file p in degree celsius.

Ex: /sys/class/thermal/thermal_zone0/temp

func Uptime

func Uptime(_ string) string

Uptime returns system uptime in 0h 0m format.

func UserGID

func UserGID(_ string) string

UserGID returns current user GID.

func UserUID

func UserUID(_ string) string

UserUID returns current user UID.

func Username

func Username(_ string) string

Username returns current username.

func WifiPerc

func WifiPerc(i string) string

WifiPerc returns wifi strength percentage.

Ex: wlan0

Types

type Fcall

type Fcall struct {
	Func   func(arg string) string
	Prefix string
	Arg    string
	Suffix string
	Sleep  uint
	Sig    uint
}

Fcall contains data for executing a module.

Jump to

Keyboard shortcuts

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