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:
|
||||
|
||||
| Prefix | Mode | Description |
|
||||
|--------|------|-------------|
|
||||
| `ssh` | SSH | Connect to servers (optional prefix) |
|
||||
| `?` | Web Search | Search the web |
|
||||
| `/`, `$`, `~` | Files | Browse filesystem |
|
||||
| Prefix | Mode | Description |
|
||||
|---------------|------------|--------------------------------------|
|
||||
| `ssh` | SSH | Connect to servers (optional prefix) |
|
||||
| `?` | Web Search | Search the web |
|
||||
| `/`, `$`, `~` | Files | Browse filesystem |
|
||||
|
||||

|
||||
|
||||
|
|
|
@ -383,12 +383,19 @@ pub struct Config {
|
|||
#[clap(long = "dynamic-lines-limit")]
|
||||
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")]
|
||||
layer: Option<Layer>,
|
||||
|
||||
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")]
|
||||
pre_display_exec: Option<bool>, // todo support this
|
||||
|
||||
|
@ -452,6 +459,11 @@ impl Config {
|
|||
self.matching.unwrap_or(MatchMethod::Contains)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn single_click(&self) -> bool {
|
||||
self.single_click.unwrap_or(false)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn fuzzy_min_score(&self) -> f64 {
|
||||
self.fuzzy_min_score.unwrap_or(0.0)
|
||||
|
|
|
@ -1490,8 +1490,11 @@ fn create_menu_row<T: Clone + 'static + Send>(
|
|||
|
||||
let click = GestureClick::new();
|
||||
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| {
|
||||
if n_press == 2 {
|
||||
if n_press == presses {
|
||||
if let Err(e) = handle_selected_item(
|
||||
&click_ui,
|
||||
Rc::<MetaData<T>>::clone(&click_meta),
|
||||
|
|
Loading…
Add table
Reference in a new issue