aboutsummaryrefslogtreecommitdiff
path: root/users/ryan/modules/simple-bar/simple-bar-source/lib/components/aerospace/opened-apps.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'users/ryan/modules/simple-bar/simple-bar-source/lib/components/aerospace/opened-apps.jsx')
-rwxr-xr-xusers/ryan/modules/simple-bar/simple-bar-source/lib/components/aerospace/opened-apps.jsx33
1 files changed, 33 insertions, 0 deletions
diff --git a/users/ryan/modules/simple-bar/simple-bar-source/lib/components/aerospace/opened-apps.jsx b/users/ryan/modules/simple-bar/simple-bar-source/lib/components/aerospace/opened-apps.jsx
new file mode 100755
index 0000000..5b56966
--- /dev/null
+++ b/users/ryan/modules/simple-bar/simple-bar-source/lib/components/aerospace/opened-apps.jsx
@@ -0,0 +1,33 @@
1import * as Uebersicht from "uebersicht";
2import * as AppIcons from "../../app-icons.js";
3import { SuspenseIcon } from "../icons/icon.jsx";
4import * as Utils from "../../utils.js";
5
6const { React } = Uebersicht;
7
8/**
9 * OpenedApps component to display icons of opened applications.
10 * @param {Object} props - The component props.
11 * @param {Array} props.apps - The list of opened applications.
12 * @returns {JSX.Element|null} The rendered component or null if no apps are opened.
13 */
14export default function OpenedApps({ apps }) {
15 if (!apps.length) return null;
16
17 return apps.map((app, i) => {
18 const { focused } = app;
19 const appName = Utils.normalizeAppName(app["app-name"]);
20 const Icon = AppIcons.apps[appName] || AppIcons.apps.Default;
21
22 // Generate class names for the app icon
23 const classes = Utils.classNames("space__icon", {
24 "space__icon--focused": focused,
25 });
26
27 return (
28 <SuspenseIcon key={i}>
29 <Icon className={classes} />
30 </SuspenseIcon>
31 );
32 });
33}