fix(ags): get rid of stack warnings
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
ccd5350370
commit
96193b4f1b
4 changed files with 14 additions and 21 deletions
1
modules/ags/config/global-types.d.ts
vendored
1
modules/ags/config/global-types.d.ts
vendored
|
@ -91,7 +91,6 @@ export type OSDStack = AgsStack<unknown & Widget, {
|
||||||
export type ConnectFunc = (self?: ProgressBarGeneric) => void;
|
export type ConnectFunc = (self?: ProgressBarGeneric) => void;
|
||||||
export type OSD = {
|
export type OSD = {
|
||||||
name: string;
|
name: string;
|
||||||
stack: OSDStack;
|
|
||||||
icon: IconPropsGeneric['icon'];
|
icon: IconPropsGeneric['icon'];
|
||||||
info: {
|
info: {
|
||||||
mod: GObject.Object;
|
mod: GObject.Object;
|
||||||
|
|
|
@ -3,10 +3,10 @@ const { Box, Icon, ProgressBar } = Widget;
|
||||||
const Y_POS = 80;
|
const Y_POS = 80;
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import { ConnectFunc, OSD } from 'global-types';
|
import { ConnectFunc, OSD, OSDStack } from 'global-types';
|
||||||
|
|
||||||
|
|
||||||
export default ({ name, stack, icon, info }: OSD) => {
|
export default ({ name, icon, info }: OSD) => {
|
||||||
let connectFunc: ConnectFunc;
|
let connectFunc: ConnectFunc;
|
||||||
const status = info.widget ?
|
const status = info.widget ?
|
||||||
info.widget :
|
info.widget :
|
||||||
|
@ -39,10 +39,12 @@ export default ({ name, stack, icon, info }: OSD) => {
|
||||||
info.logic(self);
|
info.logic(self);
|
||||||
}
|
}
|
||||||
r();
|
r();
|
||||||
}).then(() => stack.attribute.popup(name));
|
}).then(() => (osd.get_parent() as OSDStack)?.attribute?.popup(name))
|
||||||
|
.catch(console.error);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
connectFunc = () => stack.attribute.popup(name);
|
connectFunc = () => (osd.get_parent() as OSDStack)
|
||||||
|
?.attribute?.popup(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.signal) {
|
if (info.signal) {
|
||||||
|
|
|
@ -4,10 +4,10 @@ const { Stack } = Widget;
|
||||||
import PopupWindow from '../misc/popup.ts';
|
import PopupWindow from '../misc/popup.ts';
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import { BoxGeneric, StackGeneric } from 'global-types';
|
import { BoxGeneric } from 'global-types';
|
||||||
|
|
||||||
// Import all the OSDs as an array
|
// Import all the OSDs as an array
|
||||||
const OSDList = [] as Array<(stack: StackGeneric) => BoxGeneric>;
|
const OSDList = [] as Array<() => BoxGeneric>;
|
||||||
|
|
||||||
import * as Modules from './osds.ts';
|
import * as Modules from './osds.ts';
|
||||||
for (const osd in Modules) {
|
for (const osd in Modules) {
|
||||||
|
@ -35,7 +35,7 @@ const OSDs = () => {
|
||||||
// Send reference of stack to all children
|
// Send reference of stack to all children
|
||||||
stack.children = Object.fromEntries(
|
stack.children = Object.fromEntries(
|
||||||
OSDList.map((osd) => {
|
OSDList.map((osd) => {
|
||||||
const widget = osd(stack);
|
const widget = osd();
|
||||||
|
|
||||||
return [widget.name, widget];
|
return [widget.name, widget];
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -10,13 +10,9 @@ import { MicIcon } from '../misc/audio-icons.ts';
|
||||||
|
|
||||||
const AUDIO_MAX = 1.5;
|
const AUDIO_MAX = 1.5;
|
||||||
|
|
||||||
// Types
|
|
||||||
import { OSDStack } from 'global-types';
|
|
||||||
|
|
||||||
|
export const SpeakerOSD = () => OSD({
|
||||||
export const SpeakerOSD = (stack: OSDStack) => OSD({
|
|
||||||
name: 'speaker',
|
name: 'speaker',
|
||||||
stack,
|
|
||||||
icon: SpeakerIcon.bind(),
|
icon: SpeakerIcon.bind(),
|
||||||
info: {
|
info: {
|
||||||
mod: Audio.speaker,
|
mod: Audio.speaker,
|
||||||
|
@ -36,9 +32,8 @@ export const SpeakerOSD = (stack: OSDStack) => OSD({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const ScreenBrightnessOSD = (stack: OSDStack) => OSD({
|
export const ScreenBrightnessOSD = () => OSD({
|
||||||
name: 'screen',
|
name: 'screen',
|
||||||
stack,
|
|
||||||
icon: Brightness.bind('screenIcon'),
|
icon: Brightness.bind('screenIcon'),
|
||||||
info: {
|
info: {
|
||||||
mod: Brightness,
|
mod: Brightness,
|
||||||
|
@ -50,9 +45,8 @@ export const ScreenBrightnessOSD = (stack: OSDStack) => OSD({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const KbdBrightnessOSD = (stack: OSDStack) => OSD({
|
export const KbdBrightnessOSD = () => OSD({
|
||||||
name: 'kbd',
|
name: 'kbd',
|
||||||
stack,
|
|
||||||
icon: 'keyboard-brightness-symbolic',
|
icon: 'keyboard-brightness-symbolic',
|
||||||
info: {
|
info: {
|
||||||
mod: Brightness,
|
mod: Brightness,
|
||||||
|
@ -70,9 +64,8 @@ export const KbdBrightnessOSD = (stack: OSDStack) => OSD({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const MicOSD = (stack: OSDStack) => OSD({
|
export const MicOSD = () => OSD({
|
||||||
name: 'mic',
|
name: 'mic',
|
||||||
stack,
|
|
||||||
icon: MicIcon.bind(),
|
icon: MicIcon.bind(),
|
||||||
info: {
|
info: {
|
||||||
mod: Audio.microphone,
|
mod: Audio.microphone,
|
||||||
|
@ -89,9 +82,8 @@ export const MicOSD = (stack: OSDStack) => OSD({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const CapsLockOSD = (stack: OSDStack) => OSD({
|
export const CapsLockOSD = () => OSD({
|
||||||
name: 'caps',
|
name: 'caps',
|
||||||
stack,
|
|
||||||
icon: Brightness.bind('capsIcon'),
|
icon: Brightness.bind('capsIcon'),
|
||||||
info: {
|
info: {
|
||||||
mod: Brightness,
|
mod: Brightness,
|
||||||
|
|
Loading…
Reference in a new issue