Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: try to support a mini notification widget #4

Merged
merged 35 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
047dfed
fix: try to support a mini notification widget
Decodetalkers Aug 8, 2024
bade3a5
chore: run fmt
Decodetalkers Aug 8, 2024
e611ae6
feat: listen to notifications
Decodetalkers Aug 9, 2024
e2f31af
chore: little tidyup
Decodetalkers Aug 9, 2024
1b220ee
feat: split crate for iced
Decodetalkers Aug 9, 2024
30dda65
chore: base notification widget
Decodetalkers Aug 9, 2024
c12bb31
chore: tidy up
Decodetalkers Aug 10, 2024
3540a6a
fix: tidy
Decodetalkers Aug 10, 2024
978719e
chore: update deps
Decodetalkers Aug 10, 2024
d7cf37e
chore: do fmt
Decodetalkers Aug 10, 2024
7941421
fix: typo with upstream
Decodetalkers Aug 10, 2024
3f282ed
chore: tidy up
Decodetalkers Aug 10, 2024
f92cf61
feat: support remove all notifications
Decodetalkers Aug 10, 2024
fee19a4
chore: typo fix
Decodetalkers Aug 10, 2024
397a4aa
chore: update dep
Decodetalkers Aug 10, 2024
4f2ec3e
chore: finish base notifications
Decodetalkers Aug 10, 2024
0da36f4
chore: use git deps
Decodetalkers Aug 10, 2024
64b605b
chore: support inline-reply
Decodetalkers Aug 10, 2024
7e88e90
feat: better inline reply
Decodetalkers Aug 10, 2024
ee8d2ce
chore: handle image
Decodetalkers Aug 10, 2024
b32fb38
chore: nearly finished
Decodetalkers Aug 10, 2024
a5cc649
chore: code tidy
Decodetalkers Aug 10, 2024
186012a
fix: some time also need count down
Decodetalkers Aug 11, 2024
4325c90
feat: only show four notifications
Decodetalkers Aug 11, 2024
05b1052
chore: with upstream fix
Decodetalkers Aug 11, 2024
5687f95
chore: fix typos
Decodetalkers Aug 11, 2024
a45f122
fix: hidden id reshown
Decodetalkers Aug 11, 2024
eed2981
chore: base fix
Decodetalkers Aug 11, 2024
5edb401
feat: support desktop icon
Decodetalkers Aug 11, 2024
09cc9bf
feat: support full hidden panel
Decodetalkers Aug 11, 2024
7f21f68
chore: make clippy happy
Decodetalkers Aug 11, 2024
6eccb07
feat: toggle all actions
Decodetalkers Aug 11, 2024
5682574
Revert "feat: toggle all actions"
Decodetalkers Aug 11, 2024
a496ad1
feat: use secondery style
Decodetalkers Aug 11, 2024
9a9c5f7
feat: show music info in righpanel
Decodetalkers Aug 11, 2024
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
138 changes: 77 additions & 61 deletions Cargo.lock

Large diffs are not rendered by default.

