mirror of
https://github.com/zephrynis/nix-flake.git
synced 2026-02-18 20:21:53 +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:
105
home/ags-config/window/osd/index.tsx
Normal file
105
home/ags-config/window/osd/index.tsx
Normal file
@@ -0,0 +1,105 @@
|
||||
import { Astal, Gtk } from "ags/gtk4";
|
||||
import { createBinding, createState, With } from "ags";
|
||||
import { Wireplumber } from "../../modules/volume";
|
||||
import { Windows } from "../../windows";
|
||||
import { Backlights } from "../../modules/backlight";
|
||||
import { secureBaseBinding, variableToBoolean } from "../../modules/utils";
|
||||
|
||||
import Pango from "gi://Pango?version=1.0";
|
||||
import GLib from "gi://GLib?version=2.0";
|
||||
import AstalWp from "gi://AstalWp?version=0.1";
|
||||
import OSDMode from "./modules/osdmode";
|
||||
|
||||
|
||||
export const OSDModes = {
|
||||
sink: new OSDMode({
|
||||
available: createBinding(AstalWp.get_default(), "defaultSpeaker").as((sink) =>
|
||||
Boolean(sink)),
|
||||
icon: secureBaseBinding<AstalWp.Endpoint>(
|
||||
createBinding(AstalWp.get_default(), "defaultSpeaker"),
|
||||
"volumeIcon",
|
||||
"audio-volume-high-symbolic"
|
||||
),
|
||||
value: secureBaseBinding<AstalWp.Endpoint>(
|
||||
createBinding(AstalWp.get_default(), "defaultSpeaker"),
|
||||
"volume",
|
||||
.5
|
||||
),
|
||||
text: secureBaseBinding<AstalWp.Endpoint>(
|
||||
createBinding(AstalWp.get_default(), "defaultSpeaker"),
|
||||
"description",
|
||||
"Unknown Speaker"
|
||||
),
|
||||
max: Wireplumber.getDefault().getMaxSinkVolume() / 100
|
||||
}),
|
||||
brightness: new OSDMode({
|
||||
icon: "display-brightness-symbolic",
|
||||
value: secureBaseBinding<Backlights.Backlight>(
|
||||
createBinding(Backlights.getDefault(), "default"),
|
||||
"brightness",
|
||||
100
|
||||
),
|
||||
max: secureBaseBinding<Backlights.Backlight>(
|
||||
createBinding(Backlights.getDefault(), "default"),
|
||||
"maxBrightness",
|
||||
100
|
||||
),
|
||||
text: secureBaseBinding<Backlights.Backlight>(
|
||||
createBinding(Backlights.getDefault(), "default"),
|
||||
"name",
|
||||
"Unknown Backlight"
|
||||
),
|
||||
available: createBinding(Backlights.getDefault(), "available")
|
||||
})
|
||||
}
|
||||
|
||||
const [osdMode, setOSDMode] = createState(OSDModes.sink);
|
||||
let osdTimer: (GLib.Source|undefined), osdTimeout = 3500;
|
||||
|
||||
export const OSD = (mon: number) =>
|
||||
<Astal.Window namespace={"osd"} class={"osd-window"} layer={Astal.Layer.OVERLAY}
|
||||
anchor={Astal.WindowAnchor.BOTTOM} focusable={false} marginBottom={80} monitor={mon}>
|
||||
|
||||
<Gtk.Box class={"osd"}>
|
||||
<With value={osdMode}>
|
||||
{(mode: OSDMode) => {
|
||||
if(!mode.available) return;
|
||||
|
||||
return <Gtk.Box>
|
||||
<Gtk.Image class={"icon"} iconName={
|
||||
createBinding(mode, "icon")
|
||||
} />
|
||||
<Gtk.Box orientation={Gtk.Orientation.VERTICAL} class={"level"} vexpand hexpand>
|
||||
<Gtk.Label class={"text"} label={createBinding(mode, "text").as(t => t ?? "")}
|
||||
ellipsize={Pango.EllipsizeMode.END}
|
||||
visible={variableToBoolean(createBinding(mode, "text"))}
|
||||
/>
|
||||
<Gtk.LevelBar value={createBinding(mode, "value")} hexpand
|
||||
maxValue={createBinding(mode, "max")}
|
||||
/>
|
||||
</Gtk.Box>
|
||||
</Gtk.Box>;
|
||||
}}
|
||||
</With>
|
||||
</Gtk.Box>
|
||||
</Astal.Window>;
|
||||
|
||||
export function triggerOSD(mode: OSDMode) {
|
||||
setOSDMode(mode);
|
||||
Windows.getDefault().open("osd");
|
||||
|
||||
if(!osdTimer) {
|
||||
osdTimer = setTimeout(() => {
|
||||
osdTimer = undefined;
|
||||
Windows.getDefault().close("osd");
|
||||
}, osdTimeout);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
osdTimer.destroy();
|
||||
osdTimer = setTimeout(() => {
|
||||
Windows.getDefault().close("osd");
|
||||
osdTimer = undefined;
|
||||
}, osdTimeout);
|
||||
}
|
||||
39
home/ags-config/window/osd/modules/osdmode.ts
Normal file
39
home/ags-config/window/osd/modules/osdmode.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { Accessor } from "ags";
|
||||
import { construct } from "../../../modules/utils";
|
||||
import GObject, { gtype, property, register } from "ags/gobject";
|
||||
|
||||
|
||||
@register({ GTypeName: "OSDMode" })
|
||||
export default class OSDMode extends GObject.Object {
|
||||
readonly #subs: Array<() => void> = [];
|
||||
|
||||
@property(String)
|
||||
icon: string = "image-missing";
|
||||
|
||||
@property(Number)
|
||||
value: number = 0;
|
||||
|
||||
@property(Number)
|
||||
max: number = 100;
|
||||
|
||||
@property(gtype<string|null>(String))
|
||||
text: string|null = null;
|
||||
|
||||
@property(Boolean)
|
||||
available: boolean = true;
|
||||
|
||||
constructor(props: {
|
||||
icon: string | Accessor<string>;
|
||||
value: number | Accessor<number>;
|
||||
max?: number | Accessor<number>;
|
||||
text?: string | Accessor<string>;
|
||||
available?: boolean | Accessor<boolean>;
|
||||
}) {
|
||||
super();
|
||||
this.#subs = construct(this, props);
|
||||
}
|
||||
|
||||
vfunc_dispose(): void {
|
||||
this.#subs.forEach(s => s());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user