multimonitor for osk

This commit is contained in:
end-4
2024-04-05 17:36:22 +07:00
parent fe7bc24eb8
commit 53857d728d
9 changed files with 22 additions and 34 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ const SysTrayItem = (item) => Button({
className: 'bar-systray-item',
child: Icon({
hpack: 'center',
icon: item.icon,
icon: `${item.icon}`,
setup: (self) => self.hook(item, (self) => self.icon = item.icon),
}),
setup: (self) => self
-7
View File
@@ -62,12 +62,6 @@ const CheatsheetHeader = () => Widget.CenterBox({
}),
});
const ClickOutsideToClose = () => Widget.EventBox({
onPrimaryClick: () => App.closeWindow('cheatsheet'),
onSecondaryClick: () => App.closeWindow('cheatsheet'),
onMiddleClick: () => App.closeWindow('cheatsheet'),
});
export default (id) => PopupWindow({
name: `cheatsheet${id}`,
layer: 'overlay',
@@ -76,7 +70,6 @@ export default (id) => PopupWindow({
child: Widget.Box({
vertical: true,
children: [
ClickOutsideToClose(),
Widget.Box({
vertical: true,
className: "cheatsheet-bg spacing-v-15",
+1 -1
View File
@@ -6,5 +6,5 @@ export default (id) => PopupWindow({
name: `osk${id}`,
showClassName: 'osk-show',
hideClassName: 'osk-hide',
child: OnScreenKeyboard(),
child: OnScreenKeyboard({ id: id }),
});
@@ -215,7 +215,7 @@ const KeyboardWindow = () => Box({
}),
});
export default () => {
export default ({ id }) => {
const kbWindow = KeyboardWindow();
const gestureEvBox = EventBox({ child: kbWindow })
const gesture = Gtk.GestureDrag.new(gestureEvBox);
@@ -249,7 +249,7 @@ export default () => {
gesture.connect('drag-end', () => {
var offset = gesture.get_offset()[2];
if (offset > 50) {
App.closeWindow('osk');
App.closeWindow(`osk${id}`);
}
else {
kbWindow.setCss(`
+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',
-5
View File
@@ -77,11 +77,6 @@ export default () => Box({
hexpand: true,
css: 'min-width: 2px;',
children: [
EventBox({
onPrimaryClick: () => App.closeWindow('sideleft'),
onSecondaryClick: () => App.closeWindow('sideleft'),
onMiddleClick: () => App.closeWindow('sideleft'),
}),
widgetContent,
],
setup: (self) => self
@@ -76,7 +76,7 @@ export default () => SidebarModule({
className: 'sidebar-module-scripts-button',
child: scriptStateIcon,
onClicked: () => {
App.closeWindow('sideleft');
closeEverything();
execAsync([`bash`, `-c`, `${userOptions.apps.terminal} fish -C "${script.command}"`]).catch(print)
.then(() => {
scriptStateIcon.label = 'done';
@@ -41,7 +41,7 @@ export const ToggleIconBluetooth = (props = {}) => Widget.Button({
},
onSecondaryClickRelease: () => {
execAsync(['bash', '-c', `${userOptions.apps.bluetooth}`]).catch(print);
App.closeWindow('sideright');
closeEverything();
},
child: BluetoothIndicator(),
setup: (self) => {
@@ -227,8 +227,8 @@ export const ModulePowerIcon = (props = {}) => Widget.Button({
className: 'txt-small sidebar-iconbutton',
tooltipText: 'Session',
onClicked: () => {
App.toggleWindow('session');
App.closeWindow('sideright');
closeEverything();
Utils.timeout(1, () => App.openWindow('session'));
},
child: MaterialIcon('power_settings_new', 'norm'),
setup: button => {