Add workspace app icon side-effects and add wiki link for settings. (#387)

* Add side-effect for app icons for workspaces and udated mpris types.

* Add links to workspace icon toggles.

* Add subtitle
This commit is contained in:
Jas Singh
2024-10-28 00:03:28 -07:00
committed by GitHub
parent 4e2a774c7e
commit 5bc1c1e7d4
8 changed files with 90 additions and 30 deletions

View File

@@ -1,30 +1,67 @@
import { Opt } from 'lib/option';
import options from 'options';
const { show_numbered, show_icons, showWsIcons } = options.bar.workspaces;
const { show_numbered, show_icons, showWsIcons, showApplicationIcons } = options.bar.workspaces;
const { monochrome: monoBar } = options.theme.bar.buttons;
const { monochrome: monoMenu } = options.theme.bar.menus;
const { matugen } = options.theme;
show_numbered.connect('changed', ({ value }) => {
if (value === true) {
show_icons.value = false;
showWsIcons.value = false;
/**
* Turns off the specified option variables when the source value is true.
*
* @param sourceValue - The source option whose value determines whether to turn off other options.
* @param optionsToDisable - An array of option variables to disable if the source value is true.
* @param ignoreVars - An optional array of option variables to ignore and not disable.
*/
const turnOffOptionVars = (
sourceValue: Opt<boolean>,
optionsToDisable: Array<Opt<boolean>>,
ignoreVars?: Array<Opt<boolean>>,
): void => {
const toggleOffVars = (varsToToggle: Array<Opt<boolean>>): void => {
const varsToNotToggle = ignoreVars?.map((curVar) => curVar.id) || [];
varsToToggle.forEach((curVar) => {
if (sourceValue.id !== curVar.id && !varsToNotToggle.includes(curVar.id)) {
curVar.value = false;
}
});
};
if (sourceValue.value) {
const varsToToggleOff = optionsToDisable;
toggleOffVars(varsToToggleOff);
}
};
/* ================================================== */
/* WORKSPACE SIDE EFFECTS */
/* ================================================== */
const workspaceOptsToDisable = [show_numbered, show_icons, showWsIcons, showApplicationIcons];
show_numbered.connect('changed', (sourceVar) => {
turnOffOptionVars(sourceVar, workspaceOptsToDisable);
});
show_icons.connect('changed', (sourceVar) => {
turnOffOptionVars(sourceVar, workspaceOptsToDisable);
});
showWsIcons.connect('changed', (sourceVar) => {
turnOffOptionVars(sourceVar, workspaceOptsToDisable, [showApplicationIcons]);
});
showApplicationIcons.connect('changed', (sourceVar) => {
turnOffOptionVars(sourceVar, workspaceOptsToDisable, [showWsIcons]);
if (sourceVar.value) {
showWsIcons.value = true;
}
});
show_icons.connect('changed', ({ value }) => {
if (value === true) {
show_numbered.value = false;
showWsIcons.value = false;
}
});
showWsIcons.connect('changed', ({ value }) => {
if (value === true) {
show_numbered.value = false;
show_icons.value = false;
}
});
/* ================================================== */
/* MATUGEN SIDE EFFECTS */
/* ================================================== */
matugen.connect('changed', ({ value }) => {
if (value === true) {