From 02fd2e97f2c8a53bf2344e6fa8b14769cb15ee38 Mon Sep 17 00:00:00 2001
From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
Date: Thu, 16 Jan 2025 16:35:37 +1100
Subject: refactor: move ts to src
Also move popupwindow to own file
---
modules/bar.tsx | 500 --------------------------------------------------------
1 file changed, 500 deletions(-)
delete mode 100644 modules/bar.tsx
(limited to 'modules/bar.tsx')
diff --git a/modules/bar.tsx b/modules/bar.tsx
deleted file mode 100644
index 5ed309e..0000000
--- a/modules/bar.tsx
+++ /dev/null
@@ -1,500 +0,0 @@
-import { execAsync, GLib, register, Variable } from "astal";
-import { bind, kebabify } from "astal/binding";
-import { App, Astal, astalify, Gdk, Gtk, type ConstructProps } from "astal/gtk3";
-import AstalBluetooth from "gi://AstalBluetooth";
-import AstalHyprland from "gi://AstalHyprland";
-import AstalNetwork from "gi://AstalNetwork";
-import AstalNotifd from "gi://AstalNotifd";
-import AstalTray from "gi://AstalTray";
-import AstalWp01 from "gi://AstalWp";
-import { bar as config } from "../config";
-import type { Monitor } from "../services/monitors";
-import Players from "../services/players";
-import Updates from "../services/updates";
-import { getAppCategoryIcon } from "../utils/icons";
-import { ellipsize } from "../utils/strings";
-import { osIcon } from "../utils/system";
-import { setupCustomTooltip } from "../utils/widgets";
-
-const hyprland = AstalHyprland.get_default();
-
-const hookFocusedClientProp = (
- self: any, // Ugh why is there no base Widget type
- prop: keyof AstalHyprland.Client,
- callback: (c: AstalHyprland.Client | null) => void
-) => {
- let id: number | null = null;
- let lastClient: AstalHyprland.Client | null = null;
- self.hook(hyprland, "notify::focused-client", () => {
- if (id) lastClient?.disconnect(id);
- lastClient = hyprland.focusedClient; // Can be null
- id = lastClient?.connect(`notify::${kebabify(prop)}`, () => callback(lastClient));
- callback(lastClient);
- });
- self.connect("destroy", () => id && lastClient?.disconnect(id));
- callback(lastClient);
-};
-
-const OSIcon = () => ;
-
-const ActiveWindow = () => (
- {
- const title = Variable("");
- const updateTooltip = (c: AstalHyprland.Client | null) =>
- title.set(c?.class && c?.title ? `${c.class}: ${c.title}` : "");
- hookFocusedClientProp(self, "class", updateTooltip);
- hookFocusedClientProp(self, "title", updateTooltip);
- updateTooltip(hyprland.focusedClient);
-
- const window = setupCustomTooltip(self, bind(title));
- if (window) {
- self.hook(title, (_, v) => !v && window.hide());
- self.hook(window, "map", () => !title.get() && window.hide());
- }
- }}
- >
-
-);
-
-const MediaPlaying = () => {
- const players = Players.get_default();
- const getLabel = (fallback = "") =>
- players.lastPlayer ? `${players.lastPlayer.title} - ${players.lastPlayer.artist}` : fallback;
- return (
-
- );
-};
-
-const Workspace = ({ idx }: { idx: number }) => {
- let wsId = Math.floor((hyprland.focusedWorkspace.id - 1) / config.wsPerGroup) * config.wsPerGroup + idx;
- return (
-