diff --git a/astal/widget/Bar.tsx b/astal/widget/Bar.tsx index 9e74079..da04133 100644 --- a/astal/widget/Bar.tsx +++ b/astal/widget/Bar.tsx @@ -92,10 +92,10 @@ function Ram() { } -let disk_space = Variable(get_disk_space()) +let disk_space = Variable(get_disk_space()).poll(5000, () => get_disk_space()) function Disk() { return - } @@ -106,7 +106,7 @@ function Battery() { if (charging) { return { label: `${full_percentage == 100 ? "FULL" : "CHR"}: ${full_percentage}%` } } - return { label: `${full_percentage == 100 ? "FULL" : "BAT"}: ${full_percentage}` } + return { label: `${full_percentage == 100 ? "FULL" : "BAT"}: ${full_percentage}%` } }) return diff --git a/astal/widget/cpu.ts b/astal/widget/cpu.ts index 0175b30..3863c3a 100644 --- a/astal/widget/cpu.ts +++ b/astal/widget/cpu.ts @@ -1,5 +1,6 @@ import { GLib, Variable } from "astal"; import GTop from "gi://GTop"; +import Wp05 from "gi://Wp"; type Snapshot = { total: number; @@ -35,12 +36,23 @@ export function get_ram_info() { }; } +function format_bytes(bytes: number) { + let units = ["B", "KiB", "MiB", "GiB", "TiB"]; + let i = 0; + let num: number = bytes; + while (num >= 1024 && i < units.length - 1) { + num /= 1024; + i++; + } + + return `${num.toFixed(2)}${units[i]}`; +} + export function get_disk_space() { const usage = new GTop.glibtop_fsusage(); GTop.glibtop_get_fsusage(usage, "/"); const free_bytes = usage.bavail * usage.block_size; - const free_gib = free_bytes / 1024 ** 3; - return free_gib.toFixed(2); + return format_bytes(free_bytes); } diff --git a/nix/flake.lock b/nix/flake.lock index 624877f..9937134 100644 --- a/nix/flake.lock +++ b/nix/flake.lock @@ -83,11 +83,11 @@ ] }, "locked": { - "lastModified": 1750650158, - "narHash": "sha256-cGdpDr/OUjS5rfl0lH7CjnIFWtpOFQOcRkvBu9CV+Cs=", + "lastModified": 1750798083, + "narHash": "sha256-DTCCcp6WCFaYXWKFRA6fiI2zlvOLCf5Vwx8+/0R8Wc4=", "owner": "nix-community", "repo": "home-manager", - "rev": "3bd646138a9c71f244a9293dde6f59ae1c6875ab", + "rev": "ff31a4677c1a8ae506aa7e003a3dba08cb203f82", "type": "github" }, "original": { diff --git a/nix/modules/desktop.nix b/nix/modules/desktop.nix index cafb977..f74f994 100644 --- a/nix/modules/desktop.nix +++ b/nix/modules/desktop.nix @@ -35,6 +35,8 @@ adwaita-icon-theme swaybg gnome-themes-extra + wl-clipboard + wl-clip-persist ]; programs.thunar.enable = true; programs.hyprland.enable = true; @@ -67,7 +69,7 @@ configFile = ../../custom/dunst/dunstrc; }; services.hyprpolkitagent.enable = true; - services.copyq.enable = true; + services.cliphist.enable = true; gtk = { enable = true; theme.name = "Adwaita-dark"; @@ -102,6 +104,7 @@ "$mod, 0, workspace, 10" "$mod SHIFT, 0, movetoworkspacesilent, 10" + "$mod, f, fullscreen" ] ++ (builtins.concatLists ( builtins.genList ( @@ -144,6 +147,7 @@ exec-once = [ "swaybg -i ~/.config/wallpaper/bg.jpg" "status-bar" + "wl-clip-persist --clipboard regular" ]; monitor = [ "eDP-1, 1920x1080, 0x0, 1"