From d06784958d73159b5e4abafe5114804662114ed7 Mon Sep 17 00:00:00 2001 From: Ryan Schanzenbacher Date: Thu, 9 Jul 2026 22:15:53 -0400 Subject: move ubersicht modules in tree --- .../lib/components/yabai/process.jsx | 102 +++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100755 users/ryan/modules/simple-bar/simple-bar-source/lib/components/yabai/process.jsx (limited to 'users/ryan/modules/simple-bar/simple-bar-source/lib/components/yabai/process.jsx') diff --git a/users/ryan/modules/simple-bar/simple-bar-source/lib/components/yabai/process.jsx b/users/ryan/modules/simple-bar/simple-bar-source/lib/components/yabai/process.jsx new file mode 100755 index 0000000..96a0b7c --- /dev/null +++ b/users/ryan/modules/simple-bar/simple-bar-source/lib/components/yabai/process.jsx @@ -0,0 +1,102 @@ +import * as Uebersicht from "uebersicht"; +import Window from "./window.jsx"; +import * as Utils from "../../utils"; +import { useYabaiContext } from "../yabai-context.jsx"; +import { useSimpleBarContext } from "../simple-bar-context.jsx"; + +export { processStyles as styles } from "../../styles/components/process"; + +const { React } = Uebersicht; + +/** + * Process component that displays the current windows and spaces information. + * @returns {JSX.Element|null} The rendered component or null if not visible. + */ +const Component = React.memo(() => { + // Get context values from yabai and simple-bar + const { spaces, windows, skhdMode } = useYabaiContext(); + const { displayIndex, settings } = useSimpleBarContext(); + const { process, spacesDisplay, widgets } = settings; + const { processWidget } = widgets; + const { exclusionsAsRegex } = spacesDisplay; + const { displayForFocusedSpace, centered, showCurrentSpaceMode, displaySkhdMode, showOnDisplay } = + process; + + // Determine if the process widget should be visible + const visible = + processWidget && + Utils.isVisibleOnDisplay(displayIndex, showOnDisplay) && + windows; + + if (!visible) return null; + + // Parse exclusions based on settings + const exclusions = exclusionsAsRegex + ? spacesDisplay.exclusions + : spacesDisplay.exclusions.split(", "); + + const titleExclusions = exclusionsAsRegex + ? spacesDisplay.titleExclusions + : spacesDisplay.titleExclusions.split(", "); + + // Find the current space based on visibility and display index + const currentSpace = spaces.find((space) => { + const { + "is-visible": isVisible, + "has-focus" : hasFocus, + visible: __legacyIsVisible, + display, + } = space; + return (isVisible ?? __legacyIsVisible) && (displayForFocusedSpace ? hasFocus : display === displayIndex); + }); + + // Get sticky and non-sticky windows using a utility function + const { stickyWindows, nonStickyWindows } = Utils.stickyWindowWorkaround({ + windows, + uniqueApps: false, + currentDisplay: displayIndex, + currentSpace: currentSpace?.index, + exclusions, + titleExclusions, + exclusionsAsRegex, + }); + + // Combine sticky and non-sticky windows + const apps = [...stickyWindows, ...nonStickyWindows]; + + // Determine CSS classes for the component + const classes = Utils.classNames("process", { + "process--centered": centered, + }); + + // Determine the current skhd mode and its color + const currentSkhdMode = skhdMode.mode === "default" ? null : skhdMode.mode; + const skhdModeColor = "var(--" + skhdMode.color + ")"; + + return ( +
+
+ {showCurrentSpaceMode && currentSpace && ( +
+ {currentSpace.type} +
+ )} + {displaySkhdMode && currentSkhdMode && ( +
+ {currentSkhdMode} +
+ )} + {Utils.sortWindows(apps).map((window, i) => ( + + ))} +
+
+ ); +}); + +Component.displayName = "Process"; + +export default Component; -- cgit v1.3