diff --git a/src/components/taskbar/Taskbar.jsx b/src/components/taskbar/Taskbar.jsx
index 46eafa3..efe4f7d 100644
--- a/src/components/taskbar/Taskbar.jsx
+++ b/src/components/taskbar/Taskbar.jsx
@@ -32,6 +32,7 @@ export const Taskbar = memo(() => {
const settingsManager = useSettingsManager();
const [showHome, setShowHome] = useState(false);
const [showSearch, setShowSearch] = useState(false);
+ const [hideUtilMenus, setHideUtilMenus] = useState(false);
const [searchQuery, setSearchQuery] = useState("");
const { boxShadow, onUpdate } = useScrollWithShadow({ ref, shadow: {
offset: 20,
@@ -87,23 +88,25 @@ export const Taskbar = memo(() => {
});
}, [settingsManager]);
- const updateShowHome = (value) => {
- setShowHome(value);
+ const updateShowHome = (show) => {
+ setShowHome(show);
- if (value) {
+ if (show) {
setShowSearch(false);
+ setHideUtilMenus(true);
}
};
- const updateShowSearch = (value) => {
- setShowSearch(value);
+ const updateShowSearch = (show) => {
+ setShowSearch(show);
- if (value) {
+ if (show) {
if (searchQuery !== "") {
setSearchQuery("");
}
setShowHome(false);
+ setHideUtilMenus(true);
if (inputRef.current) {
inputRef.current.focus();
@@ -118,6 +121,12 @@ export const Taskbar = memo(() => {
}
};
+ const showUtilMenu = () => {
+ setShowHome(false);
+ setShowSearch(false);
+ setHideUtilMenus(false);
+ };
+
const search = (query) => {
updateShowSearch(true);
};
@@ -179,10 +188,10 @@ export const Taskbar = memo(() => {
-
-
-
-
+
+
+
+
diff --git a/src/components/taskbar/Taskbar.module.css b/src/components/taskbar/Taskbar.module.css
index 0fb49f3..1fda140 100644
--- a/src/components/taskbar/Taskbar.module.css
+++ b/src/components/taskbar/Taskbar.module.css
@@ -105,14 +105,22 @@
z-index: -1;
}
-.Util-icons > * {
+.Util-icons > div {
+ height: 100%;
+ width: min-content;
+ z-index: -1;
+}
+
+.Util-icons > button,
+.Util-icons > div > button {
height: 100%;
width: min-content;
margin: 0;
padding: 0.4rem;
}
-.Util-icons > * > svg {
+.Util-icons > button > svg,
+.Util-icons > div > button > svg {
height: 1rem;
width: 1rem;
aspect-ratio: 1;
diff --git a/src/components/taskbar/indicators/Battery.jsx b/src/components/taskbar/indicators/Battery.jsx
index 8925cbb..bfa58bf 100644
--- a/src/components/taskbar/indicators/Battery.jsx
+++ b/src/components/taskbar/indicators/Battery.jsx
@@ -2,10 +2,18 @@ import { faBatteryEmpty, faBatteryFull, faBatteryHalf, faBatteryQuarter, faBatte
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useEffect, useState } from "react";
import styles from "./Battery.module.css";
+import { UtilMenu } from "../menus/UtilMenu.jsx";
+import OutsideClickListener from "../../../hooks/_utils/outsideClick.js";
-export function Battery() {
+/**
+ * @param {object} props
+ * @param {boolean} props.hideUtilMenus
+ * @param {Function} props.showUtilMenu
+ */
+export function Battery({ hideUtilMenus, showUtilMenu }) {
const [isCharging, setIsCharging] = useState(true);
const [percentage, setPercentage] = useState(100);
+ const [showMenu, setShowMenu] = useState(false);
// const [chargingTime, setChargingTime] = useState(0);
// const [dischargingTime, setDischargingTime] = useState(0);
@@ -46,6 +54,19 @@ export function Battery() {
});
}, []);
+ useEffect(() => {
+ if (hideUtilMenus && showMenu) {
+ setShowMenu(false);
+ }
+ }, [hideUtilMenus, showMenu]);
+
+ const updateShowMenu = (show) => {
+ if (show)
+ showUtilMenu();
+
+ setShowMenu(show);
+ };
+
let icon = faBatteryFull;
if (percentage < 10) {
icon = faBatteryEmpty;
@@ -57,13 +78,23 @@ export function Battery() {
icon = faBatteryThreeQuarters;
}
- return (
-