refactor(ags): move stuff out of config.js
This commit is contained in:
parent
56713fe806
commit
c604f8fa72
5 changed files with 29 additions and 22 deletions
|
@ -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 App from 'resource:///com/github/Aylur/ags/app.js';
|
||||||
import { exec, execAsync } from 'resource:///com/github/Aylur/ags/utils.js';
|
import { exec } 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 Setup from './js/setup.js';
|
||||||
import Powermenu from './js/powermenu.js';
|
import Powermenu from './js/powermenu.js';
|
||||||
import * as Bar from './js/bar/main.js';
|
import * as Bar from './js/bar/main.js';
|
||||||
import NotifCenter from './js/notifications/center.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 AppLauncher from './js/applauncher/main.js';
|
||||||
import * as Corners from './js/screen-corners.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 scss = App.configDir + '/scss/main.scss';
|
||||||
const css = App.configDir + '/style.css';
|
const css = App.configDir + '/style.css';
|
||||||
|
|
||||||
exec(`sassc ${scss} ${css}`);
|
exec(`sassc ${scss} ${css}`);
|
||||||
|
Setup();
|
||||||
execAsync(['bash', '-c', '$AGS_PATH/startup.sh']).catch(print);
|
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
|
@ -139,7 +139,7 @@ export const Notification = ({
|
||||||
notifWidget.child.setStyle(notifWidget.child[`_squeeze${side}`]);
|
notifWidget.child.setStyle(notifWidget.child[`_squeeze${side}`]);
|
||||||
timeout(500, () => {
|
timeout(500, () => {
|
||||||
HasNotifs.value = Notifications.notifications.length > 0;
|
HasNotifs.value = Notifications.notifications.length > 0;
|
||||||
notifWidget.get_parent().remove(notifWidget);
|
notifWidget.get_parent().removeItem(notifWidget);
|
||||||
notifWidget.destroy();
|
notifWidget.destroy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -121,7 +121,7 @@ export function updateClients(box) {
|
||||||
];
|
];
|
||||||
|
|
||||||
if (newClient[0]) {
|
if (newClient[0]) {
|
||||||
toRemove.remove(newClient[0]);
|
toRemove.removeItem(newClient[0]);
|
||||||
fixed.move(...newClient);
|
fixed.move(...newClient);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
14
devices/wim/config/ags/js/setup.js
Normal file
14
devices/wim/config/ags/js/setup.js
Normal 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);
|
||||||
|
};
|
|
@ -34,7 +34,7 @@ class Tablet extends Service {
|
||||||
udevClient = GUdev.Client.new(['input']);
|
udevClient = GUdev.Client.new(['input']);
|
||||||
|
|
||||||
get tabletMode() { return this.tabletMode; }
|
get tabletMode() { return this.tabletMode; }
|
||||||
get autorotate() { return this.autorotate; }
|
get oskState() { return this.oskState; }
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
@ -140,11 +140,13 @@ class Tablet extends Service {
|
||||||
const orientation = ROTATION_MAPPING[output.split(' ').at(-1)];
|
const orientation = ROTATION_MAPPING[output.split(' ').at(-1)];
|
||||||
|
|
||||||
execAsync(['hyprctl', 'keyword', 'monitor',
|
execAsync(['hyprctl', 'keyword', 'monitor',
|
||||||
`${SCREEN},transform,${orientation}`]).catch(print);
|
`${SCREEN},transform,${orientation}`])
|
||||||
|
.catch(print);
|
||||||
|
|
||||||
this.devices.forEach(dev => {
|
this.devices.forEach(dev => {
|
||||||
execAsync(['hyprctl', 'keyword',
|
execAsync(['hyprctl', 'keyword',
|
||||||
`device:${dev}:transform`, String(orientation)]).catch(print);
|
`device:${dev}:transform`, String(orientation)])
|
||||||
|
.catch(print);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue