From 3c579d0e275cdaf6f2c9589abade94bde7905c82 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sat, 26 Apr 2025 22:36:23 +1000 Subject: clean Remove everything --- src/modules/navbar.tsx | 203 ------------------------------------------------- 1 file changed, 203 deletions(-) delete mode 100644 src/modules/navbar.tsx (limited to 'src/modules/navbar.tsx') diff --git a/src/modules/navbar.tsx b/src/modules/navbar.tsx deleted file mode 100644 index 35d3900..0000000 --- a/src/modules/navbar.tsx +++ /dev/null @@ -1,203 +0,0 @@ -import type { Monitor } from "@/services/monitors"; -import { capitalize } from "@/utils/strings"; -import type { AstalWidget } from "@/utils/types"; -import { bind, execAsync, Variable } from "astal"; -import { App, Astal, Gtk } from "astal/gtk3"; -import { navbar as config } from "config"; -import AstalHyprland from "gi://AstalHyprland"; -import Pango from "gi://Pango"; -import SideBar, { awaitSidebar, paneNames, switchPane, type PaneName } from "./sidebar"; - -const layerNames = ["mediadisplay"] as const; -type LayerName = `${(typeof layerNames)[number]}${number}`; - -const specialWsNames = ["sysmon", "communication", "music", "todo"] as const; -type SpecialWsName = (typeof specialWsNames)[number]; - -const getPaneIcon = (name: PaneName) => { - if (name === "dashboard") return "dashboard"; - if (name === "audio") return "tune"; - if (name === "connectivity") return "settings_ethernet"; - if (name === "packages") return "package_2"; - if (name === "alerts") return "notifications"; - return "date_range"; -}; - -const getLayerIcon = (name: LayerName) => { - return "graphic_eq"; -}; - -const getSpecialWsIcon = (name: SpecialWsName) => { - if (name === "sysmon") return "speed"; - if (name === "communication") return "communication"; - if (name === "music") return "music_note"; - return "checklist"; -}; - -const hookIsCurrent = ( - self: AstalWidget, - sidebar: Variable, - name: PaneName, - callback: (isCurrent: boolean) => void -) => { - const unsub = sidebar.subscribe(s => { - if (!s) return; - self.hook(s.shown, (_, v) => callback(s.visible && v === name)); - self.hook(s, "notify::visible", () => callback(s.visible && s.shown.get() === name)); - callback(s.visible && s.shown.get() === name); - unsub(); - }); -}; - -const PaneButton = ({ - monitor, - name, - sidebar, -}: { - monitor: Monitor; - name: PaneName; - sidebar: Variable; -}) => ( - -); - -const LayerButton = ({ name }: { name: LayerName }) => ( - -); - -const SpecialWsButton = ({ name }: { name: SpecialWsName }) => { - const revealChild = Variable.derive( - [config.showLabels, bind(AstalHyprland.get_default(), "focusedClient")], - (l, c) => l && c?.get_workspace().get_name() === `special:${name}` - ); - - return ( - - ); -}; - -export default ({ monitor }: { monitor: Monitor }) => { - const sidebar = Variable(null); - awaitSidebar(monitor).then(s => sidebar.set(s)); - - return ( - { - const hyprland = AstalHyprland.get_default(); - const visible = Variable(config.persistent.get()); - - visible.poll(100, () => { - const width = self.visible - ? Math.max(config.appearWidth.get(), self.get_allocated_width()) - : config.appearWidth.get(); - return hyprland.get_cursor_position().x < width; - }); - if (config.persistent.get()) visible.stopPoll(); - - self.hook(config.persistent, (_, v) => { - if (v) { - visible.stopPoll(); - visible.set(true); - } else visible.startPoll(); - }); - - self.hook(visible, (_, v) => self.set_visible(v)); - self.connect("destroy", () => visible.drop()); - }} - > - { - const shown = sidebar.get()?.shown; - if (!shown) return; - const idx = paneNames.indexOf(shown.get()); - if (event.delta_y > 0) shown.set(paneNames[Math.min(paneNames.length - 1, idx + 1)]); - else shown.set(paneNames[Math.max(0, idx - 1)]); - }} - > - - {paneNames.map(n => ( - - ))} - {layerNames.map(n => ( - - ))} - - {specialWsNames.map(n => ( - - ))} - - - - ); -}; -- cgit v1.2.3-freya