41 changes: 10 additions & 31 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,36 +1,15 @@
[package]
name = "lala_musicbar"
version = "0.2.7"
edition = "2021"
[workspace]
resolver = "2"
members = ["./lala_bar", "./notification_iced"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[workspace.package]
version = "0.1.0"

[dependencies]
iced = { version = "0.12", features = [
"tokio",
"debug",
"image",
"advanced",
"svg",
] }
#iced_native = "0.12"
iced_runtime = "0.12"
iced_layershell = "0.4.0-rc1"
tokio = { version = "1.39", features = ["full"] }
iced_futures = "0.12.0"
env_logger = "0.11.5"
tracing = "0.1.40"

futures-util = "0.3.30"
once_cell = "1.19.0"
[workspace.dependencies]
notification_iced = { version = "0.1.0", path = "notification_iced"}
futures = "0.3.30"
serde = { version = "1.0.204", features = ["derive"] }

zbus = { version = "4.4.0", default-features = false, features = ["tokio"] }
tracing-subscriber = "0.3.18"
anyhow = "1.0.86"
alsa = "0.9.0"

gio = "0.20.0"
regex = "1.10.5"
xdg = "2.5.2"
url = "2.5.2"
zbus = { version = "4.4.0", default-features = false, features = ["tokio"] }
futures-util = "0.3.30"
37 changes: 37 additions & 0 deletions lala_bar/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[package]
name = "lala-bar"
version = "0.2.7"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
iced = { version = "0.12", features = [
"tokio",
"debug",
"image",
"advanced",
"svg",
] }
#iced_native = "0.12"
iced_runtime = "0.12"
iced_layershell = { git = "https://github.com/waycrate/exwlshelleventloop", package = "iced_layershell" }
tokio = { version = "1.39", features = ["full"] }
iced_futures = "0.12.0"
env_logger = "0.11.5"
tracing = "0.1.40"

futures-util.workspace = true
serde.workspace = true

zbus.workspace = true
tracing-subscriber = "0.3.18"
anyhow = "1.0.86"
alsa = "0.9.0"

gio = "0.20.0"
regex = "1.10.5"
xdg = "2.5.2"
url.workspace = true
futures.workspace = true
notification_iced.workspace = true
File renamed without changes.
23 changes: 15 additions & 8 deletions src/launcher.rs → lala_bar/src/launcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ pub struct Launcher {
pub should_delete: bool,
}

#[derive(Debug, Clone)]
pub enum LaunchMessage {
SearchEditChanged(String),
SearchSubmit,
Launch(usize),
IcedEvent(Event),
}

impl Launcher {
pub fn new() -> Self {
Self {
Expand All @@ -34,11 +42,11 @@ impl Launcher {
text_input::focus(INPUT_ID.clone())
}

pub fn update(&mut self, message: Message, id: iced::window::Id) -> Command<Message> {
pub fn update(&mut self, message: LaunchMessage, id: iced::window::Id) -> Command<Message> {
use iced::keyboard::key::Named;
use iced_runtime::keyboard;
match message {
Message::SearchSubmit => {
LaunchMessage::SearchSubmit => {
let re = regex::Regex::new(&self.text).ok();
let index = self
.apps
Expand All @@ -63,17 +71,17 @@ impl Launcher {
Command::none()
}
}
Message::SearchEditChanged(edit) => {
LaunchMessage::SearchEditChanged(edit) => {
self.scrollpos = 0;
self.text = edit;
Command::none()
}
Message::Launch(index) => {
LaunchMessage::Launch(index) => {
self.apps[index].launch();
self.should_delete = true;
Command::single(Action::Window(WindowAction::Close(id)))
}
Message::IcedEvent(event) => {
LaunchMessage::IcedEvent(event) => {
let mut len = self.apps.len();

let re = regex::Regex::new(&self.text).ok();
Expand Down Expand Up @@ -112,16 +120,15 @@ impl Launcher {
}
text_input::focus(INPUT_ID.clone())
}
_ => Command::none(),
}
}

pub fn view(&self) -> Element<Message> {
let re = regex::Regex::new(&self.text).ok();
let text_ip: Element<Message> = text_input("put the launcher name", &self.text)
.padding(10)
.on_input(Message::SearchEditChanged)
.on_submit(Message::SearchSubmit)
.on_input(|msg| Message::LauncherInfo(LaunchMessage::SearchEditChanged(msg)))
.on_submit(Message::LauncherInfo(LaunchMessage::SearchSubmit))
.id(INPUT_ID.clone())
.into();
let bottom_vec: Vec<Element<Message>> = self
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use std::path::PathBuf;
use std::str::FromStr;

use super::LaunchMessage;

use gio::{AppLaunchContext, DesktopAppInfo};

use gio::prelude::*;
Expand All @@ -10,7 +12,7 @@ use iced::{Element, Length};

use super::Message;

static DEFAULT_ICON: &[u8] = include_bytes!("../../misc/text-plain.svg");
static DEFAULT_ICON: &[u8] = include_bytes!("../../../misc/text-plain.svg");

#[allow(unused)]
#[derive(Debug, Clone)]
Expand Down Expand Up @@ -79,7 +81,7 @@ impl App {
]
.spacing(10),
)
.on_press(Message::Launch(index))
.on_press(Message::LauncherInfo(LaunchMessage::Launch(index)))
.width(Length::Fill)
.height(Length::Fixed(85.))
.style(if selected {
Expand Down
Loading