GithubHelp home page GithubHelp logo

gerschtli / dwm-status Goto Github PK

View Code? Open in Web Editor NEW
70.0 4.0 12.0 691 KB

Highly performant and configurable DWM status service

License: MIT License

Nix 2.34% Rust 97.32% Shell 0.34%
dwm dwm-status rust dbus libnotify nix

dwm-status's Introduction

dwm-status

Github Workflow Crates.io The MIT License

DWM status service which dynamically updates when needed. Heavily inspired by i3status-rust.

Example status bar: example-sceenshot

Requirements

cargo, rustc and lib{dbus,gdk-pixbuf,notify,x11}-dev are required to build the binary.

Build and run

$ # dev mode
$ cargo run -- <config-file>
$ # release mode
$ cargo build --release
$ ./target/release/dwm-status <config-file>

Or install globally to ~/.cargo/bin:

$ cargo install dwm-status

Nix support

Build as flake:

$ nix build

And run:

$ ./result/bin/dwm-status <config-file>

Configuration

The config-file can be a HJSON, JSON, TOML or YAML file. For each possible format a config file filled with the default values can be found in examples/default-settings. The type of file is determined by its suffix.

For an example how to use icons in the status bar see examples/icon-settings/nerd-font.toml. You need to install and specify one of the available nerd fonts in your config.h in dwm to use the icons in the example config, e.g.:

static const char *fonts[] = { "Ubuntu Mono Nerd Font:size=9" };

General options

name default description
debug - Deprecated, will be removed in 2.0.0. Log level is now INFO by default.
order [] List of enabled features in order.
separator " / " Separator string between each feature.

Feature: Audio

Note: alsa-utils are required.

Shows status of configured alsa control device. Listens on alsactl monitor for changes.

Configuration options

