Skip to content

Commit

Permalink
Make prompt symbol configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
pinpox committed Aug 8, 2024
1 parent 8b8eb12 commit 7fe7dd5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion client/src/component/divider.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::Settings;
pub fn view() -> iced::Element<'static, crate::Message> {


let font_size = Settings::get_or_init().font.size;
iced::widget::column![iced::widget::horizontal_rule(1)]
.padding(iced::Padding::from([
Expand Down
10 changes: 5 additions & 5 deletions client/src/component/query_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ use crate::Settings;
pub const SEARCH_INPUT_ID: &str = "search_input";

pub fn view(query: &str, add_horizontal_rule: bool) -> iced::Element<'static, crate::Message> {

let font_size = Settings::get_or_init().font.size;
let prompt_symbol = &Settings::get_or_init().font.prompt_symbol;

let mut view = iced::widget::column![iced::widget::row![
iced::widget::container(iced::widget::text("󰍉 ").size(1.3 * font_size)).padding(
iced::Padding::from([0.2 * font_size, -0.3 * font_size, 0., 0.])
),
iced::widget::container(iced::widget::text(prompt_symbol).size(font_size))
.padding(iced::Padding::from([0.14 * font_size, 0., 0., 0.])),
iced::widget::text_input("Search", query)
.id(iced::widget::text_input::Id::new(SEARCH_INPUT_ID))
.on_input(crate::Message::Search)
.size(1. * font_size)
.style(style())
]
.padding(iced::Padding::from([0.8 * font_size, 1.2 * font_size])),]
.padding(iced::Padding::from([0., 0., 1., 0.]));
.padding(iced::Padding::from([0., 0., 2., 0.]));

if add_horizontal_rule {
view = view.push(iced::widget::horizontal_rule(1));
Expand Down
2 changes: 2 additions & 0 deletions client/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ pub struct GitRepositoriesPluginSettings {
pub struct FontSettings {
pub default: String,
pub size: f32,
pub prompt_symbol: String,
}

#[derive(Debug, Deserialize)]
Expand All @@ -134,6 +135,7 @@ impl Default for FontSettings {
Self {
default: "FiraCode Nerd Font".to_string(),
size: 14.0,
prompt_symbol: "$".to_string(),
}
}
}
Expand Down

0 comments on commit 7fe7dd5

Please sign in to comment.