diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-01-19 19:00:07 +1100 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-01-19 19:00:07 +1100 |
| commit | 611f2c766fbd916c758727e9899957df2339af8b (patch) | |
| tree | 5483ea26408e1cf273768a028996a49228aae88a /src | |
| parent | launcher: reload subcommand (diff) | |
| download | caelestia-shell-611f2c766fbd916c758727e9899957df2339af8b.tar.gz caelestia-shell-611f2c766fbd916c758727e9899957df2339af8b.tar.bz2 caelestia-shell-611f2c766fbd916c758727e9899957df2339af8b.zip | |
session screen
Switch from wlogout
Diffstat (limited to 'src')
| -rw-r--r-- | src/modules/bar.tsx | 6 | ||||
| -rw-r--r-- | src/modules/session.tsx | 34 | ||||
| -rw-r--r-- | src/widgets/popupwindow.ts | 2 |
3 files changed, 36 insertions, 6 deletions
diff --git a/src/modules/bar.tsx b/src/modules/bar.tsx index fbcfb10..47702e8 100644 --- a/src/modules/bar.tsx +++ b/src/modules/bar.tsx @@ -452,11 +452,7 @@ const DateTime = () => ( ); const Power = () => ( - <button - className="module power" - label="power_settings_new" - onClicked={() => execAsync("fish -c 'pkill wlogout || wlogout -p layer-shell'").catch(console.error)} - /> + <button className="module power" label="power_settings_new" onClicked={() => App.toggle_window("session")} /> ); export default ({ monitor }: { monitor: Monitor }) => ( 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> +); diff --git a/src/widgets/popupwindow.ts b/src/widgets/popupwindow.ts index 335260d..bbc6053 100644 --- a/src/widgets/popupwindow.ts +++ b/src/widgets/popupwindow.ts @@ -13,6 +13,7 @@ export default class PopupWindow extends Widget.Window { super({ keymode: Astal.Keymode.ON_DEMAND, exclusivity: Astal.Exclusivity.IGNORE, + borderWidth: 20, // To allow shadow, cause if not it gets cut off ...props, visible: false, application: App, @@ -24,7 +25,6 @@ export default class PopupWindow extends Widget.Window { return props.onKeyPressEvent?.(self, event); }, - borderWidth: 20, // To allow shadow, cause if not it gets cut off }); } |