re-add support for default prompt

This commit is contained in:
Alexander Mohr 2025-04-20 14:03:05 +02:00
parent 8623e3109a
commit d79b81896e
3 changed files with 20 additions and 18 deletions

View file

@ -658,7 +658,21 @@ pub fn load_config(args_opt: Option<Config>) -> Result<Config, anyhow::Error> {
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)

View file

@ -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<T>(
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<T>(
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;

View file

@ -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 {