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:
62
home/ags-config/runner/plugins/clipboard.ts
Normal file
62
home/ags-config/runner/plugins/clipboard.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import { Gtk } from "ags/gtk4";
|
||||
import { Clipboard, ClipboardItem } from "../../modules/clipboard";
|
||||
import { Runner } from "../Runner";
|
||||
import { jsx } from "ags/gtk4/jsx-runtime";
|
||||
|
||||
import Fuse from "fuse.js";
|
||||
|
||||
|
||||
class _PluginClipboard implements Runner.Plugin {
|
||||
#fuse!: Fuse<unknown>;
|
||||
prefix = '>';
|
||||
prioritize = true;
|
||||
|
||||
init() {
|
||||
const items: ReadonlyArray<ClipboardItem> = [...Clipboard.getDefault().history];
|
||||
this.#fuse = new Fuse(
|
||||
items,
|
||||
{
|
||||
keys: [ "id", "preview" ] satisfies Array<keyof ClipboardItem>,
|
||||
ignoreDiacritics: false,
|
||||
isCaseSensitive: false,
|
||||
shouldSort: true,
|
||||
useExtendedSearch: false
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private clipboardResult(item: ClipboardItem): Runner.Result {
|
||||
return {
|
||||
icon: jsx(Gtk.Label, {
|
||||
label: `${item.id}`,
|
||||
css: "font-size: 16px; margin-right: 8px; font-weight: 600;"
|
||||
}),
|
||||
title: item.preview,
|
||||
actionClick: () => Clipboard.getDefault().selectItem(item).catch((err: Error) => {
|
||||
console.error(`Runner(Plugin/Clipboard): An error occurred while selecting clipboard item. Stderr:\n${
|
||||
err.message ? `${err.message}\n` : ""}Stack: ${err.stack}`
|
||||
);
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
async handle(search: string, limit?: number) {
|
||||
if(Clipboard.getDefault().history.length < 1)
|
||||
return {
|
||||
icon: "edit-paste-symbolic",
|
||||
title: "Clipboard is empty",
|
||||
description: "Copy something and it will be shown right here!"
|
||||
};
|
||||
|
||||
if(search.trim().length === 0)
|
||||
return Clipboard.getDefault().history.map(item =>
|
||||
this.clipboardResult(item)
|
||||
);
|
||||
|
||||
return this.#fuse.search(search, {
|
||||
limit: limit ?? Infinity
|
||||
}).map(result => this.clipboardResult(result.item as ClipboardItem))
|
||||
}
|
||||
}
|
||||
|
||||
export const PluginClipboard = new _PluginClipboard();
|
||||
Reference in New Issue
Block a user