{"id":18974552,"url":"https://github.com/m7a/lp-i3bar","last_synced_at":"2026-04-08T15:30:20.185Z","repository":{"id":164554618,"uuid":"275474689","full_name":"m7a/lp-i3bar","owner":"m7a","description":"Scripts for populating i3bar status (with conky or without)","archived":false,"fork":false,"pushed_at":"2023-12-01T16:19:36.000Z","size":155,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-01T09:08:17.387Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/m7a.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-06-28T00:10:49.000Z","updated_at":"2022-02-15T20:20:46.000Z","dependencies_parsed_at":"2023-07-02T14:16:34.201Z","dependency_job_id":null,"html_url":"https://github.com/m7a/lp-i3bar","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m7a%2Flp-i3bar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m7a%2Flp-i3bar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m7a%2Flp-i3bar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m7a%2Flp-i3bar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/m7a","download_url":"https://codeload.github.com/m7a/lp-i3bar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239972105,"owners_count":19727307,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T15:15:24.237Z","updated_at":"2026-04-08T15:30:20.119Z","avatar_url":"https://github.com/m7a.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\nsection: 32\nx-masysma-name: i3bar\ntitle: Ma_Sys.ma i3bar Scripts\ndate: 2020/05/18 23:44:10\nlang: en-US\nauthor: [\"Linux-Fan, Ma_Sys.ma (Ma_Sys.ma@web.de)\"]\nkeywords: [\"i3\", \"i3bar\", \"mdvl\", \"package\", \"perl\", \"monitoring\", \"statusbar\"]\nx-masysma-version: 1.0.0\nx-masysma-repository: https://www.github.com/m7a/lp-i3bar\nx-masysma-website: https://masysma.net/32/i3bar.xhtml\nx-masysma-owned: 1\nx-masysma-copyright: |\n  Copyright (c) 2020 Ma_Sys.ma.\n  For further info send an e-mail to Ma_Sys.ma@web.de.\n---\nSummary\n=======\n\nThis repository contains a collection of different scripts for configuring a\n_status bar_. The most recent script version works in combination with\n[i3bar(1)](https://manpages.debian.org/stable/i3-wm/i3bar.1), older versions\nwork with [conky(1)](https://manpages.debian.org/stable/conky-all/conky.1).\n\nThe installable Debian package can be created by running `ant package`.\n\nIntroduction\n============\n\nA _status bar_ can be used to display system information. Usually, date and time\ninformation is provided along with other information the user may consider\nuseful.\n\nFor example, some people display the state of multimedia applications, others\ndisplay network information like IP addresses and hostnames and some like to\nhave a permanent glance at the system's load in terms of disk usage, processor\nload, memory etc.\n\nBackground\n==========\n\nPrograms like [conky(1)](https://manpages.debian.org/stable/conky-all/conky.1)\nand [i3status(1)](https://manpages.debian.org/stable/i3status/i3status.1) exist\nto aid in solving this task, but require extensive and often machine-dependent\nconfiguration. The necessity for configuration is natural, as the design and\nrationale behind a good status bar seems to be a very personal thing.\n\nHowever, being machine-dependent is not really a “nice” property for people who\nknow their personal status bar style but want to use their configuration across\nmany systems. In these cases one either has to edit the configuration for every\nsystem or come up with some kind of automation.\n\nThis repository provides exactly that: Some examples of more or less advanced\nautomated status bar “creation“ for a single user's personal configuration\nstyle. As a result, it is most unlikely that anybody will use the provided\nscripts or status bar directly, but it may serve as an inspiration of how to\ngo about it. Additionally, for the most recent version, the reasons for\nincluding specific figures in the status bar output are explained with the\nexpectation that this may serve a user who wants to thoughtfully craft their\nown status bar.\n\nAuxiliary Scripts\n=================\n\nOn the way towards creating a status bar, one may be tempted to create scripts\nto simplify processing some status information. Beware that calling external\nprocesses from status bars can be resource-intensive.\n\nThat warning given, here are two scripts which may be useful in other contexts\nthan status bars, too:\n\n## `ma_perc_bar` -- progress bar\n\nScript `ma_perc_bar` is the absolute minimum of a status-bar script. It takes\nas input a number from 0 to 100 (both inclusive) and outputs a progress bar\nmade of block characters.\n\nExample:\n\n~~~\n$ ./ma_perc_bar 30\n███░░░░░░░\n~~~\n\nThe idea here is that the script may be used in rarely-called status scripts\nor may serve as a building block for conky configuration generation scripts\n(see section `ma_genconkyconf_new`)\n\n## `ma_acpi_status` -- formatted ACPI output\n\nUses `ma_perc_bar` to format the output of the `acpi` command. This is\nintended to be called rarely (e. g. once per minute) to output Laptop battery\nstatus information as part of a possibly larger status bar.\n\nExample:\n\n\t$ ./ma_acpi_status\n\tD █████████░ 96% 10:17:57\n\nThe Legacy\n==========\n\n![Old status bar for XFCE](i3bar_att/xfceold.png)\n\nThe Ma_Sys.ma journey through status bars was roughly like this:\n\n * XFCE (3?) integrated status bar. That time, mostly disk usage and CPU load\n   were checked and space was used rather inefficiently.\n * Standalone conky. Initially a hand-crafted configuration file and soon a\n   script to generate a configuration file dependent on the presence of\n   certain file systems and information on different machines. There was only\n   one script this way, but a few machine-specific lines here and there.\n   See section `xond/ma_genconkyconf`.\n * Conky and i3bar. For integration with the i3 window manager, it turned out\n   to be nice using the i3bar e.g. as to display and be able to change the\n   different workspaces etc. Integration with i3bar is either text only or\n   colorized text by using a JSON interface. `ma_genconkyconf_new` used\n   this approach to generate a conky configuration which could be used in\n   combination with wrapper script `ma_i3conkystatus` to output a colorized\n   status bar in i3bar.\n * `mai3bar` and i3bar. This (new!) variant is the first not to contain\n   strictly machine-specific code and also the first for a long time to not\n   rely on conky for gathering system information. See section\n   _Current Ma_Sys.ma i3bar_ for details.\n\n## `xond/ma_genconkyconf`\n\nThe script in `xond/ma_genconkyconf` contains instructions to generate a status\nbar for standalone Conky usage which used to look like this:\n\n![Standalone conky with old configuration as generated by `xond/ma_genconkyconf`](i3bar_att/conky_old.png)\n\nBack then, conky had a different configuration file format which means that by\nnow, the script is no longer compatible with new Conky versions and hence only\nof historic interest.\n\nThe following items were in the status bar.\n\n### First row\n\n * CPU information in red. The first gauge displays the overall CPU load and\n   the followup gauges display the individual processor cores. The script was\n   intended to distinguish different physical processor cores by leaving a\n   little space. In the example screenshot, it displays four physical cores\n   (because it is running in a virtual machine, it cannot know that it only\n   has e.g. two physical cores).\n * Screenindex information in gray. The SCR gauge visualizes the output of\n   `screenindex -v d current -r`, see [screenindex(32)](screenindex.xhtml) for\n   details.\n * Red text which may contain CPU temperature information if detected, inside\n   the VM that is just `N_SUPPORT` to indicate _not supported_.\n * The system load averages\n * The current date and time in `dd.MM.YYYY HH:mm:ss` format.\n\n### Second row\n\n * RAM usage in green.\n * Swap usage in cyan (SWP).\n * Disk usage in blue (SYS). The script considers some specific Ma_Sys.ma\n   mountpoints to display as additional gauges here, if they are present.\n   By default, however, it only shows the disk usage of the root filesystem.\n * Network information across all interfaces from left to right:\n   total data uploaded, total data downloaded, current upload speed,\n   current download speed (yes, the VM was downloading from local network\n   with 95.4 MiB/s!)\n\n### Evaluation\n\nMost of the information selected for being displayed back then, is still\nconsidered interesting in the most recent Ma_Sys.ma status bar versions.\nHowever, some measures have been taken to reduce the space occupied for\nthings which may not require large gauges. Today, you can really see that\nthe design from `xond/ma_genconkyconf` was not intended to display more than\nfour or eight processor cores.\n\nStandalone conky works well for stacking window managers. Back then, Fluxbox\nwas being used, but others are expected to work, too. For tiling window\nmanagers, there was often need for additional configuration, but at least i3\nand spectrwm allow for conky to be used as a “standalone” status bar.\n\n## `ma_genconkyconf_new`\n\nFor about five years, this was the prevalent status bar used at the Ma_Sys.ma.\nIt ran on a few physical as well as virtual machines and supported\nenergy-efficient laptop as well as desktop usage.\n\n![Conky running as a child process of i3bar to render the status bar, configuration generated by `ma_genconkyconf_new -j`](i3bar_att/conky_new.png)\n\nTo use screen space efficiently, this status bar uses only a single line.\nIn terms of colors, it closely resembles its predecessor. The following\ninformation is displayed:\n\n * System hostname (recent versions like the one included in the repository\n   also included the IP address)\n * red CPU load gauge for all cores together\n * red indivudal tiny vertical CPU load gauges for each individual core.\n   Like before, some automation to detect Hyperthreading etc. is part of the\n   script to generate the configuration file.\n * green RAM gauge (displays as empty in the example, because the VM has much\n   more RAM assigned than used)\n * cyan Swap gauge\n * blue root filesystem disk usage gauge\n * grey Screenindex gauge\n * Magenta network information. The first (unlabelled) entry displays the\n   current upload/download activity. The other (potentially multiple) entries\n   display the totally uploaded and downloaded data by interface. The leading\n   `0` indicates that the interface's name ends on 0 (e. g. `eth0`).\n * One-Minute Load average indicator\n * Local time\n\nSome system-specific code allows special file systems to appear as additional\ngauges. Automatic detection of the `apcupsd` daemon or the use on a Laptop\nallow for battery monitoring gauges to appear on those systems, where they\nmake sense.\n\nThe configuration format is already conky's new format such that script\n`ma_genconkyconf_new` may still be used if one wants to create a similar\nstatus bar.\n\nThe disadvantage of the integration with i3bar is complexity: To generate the\nJSON output needed by i3bar, a very convoluted Conky configuration file is\ngenerated and one cannot run conky directly from i3bar -- a wrapper script for\ndisplaying a leading `{\"version:1\"}[` string is needed. Additionally, conky\noccasionally crashed when network interfaces were changing or ACPI information\nwas garbled.\n\n### Other noteworthy features\n\n * Script `ma_genconkyconf_new` can be used in conjunction with a standalone\n   conky if called with the `-t` option instead of `-j`.\n * Temperature information is displayed if detected (some potential sensors\n   for Ma_Sys.ma computers are hard-coded in the script...)\n\n## `ma_i3conkystatus`\n\nIn case you are interested in running `ma_genconkyconf_new` in conjunction with\ni3bar, the steps are as follows:\n\n 1. Generate a Conky configuration file:\n    `ma_genconkyconf_new -j \u003e ~/.mdvl/conkyrc_i3`\n 2. Configure to use `ma_i3conkystatus` in i3. This script in turn invokes\n    `conky` with the configuration file generated in the previous step and\n    produces the static part of the necessary output for i3bar integration.\n    Additionally, in case of conky crashes, it attempts to re-start conky\n    without leaving i3bar in an error state.\n 3. Restart/Reload i3 for the changes to take effect.\n\nHere is an example of an i3 configuration file snippet to invoke\n`ma_i3conkystatus`.\n\n\tbar {\n\t\tstatus_command /usr/bin/ma_i3conkystatus\n\t\tposition top\n\t\ttray_output primary\n\t\tcolors {\n\t\t\t#                   border  bg      fg\n\t\t\tfocused_workspace   #cc4040 #cc4040 #ffffff\n\t\t\tactive_workspace    #806060 #806060 #aaaaaa\n\t\t\tinactive_workspace  #201818 #201818 #505050\n\t\t\turgent_workspace    #ffaa00 #ffaa00 #ffffff\n\t\t\tbackground                  #000000\n\t\t\tstatusline                          #ffffff\n\t\t\tseparator                           #333333\n\t\t}\n\t}\n\nCurrent Ma_Sys.ma i3bar\n=======================\n\nThe current Ma_Sys.ma status bar is no longer dependent on conky. Instead, it\nis a Perl script which directly outputs JSON that can be processed by i3bar.\nMost notable change compared to the previous variants is the use of less colors:\nInstead of coloring different ressource types differntly, `mai3bar` colors\nresources depending on whether they can be considered to be in a critical,\nwarning or normal state. This is intended to have the following advantages:\n\n * Draw less attention to the status bar as to focus more on the actual\n   problems at hand.\n * Use less space for less important metrics (e.\\,g. CPU and RAM) but draw\n   attention to them if they are critical by means of color.\n\nAdditionally, no longer using conky, it becomes feasible to implement gauges\nwhich have text written _on_ them. This allows for higher density in\ninformation. Additionally, actual _figures_ can be presented for resources\nlike disk space and RAM. While it might seem a minor detail, having these values\nas numbers is useful in the context of virtual and old machines where limits\nmight be very low e.\\,g. for RAM or disk space compared to what one expects from\nmodern physical systems.\n\nHere are a few other newly added features compared to the previous status bars\nused at the Ma_Sys.ma. A few of them are somewhat experimental because they may\nnot fit the common expectations of how values would appear in a status bar:\n\n * The CPU load gauges' layout provides more advanced CPU topology information\n   as detected by an integrated copy of Perl package `CpuTopology`.\n * Automatic choice of units for displayed metrics: For storage and RAM, current\n   systems may have a wide range from a few gigabytes to terabytes. As a result,\n   there does not seem to be a one size fits all unit of measure and hence, the\n   status bar automatically chooses between megabytes and gigabytes for RAM and\n   file systems. On systems with little RAM (e.g. 4 GiB), RAM is displayed\n   in megabytes, whereas on systems with much RAM (e.g. 16 GiB), RAM is\n   displayed in GiB. As there is currently no explicit indicator for which\n   unit is being used, there is some potential for confusion here and new\n   status bar versions might add a (potentially indirect) indicator for the\n   unit of measure.\n * To give compact (e.g. one or two letter) names to file systems and network\n   interfaces, a special _name shortening algorithm_ is integrated.\n * The refresh interval of the status bar uses different (hard-coded) delays\n   depending on the situation:\n   If a discharging laptop battery is detected, the refresh rate is once every\n   20 sec. Under regular circumstances, the refresh rate is once per second and\n   it may slow down if slow processing is noticed (as not to give too many of\n   the scarce resources to status bar computation).\n * The refresh interval of the status bar is attempted to be aligned to the\n   actual turning of seconds such that the clock is expected to be more accurate\n   than with other status bars.\n\n![Screenshot of the Ma_Sys.ma i3bar on a typical VM, observe the RAM being in MiB](i3bar_att/new_short_vm.png)\n\n![Screenshot of the Ma_Sys.ma i3bar on the Ma_Sys.ma main system pte5](i3bar_att/new_extended.png)\n\nSummary of items displayed:\n\n * MDADM RAID resync progress (only if happening at the time)\n * Hostname\n * `C` for CPU indicates a CPU section with vertical gauges for each processor\n   (core).\n * `R` for RAM indicates the RAM memory section with figures in GiB (if\n   total RAM large) or MiB (if total RAM small) .\n * `SW` for Swap indicates the use of swap space. At the time of the\n   screenshot there were 48 GiB swap and 1 GiB of it used.\n * Filesystem sections. For each file system, the structure is as follows:\n   FS name (`/`, `d`, `e`, `l` ... as generated by the name shortening\n   algoritm), filesystem usage, total filesystme size.\n * `SC` section if [screenindex(32)](screenindex.xhtml) is installed.\n * Network interface sections. For each interface:\n   Interface name as generated by the name shortening algorithm,\n   IP address, current upload speed, current download speed (units displayed and\n   dynamically adjusting to the order of magnitude).\n * In case it reports a battery level and is installed, a formatted output\n   of [acpi(1)](https://manpages.debian.org/buster/acpi/acpi.1.en.html)\n   will be displayed (useful for mobile devices),\n * APC UPS section if [apcupsd(8)](https://manpages.debian.org/stretch/apcupsd/apcupsd.8.en.html)\n   is installed. Displays the battery's fill level and the estimated time the\n   system could run on battery under current load.\n * Load AVG section\n * Date and Time section (`DD.MM.YYYY hh:mm:ss`)\n\n## Name Shortening Algorithm\n\nIn order to display the names of file systems and network interfaces in a\nrecognizable and compact fashion, a special algorithm for shortening the names\nof file system mountpoints and network interfaces has been devised. It should\nstill be considered experimental, but seems to work in many “common” cases so\nfar.\n\nThe algorithm does the following steps:\n\n 1. Given a _list of names_ to process.\n 2. Sort the _list of names_ (lexicographically) to obtain a _sorted list_\n 3. Process names starting from the first item in the _sorted list_.\n    For the current and all subsequent names in the sorted list.\n    Remove their longest common prefix.\n 4. Continue with the _prefix reduced list_.\n 5. Process each item in the prefix reduced list:\n 6. Take the shortest prefix of the item such that it is not a prefix of any\n    other item in the list.\n 7. Output the resulting names.\n\nExample shortenings:\n\nInput             Prefix Reduced List  Output\n----------------  -------------------  ----------\neno1, ens1        o1, s1               o, s\neno1, eno2, ens1  o1, o2, s1           o1, o2, s\n/*, /data,        /, data, e01, ll     /, d, e, l\n/fs/e01, /fs/ll\n\n*) As a special execption, an empty string is kept to be `/` instead of being\nreduced to the empty string for being a prefix of each other entry.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm7a%2Flp-i3bar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm7a%2Flp-i3bar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm7a%2Flp-i3bar/lists"}