Compare commits

...

4 Commits

Author SHA1 Message Date
0x61nas 27b258bd0a
feat: show more info, and fix the cpu temp path 2024-05-15 15:28:53 +03:00
0x61nas 23d7ce0ebe
chore(gitignore): ignore the .direnv dir 2024-05-15 15:27:26 +03:00
0x61nas 488fd4db15
chore(direnv): init 2024-05-15 15:26:35 +03:00
0x61nas 72448f67d7
chore(nix): init flake 2024-05-15 15:25:16 +03:00
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
build/
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_essid WiFi ESSID interface name (wlan0)
*/
static const struct arg _separator = {separator, " \\|/ ", NULL};
#define BAT_NAME "BAT0"
static const struct arg args[] = {
/* function format argument */
{ run_command, "SP:%s ", "amixer sget Master | awk -F\"[][]\" '/%/ { print $2 }' | head -n1" },
{ run_command, "BR:%s%% ", "xbacklight -get | awk '{printf \"%.0f\", $1}'" },
{ cpu_perc, "CPU:%s%%|", NULL },
{ cpu_freq, "%s ", NULL },
{ temp, "%s\u00b0C ", "/sys/class/hwmon/hwmon5/temp1_input" },
{ ram_perc, "RAM:%s%% ", NULL },
// { netspeed_tx, " %s ^ ", "wlan0" },
// { netspeed_rx, " %s ", "wlan0" },
{ battery_perc, "BAT:%s%%", "BAT0" },
{ battery_state, "%s ", "BAT0" },
{ keymap, "KB:%s ", NULL },
{ datetime, "TIME:%s|", "%r" },
{ datetime, "%s ", "%a %d/%m/%Y" },
{ disk_used, "(/:%s|", "/" },
{ disk_used, "~:%s)", "/home" },
/* function format argument */
{run_command, "SP:%s ",
"amixer sget Master | awk -F\"[][]\" '/%/ { print $2 }' | head -n1"},
{run_command, "BR:%s%% ", "xbacklight -get | awk '{printf \"%.0f\", $1}'"},
_separator,
{cpu_perc, "CPU:%s%%|", NULL},
{cpu_freq, "%s ", NULL},
{temp, "%s\u00b0C ", "/sys/class/thermal/thermal_zone8/temp"},
_separator,
{ram_perc, "RAM:%s%% ", NULL},
{swap_perc, "SWAP: %s%% ", NULL },
// { netspeed_tx, " %s ^ ", "wlan0" },
// { netspeed_rx, " %s ", "wlan0" },
_separator,
{battery_perc, "BAT:%s%%", BAT_NAME},
{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},
};