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';
|
||||
|
||||
.powermenu {
|
||||
font-size: 70px;
|
||||
padding: 10px;
|
||||
|
||||
icon {
|
||||
font-size: 70px;
|
||||
min-width: 130px;
|
||||
min-height: 130px;
|
||||
}
|
||||
|
||||
label {
|
||||
font-size: 50px;
|
||||
}
|
||||
|
||||
button {
|
||||
margin: 5px 10px;
|
||||
transition: all ease .2s;
|
||||
|
|
|
@ -1,38 +1,62 @@
|
|||
import { execAsync } from 'astal';
|
||||
import { Astal } from 'astal/gtk3';
|
||||
import { Astal, Gtk } from 'astal/gtk3';
|
||||
|
||||
import { hyprMessage } from '../../lib';
|
||||
|
||||
import PopupWindow from '../misc/popup-window';
|
||||
|
||||
|
||||
const PowermenuWidget = () => (
|
||||
<centerbox className="powermenu widget">
|
||||
<button
|
||||
className="shutdown button"
|
||||
cursor="pointer"
|
||||
onButtonReleaseEvent={() => execAsync(['systemctl', 'poweroff']).catch(print)}
|
||||
>
|
||||
<icon icon="system-shutdown-symbolic" />
|
||||
</button>
|
||||
const PowermenuWidget = () => {
|
||||
const label = <label /> as Astal.Label;
|
||||
|
||||
<button
|
||||
className="reboot button"
|
||||
cursor="pointer"
|
||||
onButtonReleaseEvent={() => execAsync(['systemctl', 'reboot']).catch(print)}
|
||||
>
|
||||
<icon icon="system-restart-symbolic" />
|
||||
</button>
|
||||
return (
|
||||
<centerbox className="powermenu widget">
|
||||
<stack transitionType={Gtk.StackTransitionType.SLIDE_DOWN}>
|
||||
<box name="buttons">
|
||||
<button
|
||||
className="shutdown button"
|
||||
cursor="pointer"
|
||||
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" />
|
||||
</button>
|
||||
|
||||
<button
|
||||
className="logout button"
|
||||
cursor="pointer"
|
||||
onButtonReleaseEvent={() => hyprMessage('dispatch exit').catch(print)}
|
||||
>
|
||||
<icon icon="system-log-out-symbolic" />
|
||||
</button>
|
||||
</centerbox>
|
||||
);
|
||||
<button
|
||||
className="reboot button"
|
||||
cursor="pointer"
|
||||
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" />
|
||||
</button>
|
||||
|
||||
<button
|
||||
className="logout button"
|
||||
cursor="pointer"
|
||||
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" />
|
||||
</button>
|
||||
</box>
|
||||
|
||||
<box name="message" hexpand={false} halign={Gtk.Align.CENTER}>
|
||||
{label}
|
||||
</box>
|
||||
</stack>
|
||||
</centerbox>
|
||||
);
|
||||
};
|
||||
|
||||
export default () => (
|
||||
<PopupWindow
|
||||
|
|
Loading…
Add table
Reference in a new issue