mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-08-16 22:31:03 +02:00
Merge pull request #814 from BowDown097/master
feat(launcher): open new window on middle-click
This commit is contained in:
commit
cfaa99830f
2 changed files with 20 additions and 11 deletions
|
@ -3,7 +3,8 @@
|
|||
|
||||
Windows-style taskbar that displays running windows, grouped by program.
|
||||
Hovering over a program with multiple windows open shows a popup with each window.
|
||||
Clicking an icon/popup item focuses or launches the program.
|
||||
Left clicking an icon/popup item focuses the program if it has any open instances or otherwise launches a new instance of the program.
|
||||
Middle clicking an icon always launches a new instance of the program.
|
||||
Optionally displays a launchable set of favourites.
|
||||
|
||||

|
||||
|
|
|
@ -7,6 +7,7 @@ use crate::modules::launcher::{ItemEvent, LauncherUpdate};
|
|||
use crate::modules::ModuleUpdateEvent;
|
||||
use crate::{read_lock, try_send};
|
||||
use glib::Propagation;
|
||||
use gtk::gdk::{BUTTON_MIDDLE, BUTTON_PRIMARY};
|
||||
use gtk::prelude::*;
|
||||
use gtk::{Button, IconTheme, Image, Label, Orientation};
|
||||
use indexmap::IndexMap;
|
||||
|
@ -201,7 +202,9 @@ impl ItemButton {
|
|||
let app_id = item.app_id.clone();
|
||||
let tx = controller_tx.clone();
|
||||
let menu_state = menu_state.clone();
|
||||
button.connect_clicked(move |button| {
|
||||
|
||||
button.connect_button_release_event(move |button, event| {
|
||||
if event.button() == BUTTON_PRIMARY {
|
||||
// lazy check :| TODO: Improve this
|
||||
let style_context = button.style_context();
|
||||
if style_context.has_class("open") {
|
||||
|
@ -215,6 +218,11 @@ impl ItemButton {
|
|||
} else {
|
||||
try_send!(tx, ItemEvent::OpenItem(app_id.clone()));
|
||||
}
|
||||
} else if event.button() == BUTTON_MIDDLE {
|
||||
try_send!(tx, ItemEvent::OpenItem(app_id.clone()));
|
||||
}
|
||||
|
||||
Propagation::Proceed
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue