multimonitor for osk

This commit is contained in:
end-4
2024-04-05 17:36:22 +07:00
parent f1c3c27e7e
commit f8d84d6068
9 changed files with 22 additions and 34 deletions
+3 -3
View File
@@ -2,12 +2,12 @@ import Widget from 'resource:///com/github/Aylur/ags/widget.js';
import SessionScreen from "./sessionscreen.js";
import PopupWindow from '../.widgethacks/popupwindow.js';
export default () => PopupWindow({ // On-screen keyboard
name: 'session',
export default (id = '') => PopupWindow({ // On-screen keyboard
name: `session${id}`,
visible: false,
keymode: 'exclusive',
layer: 'overlay',
exclusivity: 'ignore',
anchor: ['top', 'bottom', 'left', 'right'],
child: SessionScreen(),
child: SessionScreen({ id: id }),
})
+11 -11
View File
@@ -59,16 +59,16 @@ const SessionButton = (name, icon, command, props = {}, colorid = 0) => {
});
}
export default () => {
export default ({ id = '' }) => {
// lock, logout, sleep
const lockButton = SessionButton('Lock', 'lock', () => { App.closeWindow('session'); execAsync(['loginctl', 'lock-session']).catch(print) }, {}, 1);
const logoutButton = SessionButton('Logout', 'logout', () => { App.closeWindow('session'); execAsync(['bash', '-c', 'pkill Hyprland || pkill sway || pkill niri || loginctl terminate-user $USER']).catch(print) }, {}, 2);
const sleepButton = SessionButton('Sleep', 'sleep', () => { App.closeWindow('session'); execAsync(['bash', '-c', 'systemctl suspend || loginctl suspend']).catch(print) }, {}, 3);
const lockButton = SessionButton('Lock', 'lock', () => { App.closeWindow(`session${id}`); execAsync(['loginctl', 'lock-session']).catch(print) }, {}, 1);
const logoutButton = SessionButton('Logout', 'logout', () => { App.closeWindow(`session${id}`); execAsync(['bash', '-c', 'pkill Hyprland || pkill sway || pkill niri || loginctl terminate-user $USER']).catch(print) }, {}, 2);
const sleepButton = SessionButton('Sleep', 'sleep', () => { App.closeWindow(`session${id}`); execAsync(['bash', '-c', 'systemctl suspend || loginctl suspend']).catch(print) }, {}, 3);
// hibernate, shutdown, reboot
const hibernateButton = SessionButton('Hibernate', 'downloading', () => { App.closeWindow('session'); execAsync(['bash', '-c', 'systemctl hibernate || loginctl hibernate']).catch(print) }, {}, 4);
const shutdownButton = SessionButton('Shutdown', 'power_settings_new', () => { App.closeWindow('session'); execAsync(['bash', '-c', 'systemctl poweroff || loginctl poweroff']).catch(print) }, {}, 5);
const rebootButton = SessionButton('Reboot', 'restart_alt', () => { App.closeWindow('session'); execAsync(['bash', '-c', 'systemctl reboot || loginctl reboot']).catch(print) }, {}, 6);
const cancelButton = SessionButton('Cancel', 'close', () => App.closeWindow('session'), { className: 'session-button-cancel' }, 7);
const hibernateButton = SessionButton('Hibernate', 'downloading', () => { App.closeWindow(`session${id}`); execAsync(['bash', '-c', 'systemctl hibernate || loginctl hibernate']).catch(print) }, {}, 4);
const shutdownButton = SessionButton('Shutdown', 'power_settings_new', () => { App.closeWindow(`session${id}`); execAsync(['bash', '-c', 'systemctl poweroff || loginctl poweroff']).catch(print) }, {}, 5);
const rebootButton = SessionButton('Reboot', 'restart_alt', () => { App.closeWindow(`session${id}`); execAsync(['bash', '-c', 'systemctl reboot || loginctl reboot']).catch(print) }, {}, 6);
const cancelButton = SessionButton('Cancel', 'close', () => App.closeWindow(`session${id}`), { className: 'session-button-cancel' }, 7);
const sessionDescription = Widget.Box({
vertical: true,
@@ -104,9 +104,9 @@ export default () => {
vertical: true,
children: [
Widget.EventBox({
onPrimaryClick: () => App.closeWindow('session'),
onSecondaryClick: () => App.closeWindow('session'),
onMiddleClick: () => App.closeWindow('session'),
onPrimaryClick: () => App.closeWindow(`session${id}`),
onSecondaryClick: () => App.closeWindow(`session${id}`),
onMiddleClick: () => App.closeWindow(`session${id}`),
}),
Widget.Box({
hpack: 'center',