Migrate dotfiles to Omarchy 4

Claude-Session: https://claude.ai/code/session_014ADhvRXuiTvrXSbConxUey
This commit is contained in:
2026-08-19 13:46:33 -04:00
parent 007a032568
commit a0b06b12a3
35 changed files with 390 additions and 876 deletions
+39 -21
View File
@@ -7,44 +7,62 @@ import { sh, shell } from "../lib/utils"
export const NOTIFICATION_WINDOW = "notification-center"
type Notification = {
id: number
file: string
appName: string
summary: string
body: string
timestamp: number
}
const NOTIFICATION_DIR = "$HOME/.local/state/omarchy/notifications"
const listCommand =
`for file in "${NOTIFICATION_DIR}"/*.json "${NOTIFICATION_DIR}"/history/*.json; do ` +
"[ -f \"$file\" ] || continue; " +
"printf '%s\\t%s\\n' \"$file\" \"$(head -n 1 \"$file\")\"; " +
"done"
function parseNotifications(stdout: string): Notification[] {
try {
const parsed = JSON.parse(stdout)
const group = parsed?.data?.[0] ?? []
return group.map((item: any) => ({
id: item.id?.value ?? 0,
appName: item["app-name"]?.value ?? "",
summary: item.summary?.value ?? "",
body: item.body?.value ?? "",
}))
} catch {
return []
}
return stdout
.split("\n")
.filter((line) => line.includes("\t"))
.map((line) => {
const separator = line.indexOf("\t")
const file = line.slice(0, separator)
try {
const entry = JSON.parse(line.slice(separator + 1))
return {
file,
appName: String(entry.app ?? ""),
summary: String(entry.summary ?? ""),
body: String(entry.body ?? ""),
timestamp: Number(entry.timestamp ?? 0),
}
} catch {
return null
}
})
.filter((item): item is Notification => item !== null)
.sort((left, right) => right.timestamp - left.timestamp)
}
const notifications = createPoll<Notification[]>(
[],
1000,
shell("makoctl list -j 2>/dev/null || echo '{}'"),
shell(listCommand),
(stdout) => parseNotifications(stdout),
)
const doNotDisturb = createPoll(
false,
1000,
shell("makoctl mode 2>/dev/null"),
(stdout) => stdout.split("\n").includes("do-not-disturb"),
shell("omarchy-shell notifications dndState 2>/dev/null"),
(stdout) => stdout.trim() === "on",
)
const dismiss = (id: number) => sh(`makoctl dismiss -n ${id}`)
const clearAll = () => sh("makoctl dismiss -a")
const toggleDoNotDisturb = () => sh("makoctl mode -t do-not-disturb")
const dismiss = (file: string) => sh(`rm -f '${file.replace(/'/g, "'\\''")}'`)
const clearAll = () => sh("omarchy-shell notifications dismissAll; omarchy-shell notifications clear")
const toggleDoNotDisturb = () => sh("omarchy-shell notifications toggleDnd")
function NotificationItem({ item }: { item: Notification }) {
return (
@@ -60,7 +78,7 @@ function NotificationItem({ item }: { item: Notification }) {
<button
class="notification-item-close"
halign={Gtk.Align.END}
onClicked={() => dismiss(item.id)}
onClicked={() => dismiss(item.file)}
>
<label label={""} />
</button>
@@ -126,7 +144,7 @@ export default function NotificationCenter() {
vscroll={Gtk.PolicyType.AUTOMATIC}
>
<box vertical spacing={8}>
<For each={notifications} id={(item: Notification) => item.id}>
<For each={notifications} id={(item: Notification) => item.file}>
{(item: Notification) => <NotificationItem item={item} />}
</For>
</box>
+5 -5
View File
@@ -43,12 +43,12 @@ const [bluetoothOn] = pollBool(
)
const [doNotDisturb, setDoNotDisturb] = pollBool(
"makoctl mode 2>/dev/null | grep -qx do-not-disturb && echo on || echo off",
"omarchy-shell notifications dndState 2>/dev/null",
2000,
)
const [nightLight, setNightLight] = pollBool(
"pgrep -x hyprsunset >/dev/null && echo on || echo off",
"omarchy-toggle-nightlight --status 2>/dev/null | grep -q '\"enabled\":true' && echo on || echo off",
2000,
)
@@ -134,14 +134,14 @@ function Toggles() {
return (
<box vertical spacing={8}>
<box class="qs-tiles" spacing={8} homogeneous>
<Tile icon={""} label="Wi-Fi" onClicked={() => { closePanel(); sh("omarchy-launch-wifi") }} />
<Tile icon={""} label="Wi-Fi" onClicked={() => { closePanel(); sh("omarchy-shell shell toggle omarchy.network") }} />
<Tile
icon={""}
label="Bluetooth"
active={bluetoothOn}
onClicked={() => {
closePanel()
sh("omarchy-launch-bluetooth")
sh("omarchy-shell shell toggle omarchy.bluetooth")
}}
/>
<Tile
@@ -160,7 +160,7 @@ function Toggles() {
active={doNotDisturb}
onClicked={() => {
setDoNotDisturb(!doNotDisturb.get())
sh("makoctl mode -t do-not-disturb")
sh("omarchy-shell notifications toggleDnd")
}}
/>
<Tile
+1 -1
View File
@@ -39,7 +39,7 @@ const themes = createPoll<Theme[]>(
const currentThemeName = createPoll(
"",
2000,
shell("cat \"$HOME/.config/omarchy/current/theme.name\" 2>/dev/null"),
shell("cat \"$HOME/.local/state/omarchy/current/theme.name\" 2>/dev/null"),
(stdout) => stdout.trim(),
)