Fix menu top margin even box

This commit is contained in:
Jas Singh
2024-06-30 22:38:06 -07:00
parent 57b468beb3
commit 8f54a92e80
8 changed files with 66 additions and 42 deletions

View File

@@ -33,11 +33,10 @@ const moveBoxToCursor = (self, minWidth, minHeight, fixed) => {
marginRight = 13; marginRight = 13;
marginLeft = monWidth - minWidth - 13; marginLeft = monWidth - minWidth - 13;
} }
const marginTop = 40; const marginTop = 45;
const marginBottom = monHeight + minHeight - marginTop; const marginBottom = monHeight + minHeight - marginTop;
self.set_margin_left(marginLeft); self.set_margin_left(marginLeft);
self.set_margin_right(marginRight); self.set_margin_right(marginRight);
self.set_margin_top(marginTop);
self.set_margin_bottom(marginBottom); self.set_margin_bottom(marginBottom);
}); });
}; };
@@ -63,36 +62,54 @@ export default ({
layer: "top", layer: "top",
anchor: ["top", "left"], anchor: ["top", "left"],
child: Widget.EventBox({ child: Widget.EventBox({
class_name: "parent-event",
on_primary_click: () => App.closeWindow(name), on_primary_click: () => App.closeWindow(name),
on_secondary_click: () => App.closeWindow(name), on_secondary_click: () => App.closeWindow(name),
child: Widget.EventBox({ child: Widget.Box({
on_primary_click: () => { vertical: true,
return true; children: [
}, Widget.EventBox({
on_secondary_click: () => { class_name: "event-top-padding",
return true; hexpand: true,
}, vexpand: false,
setup: (self) => { can_focus: false,
moveBoxToCursor(self, minWidth, minHeight, fixed); child: Widget.Box(),
}, setup: (w) => {
child: Widget.Box({ w.on("button-press-event", () => App.toggleWindow(name));
class_name: "dropdown-menu-container", w.set_margin_top(1);
css: "padding: 1px; margin: -1px;", },
child: Widget.Revealer({ }),
revealChild: false, Widget.EventBox({
setup: (self) => class_name: "menu-event-box",
self.hook(App, (_, wname, visible) => { on_primary_click: () => {
if (wname === name) self.reveal_child = visible; return true;
}), },
transition: "crossfade", on_secondary_click: () => {
transitionDuration: 350, return true;
},
setup: (self) => {
moveBoxToCursor(self, minWidth, minHeight, fixed);
},
child: Widget.Box({ child: Widget.Box({
class_name: "dropdown-menu-container", class_name: "dropdown-menu-container",
can_focus: true, css: "padding: 1px; margin: -1px;",
children: [child], child: Widget.Revealer({
revealChild: false,
setup: (self) =>
self.hook(App, (_, wname, visible) => {
if (wname === name) self.reveal_child = visible;
}),
transition: "crossfade",
transitionDuration: 350,
child: Widget.Box({
class_name: "dropdown-menu-container",
can_focus: true,
children: [child],
}),
}),
}), }),
}), }),
}), ],
}), }),
}), }),
...props, ...props,

View File

@@ -60,7 +60,7 @@ const Layout = (name, child, transition) => ({
}, },
Padding(name, { Padding(name, {
vexpand: false, vexpand: false,
className: "top-right-event-box_top", className: "event-top-padding",
}), }),
PopupRevealer(name, child, transition), PopupRevealer(name, child, transition),
Padding(name), Padding(name),
@@ -77,7 +77,7 @@ const Layout = (name, child, transition) => ({
}, },
Padding(name, { Padding(name, {
vexpand: false, vexpand: false,
className: "top-right-event-box_top", className: "event-top-padding",
}), }),
PopupRevealer(name, child, transition), PopupRevealer(name, child, transition),
Padding(name), Padding(name),

View File

@@ -65,6 +65,7 @@ const renderWapStaging = (self, network, staging, connecting) => {
Utils.notify({ Utils.notify({
summary: "Network", summary: "Network",
body: err, body: err,
timeout: 5000,
}); });
}) })
.then(() => { .then(() => {

View File

@@ -77,6 +77,10 @@ const renderWAPs = (self, network, staging, connecting) => {
children: [ children: [
Widget.Button({ Widget.Button({
on_primary_click: () => { on_primary_click: () => {
if (ap.bssid === connecting.value || ap.active) {
return;
}
connecting.value = ap.bssid; connecting.value = ap.bssid;
Utils.execAsync(`nmcli device wifi connect ${ap.bssid}`) Utils.execAsync(`nmcli device wifi connect ${ap.bssid}`)
.then(() => { .then(() => {
@@ -94,6 +98,7 @@ const renderWAPs = (self, network, staging, connecting) => {
Utils.notify({ Utils.notify({
summary: "Network", summary: "Network",
body: err, body: err,
timeout: 5000,
}); });
} }
connecting.value = ""; connecting.value = "";

View File

@@ -242,11 +242,12 @@ tooltip label {
min-height: 10em; min-height: 10em;
} }
.top-right-event-box_top *{
min-height: 0em;
margin-top: 2.5em;
}
.menu-label { .menu-label {
margin: 0.5em 1em; margin: 0.5em 1em;
color: $sky; color: $sky;
} }
.event-top-padding * {
min-height: 0em;
margin-top: 2.8em;
}

View File

@@ -63,7 +63,7 @@
.close-network-password-input-button { .close-network-password-input-button {
padding: 0em 0.5em; padding: 0em 0.5em;
&:hover image { &:hover image {
color: $maroon; color: $mauve;
} }
} }
@@ -73,7 +73,7 @@
font-size: 1.3em; font-size: 1.3em;
} }
&:hover { &:hover {
color: $maroon; color: $mauve;
} }
} }
} }

View File

@@ -637,16 +637,16 @@ tooltip label {
min-height: 10em; min-height: 10em;
} }
.top-right-event-box_top * {
min-height: 0em;
margin-top: 2.5em;
}
.menu-label { .menu-label {
margin: 0.5em 1em; margin: 0.5em 1em;
color: #89dceb; color: #89dceb;
} }
.event-top-padding * {
min-height: 0em;
margin-top: 2.8em;
}
window#powermenu, window#powermenu,
window#verification { window#verification {
background-color: rgba(0, 0, 0, 0.4); background-color: rgba(0, 0, 0, 0.4);
@@ -885,7 +885,7 @@ window#powermenu .powermenu.box {
padding: 0em 0.5em; padding: 0em 0.5em;
} }
.menu-items-container.network .close-network-password-input-button:hover image { .menu-items-container.network .close-network-password-input-button:hover image {
color: #eba0ac; color: #cba6f7;
} }
.menu-items-container.network .menu-icon-button.network.disconnect { .menu-items-container.network .menu-icon-button.network.disconnect {
margin-bottom: 0.4em; margin-bottom: 0.4em;
@@ -894,7 +894,7 @@ window#powermenu .powermenu.box {
font-size: 1.3em; font-size: 1.3em;
} }
.menu-items-container.network .menu-icon-button.network.disconnect:hover { .menu-items-container.network .menu-icon-button.network.disconnect:hover {
color: #eba0ac; color: #cba6f7;
} }
.menu-items-container.bluetooth { .menu-items-container.bluetooth {

File diff suppressed because one or more lines are too long