chore: update ags and flakes

This commit is contained in:
matt1432 2023-10-14 13:54:45 -04:00
parent cd7aaebbee
commit 4cb39c4946
12 changed files with 16 additions and 27 deletions

View file

@ -1,10 +1,8 @@
const resource = file => `resource:///com/github/Aylur/ags/${file}.js`; const resource = file => `resource:///com/github/Aylur/ags/${file}.js`;
const require = async file => (await import(resource(file))).default; const require = async file => (await import(resource(file))).default;
const service = async file => (await require(`service/${file}`)).instance; const service = async file => (await require(`service/${file}`));
export const App = await require('app'); export const App = await require('app');
App.connect = (...args) => App.instance.connect(...args);
export const Widget = await require('widget'); export const Widget = await require('widget');
export const Service = await require('service'); export const Service = await require('service');
export const Variable = await require('variable'); export const Variable = await require('variable');

View file

@ -1,6 +1,5 @@
import { App, Widget } from '../../imports.js'; import { App, Widget } from '../../imports.js';
const { Box, Label } = Widget; const { Box, Label } = Widget;
const { toggleWindow } = App;
import GLib from 'gi://GLib'; import GLib from 'gi://GLib';
const { DateTime } = GLib; const { DateTime } = GLib;
@ -24,7 +23,7 @@ const ClockModule = ({
export const Clock = EventBox({ export const Clock = EventBox({
className: 'toggle-off', className: 'toggle-off',
onPrimaryClickRelease: () => toggleWindow('calendar'), onPrimaryClickRelease: () => App.toggleWindow('calendar'),
connections: [ connections: [
[App, (box, windowName, visible) => { [App, (box, windowName, visible) => {
if (windowName == 'calendar') { if (windowName == 'calendar') {

View file

@ -1,6 +1,5 @@
import { Widget, App } from '../../imports.js'; import { Widget, App } from '../../imports.js';
const { CenterBox, EventBox } = Widget; const { CenterBox, EventBox } = Widget;
const { openWindow } = App;
import Gtk from 'gi://Gtk'; import Gtk from 'gi://Gtk';
@ -24,7 +23,7 @@ export const Gesture = ({
[gesture, _ => { [gesture, _ => {
const velocity = gesture.get_velocity()[1]; const velocity = gesture.get_velocity()[1];
if (velocity < -100) if (velocity < -100)
openWindow('quick-settings'); App.openWindow('quick-settings');
}, 'update'], }, 'update'],
], ],

View file

@ -1,6 +1,5 @@
import { App, Notifications, Widget } from '../../imports.js'; import { App, Notifications, Widget } from '../../imports.js';
const { Box, Label, Icon } = Widget; const { Box, Label, Icon } = Widget;
const { toggleWindow } = App;
import { Separator } from '../misc/separator.js'; import { Separator } from '../misc/separator.js';
import { EventBox } from '../misc/cursorbox.js'; import { EventBox } from '../misc/cursorbox.js';
@ -8,7 +7,7 @@ import { EventBox } from '../misc/cursorbox.js';
export const NotifButton = EventBox({ export const NotifButton = EventBox({
className: 'toggle-off', className: 'toggle-off',
onPrimaryClickRelease: () => toggleWindow('notification-center'), onPrimaryClickRelease: () => App.toggleWindow('notification-center'),
connections: [ connections: [
[App, (box, windowName, visible) => { [App, (box, windowName, visible) => {
if (windowName == 'notification-center') { if (windowName == 'notification-center') {

View file

@ -1,13 +1,12 @@
import { Widget, App } from '../../imports.js'; import { Widget, App } from '../../imports.js';
const { Box, Label } = Widget; const { Box, Label } = Widget;
const { toggleWindow } = App;
import { EventBox } from '../misc/cursorbox.js'; import { EventBox } from '../misc/cursorbox.js';
export const QsToggle = EventBox({ export const QsToggle = EventBox({
className: 'toggle-off', className: 'toggle-off',
onPrimaryClickRelease: () => toggleWindow('quick-settings'), onPrimaryClickRelease: () => App.toggleWindow('quick-settings'),
connections: [ connections: [
[App, (box, windowName, visible) => { [App, (box, windowName, visible) => {
if (windowName == 'quick-settings') { if (windowName == 'quick-settings') {

View file

@ -1,6 +1,5 @@
import { App, Widget } from '../../imports.js'; import { App, Widget } from '../../imports.js';
const { Window, EventBox } = Widget; const { Window, EventBox } = Widget;
const { closeWindow } = App;
const ALWAYS_OPEN = [ const ALWAYS_OPEN = [
'closer', 'closer',
@ -13,9 +12,9 @@ const ALWAYS_OPEN = [
export const closeAll = () => { export const closeAll = () => {
App.windows.forEach(w => { App.windows.forEach(w => {
if (!ALWAYS_OPEN.some(window => window === w.name)) if (!ALWAYS_OPEN.some(window => window === w.name))
closeWindow(w.name) App.closeWindow(w.name)
}); });
closeWindow('closer'); App.closeWindow('closer');
}; };
export const Closer = Window({ export const Closer = Window({
@ -29,7 +28,7 @@ export const Closer = Window({
connections: [[App, (_b, _w, _v) => { connections: [[App, (_b, _w, _v) => {
if (!Array.from(App.windows).some(w => w[1].visible && if (!Array.from(App.windows).some(w => w[1].visible &&
!ALWAYS_OPEN.some(window => window === w[0]))) { !ALWAYS_OPEN.some(window => window === w[0]))) {
closeWindow('closer'); App.closeWindow('closer');
} }
}]], }]],
}), }),

View file

@ -1,6 +1,5 @@
import { App, Widget } from '../../imports.js'; import { App, Widget } from '../../imports.js';
const { Revealer, Box, Window } = Widget; const { Revealer, Box, Window } = Widget;
const { openWindow } = App;
export const PopupWindow = ({ export const PopupWindow = ({
@ -25,7 +24,7 @@ export const PopupWindow = ({
revealer.reveal_child = visible; revealer.reveal_child = visible;
if (visible && name !== 'overview') if (visible && name !== 'overview')
openWindow('closer'); App.openWindow('closer');
} }
}]], }]],
child: child, child: child,

View file

@ -1,7 +1,6 @@
import { Notifications, App, Utils, Widget } from '../../imports.js'; import { Notifications, App, Utils, Widget } from '../../imports.js';
const { Button, Label, Box, Icon, Scrollable, Revealer } = Widget; const { Button, Label, Box, Icon, Scrollable, Revealer } = Widget;
const { timeout } = Utils; const { timeout } = Utils;
const { getWindow } = App;
import Notification from './base.js'; import Notification from './base.js';
import { EventBox } from '../misc/cursorbox.js'; import { EventBox } from '../misc/cursorbox.js';
@ -26,7 +25,7 @@ const ClearButton = () => EventBox({
button._notifList = NotificationList; button._notifList = NotificationList;
if (!button._popups) if (!button._popups)
button._popups = getWindow('notifications').child.children[0].child; button._popups = App.getWindow('notifications').child.children[0].child;
button.sensitive = Notifications.notifications.length > 0; button.sensitive = Notifications.notifications.length > 0;
}]], }]],

View file

@ -1,6 +1,5 @@
import { App, Hyprland, Utils, Widget } from '../../imports.js'; import { App, Hyprland, Utils, Widget } from '../../imports.js';
const { Icon, Revealer } = Widget; const { Icon, Revealer } = Widget;
const { closeWindow } = App;
const { execAsync } = Utils; const { execAsync } = Utils;
import { WindowButton } from './dragndrop.js'; import { WindowButton } from './dragndrop.js';
@ -22,6 +21,7 @@ const Client = (client, active, clients) => {
let wsId = client.workspace.id; let wsId = client.workspace.id;
let addr = `address:${client.address}`; let addr = `address:${client.address}`;
// FIXME: special workspaces not closing when in one and clicking on normal client
return Revealer({ return Revealer({
transition: 'crossfade', transition: 'crossfade',
setup: rev => rev.revealChild = true, setup: rev => rev.revealChild = true,
@ -37,13 +37,13 @@ const Client = (client, active, clients) => {
if (client.workspace.name === 'special') { if (client.workspace.name === 'special') {
execAsync(`hyprctl dispatch movetoworkspacesilent special:${wsId},${addr}`).then( execAsync(`hyprctl dispatch movetoworkspacesilent special:${wsId},${addr}`).then(
execAsync(`hyprctl dispatch togglespecialworkspace ${wsId}`).then( execAsync(`hyprctl dispatch togglespecialworkspace ${wsId}`).then(
() => closeWindow('overview') () => App.closeWindow('overview')
).catch(print) ).catch(print)
).catch(print); ).catch(print);
} }
else { else {
execAsync(`hyprctl dispatch togglespecialworkspace ${wsName}`).then( execAsync(`hyprctl dispatch togglespecialworkspace ${wsName}`).then(
() => closeWindow('overview') () => App.closeWindow('overview')
).catch(print); ).catch(print);
} }
} }
@ -56,7 +56,7 @@ const Client = (client, active, clients) => {
execAsync(`hyprctl dispatch togglespecialworkspace ${wsName}`).catch(print); execAsync(`hyprctl dispatch togglespecialworkspace ${wsName}`).catch(print);
} }
execAsync(`hyprctl dispatch focuswindow ${addr}`).then( execAsync(`hyprctl dispatch focuswindow ${addr}`).then(
() => closeWindow('overview') () => App.closeWindow('overview')
).catch(print); ).catch(print);
} }
}, },

View file

@ -1,7 +1,6 @@
import { App, Utils, Widget } from '../../imports.js'; import { App, Utils, Widget } from '../../imports.js';
const { EventBox } = Widget; const { EventBox } = Widget;
const { execAsync } = Utils; const { execAsync } = Utils;
const { getWindow } = App;
import Gtk from 'gi://Gtk'; import Gtk from 'gi://Gtk';
import Gdk from 'gi://Gdk'; import Gdk from 'gi://Gdk';
@ -66,7 +65,7 @@ export const WindowButton = ({address, ...params} = {}) => Button({
button.connect('drag-end', () => { button.connect('drag-end', () => {
button.get_parent().destroy(); button.get_parent().destroy();
let mainBox = getWindow('overview').child.children[0].child; let mainBox = App.getWindow('overview').child.children[0].child;
updateClients(mainBox); updateClients(mainBox);
}); });
}, },

View file

@ -1,7 +1,6 @@
import { Network, Bluetooth, Audio, App, Utils, Widget } from '../../imports.js'; import { Network, Bluetooth, Audio, App, Utils, Widget } from '../../imports.js';
const { Box, CenterBox, Label, Icon } = Widget; const { Box, CenterBox, Label, Icon } = Widget;
const { execAsync } = Utils; const { execAsync } = Utils;
const { openWindow } = App;
import { EventBox } from '../misc/cursorbox.js'; import { EventBox } from '../misc/cursorbox.js';
@ -190,7 +189,7 @@ const SecondRow = Box({
GridButton({ GridButton({
command: () => execAsync(['bash', '-c', '$LOCK_PATH/lock.sh']).catch(print), command: () => execAsync(['bash', '-c', '$LOCK_PATH/lock.sh']).catch(print),
secondaryCommand: () => openWindow('powermenu'), secondaryCommand: () => App.openWindow('powermenu'),
icon: Label({ icon: Label({
className: 'grid-label', className: 'grid-label',
label: " 󰌾 ", label: " 󰌾 ",

Binary file not shown.