name default description
control "Master" Alsa control device to listen for.
icons [] List of icons, which represent different stages relative to the current volume, e.g. ["LOW", "MIDDLE, "HIGH"].
mute "MUTE" Text representation if muted.
template "S {VOL}%" Text representation if unmuted. ({VOL} gets replaced with the current volume, {ICO} gets replaced with the icon)

Feature: Backlight

Shows status of backlight value and watches /sys/class/backlight for changes.

Configuration options

name default description
device "intel_backlight" Backlight device in /sys/class/backlight.
fallback None If device doesn't exist, pattern match (Unix shell style patterns) the first element in /sys/class/backlight. e.g. amdgpu_*
icons [] List of icons, which represent different stages relative to the current value, e.g. ["LOW", "MIDDLE, "HIGH"].
template "L {BL}%" Text representation. ({BL} gets replaced with the current backlight value, {ICO} gets replaced with the icon)

Feature: Battery

Note: The upower daemon has to be running for receiving DBus messages.

Watches UPower DBus signals for added or removed batteries and changes of battery states.

If notifier is enabled, currently discharging and the capacity of the fullest battery is under the configured values value, warning notifications with urgency normal or critical (depending on the configured critical value) are sent.

Shows following information per battery:

status example notes
charging ▲ 10% (01:23) In parentheses time to full
discharging ▼ 50% (02:03) In parentheses time to empty

Shows following information as feature block (ICO gets replaced with an icon if any are defined):

battery count example notes
0 NO BATT
1 ▼ ICO 50% (02:03)
2 ▼ ICO 50% (02:03) · ICO 50% Batteries ordered alphabetically by name

Configuration options

name default description
charging "▲" Text representation for status charging.
discharging "▼" Text representation for status discharging.
enable_notifier true Whether to enable the notifier.
icons [] List of icons, which represent different stages relative to the current battery state, e.g. ["LOW", "MIDDLE, "HIGH"].
no_battery "NO BATT" Text representation if no battery present.
notifier_critical 10 Maximum battery value to notify via critical notification.
notifier_levels [2, 5, 10, 15, 20] Battery values to notify.
separator " · " Separator string between mutliple battery infos.

Feature: CPU Load

Shows CPU load taken from /proc/loadavg in configured format and refreshes every n seconds.

Configuration options

name default description
template "{CL1} {CL5} {CL15}" Text representation. ({CLx} gets replaced with the load of last x minutes for x in {1, 5, 15})
update_interval 20 Update interval in seconds.

Feature: Network

Note: The commands ip, dig and iwgetid need to be in PATH.

Shows connected ESSID, public IPv4 and IPv6 address. Updates get triggered by listening on ip monitor address link.

Configuration options

name default description
no_value "NA" Value for not defined elements.
template "{IPv4} · {IPv6} · {ESSID}" Text representation. Placeholders surrounded by curly braces are {IPv4}, {IPv6} and {ESSID}.

Feature: Time

Shows time in configured format and refreshes every second or minute.

Configuration options

name default description
format "%Y-%m-%d %H:%M" Time format of chrono crate.
update_seconds false Whether to update time feature every second or minute, automatically set by parsing format.

Contributing

You need rustup with nightly toolchain, rustfmt, clippy and lib{dbus,gdk-pixbuf,notify,x11}-dev. I recommend the installation of racer.

If your are using nix you can use shell.nix for all dependencies except the rustup toolchain and components:

$ nix-shell
[nix-shell]$ rustup install nightly
[nix-shell]$ rustup default nightly

dwm-status's People

Contributors

almielczarek avatar gerschtli avatar lucassardois avatar oatiz avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dwm-status's Issues

The battery feature report "NO BATT"

In my config file I enabled the battery feature. Yet it doesn't report any battery data, it just display NO BATT as defined in the config file in case of no battery found.

When dwm-status is running I get the following error because of the battery feature:
Error in dbus: failed to send message (D-Bus error: The name org.freedesktop.UPower was not provided by any .service files (org.freedesktop.DBus.Error.ServiceUnknown))

On my system the acpi command returns the following:

Battery 0: Charging, 18%, 00:36:43 until charged
Battery 1: Unknown, 4%

I'm running arch linux on a lenovo thinkpad T400.

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

Battery feature not working

Enabling battery feature in config file makes program crash with the following message:
15:50:14 [ERROR] Error in battery: no ac name (AC or ACAD) matched in /sys/class/power_supply

$ ls /sys/class/power_supply
ADP1  BAT0

upower is installed and the daemon enabled and running through systemctl

how to start?

hi,
i tried to run dwm-status with one of the example files dwm-status examples/default-settings/defaults.toml, and i get this error:

23:10:21 [WARN] Config option 'debug' is deprecated and will be removed in 2.0.0. Log level is set to info by default.
23:10:21 [ERROR] Error in settings: no features enabled

how to enable features? and shouldn't the example be working? am i missing something?

thanks

dwm-status stop when battery runs low

When my battery become low (around 21%) dwm-status stop to update the bar and more, seems to just completly crash. No message is printed in the log file. When tihs happen I simply restart the program using the following command: dwm-status ~/config/dwm-status/examples/default-settings/defaults.json &. Here is my config file:

{
  "debug": false,
  "order": ["network", "audio", "backlight", "battery", "time"],
  "separator": " / ",
  "audio": {
    "control": "Master",
    "mute": "ﱝ MUTE",
    "template": "{ICO} {VOL}%",
    "icons": ["奄", "奔", "墳"]
  },
  "backlight": {
    "device": "intel_backlight",
    "template": "{ICO} {BL}%",
    "icons": ["", "", ""]
  },
  "battery": {
    "charging": "",
    "discharging": "",
    "enable_notifier": true,
    "no_battery": "",
    "notifier_critical": 10,
    "notifier_levels": [
      2,
      5,
      10,
      15,
      20
    ],
    "separator": " · ",
    "icons": ["", "", "", "", "", "", "", "", "", "", ""]
  },
  "cpu_load": {
    "template": "{CL1} {CL5} {CL15}",
    "update_interval": 20
  },
  "network": {
    "no_value": "NA",
    "template": " {ESSID}"
  },
  "time": {
    "format": "%Y-%m-%d %H:%M",
    "update_seconds": false
  }
}

I'm using archlinux + dwm. I think that maybe some powersaving feature kill dwm-status to preserve battery but it's pure supposition.

Any ideas how to fix the issue?

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

cargo
Cargo.toml
  • battery 0.7.8
  • chrono 0.4.38
  • inotify 0.10.2
  • libnotify 1.0.3
  • log 0.4.21
  • serde 1.0.200
  • serde_derive 1.0.200
  • simplelog 0.12.2
  • glob 0.3.1
  • ctrlc 3.4.4
  • mocktopus 0.8.0
  • x11 2.21.0
  • hamcrest2 0.3.0
github-actions
.github/workflows/ci.yml
  • actions/checkout v4
  • hecrj/setup-rust-action v1
  • actions/cache v4
  • actions/cache v4
  • actions/cache v4
  • actions/checkout v4
  • cachix/install-nix-action v27
  • cachix/cachix-action v15

  • Check this box to trigger a request for Renovate to run again on this repository

Erorr in dbus

Hello,

When I run cargo run -- <config-file> I get the following output before the program stop:

06:22:04 [ WARN] Config option 'debug' is deprecated and will be removed in 2.0.0. Log level is set to info by default.
06:22:04 [ INFO] Update all features
06:22:04 [ERROR] Error in process: reading process output failed (Os { code: 2, kind: NotFound, message: "No such file or directory" })

The first time I started it I had an additional error line saying dbus error

Thanks for help

Arch Linux AUR package

Hi!

Ran into this project and it was exactly what I was looking for in a status bar (without having to write my own). Really awesome stuff.

Any chance of getting a PKGBUILD up and posted onto the AUR for Arch Linux?

Only one battery reported

Hello,

Since I updated to master from and older version, dwm-status now only report one of my two batteries.
The result of acpi is the following:

Battery 0: Discharging, 83%, 02:37:07 remaining
Battery 1: Unknown, 78%

Audio feature wrong volume

This is totally not your fault, it is more a question on my side. The Control "Master" doesn't show my actual volume. And none of "amixer get <PCM/Speaker/etc> outputs show my actual volume. Is there anyway you could help me? I've spent hours trying to figure it out with the original dwmstatus and wanted to try yours now.
Best regards, Joel

Battery capacity rounding error

.On my machine sometimes the capacity for my battery is buggy and shows a really low percentage such as the following:

Charge Now: 45260000
Charge Full: 59920000
Capacity (as calculated in BatteryDevice.capacity()): 3
The real capacity should be about 75

I obtained these numbers by inserting a println! in the capacity method of the battery device implementation. I think this happens because the code is trying to do the multiplication and division with integers. I could be wrong, but I think floats may be needed here.

In my own copy of the repo I was able to make this work by doing the capacity calculation using floats and converting back to a u32 in the return statement.

I can send a PR if you think the change makes sense.

Add memory feature

Adding a feature that allows people to see how much ram the have left would be a good addition I think.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.