Skip to content

Commit

Permalink
improv: desktop entries update
Browse files Browse the repository at this point in the history
  • Loading branch information
wiiznokes authored Jul 12, 2024
1 parent ab7a71a commit 1725320
Show file tree
Hide file tree
Showing 25 changed files with 556 additions and 660 deletions.
654 changes: 308 additions & 346 deletions Cargo.lock

Large diffs are not rendered by default.

38 changes: 31 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,51 @@ license = "MPL-2.0"
authors = ["Michael Aaron Murphy <[email protected]>"]
description = "Library for writing plugins and frontends for pop-launcher"
repository = "https://github.com/pop-os/launcher"
edition = "2018"
edition.workspace = true

[workspace]
members = ["bin", "plugins", "service", "toolkit"]
resolver = "2"

[dependencies]
const_format = "0.2.32"
dirs = "5.0.1"
futures = "0.3.30"
[workspace.package]
edition = "2021"

[workspace.dependencies]
anyhow = "1.0.82"
serde = { version = "1.0.198", features = ["derive"] }
serde_json = "1.0.116"
tracing = "0.1.40"
dirs = "5.0.1"
serde_with = "3.7.0"
futures = "0.3.30"
flume = "0.11.0"
toml = "0.8.12"
regex = "1.10.4"
ron = "0.8.1"
tokio = "1.37.0"
tokio-stream = "0.1.15"

[dependencies]
const_format = "0.2.32"
dirs.workspace = true
futures.workspace = true
serde.workspace = true
serde_json.workspace = true
serde_with.workspace = true

[profile.release]
lto = "fat"
panic = "abort"

[dependencies.tokio]
version = "1.37.0"
workspace = true
features = ["io-std", "io-util"]

[dependencies.tokio-stream]
version = "0.1.15"
workspace = true
features = ["io-util"]



# [patch.crates-io]
# freedesktop-desktop-entry = { path = "../freedesktop-desktop-entry" }
10 changes: 5 additions & 5 deletions bin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
[package]
name = "pop-launcher-bin"
version = "1.2.3"
edition = "2018"
license = "GPL-3.0-only"
edition.workspace = true
publish = false

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

[dependencies]
pop-launcher-toolkit = { path = "../toolkit" }
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", default-features = false, features = ["std", "fmt", "env-filter"] }
dirs = "5.0.1"
tracing.workspace = true
tracing-subscriber = { version = "0.3.18", default-features = false, features = ["std", "fmt", "env-filter", "chrono"] }
dirs.workspace = true
mimalloc = "0.1.39"

[dependencies.tokio]
version = "1.37.0"
workspace = true
features = ["rt"]
31 changes: 24 additions & 7 deletions bin/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use pop_launcher_toolkit::plugins;
use pop_launcher_toolkit::service;

use mimalloc::MiMalloc;
use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::EnvFilter;

#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;
Expand Down Expand Up @@ -37,7 +39,10 @@ async fn main() {
}
}

// todo: support journald once this issue is resolved: https://github.com/tokio-rs/tracing/issues/2348
fn init_logging(cmd: &str) {
use tracing_subscriber::{fmt, Registry};

let logdir = match dirs::state_dir() {
Some(dir) => dir.join("pop-launcher/"),
None => dirs::home_dir()
Expand All @@ -49,15 +54,27 @@ fn init_logging(cmd: &str) {

let logfile = std::fs::OpenOptions::new()
.create(true)
.truncate(true)
.write(true)
.append(true)
.open(logdir.join([cmd, ".log"].concat().as_str()).as_path());

if let Ok(file) = logfile {
use tracing_subscriber::{fmt, EnvFilter};
fmt()
.with_env_filter(EnvFilter::from_default_env())
.with_writer(file)
.init();
if let Ok(meta) = file.metadata() {
if meta.len() > 1000 {
let _ = file.set_len(0);
}
}

let filter_layer = EnvFilter::try_from_default_env()
.or_else(|_| EnvFilter::try_new("warn"))
.unwrap();

let fmt_layer = fmt::layer()
.with_target(false)
.with_timer(fmt::time::ChronoLocal::new("%T".into()))
.with_writer(file);

let subscriber = Registry::default().with(filter_layer).with(fmt_layer);

tracing::subscriber::set_global_default(subscriber).expect("Failed to set subscriber");
}
}
29 changes: 14 additions & 15 deletions plugins/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,33 @@ name = "pop-launcher-plugins"
version = "1.2.3"
license = "GPL-3.0-only"
authors = ["Michael Aaron Murphy <[email protected]>"]
edition = "2018"
edition.workspace = true
publish = false

[dependencies]
async-pidfd = "0.1.4"
fork = "0.1.23"
freedesktop-desktop-entry = "0.6.0"
freedesktop-desktop-entry = "0.6.2"
human_format = "1.1.0"
human-sort = "0.2.2"
new_mime_guess = "4.0.1"
pop-launcher = { path = "../" }
regex = "1.10.4"
ron = "0.8.1"
serde = "1.0.198"
serde_json = "1.0.116"
regex.workspace = true
ron.workspace = true
serde.workspace = true
serde_json.workspace = true
slab = "0.4.9"
strsim = "0.11.1"
tracing = "0.1.40"
tracing.workspace = true
urlencoding = "2.1.3"
zbus = "3.15.2"
zvariant = "3.15.2"
ward = "2.1.0"
zbus = "4.2.2"
zvariant = "4.1.1"
url = "2.5.0"
sysfs-class = "0.1.3"
anyhow = "1.0.82"
flume = "0.11.0"
dirs = "5.0.1"
futures = "0.3.30"
anyhow.workspace = true
flume.workspace = true
dirs.workspace = true
futures.workspace = true
bytes = "1.6.0"
recently-used-xbel = "1.0.0"

Expand All @@ -49,5 +48,5 @@ default-features = false
features = ["rustls-tls"]

[dependencies.tokio]
version = "1.37.0"
workspace = true
features = ["fs", "io-std", "macros", "process", "rt"]
8 changes: 4 additions & 4 deletions plugins/src/calc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ impl App {
async fn qcalc(regex: &mut Regex, expression: &str, decimal_comma: bool) -> Option<String> {
let mut command = Command::new("qalc");

command.args(&["-u8"]);
command.args(&["-set", "maxdeci 9"]);
command.args(["-u8"]);
command.args(["-set", "maxdeci 9"]);

if decimal_comma {
command.args(&["-set", "decimal comma on"]);
command.args(["-set", "decimal comma on"]);
} else {
command.args(&["-set", "decimal comma off"]);
command.args(["-set", "decimal comma off"]);
}

let spawn = command
Expand Down
2 changes: 1 addition & 1 deletion plugins/src/cosmic_toplevel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ impl<W: AsyncWrite + Unpin> App<W> {
}

send(&mut self.tx, PluginResponse::Finished).await;
let _ = self.tx.flush();
let _ = self.tx.flush().await;
}
}

Expand Down
1 change: 1 addition & 0 deletions plugins/src/cosmic_toplevel/toplevel_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub enum ToplevelEvent {
Update(ZcosmicToplevelHandleV1, ToplevelInfo),
}

#[allow(dead_code)]
#[derive(Debug, Clone)]
pub struct Toplevel {
pub name: String,
Expand Down
Loading

0 comments on commit 1725320

Please sign in to comment.