Workspace bar changes (#129)

* workspace mask + 'color only' indicator

* edits

* edits - 2

* Update modules/bar/workspaces/index.ts

---------

Co-authored-by: Jas Singh <jaskiratpal.singh@outlook.com>
This commit is contained in:
matavach
2024-08-16 23:52:07 -05:00
committed by GitHub
parent 84e85b168e
commit b3b397d479
4 changed files with 19 additions and 6 deletions

View File

@@ -2,7 +2,14 @@ const hyprland = await Service.import("hyprland");
import { WorkspaceRule, WorkspaceMap } from "lib/types/workspace";
import options from "options";
const { workspaces, monitorSpecific, reverse_scroll, scroll_speed, spacing } = options.bar.workspaces;
const {
workspaces,
monitorSpecific,
workspaceMask,
reverse_scroll,
scroll_speed,
spacing
} = options.bar.workspaces;
function range(length: number, start = 1) {
return Array.from({ length }, (_, i) => i + start);
@@ -158,7 +165,7 @@ const Workspaces = (monitor = -1, ws = 8) => {
const workspaceRules = getWorkspaceRules();
return getWorkspacesForMonitor(i, workspaceRules);
})
.map((i) => {
.map((i, index) => {
return Widget.Button({
class_name: "workspace-button",
on_primary_click: () => {
@@ -199,9 +206,10 @@ const Workspaces = (monitor = -1, ws = 8) => {
options.bar.workspaces.icons.available.bind("value"),
options.bar.workspaces.icons.active.bind("value"),
options.bar.workspaces.icons.occupied.bind("value"),
workspaceMask.bind("value"),
hyprland.active.workspace.bind("id")
],
(showIcons, available, active, occupied, _) => {
(showIcons, available, active, occupied, workspaceMask, _) => {
if (showIcons) {
if (hyprland.active.workspace.id === i) {
return active;
@@ -215,7 +223,9 @@ const Workspaces = (monitor = -1, ws = 8) => {
return available;
}
}
return `${i}`;
return workspaceMask
? `${index + 1}`
: `${i}`;
},
),
setup: (self) => {
@@ -260,4 +270,4 @@ const Workspaces = (monitor = -1, ws = 8) => {
}
};
};
export { Workspaces };
export { Workspaces };