From a8febf928ddab26e0caf2ae8340b8c62af81dd3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Kintzi?= Date: Mon, 13 Nov 2023 18:34:09 +0100 Subject: [PATCH] Add Makefile and man pages --- Makefile | 28 ++++ cmds/pavolmon/pavolmon.1.scd | 27 ++++ statusbar.1.scd | 27 ++++ statusbar.5.scd | 276 +++++++++++++++++++++++++++++++++++ 4 files changed, 358 insertions(+) create mode 100644 Makefile create mode 100644 cmds/pavolmon/pavolmon.1.scd create mode 100644 statusbar.1.scd create mode 100644 statusbar.5.scd diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d4066f5 --- /dev/null +++ b/Makefile @@ -0,0 +1,28 @@ +.DEFAULT_GOAL=all +PREFIX?=/usr/local +BINDIR?=$(PREFIX)/bin +MANDIR?=$(PREFIX)/share/man + +statusbar.1: statusbar.1.scd + scdoc < $< > $@ + +statusbar.5: statusbar.5.scd + scdoc < $< > $@ + +pavolmon.1: cmds/pavolmon/pavolmon.1.scd + scdoc < $< > $@ + +pavolmon: ./cmds/pavolmon/volmon.cpp + $(CXX) -o $@ $(shell pkg-config -libs libpulse) -lm $< + +statusbar: + go build ./cmds/statusbar + +all: statusbar pavolmon statusbar.1 statusbar.5 pavolmon.1 + +install: all + mkdir -p $(DESTDIR)/$(BINDIR) $(DESTDIR)/$(MANDIR)/man1 $(DESTDIR)/$(MANDIR)/man5 + install -m755 statusbar $(DESTDIR)/$(BINDIR)/statusbar + install -m755 pavolmon $(DESTDIR)/$(BINDIR)/pavolmon + install -m644 statusbar.1 $(DESTDIR)/$(MANDIR)/man1/statusbar.1 + install -m644 statusbar.5 $(DESTDIR)/$(MANDIR)/man5/statusbar.5 diff --git a/cmds/pavolmon/pavolmon.1.scd b/cmds/pavolmon/pavolmon.1.scd new file mode 100644 index 0000000..d9a6718 --- /dev/null +++ b/cmds/pavolmon/pavolmon.1.scd @@ -0,0 +1,27 @@ +pavolmon(1) + +# NAME + +pavolmon - monitor volume of a default PulseAudio output device + +# SYNOPSIS + +*pavolmon* + +# DESCRIPTION + +This simple program connects to the PulseAudio server and constantly monitors +the volume level of a default output device. Whenever it changes it prints on +the standard output a single line containing the level. + +*pavolmon* program is a part of the *statusbar* program distribution. + +# SEE ALSO + +_statusbar_(1) + +# AUTHORS + +Maintained by Radosław Kintzi. Up-do-date sources can be found at +https://gobytes.dev/statusbar. Bugs/patches can be submitted by email +to ~rkintzi/GoSway@lists.sr.ht. diff --git a/statusbar.1.scd b/statusbar.1.scd new file mode 100644 index 0000000..574eff8 --- /dev/null +++ b/statusbar.1.scd @@ -0,0 +1,27 @@ +statusbar(1) + +# NAME + +statusbar - content generator for swaybar/i3bar + +# SYNOPSIS + +*statusbar* [-h | -c config.yaml ] + +# OPTIONS + +*-config filename* + Configuration file to parse (default "~/.config/statusbar/config.yaml") + +*-c string* + Equivalent to -config (default "~/.config/statusbar/config.yaml") + +# SEE ALSO + +_statusbar_(5) + +# AUTHORS + +Maintained by Radosław Kintzi. Up-do-date sources can be found at +https://gobytes.dev/statusbar. Bugs/patches can be submitted by email +to ~rkintzi/GoSway@lists.sr.ht. diff --git a/statusbar.5.scd b/statusbar.5.scd new file mode 100644 index 0000000..4584972 --- /dev/null +++ b/statusbar.5.scd @@ -0,0 +1,276 @@ +statusbar(5) + +# NAME + +statusbar - configuration file + +# DESCRIPTION + +By default, the program reads its configuration from the +~/.config/statusbar/config.yaml file. The following is a good starting point +for further customization: + +``` +- widget: DefaultConfig +- widget: Window + excludeAppIDs: ["foot"] + titlePrefix: "\uf2a3 " + ellipsis: "\u2026" +- widget: ExternalProgram + command: /usr/bin/i3status +- widget: SystemMonitor + format: "\ue8b0 {cpu}% \ue8b2 {mem}% \ue8b3 {load}%" + separator: false + separatorBlockWidth: 0 +- widget: TempMonitor + format: " \ue8a2 {temp}\u00B0C \ue8a1 {fan}" +- widget: Volume + scrollDownCommand: volumeup + scrollUpCommand: volumedown + rightClickCommand: mute toggle + leftClickCommand: pavuctrl +- widget: BatteryMonitor + format: "{icon} {level}%" + statusIcons: "\ue85b\ue85b " + chargingIcons: "\ue850\ue851\ue852\ue853\ue854\ue855\ue856\ue857\ue858\ue859\ue85a" + dischargingIcons: "\ue860\ue861\ue862\ue863\ue864\ue866\ue866\ue867\ue868\ue869\ue86a" + colors: "#9e1828,10,#968a38,20,#ccc" + criticalLevel: 5 +- widget: DateTime + format: "\uf2ab 2006-01-02 \uf394 15:04:05" +``` + +Each item in the list corresponds to a widget on the status bar. Widgets are +placed on the bar in the order they appear in the configuration file. You can +configure multiple instances of the same widget if you find it useful. Please +refer to the section below for the available widgets and their configuration. + +To ensure that the statusbar is run in sway, you need to replace the +_status_command_ in sway's configuration file (usually +~/.config/sway/config) with the following: + +``` +bar { + status_command statusbar +} +``` + +## Default Configuration + +In the above example, the first section of the configuration file refers to +the DefaultConfig widget. Despite its somewhat misleading name, it does not +describe an actual widget. Instead, all the configuration options provided in +this section are used to initialize other widgets, unless their configuration +overwrites them. The settings that can be used to describe the default +configuration are listed and explained in the next section below. In the +example, no options were provided, so the section could have been omitted. + +## Common options + +Options described in this section can be set for every widget, as well +as in the special widget DefaultConfig (described above). This options are +also described in the swaybar-protocol(7). + +- *color* - Sets the text color of the widget using #rrggbbaa or #rrggbb + notation. + +- *background* - Sets the background color of the widget. + +- *border* - Sets the border color for the widget. + +- *borderTop* - Sets the height in pixels of the top border. The default value + is 1. + +- *borderBottom* - Sets the height in pixels of the bottom border. The default + value is 1. + +- *borderLeft* - Sets the width in pixels of the left border. The default + value is 1. + +- *borderRight* - Sets the width in pixels of the right border. The default + value is 1. + +- *minWidth* - Sets the minimum width to use for the widget. The width can be + specified in pixels or as a string to allow for dynamic calculation based on + the width of the text. + +- *separator* - Specifies whether the bar separator should be drawn after the + widget. Refer to sway-bar(5) for + more information on how to set the separator text. + +- *separatorBlockWidth* - Sets the amount of pixels to leave blank after the + block. The separator text will be displayed centered in this gap. The + default value is 9 pixels. + +- *align* - Specifies how the text should be aligned inside the block if it + does not span the full width. The options are left (default), right, or + center. + +# AVAILABLE WIDGETS + +Currently, the statusbar provides following widgets. + +## BatteryMonitor + +The BatteryMonitor widget is used to display the status and level of the +system battery. It offers the following options for customization: + +- *format*: This option determines how the battery status is displayed. The + default format is *{icon} {level}*. It can also include a *{status}* + indicator that shows text describing the battery status. By default, the + statuses are displayed as "Full," "Not charging," "Charging," "Discharging," + and "Unknown." However, these labels can be changed using the *statusFull*, + *statusNotCharging*, *statusCharging*, and *statusDischarging* options + described below. The *{level}* placeholder can also include a formatting + verb, as defined in the [Golang's fmt package + documentation](https://pkg.go.dev/fmt#hdr-Printing). For example, you can + use {level:%2d} to format the level with at least two-digit (the + default formatting is *%d*). + +- *statusIcons*: Specifies four icons (Unicode points) that correspond to the + "Full," "Not charging," "Charging," and "Discharging" statuses. These icons + are used in place of the *{icon}* placeholder. The default icons are *FNCD*. + +- *chargingIcons*: If provided, these icons are displayed instead of the *C* + icon defined using the *statusIcons* option. The icons should represent + different battery levels, starting with the icon that represents the lowest + level. There is no limit to the number of icons that can be used. + +- *dischargingIcons*: Similar to the *chargingIcons* above. Specifies icons + that are displayed instead of the *D* icon defined using the *statusIcons* + option. + +- *statusFull*, *statusNotCharging*, *statusCharging*, *statusDischarging*: + These options allows to specify labels for the "Full", "Not charging", + "Charging", and "Discharging" statuses. + +- *colors*: This option specifies the colors in which the widget will be + rendered based on the battery levels. For instance, if you set this option + to *#9e1828,10,#968a38,20,#ccc*, the widget will appear red when the battery + level is below or equal to 10, yellow when the level is between 10 and 20 + (inclusive), and light gray otherwise. + +- *criticalLevel*: If this option is set above 0, the user will receive an + urgent notification when the battery level falls below the provided value. + Notifications are sent using D-bus. + +- *notificationTitle*: Provides the title of the notification sent when the + battery level reaches a critically low level. The default title is: + "Critical Battery Level" + +- *notificationBody*: Specifies the notification body. The default message is: + "Your battery level is critically low.\nPlease connect your device to + a power source immediately to avoid any unexpected shutdowns." + +- *notificationIcon*: This option allows to set notification icon. + +- *ueventFile*: Specifies the file that keeps infomation about the battery + status (the default file is "/sys/class/power_supply/BAT0/uevent") + +## DateTime + +The DateTime widget displays the current date and time. It has one +configuration option, which is *format*. The default format is *2006-01-02 +15:04:05*, and you can specify any format that is accepted by Golang's +time.Format method. + +## ExternalProgram + +The ExternalPrgram widget runs an external program that generates +swaybar/i3bar content. It relays the output of the program to the bar and also +forwards events from the bar to the external program. This widget is +beneficial if you want to incorporate information from another content +generator into your bar. + +The only configuration option available for this widget is *command*. It +allows you to specify the command that will execute the external generator. + +## SystemMonitor + +The SystemMonitor widget provides information regarding the utilization of the +CPU and RAM, as well as the system load. It offers a single configuration +option, which is the *format*. The default format is *CPU:{cpu}% MEM:{mem}% +LOAD:{load}%*. You have the flexibility to change the order or remove any of +the indicators. + +Additionally, the format option allows you to specify the width and precision +used to format floating numbers. Please refer to the Golang's fmt package +documentation for more details. For example, using "{cpu:3.2f}%" will output +at least three characters for the decimal part, padding it with spaces if +necessary, and will display two digits for the fractional part. Please note +that the width and precision specification should be followed by the 'f' +suffix, but no '%' prefix should be included. + +## TemperatureMonitor + +The TemperatureMonitor widget displays temperature and/or fan speed. It offers +the following settings: + +- *format*: Determines how the widget is displayed. The default + format is *{temp:%d} {fan:%d}*. + +- *tempInput*: Specifies the file that keeps the current temperature (the + default file is "/sys/class/hwmon/hwmon3/temp1_input") + +- *fanInput*: Specifies the file that keeps the current fan speed (the default + file is "/sys/class/hwmon/hwmon3/fan1_input") + + +## Volume + +The Volume widget shows and allows you to adjust the volume of an audio +device. It offers the following options for customization: + +- *format*: Determines how the widget is displayed. The default format is + *{icon} {level}%*. + +- *icon*: Specifies the icon that appears when the device is not muted. + +- *muteIcon*: Specifies the icon that appears when the device is muted. + +- *leftClickCommand*: Specifies the command that is executed when the left + mouse button is clicked. + +- *rightClickCommand*: Specifies the command that is executed when the right + mouse button is clicked. + +- *scrollUpCommand*: Specifies the command that is executed when the mouse + scroll up event occurs. + +- *scrollDownCommand*: Specifies the command that is executed when the mouse + scroll down event occurs. + +- *volMonCommand*: Specifies the program responsible for monitoring the volume + level of the devices. The program should print the volume level to its + standard output each time it detects a change. *pavolmon* program that works + with the PulseAudio (and PipeWire) server is distributed with statusbar. + +## Window + +The window widget displays the title of the focused window. It provides the +following options: + +- *titlePrefix* - a string that is added before the title (default: "") + +- *maxTitleLength* - if the length of the title exceeds the specified value, + it is trimmed and an ellipsis symbol is added (default: 80, set to -1 to + disable trimming) + +- *ellipsis* - the symbol used as an ellipsis after trimming the window's + title (default: "...") + +- *excludeAppIDs* - to make the title appear more standardized, the Window + widget first removes the app ID from the title (because different + applications place them in different locations) and then appends it back. + This option allows you to specify a list of application IDs that will not be + appended. + +# SEE ALSO + +_statusbar_(1) + +# AUTHORS + +Maintained by Radosław Kintzi. Up-do-date sources can be found at +https://gobytes.dev/statusbar. Bugs/patches can be submitted by email +to ~rkintzi/GoSway@lists.sr.ht. -- 2.45.2