From 611f2c766fbd916c758727e9899957df2339af8b Mon Sep 17 00:00:00 2001
From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
Date: Sun, 19 Jan 2025 19:00:07 +1100
Subject: session screen

Switch from wlogout
---
 src/modules/session.tsx | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 src/modules/session.tsx

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

diff --git a/src/modules/session.tsx b/src/modules/session.tsx
new file mode 100644
index 0000000..7d04870
--- /dev/null
+++ b/src/modules/session.tsx
@@ -0,0 +1,34 @@
+import { execAsync } from "astal";
+import { Astal, Gtk } from "astal/gtk3";
+import PopupWindow from "../widgets/popupwindow";
+
+const Item = ({ icon, label, cmd }: { icon: string; label: string; cmd: string }) => (
+    <box vertical className="item">
+        <button cursor="pointer" onClicked={() => execAsync(cmd).catch(console.error)}>
+            <label className="icon" label={icon} />
+        </button>
+        <label className="label" label={label} />
+    </box>
+);
+
+export default () => (
+    <PopupWindow
+        className="session"
+        name="session"
+        anchor={Astal.WindowAnchor.TOP | Astal.WindowAnchor.LEFT | Astal.WindowAnchor.BOTTOM | Astal.WindowAnchor.RIGHT}
+        keymode={Astal.Keymode.EXCLUSIVE}
+        layer={Astal.Layer.OVERLAY}
+        borderWidth={0} // Don't need border width cause takes up entire screen
+    >
+        <box vertical halign={Gtk.Align.CENTER} valign={Gtk.Align.CENTER} className="inner">
+            <box>
+                <Item icon="logout" label="Logout" cmd="uwsm stop" />
+                <Item icon="cached" label="Reboot" cmd="systemctl reboot" />
+            </box>
+            <box>
+                <Item icon="downloading" label="Hibernate" cmd="systemctl hibernate" />
+                <Item icon="power_settings_new" label="Shutdown" cmd="systemctl poweroff" />
+            </box>
+        </box>
+    </PopupWindow>
+);
-- 
cgit v1.2.3-freya

