#327 for session screen

This commit is contained in:
end-4 2024-03-17 01:22:38 +07:00
parent 99a5000481
commit 03ec2616df
3 changed files with 24 additions and 19 deletions

View file

@ -8,7 +8,7 @@ import * as Utils from 'resource:///com/github/Aylur/ags/utils.js';
const { exec, execAsync } = Utils;
const SessionButton = (name, icon, command, props = {}) => {
const SessionButton = (name, icon, command, props = {}, colorid = 0) => {
const buttonDescription = Widget.Revealer({
vpack: 'end',
transitionDuration: userOptions.animations.durationSmall,
@ -21,7 +21,7 @@ const SessionButton = (name, icon, command, props = {}) => {
});
return Widget.Button({
onClicked: command,
className: 'session-button',
className: `session-button session-color-${colorid}`,
child: Widget.Overlay({
className: 'session-button-box',
child: Widget.Label({
@ -61,14 +61,14 @@ const SessionButton = (name, icon, command, props = {}) => {
export default () => {
// lock, logout, sleep
const lockButton = SessionButton('Lock', 'lock', () => { App.closeWindow('session'); execAsync(['loginctl', 'lock-session']) });
const logoutButton = SessionButton('Logout', 'logout', () => { App.closeWindow('session'); execAsync(['bash', '-c', 'pkill Hyprland || pkill sway']) });
const sleepButton = SessionButton('Sleep', 'sleep', () => { App.closeWindow('session'); execAsync('systemctl suspend') });
const lockButton = SessionButton('Lock', 'lock', () => { App.closeWindow('session'); execAsync(['loginctl', 'lock-session']) }, {}, 1);
const logoutButton = SessionButton('Logout', 'logout', () => { App.closeWindow('session'); execAsync(['bash', '-c', 'pkill Hyprland || pkill sway']) }, {}, 2);
const sleepButton = SessionButton('Sleep', 'sleep', () => { App.closeWindow('session'); execAsync('systemctl suspend') }, {}, 3);
// hibernate, shutdown, reboot
const hibernateButton = SessionButton('Hibernate', 'downloading', () => { App.closeWindow('session'); execAsync('systemctl hibernate') });
const shutdownButton = SessionButton('Shutdown', 'power_settings_new', () => { App.closeWindow('session'); execAsync('systemctl poweroff') });
const rebootButton = SessionButton('Reboot', 'restart_alt', () => { App.closeWindow('session'); execAsync('systemctl reboot') });
const cancelButton = SessionButton('Cancel', 'close', () => App.closeWindow('session'), { className: 'session-button-cancel' });
const hibernateButton = SessionButton('Hibernate', 'downloading', () => { App.closeWindow('session'); execAsync('systemctl hibernate') }, {}, 4);
const shutdownButton = SessionButton('Shutdown', 'power_settings_new', () => { App.closeWindow('session'); execAsync('systemctl poweroff') }, {}, 5);
const rebootButton = SessionButton('Reboot', 'restart_alt', () => { App.closeWindow('session'); execAsync('systemctl reboot') }, {}, 6);
const cancelButton = SessionButton('Cancel', 'close', () => App.closeWindow('session'), { className: 'session-button-cancel' }, 7);
const sessionDescription = Widget.Box({
vertical: true,

View file

@ -16,7 +16,7 @@ $osk_key_fontsize: 1.091rem;
.osk-body {
padding: 1.023rem;
padding-top: 0px;
padding-top: 0rem;
}
.osk-show {

View file

@ -1,24 +1,23 @@
.session-bg {
background-color: mix($t_t_background, $background, 40%);
background-color: transparentize($color: $layer0, $amount: 0.4);
}
.session-button {
@include large-rounding;
min-width: 8.182rem;
min-height: 8.182rem;
background-color: $surfaceVariant;
color: $onSurfaceVariant;
background-color: $layer1;
color: $onLayer1;
font-size: 3rem;
}
.session-button-focused {
background-color: $secondaryContainer;
color: $onSecondaryContainer;
background-color: $layer1Hover;
}
.session-button-desc {
background-color: mix($surface, $surfaceVariant, 50%);
color: mix($onSurface, $onSurfaceVariant, 50%);
background-color: $layer2;
color: $onLayer2;
border-bottom-left-radius: $rounding_large;
border-bottom-right-radius: $rounding_large;
padding: 0.205rem 0.341rem;
@ -29,7 +28,13 @@
@include large-rounding;
min-width: 8.182rem;
min-height: 5.455rem;
background-color: $surfaceVariant;
color: $onSurfaceVariant;
background-color: $layer1;
color: $onLayer1;
font-size: 3rem;
}
@for $i from 1 through 7 {
.session-color-#{$i} {
color: nth($sessionColors, $i);
}
}