From d79b81896edd55af1212229455095ec69c967161 Mon Sep 17 00:00:00 2001 From: Alexander Mohr Date: Sun, 20 Apr 2025 14:03:05 +0200 Subject: [PATCH] re-add support for default prompt --- src/lib/config.rs | 16 +++++++++++++++- src/lib/gui.rs | 6 +++--- styles/launcher/style.css | 16 ++-------------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/lib/config.rs b/src/lib/config.rs index c15d618..b7d5e6c 100644 --- a/src/lib/config.rs +++ b/src/lib/config.rs @@ -658,7 +658,21 @@ pub fn load_config(args_opt: Option) -> Result { let mut config: Config = toml::from_str(&toml_content)?; if let Some(args) = args_opt { - let merge_result = merge_config_with_args(&mut config, &args)?; + let mut merge_result = merge_config_with_args(&mut config, &args)?; + + if merge_result.prompt.is_none() { + match &merge_result.show { + None => {} + Some(mode) => { + match mode { + Mode::Run => merge_result.prompt = Some("run".to_owned()), + Mode::Drun => merge_result.prompt = Some("drun".to_owned()), + Mode::Dmenu => merge_result.prompt = Some("dmenu".to_owned()), + } + } + } + } + Ok(merge_result) } else { Ok(config) diff --git a/src/lib/gui.rs b/src/lib/gui.rs index 984c635..245ca07 100644 --- a/src/lib/gui.rs +++ b/src/lib/gui.rs @@ -1,5 +1,4 @@ use std::collections::HashMap; -use std::ops::DerefMut; use std::sync::{Arc, Mutex}; use std::time::Duration; @@ -182,7 +181,7 @@ fn build_ui( fb.invalidate_sort(); let mut item_lock = items_focus.lock().unwrap(); - select_first_visible_child(item_lock.deref_mut(), fb) + select_first_visible_child(&mut *item_lock, fb); }); let wrapper_box = gtk4::Box::new(Orientation::Vertical, 0); @@ -766,7 +765,8 @@ fn select_first_visible_child( inner_box: &FlowBox, ) { for i in 0..items.len() { - if let Some(child) = inner_box.child_at_index(i as i32) { + let i_32 = i.try_into().unwrap_or(i32::MAX); + if let Some(child) = inner_box.child_at_index(i_32) { if child.is_visible() { inner_box.select_child(&child); break; diff --git a/styles/launcher/style.css b/styles/launcher/style.css index 141b141..435aa23 100644 --- a/styles/launcher/style.css +++ b/styles/launcher/style.css @@ -5,7 +5,7 @@ #window { all: unset; background-color: rgba(33, 33, 33, 0.8); /* Matches #212121BB */ - border-radius: 0px; + border-radius: 0; } #window #outer-box { @@ -31,14 +31,6 @@ font-size: 1rem; } -#window #outer-box #scroll { - /* The name of the box containing all of the entries */ -} -#window #outer-box #scroll #inner-box { - /* The name of all entries */ - /* The name of all boxes shown when expanding */ - /* entries with multiple actions */ -} #window #outer-box #scroll #inner-box #entry { color: #fff; background-color: rgba(32, 32, 32, 0.1); @@ -49,7 +41,6 @@ } #window #outer-box #scroll #inner-box #entry #img { - width: 1rem; margin-right: 0.5rem; } @@ -63,15 +54,12 @@ } #row:hover { - background-color: rgba(255, 255, 255, 0);; + background-color: rgba(255, 255, 255, 0); outline: inherit; - outline-color: inherit; - } #window #outer-box #scroll #inner-box #entry:hover { background-color: rgba(255, 255, 255, 0.1); outline: inherit; - outline-color: inherit; } #label {