sysmon

package module
v0.0.0-...-3f331ed Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2021 License: MIT Imports: 2 Imported by: 0

README

sysmon

Shows a graph with the recent CPU usage history in your i3 status bar.

demo

Installation

; go install github.com/alcortesm/sysmon/cmd/sysmon@latest
; go install github.com/alcortesm/sysmon/cmd/sysmon-server@latest

Usage

To use sysmon as part of your i3status bar:

  1. Create an executable script with the following content and add it to your path:

    #!/bin/bash
    i3status | while :
    do
        read line
        load=`sysmon`
        echo "sysmon: $load | $line" || exit 1
    done
    

    This will call the regular i3status command and the sysmon command and combine their outputs into a single line.

    For purpose of demonstration, we will call this script i3status_with_sysmon.

  2. Now modify your .i3/conf file, to tell i3 to run your script, instead of the regular i3status command:

    bar {                                                                           
    #    status_command i3status                                               
        status_command i3status_with_sysmon                                               
    }
    

Documentation

Index

Constants

View Source
const (
	// WellKnownBusName is the D-bus "well know bus name" that the
	// server will use for its connection.
	WellKnownBusName = "com.github.alcortesm.sysmon1"
	// InterfaceName is the D-bus interface name the sysmon server implements.
	InterfaceName = WellKnownBusName
	// Path is the single D-bus path the server will use.
	Path = "/com/github/alcortesm/sysmon1"
	// IntrospectDataString is the string that the Instrocpect method will return.
	IntrospectDataString = `<node name="` + Path + `">
	<interface name="` + InterfaceName + `">
		<method name="CPUsUsageHistory">
			<arg direction="out" type="ad"/>
		</method>
	</interface>` + introspect.IntrospectDataString + `</node>`
	// CPUsUsageHistoryMethod is the dbus method id call for clients.
	CPUsUsageHistoryMethod = WellKnownBusName + ".CPUsUsageHistory"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server interface {
	// Connect connects the server to the D-bus system.
	Connect() error
	// Disconnect disconnects the server from the D-bus system.
	Disconnect() error
	// CPUsUsageHistory returns the recent history of the combined usage
	// percentage of all the CPUs.  This method is exposed through the
	// dbus system.
	CPUsUsageHistory() ([]float64, *dbus.Error)
}

The server interface provides a higher-level API suitable for applications to run and shutdown sysmon servers.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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