dotfiles/apps/.config/ags/widget/modules/WindowTitle.tsx
End bbf099c078
Add AGS bar, wezterm, and misc configs; exclude KDE private keys
- Add full AGS bar (GTK4/Astal/TypeScript) with all modules
- Add wezterm config
- Add niri config, starship, btop, xdg-portal, fish colors
- Add gitignores for browser caches, JetBrains runtime, AGS node_modules
- Exclude kdeconnect private/certificate pem files
2026-04-12 14:45:39 -07:00

32 lines
763 B
TypeScript

import { createState } from "ags"
import { interval } from "ags/time"
import { execAsync } from "ags/process"
import { Gtk } from "ags/gtk4"
interface NiriWindow {
title: string | null
app_id: string | null
}
export default function WindowTitle() {
const [win, setWin] = createState<NiriWindow>({ title: null, app_id: null })
function poll() {
execAsync(["niri", "msg", "--json", "focused-window"])
.then(out => { try { setWin(JSON.parse(out)) } catch {} })
.catch(() => setWin({ title: null, app_id: null }))
}
poll()
interval(1000, poll)
return (
<label
class="window-title"
halign={Gtk.Align.START}
ellipsize={3}
maxWidthChars={40}
label={win(w => w.title ?? w.app_id ?? "")}
/>
)
}