Added the options to allow workspaces to be indicated as active on multiple monitors. (#289)

* Added the options to allow workspaces to be indicated as active on multiple monitors.

* Add subtitle
This commit is contained in:
Jas Singh
2024-09-28 17:09:15 -07:00
committed by GitHub
parent a3ae60f621
commit 19a0ccf150
5 changed files with 55 additions and 9 deletions

View File

@@ -5,6 +5,7 @@ import { range } from 'lib/utils';
import { BoxWidget } from 'lib/types/widget';
import { getWsColor, renderClassnames, renderLabel } from '../utils';
import { WorkspaceIconMap } from 'lib/types/workspace';
import { Monitor } from 'types/service/hyprland';
const { workspaces, monitorSpecific, workspaceMask, spacing, ignored } = options.bar.workspaces;
export const defaultWses = (monitor: number): BoxWidget => {
@@ -42,6 +43,7 @@ export const defaultWses = (monitor: number): BoxWidget => {
options.bar.workspaces.workspaceIconMap.bind('value'),
options.theme.matugen.bind('value'),
options.theme.bar.buttons.workspaces.smartHighlight.bind('value'),
hyprland.bind('monitors'),
hyprland.active.workspace.bind('id'),
],
(
@@ -50,10 +52,11 @@ export const defaultWses = (monitor: number): BoxWidget => {
workspaceIconMap: WorkspaceIconMap,
matugen: boolean,
smartHighlight: boolean,
monitors: Monitor[],
) => {
return (
`margin: 0rem ${0.375 * sp}rem;` +
`${showWsIcons && !matugen ? getWsColor(workspaceIconMap, i, smartHighlight) : ''}`
`${showWsIcons && !matugen ? getWsColor(workspaceIconMap, i, smartHighlight, monitor, monitors) : ''}`
);
},
),
@@ -64,6 +67,7 @@ export const defaultWses = (monitor: number): BoxWidget => {
options.bar.workspaces.numbered_active_indicator.bind('value'),
options.bar.workspaces.showWsIcons.bind('value'),
options.theme.bar.buttons.workspaces.smartHighlight.bind('value'),
hyprland.bind('monitors'),
options.bar.workspaces.icons.available.bind('value'),
options.bar.workspaces.icons.active.bind('value'),
hyprland.active.workspace.bind('id'),
@@ -74,6 +78,7 @@ export const defaultWses = (monitor: number): BoxWidget => {
numberedActiveIndicator: string,
showWsIcons: boolean,
smartHighlight: boolean,
monitors: Monitor[],
) => {
return renderClassnames(
showIcons,
@@ -81,6 +86,8 @@ export const defaultWses = (monitor: number): BoxWidget => {
numberedActiveIndicator,
showWsIcons,
smartHighlight,
monitor,
monitors,
i,
);
},
@@ -94,6 +101,7 @@ export const defaultWses = (monitor: number): BoxWidget => {
options.bar.workspaces.workspaceIconMap.bind('value'),
options.bar.workspaces.showWsIcons.bind('value'),
workspaceMask.bind('value'),
hyprland.bind('monitors'),
hyprland.active.workspace.bind('id'),
],
(
@@ -104,6 +112,7 @@ export const defaultWses = (monitor: number): BoxWidget => {
wsIconMap: WorkspaceIconMap,
showWsIcons: boolean,
workspaceMask: boolean,
monitors: Monitor[],
) => {
return renderLabel(
showIcons,
@@ -116,6 +125,7 @@ export const defaultWses = (monitor: number): BoxWidget => {
i,
index,
monitor,
monitors,
);
},
),

View File

@@ -1,13 +1,13 @@
const hyprland = await Service.import('hyprland');
import options from 'options';
import { getWorkspaceRules, getWorkspacesForMonitor, isWorkspaceIgnored } from '../helpers';
import { Workspace } from 'types/service/hyprland';
import { Monitor, Workspace } from 'types/service/hyprland';
import { getWsColor, renderClassnames, renderLabel } from '../utils';
import { range } from 'lib/utils';
import { BoxWidget } from 'lib/types/widget';
import { WorkspaceIconMap } from 'lib/types/workspace';
const { workspaces, monitorSpecific, workspaceMask, spacing, ignored } = options.bar.workspaces;
const { workspaces, monitorSpecific, workspaceMask, spacing, ignored, showAllActive } = options.bar.workspaces;
export const occupiedWses = (monitor: number): BoxWidget => {
return Widget.Box({
@@ -29,7 +29,9 @@ export const occupiedWses = (monitor: number): BoxWidget => {
options.bar.workspaces.showWsIcons.bind('value'),
options.theme.matugen.bind('value'),
options.theme.bar.buttons.workspaces.smartHighlight.bind('value'),
hyprland.bind('monitors'),
ignored.bind('value'),
showAllActive.bind('value'),
],
(
monitorSpecific: boolean,
@@ -48,6 +50,7 @@ export const occupiedWses = (monitor: number): BoxWidget => {
showWsIcons: boolean,
matugen: boolean,
smartHighlight: boolean,
monitors: Monitor[],
) => {
let allWkspcs = range(totalWkspcs || 8);
@@ -106,13 +109,15 @@ export const occupiedWses = (monitor: number): BoxWidget => {
vpack: 'center',
css:
`margin: 0rem ${0.375 * spacing}rem;` +
`${showWsIcons && !matugen ? getWsColor(wsIconMap, i, smartHighlight) : ''}`,
`${showWsIcons && !matugen ? getWsColor(wsIconMap, i, smartHighlight, monitor, monitors) : ''}`,
class_name: renderClassnames(
showIcons,
showNumbered,
numberedActiveIndicator,
showWsIcons,
smartHighlight,
monitor,
monitors,
i,
),
label: renderLabel(
@@ -126,6 +131,7 @@ export const occupiedWses = (monitor: number): BoxWidget => {
i,
index,
monitor,
monitors,
),
setup: (self) => {
self.toggleClassName('active', activeId === i);