Compare commits

...

4 commits

5 changed files with 111 additions and 16 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
use flake

1
.gitignore vendored
View file

@ -2,3 +2,4 @@
slstatus slstatus
build/ build/
dist/ dist/
.direnv/

40
flake.lock Normal file
View file

@ -0,0 +1,40 @@
{
"nodes": {
"flake-schemas": {
"locked": {
"lastModified": 1697467827,
"narHash": "sha256-j8SR19V1SRysyJwpOBF4TLuAvAjF5t+gMiboN4gYQDU=",
"rev": "764932025c817d4e500a8d2a4d8c565563923d29",
"revCount": 29,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.2/018b3da8-4cc3-7fbb-8ff7-1588413c53e2/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%2A.tar.gz"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1715668745,
"narHash": "sha256-xp62OkRkbUDNUc6VSqH02jB0FbOS+MsfMb7wL1RJOfA=",
"rev": "9ddcaffecdf098822d944d4147dd8da30b4e6843",
"revCount": 558484,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2311.558484%2Brev-9ddcaffecdf098822d944d4147dd8da30b4e6843/018f7bf7-c7bb-7b91-bed1-833da8f9e65e/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/NixOS/nixpkgs/%2A.tar.gz"
}
},
"root": {
"inputs": {
"flake-schemas": "flake-schemas",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

39
flake.nix Normal file
View file

@ -0,0 +1,39 @@
# This flake was initially generated by fh, the CLI for FlakeHub (version 0.1.8)
{
description = "slstatus";
inputs = {
flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*.tar.gz";
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/*.tar.gz";
};
outputs = { self, flake-schemas, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});
in {
schemas = flake-schemas.schemas;
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell {
packages = with pkgs; [
git
nixpkgs-fmt
xorg.libX11
entr
gnumake
];
};
});
};
}

View file

@ -63,21 +63,35 @@ static const char unknown_str[] = "n/a";
* wifi_perc WiFi signal in percent interface name (wlan0) * wifi_perc WiFi signal in percent interface name (wlan0)
* wifi_essid WiFi ESSID interface name (wlan0) * wifi_essid WiFi ESSID interface name (wlan0)
*/ */
static const struct arg _separator = {separator, " \\|/ ", NULL};
#define BAT_NAME "BAT0"
static const struct arg args[] = { static const struct arg args[] = {
/* function format argument */ /* function format argument */
{ run_command, "SP:%s ", "amixer sget Master | awk -F\"[][]\" '/%/ { print $2 }' | head -n1" }, {run_command, "SP:%s ",
{ run_command, "BR:%s%% ", "xbacklight -get | awk '{printf \"%.0f\", $1}'" }, "amixer sget Master | awk -F\"[][]\" '/%/ { print $2 }' | head -n1"},
{ cpu_perc, "CPU:%s%%|", NULL }, {run_command, "BR:%s%% ", "xbacklight -get | awk '{printf \"%.0f\", $1}'"},
{ cpu_freq, "%s ", NULL }, _separator,
{ temp, "%s\u00b0C ", "/sys/class/hwmon/hwmon5/temp1_input" }, {cpu_perc, "CPU:%s%%|", NULL},
{ ram_perc, "RAM:%s%% ", NULL }, {cpu_freq, "%s ", NULL},
// { netspeed_tx, " %s ^ ", "wlan0" }, {temp, "%s\u00b0C ", "/sys/class/thermal/thermal_zone8/temp"},
// { netspeed_rx, " %s ", "wlan0" }, _separator,
{ battery_perc, "BAT:%s%%", "BAT0" }, {ram_perc, "RAM:%s%% ", NULL},
{ battery_state, "%s ", "BAT0" }, {swap_perc, "SWAP: %s%% ", NULL },
{ keymap, "KB:%s ", NULL }, // { netspeed_tx, " %s ^ ", "wlan0" },
{ datetime, "TIME:%s|", "%r" }, // { netspeed_rx, " %s ", "wlan0" },
{ datetime, "%s ", "%a %d/%m/%Y" }, _separator,
{ disk_used, "(/:%s|", "/" }, {battery_perc, "BAT:%s%%", BAT_NAME},
{ disk_used, "~:%s)", "/home" }, {battery_state, "%s ", BAT_NAME},
// {battery_remaining, " REM: %s", BAT_NAME},
_separator,
{keymap, "KB:%s", NULL},
_separator,
{datetime, "TIME:%s", "%r"},
_separator,
{datetime, "%s ", "%a %d/%m/%Y"},
_separator,
{disk_used, "(ROOT:%s|", "/"},
{disk_used, "HOME:%s)", "/home"},
_separator,
{uptime, "UP: %s", NULL},
}; };