Skip to content

Commit 87900fa

Browse files
committed
fix: handle tray interaction
1 parent 989c567 commit 87900fa

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

pkgs/astal/conf/src/lib/state.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ export const launcherVisible = Variable(false);
44
export const powerMenuVisible = Variable(false);
55
export const barVisible = Variable(true);
66
export const barAutohide = Variable(false);
7+
export const trayMenuOpen = Variable(false);

pkgs/astal/conf/src/widget/bar.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Wp from 'gi://AstalWp';
66
import Tray from 'gi://AstalTray';
77
import Pango from 'gi://Pango';
88
import AstalBattery from 'gi://AstalBattery';
9-
import { barVisible, barAutohide } from '../lib/state';
9+
import { barVisible, barAutohide, trayMenuOpen } from '../lib/state';
1010

1111
type WMState = {
1212
activeWs: Variable<number>;
@@ -346,6 +346,13 @@ function SysTray() {
346346
const menu = Gtk.Menu.new_from_model(item.menuModel);
347347
menu.insert_action_group('dbusmenu', item.actionGroup);
348348
menu.get_style_context().add_class('tray-menu');
349+
trayMenuOpen.set(true);
350+
menu.connect('deactivate', () => {
351+
trayMenuOpen.set(false);
352+
if (barAutohide.get()) {
353+
barVisible.set(false);
354+
}
355+
});
349356
menu.popup_at_widget(
350357
self,
351358
Gdk.Gravity.SOUTH,
@@ -428,7 +435,7 @@ export default function Bar(monitor: number) {
428435
>
429436
<eventbox
430437
onHoverLost={() => {
431-
if (barAutohide.get()) {
438+
if (barAutohide.get() && !trayMenuOpen.get()) {
432439
barVisible.set(false);
433440
}
434441
}}

0 commit comments

Comments
 (0)