Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/app/apps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::io::Cursor;

use iced::{
Alignment,
Length::Fill,
Length::{self, Fill},
widget::{
Button, Row, Text, container,
image::{Handle, Viewer},
Expand All @@ -18,7 +18,7 @@ use crate::{
app::{Message, Page, RUSTCAST_DESC_NAME},
clipboard::ClipBoardContentType,
commands::Function,
styles::{result_button_style, result_row_container_style},
styles::{favourite_button_style, result_button_style, result_row_container_style},
utils::icns_data_to_handle,
};

Expand Down Expand Up @@ -214,9 +214,10 @@ impl App {
let name = self.search_name.clone();
let theme_clone = theme.clone();
row = row.push(
Button::new("♥️")
Button::new(Text::new("♥️").width(Length::Fill).align_x(Alignment::End))
.on_press_with(move || Message::ToggleFavouriteApp(name.clone()))
.style(move |_, _| result_button_style(&theme_clone)),
.width(Length::Fill)
.style(move |_, status| favourite_button_style(&theme_clone, status)),
);

let msg = on_press.or(match self.open_command.clone() {
Expand Down
4 changes: 4 additions & 0 deletions src/app/tile/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,10 @@ fn execute_query(tile: &mut Tile, id: Id) -> Task<Message> {
return Task::batch([zero_item_resize_task(id), task]);
}
}
"fav" => {
tile.results = tile.options.get_favourites();
return resize_for_results_count(id, tile.results.len());
}
query => 'a: {
if !query.starts_with(">") || tile.page != Page::Main {
break 'a;
Expand Down
15 changes: 15 additions & 0 deletions src/styles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,21 @@ pub fn result_button_style(theme: &ConfigTheme) -> button::Style {
}
}

pub fn favourite_button_style(theme: &ConfigTheme, status: button::Status) -> button::Style {
let text_color = match status {
button::Status::Pressed => theme.text_color(1.),
button::Status::Hovered => theme.text_color(0.5),
button::Status::Active => theme.text_color(0.1),
button::Status::Disabled => theme.text_color(0.1),
};

button::Style {
text_color,
background: Some(Background::Color(theme.bg_color())),
..Default::default()
}
}

pub fn results_scrollbar_style(tile: &ConfigTheme) -> scrollable::Style {
let clr = with_alpha(tile.bg_color(), 0.7);

Expand Down
Loading