diff --git a/src/components/menus/shared/dropdown/index.tsx b/src/components/menus/shared/dropdown/index.tsx
index f594930..f8b2b7d 100644
--- a/src/components/menus/shared/dropdown/index.tsx
+++ b/src/components/menus/shared/dropdown/index.tsx
@@ -25,11 +25,21 @@ export default ({
name={name}
namespace={name}
className={`${name} dropdown-menu`}
- onKeyPressEvent={(_, event) => {
+ onKeyPressEvent={(self, event) => {
const key = event.get_keyval()[1];
if (key === Gdk.KEY_Escape) {
- App.get_window(name)?.set_visible(false);
+ self.visible = false;
+ }
+ }}
+ onFocusOutEvent={(self) => {
+ self.visible = false;
+ }}
+ onButtonPressEvent={(self, event) => {
+ const buttonClicked = event.get_button()[1];
+
+ if (buttonClicked === Gdk.BUTTON_PRIMARY || buttonClicked === Gdk.BUTTON_SECONDARY) {
+ self.visible = false;
}
}}
visible={false}
@@ -48,67 +58,53 @@ export default ({
})}
{...props}
>
- {
- const buttonClicked = event.get_button()[1];
-
- if (buttonClicked === Gdk.BUTTON_PRIMARY || buttonClicked === Gdk.BUTTON_SECONDARY) {
- App.get_window(name)?.set_visible(false);
+
+ {bind(location).as((lcn) => {
+ if (locationMap[lcn] === Astal.WindowAnchor.TOP) {
+ return ;
}
- }}
- >
-
- {bind(location).as((lcn) => {
- if (locationMap[lcn] === Astal.WindowAnchor.TOP) {
- return ;
- }
- return ;
- })}
- {
- const buttonClicked = event.get_button()[1];
+ return ;
+ })}
+ {
+ const buttonClicked = event.get_button()[1];
- if (
- buttonClicked === Gdk.BUTTON_PRIMARY ||
- buttonClicked === Gdk.BUTTON_SECONDARY
- ) {
- return true;
- }
- }}
- setup={(self) => {
- globalEventBoxes.set({
- ...globalEventBoxes.get(),
- [name]: self,
- });
- }}
- >
-
- {
- App.connect('window-toggled', (_, window) => {
- self.set_reveal_child(window.visible);
- });
- }}
- transitionType={transition}
- transitionDuration={bind(options.menus.transitionTime)}
- >
-
- {child}
-
-
-
-
- {bind(location).as((lcn) => {
- if (locationMap[lcn] === Astal.WindowAnchor.BOTTOM) {
- return ;
+ if (buttonClicked === Gdk.BUTTON_PRIMARY || buttonClicked === Gdk.BUTTON_SECONDARY) {
+ return true;
}
- return ;
- })}
-
-
+ }}
+ setup={(self) => {
+ globalEventBoxes.set({
+ ...globalEventBoxes.get(),
+ [name]: self,
+ });
+ }}
+ >
+
+ {
+ App.connect('window-toggled', (_, window) => {
+ self.set_reveal_child(window.visible);
+ });
+ }}
+ transitionType={transition}
+ transitionDuration={bind(options.menus.transitionTime)}
+ >
+
+ {child}
+
+
+
+
+ {bind(location).as((lcn) => {
+ if (locationMap[lcn] === Astal.WindowAnchor.BOTTOM) {
+ return ;
+ }
+ return ;
+ })}
+
);
};