feat(ags): add message when shutting down, rebooting, etc.
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
6e2c84a050
commit
a504422ca8
2 changed files with 55 additions and 27 deletions
|
@ -2,14 +2,18 @@
|
||||||
@use '../../style/colors';
|
@use '../../style/colors';
|
||||||
|
|
||||||
.powermenu {
|
.powermenu {
|
||||||
font-size: 70px;
|
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
|
||||||
icon {
|
icon {
|
||||||
|
font-size: 70px;
|
||||||
min-width: 130px;
|
min-width: 130px;
|
||||||
min-height: 130px;
|
min-height: 130px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
font-size: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
margin: 5px 10px;
|
margin: 5px 10px;
|
||||||
transition: all ease .2s;
|
transition: all ease .2s;
|
||||||
|
|
|
@ -1,17 +1,26 @@
|
||||||
import { execAsync } from 'astal';
|
import { execAsync } from 'astal';
|
||||||
import { Astal } from 'astal/gtk3';
|
import { Astal, Gtk } from 'astal/gtk3';
|
||||||
|
|
||||||
import { hyprMessage } from '../../lib';
|
import { hyprMessage } from '../../lib';
|
||||||
|
|
||||||
import PopupWindow from '../misc/popup-window';
|
import PopupWindow from '../misc/popup-window';
|
||||||
|
|
||||||
|
|
||||||
const PowermenuWidget = () => (
|
const PowermenuWidget = () => {
|
||||||
|
const label = <label /> as Astal.Label;
|
||||||
|
|
||||||
|
return (
|
||||||
<centerbox className="powermenu widget">
|
<centerbox className="powermenu widget">
|
||||||
|
<stack transitionType={Gtk.StackTransitionType.SLIDE_DOWN}>
|
||||||
|
<box name="buttons">
|
||||||
<button
|
<button
|
||||||
className="shutdown button"
|
className="shutdown button"
|
||||||
cursor="pointer"
|
cursor="pointer"
|
||||||
onButtonReleaseEvent={() => execAsync(['systemctl', 'poweroff']).catch(print)}
|
onButtonReleaseEvent={(self) => {
|
||||||
|
label.set_label('Shutting down...');
|
||||||
|
(self.get_parent()?.get_parent() as Astal.Stack).set_shown('message');
|
||||||
|
execAsync(['systemctl', 'poweroff']).catch(print);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<icon icon="system-shutdown-symbolic" />
|
<icon icon="system-shutdown-symbolic" />
|
||||||
</button>
|
</button>
|
||||||
|
@ -19,7 +28,11 @@ const PowermenuWidget = () => (
|
||||||
<button
|
<button
|
||||||
className="reboot button"
|
className="reboot button"
|
||||||
cursor="pointer"
|
cursor="pointer"
|
||||||
onButtonReleaseEvent={() => execAsync(['systemctl', 'reboot']).catch(print)}
|
onButtonReleaseEvent={(self) => {
|
||||||
|
label.set_label('Rebooting...');
|
||||||
|
(self.get_parent()?.get_parent() as Astal.Stack).set_shown('message');
|
||||||
|
execAsync(['systemctl', 'reboot']).catch(print);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<icon icon="system-restart-symbolic" />
|
<icon icon="system-restart-symbolic" />
|
||||||
</button>
|
</button>
|
||||||
|
@ -27,12 +40,23 @@ const PowermenuWidget = () => (
|
||||||
<button
|
<button
|
||||||
className="logout button"
|
className="logout button"
|
||||||
cursor="pointer"
|
cursor="pointer"
|
||||||
onButtonReleaseEvent={() => hyprMessage('dispatch exit').catch(print)}
|
onButtonReleaseEvent={(self) => {
|
||||||
|
label.set_label('Logging out...');
|
||||||
|
(self.get_parent()?.get_parent() as Astal.Stack).set_shown('message');
|
||||||
|
hyprMessage('dispatch exit').catch(print);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<icon icon="system-log-out-symbolic" />
|
<icon icon="system-log-out-symbolic" />
|
||||||
</button>
|
</button>
|
||||||
|
</box>
|
||||||
|
|
||||||
|
<box name="message" hexpand={false} halign={Gtk.Align.CENTER}>
|
||||||
|
{label}
|
||||||
|
</box>
|
||||||
|
</stack>
|
||||||
</centerbox>
|
</centerbox>
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export default () => (
|
export default () => (
|
||||||
<PopupWindow
|
<PopupWindow
|
||||||
|
|
Loading…
Add table
Reference in a new issue