mirror of
https://github.com/zephrynis/nix-flake.git
synced 2026-02-19 04:21:55 +00:00
feat: make AGS colorshell configuration fully declarative
- Add complete colorshell v2.0.3 configuration to home/ags-config/ - Disable runner plugin and NightLight tile (incompatible with NixOS) - Customize SCSS with full opacity (no transparency) - Add dark pale blue color scheme in home/pywal-colors/ - Configure Papirus-Dark icon theme via home-manager - Make ~/.config/ags/ immutable and managed by Nix store - Auto-deploy pywal colors to ~/.cache/wal/colors.json All AGS configuration is now reproducible and version controlled.
This commit is contained in:
63
home/ags-config/runner/plugins/wallpapers.ts
Normal file
63
home/ags-config/runner/plugins/wallpapers.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
import Fuse from "fuse.js";
|
||||
import { Wallpaper } from "../../modules/wallpaper";
|
||||
import { Runner } from "../Runner";
|
||||
|
||||
import Gio from "gi://Gio?version=2.0";
|
||||
|
||||
|
||||
class _PluginWallpapers implements Runner.Plugin {
|
||||
prefix = "#";
|
||||
prioritize = true;
|
||||
#fuse!: Fuse<string>;
|
||||
#files!: Array<string>;
|
||||
|
||||
init() {
|
||||
this.#files = [];
|
||||
const dir = Gio.File.new_for_path(Wallpaper.getDefault().wallpapersPath);
|
||||
if(dir.query_file_type(null, null) === Gio.FileType.DIRECTORY) {
|
||||
for(const file of dir.enumerate_children(
|
||||
"standard::*",
|
||||
Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,
|
||||
null
|
||||
)) {
|
||||
this.#files.push(`${dir.get_path()}/${file.get_name()}`);
|
||||
}
|
||||
}
|
||||
|
||||
this.#fuse = new Fuse<string>(
|
||||
this.#files as ReadonlyArray<string>,
|
||||
{
|
||||
useExtendedSearch: false,
|
||||
shouldSort: true,
|
||||
isCaseSensitive: false
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private wallpaperResult(path: string): Runner.Result {
|
||||
return {
|
||||
title: path.split('/')[path.split('/').length-1].replace(/\..*$/, ""),
|
||||
actionClick: () => Wallpaper.getDefault().setWallpaper(path)
|
||||
};
|
||||
}
|
||||
|
||||
handle(search: string, limit?: number) {
|
||||
if(search.trim().length === 0)
|
||||
return this.#files.map(path =>
|
||||
this.wallpaperResult(path)
|
||||
);
|
||||
|
||||
if(this.#files.length > 0)
|
||||
return this.#fuse.search(search, {
|
||||
limit: limit ?? Infinity
|
||||
}).map(result => this.wallpaperResult(result.item));
|
||||
|
||||
return {
|
||||
title: "No wallpapers found!",
|
||||
description: "Define the $WALLPAPERS variable on Hyprland or create a ~/wallpapers directory",
|
||||
icon: "image-missing-symbolic"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export const PluginWallpapers = new _PluginWallpapers();
|
||||
Reference in New Issue
Block a user