mirror of
https://github.com/System-End/dotfiles.git
synced 2026-04-19 20:55:06 +00:00
- 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
32 lines
763 B
TypeScript
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 ?? "")}
|
|
/>
|
|
)
|
|
}
|