diff options
| author | srdusr <trevorgray@srdusr.com> | 2025-08-30 19:22:59 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2025-08-30 19:22:59 +0200 |
| commit | 19120d4f9761c67d99ed1ce3da6084b83f5a49c9 (patch) | |
| tree | f234cad1bdad88114a63c9702144da487024967a /.config/ags/service/colorpicker.ts | |
| parent | 5928998af5404ae2be84c6cecc10ebf84bd3f3ed (diff) | |
| download | dotfiles-19120d4f9761c67d99ed1ce3da6084b83f5a49c9.tar.gz dotfiles-19120d4f9761c67d99ed1ce3da6084b83f5a49c9.zip | |
Linux-specific dotfiles
Diffstat (limited to '.config/ags/service/colorpicker.ts')
| -rw-r--r-- | .config/ags/service/colorpicker.ts | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/.config/ags/service/colorpicker.ts b/.config/ags/service/colorpicker.ts deleted file mode 100644 index 5918f31..0000000 --- a/.config/ags/service/colorpicker.ts +++ /dev/null @@ -1,56 +0,0 @@ -import icons from "lib/icons" -import { bash, dependencies } from "lib/utils" - -const COLORS_CACHE = Utils.CACHE_DIR + "/colorpicker.json" -const MAX_NUM_COLORS = 10 - -class ColorPicker extends Service { - static { - Service.register(this, {}, { - "colors": ["jsobject"], - }) - } - - #notifID = 0 - #colors = JSON.parse(Utils.readFile(COLORS_CACHE) || "[]") as string[] - - get colors() { return [...this.#colors] } - set colors(colors) { - this.#colors = colors - this.changed("colors") - } - - // TODO: doesn't work? - async wlCopy(color: string) { - if (dependencies("wl-copy")) - bash(`wl-copy ${color}`) - } - - readonly pick = async () => { - if (!dependencies("hyprpicker")) - return - - const color = await bash("hyprpicker -a -r") - if (!color) - return - - this.wlCopy(color) - const list = this.colors - if (!list.includes(color)) { - list.push(color) - if (list.length > MAX_NUM_COLORS) - list.shift() - - this.colors = list - Utils.writeFile(JSON.stringify(list, null, 2), COLORS_CACHE) - } - - this.#notifID = await Utils.notify({ - id: this.#notifID, - iconName: icons.ui.colorpicker, - summary: color, - }) - } -} - -export default new ColorPicker |
