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:
@@ -259,12 +259,17 @@ export const BarSettings = (): Scrollable<Gtk.Widget, Gtk.Widget> => {
|
||||
Option({
|
||||
opt: options.bar.workspaces.showWsIcons,
|
||||
title: 'Map Workspaces to Icons',
|
||||
subtitle: 'https://hyprpanel.com/configuration/panel.html#show-workspace-icons',
|
||||
subtitleLink: 'https://hyprpanel.com/configuration/panel.html#show-workspace-icons',
|
||||
type: 'boolean',
|
||||
}),
|
||||
Option({
|
||||
opt: options.bar.workspaces.showApplicationIcons,
|
||||
title: 'Map Workspaces to Application Icons',
|
||||
subtitle: "Requires 'Map Workspace to Icons' to be enabled",
|
||||
subtitle:
|
||||
"Requires 'Map Workspace to Icons' to be enabled\n" +
|
||||
'https://hyprpanel.com/configuration/panel.html#map-workspaces-to-application-icons',
|
||||
subtitleLink: 'https://hyprpanel.com/configuration/panel.html#map-workspaces-to-application-icons',
|
||||
type: 'boolean',
|
||||
}),
|
||||
Option({
|
||||
@@ -291,7 +296,9 @@ export const BarSettings = (): Scrollable<Gtk.Widget, Gtk.Widget> => {
|
||||
}),
|
||||
Option({
|
||||
opt: options.bar.workspaces.workspaceIconMap,
|
||||
title: 'Workspace Icon Mappings',
|
||||
title: 'Workspace Icon & Color Mappings',
|
||||
subtitle: 'https://hyprpanel.com/configuration/panel.html#show-workspace-icons',
|
||||
subtitleLink: 'https://hyprpanel.com/configuration/panel.html#show-workspace-icons',
|
||||
type: 'object',
|
||||
}),
|
||||
Option({
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user