diff options
Diffstat (limited to 'users/ryan/modules/simple-bar/simple-bar-source/lib/components/aerospace/opened-apps.jsx')
| -rwxr-xr-x | users/ryan/modules/simple-bar/simple-bar-source/lib/components/aerospace/opened-apps.jsx | 33 |
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 @@ | |||
| 1 | import * as Uebersicht from "uebersicht"; | ||
| 2 | import * as AppIcons from "../../app-icons.js"; | ||
| 3 | import { SuspenseIcon } from "../icons/icon.jsx"; | ||
| 4 | import * as Utils from "../../utils.js"; | ||
| 5 | |||
| 6 | const { 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 | */ | ||
| 14 | export 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 | } | ||
