support single click fixes #45
This commit is contained in:
parent
d00d307c4f
commit
c852847ffc
3 changed files with 23 additions and 8 deletions
10
README.md
10
README.md
|
@ -27,11 +27,11 @@ Worf is yet another style launcher, heavily inspired by **wofi**, **rofi**, and
|
||||||
|
|
||||||
Auto mode intelligently detects what you're trying to do! Use these prefixes for quick access:
|
Auto mode intelligently detects what you're trying to do! Use these prefixes for quick access:
|
||||||
|
|
||||||
| Prefix | Mode | Description |
|
| Prefix | Mode | Description |
|
||||||
|--------|------|-------------|
|
|---------------|------------|--------------------------------------|
|
||||||
| `ssh` | SSH | Connect to servers (optional prefix) |
|
| `ssh` | SSH | Connect to servers (optional prefix) |
|
||||||
| `?` | Web Search | Search the web |
|
| `?` | Web Search | Search the web |
|
||||||
| `/`, `$`, `~` | Files | Browse filesystem |
|
| `/`, `$`, `~` | Files | Browse filesystem |
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
|
@ -383,12 +383,19 @@ pub struct Config {
|
||||||
#[clap(long = "dynamic-lines-limit")]
|
#[clap(long = "dynamic-lines-limit")]
|
||||||
dynamic_lines_limit: Option<bool>,
|
dynamic_lines_limit: Option<bool>,
|
||||||
|
|
||||||
|
/// Defines the layer worf is running on.
|
||||||
|
/// Has no effect when normal window is used.
|
||||||
|
/// defaults to `Top`
|
||||||
#[clap(long = "layer")]
|
#[clap(long = "layer")]
|
||||||
layer: Option<Layer>,
|
layer: Option<Layer>,
|
||||||
|
|
||||||
copy_exec: Option<String>, // todo support this
|
copy_exec: Option<String>, // todo support this
|
||||||
#[clap(long = "single_click")]
|
|
||||||
single_click: Option<bool>, // todo support this
|
/// If set to `true` single click instead of double click will select
|
||||||
|
/// Defaults to `false`
|
||||||
|
#[clap(long = "single-click")]
|
||||||
|
single_click: Option<bool>,
|
||||||
|
|
||||||
#[clap(long = "pre-display-exec")]
|
#[clap(long = "pre-display-exec")]
|
||||||
pre_display_exec: Option<bool>, // todo support this
|
pre_display_exec: Option<bool>, // todo support this
|
||||||
|
|
||||||
|
@ -452,6 +459,11 @@ impl Config {
|
||||||
self.matching.unwrap_or(MatchMethod::Contains)
|
self.matching.unwrap_or(MatchMethod::Contains)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[must_use]
|
||||||
|
pub fn single_click(&self) -> bool {
|
||||||
|
self.single_click.unwrap_or(false)
|
||||||
|
}
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn fuzzy_min_score(&self) -> f64 {
|
pub fn fuzzy_min_score(&self) -> f64 {
|
||||||
self.fuzzy_min_score.unwrap_or(0.0)
|
self.fuzzy_min_score.unwrap_or(0.0)
|
||||||
|
|
|
@ -1490,8 +1490,11 @@ fn create_menu_row<T: Clone + 'static + Send>(
|
||||||
|
|
||||||
let click = GestureClick::new();
|
let click = GestureClick::new();
|
||||||
click.set_button(gtk4::gdk::BUTTON_PRIMARY);
|
click.set_button(gtk4::gdk::BUTTON_PRIMARY);
|
||||||
|
|
||||||
|
let presses = if meta.config.single_click() { 1 } else { 2 };
|
||||||
|
|
||||||
click.connect_pressed(move |_gesture, n_press, _x, _y| {
|
click.connect_pressed(move |_gesture, n_press, _x, _y| {
|
||||||
if n_press == 2 {
|
if n_press == presses {
|
||||||
if let Err(e) = handle_selected_item(
|
if let Err(e) = handle_selected_item(
|
||||||
&click_ui,
|
&click_ui,
|
||||||
Rc::<MetaData<T>>::clone(&click_meta),
|
Rc::<MetaData<T>>::clone(&click_meta),
|
||||||
|
|
Loading…
Add table
Reference in a new issue