refactor(ags): move stuff out of config.js

This commit is contained in:
matt1432 2023-11-04 22:10:23 -04:00
parent 56713fe806
commit c604f8fa72
5 changed files with 29 additions and 22 deletions

View file

@ -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 {

View file

@ -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();
});
});

View file

@ -121,7 +121,7 @@ export function updateClients(box) {
];
if (newClient[0]) {
toRemove.remove(newClient[0]);
toRemove.removeItem(newClient[0]);
fixed.move(...newClient);
}
else {

View file

@ -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);
};

View file

@ -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);
});
}
},