From 3c579d0e275cdaf6f2c9589abade94bde7905c82 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sat, 26 Apr 2025 22:36:23 +1000 Subject: clean Remove everything --- src/services/storage.ts | 65 ------------------------------------------------- 1 file changed, 65 deletions(-) delete mode 100644 src/services/storage.ts (limited to 'src/services/storage.ts') diff --git a/src/services/storage.ts b/src/services/storage.ts deleted file mode 100644 index 3f8992d..0000000 --- a/src/services/storage.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { GObject, interval, property, register } from "astal"; -import { storage as config } from "config"; -import GTop from "gi://GTop"; - -@register({ GTypeName: "Storage" }) -export default class Storage extends GObject.Object { - static instance: Storage; - static get_default() { - if (!this.instance) this.instance = new Storage(); - - return this.instance; - } - - #total: number = 0; - #free: number = 0; - #used: number = 0; - #usage: number = 0; - - @property(Number) - get total() { - return this.#total; - } - - @property(Number) - get free() { - return this.#free; - } - - @property(Number) - get used() { - return this.#used; - } - - @property(Number) - get usage() { - return this.#usage; - } - - update() { - const root = new GTop.glibtop_fsusage(); - GTop.glibtop_get_fsusage(root, "/"); - const home = new GTop.glibtop_fsusage(); - GTop.glibtop_get_fsusage(home, "/home"); - - this.#total = root.blocks * root.block_size + home.blocks * home.block_size; - this.#free = root.bavail * root.block_size + home.bavail * home.block_size; - this.#used = this.#total - this.#free; - this.#usage = this.#total > 0 ? (this.#used / this.#total) * 100 : 0; - - this.notify("total"); - this.notify("free"); - this.notify("used"); - this.notify("usage"); - } - - constructor() { - super(); - - let source = interval(config.interval.get(), () => this.update()); - config.interval.subscribe(i => { - source.cancel(); - source = interval(i, () => this.update()); - }); - } -} -- cgit v1.2.3-freya