1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-07-03 19:51:03 +02:00

fix: popup placement issues

This commit is contained in:
Jake Stanger 2022-08-15 21:11:00 +01:00
parent 8518262053
commit 8576ac5c44
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
7 changed files with 54 additions and 66 deletions

View file

@ -2,7 +2,6 @@ use crate::collection::Collection;
use crate::icon::{find_desktop_file, get_icon};
use crate::modules::launcher::popup::Popup;
use crate::modules::launcher::FocusEvent;
use crate::popup::PopupAlignment;
use crate::sway::SwayNode;
use gtk::prelude::*;
use gtk::{Button, IconTheme, Image};
@ -175,19 +174,8 @@ impl LauncherItem {
button.connect_enter_notify_event(move |button, _| {
let windows = windows.lock().unwrap();
if windows.len() > 1 {
let button_w = button.allocation().width();
let (button_x, _) = button
.translate_coordinates(&button.toplevel().unwrap(), 0, 0)
.unwrap();
let button_center = f64::from(button_x) + f64::from(button_w) / 2.0;
popup.set_windows(windows.as_slice(), &tx_hover);
popup.show();
// TODO: Pass through module location
popup.set_pos(button_center, PopupAlignment::Center);
popup.show(button);
}
Inhibit(false)

View file

@ -194,6 +194,7 @@ impl Module<gtk::Box> for LauncherModule {
let popup = Popup::new(
"popup-launcher",
info.app,
info.monitor,
Orientation::Vertical,
info.bar_position,
);