From dcc3c1fd4c5960f49f9bce443b77393430a95f38 Mon Sep 17 00:00:00 2001
From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
Date: Wed, 2 Apr 2025 15:02:36 +1100
Subject: sidebar: add date time to time pane

---
 src/modules/bar.tsx | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

(limited to 'src/modules/bar.tsx')

diff --git a/src/modules/bar.tsx b/src/modules/bar.tsx
index 29f4f88..2aa45b6 100644
--- a/src/modules/bar.tsx
+++ b/src/modules/bar.tsx
@@ -7,7 +7,6 @@ import { ellipsize } from "@/utils/strings";
 import { bindCurrentTime, osIcon } from "@/utils/system";
 import type { AstalWidget } from "@/utils/types";
 import { setupCustomTooltip } from "@/utils/widgets";
-import type PopupWindow from "@/widgets/popupwindow";
 import ScreenCorner from "@/widgets/screencorner";
 import { execAsync, Variable } from "astal";
 import Binding, { bind, kebabify } from "astal/binding";
@@ -66,14 +65,6 @@ const hookFocusedClientProp = (
     callback(lastClient);
 };
 
-const togglePopup = (self: JSX.Element, event: Astal.ClickEvent, name: string) => {
-    const popup = App.get_window(name) as PopupWindow | null;
-    if (popup) {
-        if (popup.visible) popup.hide();
-        else popup.popup_at_widget(self, event);
-    }
-};
-
 const switchPane = (name: string) => {
     const sidebar = App.get_window("sidebar") as SideBar | null;
     if (sidebar) {
@@ -511,7 +502,7 @@ const Battery = () => {
 
 const DateTime = () => (
     <button
-        onClick={(self, event) => event.button === Astal.MouseButton.PRIMARY && togglePopup(self, event, "sideright")}
+        onClick={(_, event) => event.button === Astal.MouseButton.PRIMARY && switchPane("time")}
         setup={self =>
             setupCustomTooltip(self, bindCurrentTime(bind(config.modules.dateTime.detailedFormat), undefined, self))
         }
@@ -532,7 +523,7 @@ const DateTime = () => (
 
 const DateTimeVertical = () => (
     <button
-        onClick={(self, event) => event.button === Astal.MouseButton.PRIMARY && togglePopup(self, event, "sideright")}
+        onClick={(_, event) => event.button === Astal.MouseButton.PRIMARY && switchPane("time")}
         setup={self =>
             setupCustomTooltip(self, bindCurrentTime(bind(config.modules.dateTime.detailedFormat), undefined, self))
         }
-- 
cgit v1.2.3-freya

