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 OSD = {
|
||||
name: string;
|
||||
stack: OSDStack;
|
||||
icon: IconPropsGeneric['icon'];
|
||||
info: {
|
||||
mod: GObject.Object;
|
||||
|
|
|
@ -3,10 +3,10 @@ const { Box, Icon, ProgressBar } = Widget;
|
|||
const Y_POS = 80;
|
||||
|
||||
// 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;
|
||||
const status = info.widget ?
|
||||
info.widget :
|
||||
|
@ -39,10 +39,12 @@ export default ({ name, stack, icon, info }: OSD) => {
|
|||
info.logic(self);
|
||||
}
|
||||
r();
|
||||
}).then(() => stack.attribute.popup(name));
|
||||
}).then(() => (osd.get_parent() as OSDStack)?.attribute?.popup(name))
|
||||
.catch(console.error);
|
||||
}
|
||||
else {
|
||||
connectFunc = () => stack.attribute.popup(name);
|
||||
connectFunc = () => (osd.get_parent() as OSDStack)
|
||||
?.attribute?.popup(name);
|
||||
}
|
||||
|
||||
if (info.signal) {
|
||||
|
|
|
@ -4,10 +4,10 @@ const { Stack } = Widget;
|
|||
import PopupWindow from '../misc/popup.ts';
|
||||
|
||||
// Types
|
||||
import { BoxGeneric, StackGeneric } from 'global-types';
|
||||
import { BoxGeneric } from 'global-types';
|
||||
|
||||
// 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';
|
||||
for (const osd in Modules) {
|
||||
|
@ -35,7 +35,7 @@ const OSDs = () => {
|
|||
// Send reference of stack to all children
|
||||
stack.children = Object.fromEntries(
|
||||
OSDList.map((osd) => {
|
||||
const widget = osd(stack);
|
||||
const widget = osd();
|
||||
|
||||
return [widget.name, widget];
|
||||
}),
|
||||
|
|
|
@ -10,13 +10,9 @@ import { MicIcon } from '../misc/audio-icons.ts';
|
|||
|
||||
const AUDIO_MAX = 1.5;
|
||||
|
||||
// Types
|
||||
import { OSDStack } from 'global-types';
|
||||
|
||||
|
||||
export const SpeakerOSD = (stack: OSDStack) => OSD({
|
||||
export const SpeakerOSD = () => OSD({
|
||||
name: 'speaker',
|
||||
stack,
|
||||
icon: SpeakerIcon.bind(),
|
||||
info: {
|
||||
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',
|
||||
stack,
|
||||
icon: Brightness.bind('screenIcon'),
|
||||
info: {
|
||||
mod: Brightness,
|
||||
|
@ -50,9 +45,8 @@ export const ScreenBrightnessOSD = (stack: OSDStack) => OSD({
|
|||
},
|
||||
});
|
||||
|
||||
export const KbdBrightnessOSD = (stack: OSDStack) => OSD({
|
||||
export const KbdBrightnessOSD = () => OSD({
|
||||
name: 'kbd',
|
||||
stack,
|
||||
icon: 'keyboard-brightness-symbolic',
|
||||
info: {
|
||||
mod: Brightness,
|
||||
|
@ -70,9 +64,8 @@ export const KbdBrightnessOSD = (stack: OSDStack) => OSD({
|
|||
},
|
||||
});
|
||||
|
||||
export const MicOSD = (stack: OSDStack) => OSD({
|
||||
export const MicOSD = () => OSD({
|
||||
name: 'mic',
|
||||
stack,
|
||||
icon: MicIcon.bind(),
|
||||
info: {
|
||||
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',
|
||||
stack,
|
||||
icon: Brightness.bind('capsIcon'),
|
||||
info: {
|
||||
mod: Brightness,
|
||||
|
|
Loading…
Reference in a new issue