support dmenu style
This commit is contained in:
parent
ed72037239
commit
00df9f4d88
4 changed files with 18 additions and 13 deletions
|
@ -182,6 +182,7 @@ pub struct Config {
|
|||
#[clap(short = 'n', long = "normal-window")]
|
||||
pub normal_window: bool,
|
||||
|
||||
/// Set to 'false' to disable images, defaults to true
|
||||
#[clap(short = 'I', long = "allow-images")]
|
||||
pub allow_images: Option<bool>,
|
||||
|
||||
|
@ -201,9 +202,11 @@ pub struct Config {
|
|||
#[clap(short = 'e', long = "exec-search")]
|
||||
pub exec_search: Option<bool>,
|
||||
|
||||
/// Defines whether the scrollbar is visible
|
||||
#[clap(short = 'b', long = "hide-scroll")]
|
||||
pub hide_scroll: Option<bool>,
|
||||
|
||||
/// Defines the matching method, defaults to contains
|
||||
#[serde(default = "default_match_method")]
|
||||
#[clap(short = 'M', long = "matching")]
|
||||
pub matching: Option<MatchMethod>,
|
||||
|
|
|
@ -15,10 +15,7 @@ use gdk4::glib::{Propagation, timeout_add_local};
|
|||
use gdk4::prelude::{Cast, DisplayExt, MonitorExt};
|
||||
use gdk4::{Display, Key};
|
||||
use gtk4::glib::ControlFlow;
|
||||
use gtk4::prelude::{
|
||||
ApplicationExt, ApplicationExtManual, BoxExt, EditableExt, FlowBoxChildExt, GestureSingleExt,
|
||||
GtkWindowExt, ListBoxRowExt, NativeExt, WidgetExt,
|
||||
};
|
||||
use gtk4::prelude::{ApplicationExt, ApplicationExtManual, BoxExt, EditableExt, FlowBoxChildExt, GestureSingleExt, GtkWindowExt, ListBoxRowExt, NativeExt, OrientableExt, WidgetExt};
|
||||
use gtk4::{
|
||||
Align, EventControllerKey, Expander, FlowBox, FlowBoxChild, GestureClick, Image, Label,
|
||||
ListBox, ListBoxRow, NaturalWrapMode, Ordering, PolicyType, ScrolledWindow, SearchEntry,
|
||||
|
@ -246,7 +243,7 @@ fn build_ui<T, P>(
|
|||
.set_keyboard_mode(KeyboardMode::Exclusive);
|
||||
ui_elements.window.set_namespace(Some("worf"));
|
||||
}
|
||||
|
||||
|
||||
let window_done = Instant::now();
|
||||
|
||||
if let Some(location) = config.location.as_ref() {
|
||||
|
@ -318,12 +315,13 @@ fn build_main_box<T: Clone + 'static>(config: &Config, ui_elements: &Rc<UiElemen
|
|||
}
|
||||
if let Some(valign) = config.valign {
|
||||
ui_elements.main_box.set_valign(valign.into());
|
||||
} else if config.orientation.unwrap() == config::Orientation::Horizontal {
|
||||
}
|
||||
if config.orientation.unwrap() == config::Orientation::Horizontal {
|
||||
ui_elements.main_box.set_valign(Align::Center);
|
||||
ui_elements.main_box.set_orientation(Orientation::Vertical);
|
||||
} else {
|
||||
ui_elements.main_box.set_valign(Align::Start);
|
||||
}
|
||||
|
||||
let ui_clone = Rc::clone(ui_elements);
|
||||
ui_elements.main_box.connect_map(move |fb| {
|
||||
fb.grab_focus();
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
image_size=0
|
||||
columns=999
|
||||
allow_images=false
|
||||
orientation="Horizontal"
|
||||
row_bow_orientation="Horizontal"
|
||||
content_halign="Center"
|
||||
height="25"
|
||||
content_halign="Start"
|
||||
height="0"
|
||||
width="100%"
|
||||
valign="Start"
|
||||
hide_scroll=true
|
||||
location=["Top"]
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
font-family: DejaVu;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
min-height: 1px;
|
||||
}
|
||||
|
||||
#window {
|
||||
|
@ -22,8 +23,8 @@
|
|||
background-color: rgba(32, 32, 32, 0.6);
|
||||
color: #f2f2f2;
|
||||
border-bottom: 2px solid rgba(214, 174, 0, 1);
|
||||
padding: 0.8rem 1rem;
|
||||
font-size: 1rem;
|
||||
min-height: 1px;
|
||||
}
|
||||
|
||||
#window #outer-box #input:focus, #window #outer-box #input:focus-visible, #window #outer-box #input:active {
|
||||
|
@ -37,10 +38,11 @@
|
|||
background-color: rgba(32, 32, 32, 0.1);
|
||||
border-radius: 0.5rem;
|
||||
border-bottom: 5px solid rgba(32, 32, 32, 0.1);
|
||||
|
||||
padding-left: 1rem;
|
||||
padding-right: 1rem;
|
||||
min-height: 1px;
|
||||
}
|
||||
#window #outer-box #scroll #inner-box #entry #img {
|
||||
|
||||
}
|
||||
|
||||
#window #outer-box #scroll #inner-box #entry:selected {
|
||||
|
|
Loading…
Add table
Reference in a new issue