diff --git a/devices/wim/config/ags/config.js b/devices/wim/config/ags/config.js index 5ded7bd0..87126f97 100644 --- a/devices/wim/config/ags/config.js +++ b/devices/wim/config/ags/config.js @@ -1,18 +1,7 @@ -// Has to be a traditional function for 'this' scope -Array.prototype.remove = function (el) { this.splice(this.indexOf(el), 1); }; - -import App from 'resource:///com/github/Aylur/ags/app.js'; -import { exec, execAsync } from 'resource:///com/github/Aylur/ags/utils.js'; - -import Tablet from './services/tablet.js'; -globalThis.Tablet = Tablet; - -import Pointers from './services/pointers.js'; -globalThis.Pointers = Pointers; - -import closeAll from './js/misc/closer.js'; -globalThis.closeAll = closeAll; +import App from 'resource:///com/github/Aylur/ags/app.js'; +import { exec } from 'resource:///com/github/Aylur/ags/utils.js'; +import Setup from './js/setup.js'; import Powermenu from './js/powermenu.js'; import * as Bar from './js/bar/main.js'; import NotifCenter from './js/notifications/center.js'; @@ -23,13 +12,15 @@ import Overview from './js/overview/main.js'; import AppLauncher from './js/applauncher/main.js'; import * as Corners from './js/screen-corners.js'; +// Has to be a traditional function for 'this' scope +// Keep this here for no errors +Array.prototype.removeItem = function (el) { this.splice(this.indexOf(el), 1); }; + const scss = App.configDir + '/scss/main.scss'; const css = App.configDir + '/style.css'; - exec(`sassc ${scss} ${css}`); - -execAsync(['bash', '-c', '$AGS_PATH/startup.sh']).catch(print); +Setup(); export default { diff --git a/devices/wim/config/ags/js/notifications/base.js b/devices/wim/config/ags/js/notifications/base.js index d1c8fe10..864043df 100644 --- a/devices/wim/config/ags/js/notifications/base.js +++ b/devices/wim/config/ags/js/notifications/base.js @@ -139,7 +139,7 @@ export const Notification = ({ notifWidget.child.setStyle(notifWidget.child[`_squeeze${side}`]); timeout(500, () => { HasNotifs.value = Notifications.notifications.length > 0; - notifWidget.get_parent().remove(notifWidget); + notifWidget.get_parent().removeItem(notifWidget); notifWidget.destroy(); }); }); diff --git a/devices/wim/config/ags/js/overview/clients.js b/devices/wim/config/ags/js/overview/clients.js index 03df4261..36f64c83 100644 --- a/devices/wim/config/ags/js/overview/clients.js +++ b/devices/wim/config/ags/js/overview/clients.js @@ -121,7 +121,7 @@ export function updateClients(box) { ]; if (newClient[0]) { - toRemove.remove(newClient[0]); + toRemove.removeItem(newClient[0]); fixed.move(...newClient); } else { diff --git a/devices/wim/config/ags/js/setup.js b/devices/wim/config/ags/js/setup.js new file mode 100644 index 00000000..53cbb54f --- /dev/null +++ b/devices/wim/config/ags/js/setup.js @@ -0,0 +1,14 @@ +import { execAsync } from 'resource:///com/github/Aylur/ags/utils.js'; + +import Tablet from '../services/tablet.js'; +import Pointers from '../services/pointers.js'; +import closeAll from './misc/closer.js'; + + +export default () => { + globalThis.Tablet = Tablet; + globalThis.Pointers = Pointers; + globalThis.closeAll = closeAll; + + execAsync(['bash', '-c', '$AGS_PATH/startup.sh']).catch(print); +}; diff --git a/devices/wim/config/ags/services/tablet.js b/devices/wim/config/ags/services/tablet.js index e0fa45ce..8c88c5a6 100644 --- a/devices/wim/config/ags/services/tablet.js +++ b/devices/wim/config/ags/services/tablet.js @@ -34,7 +34,7 @@ class Tablet extends Service { udevClient = GUdev.Client.new(['input']); get tabletMode() { return this.tabletMode; } - get autorotate() { return this.autorotate; } + get oskState() { return this.oskState; } constructor() { super(); @@ -140,11 +140,13 @@ class Tablet extends Service { const orientation = ROTATION_MAPPING[output.split(' ').at(-1)]; execAsync(['hyprctl', 'keyword', 'monitor', - `${SCREEN},transform,${orientation}`]).catch(print); + `${SCREEN},transform,${orientation}`]) + .catch(print); this.devices.forEach(dev => { execAsync(['hyprctl', 'keyword', - `device:${dev}:transform`, String(orientation)]).catch(print); + `device:${dev}:transform`, String(orientation)]) + .catch(print); }); } },