Option to close window when a click is received outside the main box
This commit is contained in:
@@ -98,6 +98,9 @@ by managing it in Nix/home-manager, and using the full path, like this (in hm):_
|
|||||||
// Hide the plugin info panel
|
// Hide the plugin info panel
|
||||||
hide_plugin_info: true,
|
hide_plugin_info: true,
|
||||||
|
|
||||||
|
// Close window when a click outside the main box is received
|
||||||
|
close_on_click: false,
|
||||||
|
|
||||||
plugins: [
|
plugins: [
|
||||||
"${pkgs.anyrun}/lib/libapplications.so",
|
"${pkgs.anyrun}/lib/libapplications.so",
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ struct Config {
|
|||||||
hide_icons: bool,
|
hide_icons: bool,
|
||||||
hide_plugin_info: bool,
|
hide_plugin_info: bool,
|
||||||
ignore_exclusive_zones: bool,
|
ignore_exclusive_zones: bool,
|
||||||
|
close_on_click: bool,
|
||||||
layer: Layer,
|
layer: Layer,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -513,8 +514,18 @@ fn activate(app: >k::Application, runtime_data: Rc<RefCell<Option<RuntimeData>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Show the window initially, so it gets allocated and configured
|
// If the option is enabled, close the window when any click is received
|
||||||
window.show_all();
|
// that is outside the bounds of the main box
|
||||||
|
if config.close_on_click {
|
||||||
|
window.connect_button_press_event(move |window, event| {
|
||||||
|
if event.window() == window.window() {
|
||||||
|
window.close();
|
||||||
|
Inhibit(true)
|
||||||
|
} else {
|
||||||
|
Inhibit(false)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Create widgets here for proper positioning
|
// Create widgets here for proper positioning
|
||||||
window.connect_configure_event(move |window, event| {
|
window.connect_configure_event(move |window, event| {
|
||||||
@@ -557,6 +568,9 @@ fn activate(app: >k::Application, runtime_data: Rc<RefCell<Option<RuntimeData>
|
|||||||
entry.grab_focus(); // Grab the focus so typing is immediately accepted by the entry box
|
entry.grab_focus(); // Grab the focus so typing is immediately accepted by the entry box
|
||||||
false
|
false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Show the window initially, so it gets allocated and configured
|
||||||
|
window.show_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_matches(
|
fn handle_matches(
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ Config(
|
|||||||
|
|
||||||
// Hide the plugin info panel
|
// Hide the plugin info panel
|
||||||
hide_plugin_info: false,
|
hide_plugin_info: false,
|
||||||
|
|
||||||
|
// Close window when a click outside the main box is received
|
||||||
|
close_on_click: false,
|
||||||
|
|
||||||
// List of plugins to be loaded by default, can be specified with a relative path to be loaded from the
|
// List of plugins to be loaded by default, can be specified with a relative path to be loaded from the
|
||||||
// `<anyrun config dir>/plugins` directory or with an absolute path to just load the file the path points to.
|
// `<anyrun config dir>/plugins` directory or with an absolute path to just load the file the path points to.
|
||||||
|
|||||||
Reference in New Issue
Block a user