chore: Rust 2024 edition
This commit is contained in:
parent
8d9da92dba
commit
8a0b37bd36
16 changed files with 29 additions and 33 deletions
|
|
@ -9,10 +9,10 @@ edition.workspace = true
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = ["bin", "plugins", "service", "toolkit"]
|
members = ["bin", "plugins", "service", "toolkit"]
|
||||||
resolver = "2"
|
resolver = "3"
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
anyhow = "1.0.98"
|
anyhow = "1.0.98"
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ async fn main() {
|
||||||
|
|
||||||
fn init_logging(cmd: &str) {
|
fn init_logging(cmd: &str) {
|
||||||
use tracing_subscriber::prelude::*;
|
use tracing_subscriber::prelude::*;
|
||||||
use tracing_subscriber::{fmt, EnvFilter};
|
use tracing_subscriber::{EnvFilter, fmt};
|
||||||
|
|
||||||
let logdir = match dirs::state_dir() {
|
let logdir = match dirs::state_dir() {
|
||||||
Some(dir) => dir.join("pop-launcher/"),
|
Some(dir) => dir.join("pop-launcher/"),
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ async fn qcalc(regex: &mut Regex, expression: &str, decimal_comma: bool) -> Opti
|
||||||
String::from("qalc command is not installed")
|
String::from("qalc command is not installed")
|
||||||
} else {
|
} else {
|
||||||
format!("qalc command failed to spawn: {}", why)
|
format!("qalc command failed to spawn: {}", why)
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,18 +11,18 @@ use tracing::{debug, error, info, warn};
|
||||||
use crate::desktop_entries::utils::{get_description, is_session_cosmic};
|
use crate::desktop_entries::utils::{get_description, is_session_cosmic};
|
||||||
use crate::send;
|
use crate::send;
|
||||||
use futures::{
|
use futures::{
|
||||||
channel::mpsc,
|
|
||||||
future::{select, Either},
|
|
||||||
StreamExt,
|
StreamExt,
|
||||||
|
channel::mpsc,
|
||||||
|
future::{Either, select},
|
||||||
};
|
};
|
||||||
use pop_launcher::{
|
use pop_launcher::{
|
||||||
async_stdin, async_stdout, json_input_stream, IconSource, PluginResponse, PluginSearchResult,
|
IconSource, PluginResponse, PluginSearchResult, Request, async_stdin, async_stdout,
|
||||||
Request,
|
json_input_stream,
|
||||||
};
|
};
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use tokio::io::{AsyncWrite, AsyncWriteExt};
|
use tokio::io::{AsyncWrite, AsyncWriteExt};
|
||||||
|
|
||||||
use self::toplevel_handler::{toplevel_handler, ToplevelAction};
|
use self::toplevel_handler::{ToplevelAction, toplevel_handler};
|
||||||
|
|
||||||
pub async fn main() {
|
pub async fn main() {
|
||||||
let mut tx = async_stdout();
|
let mut tx = async_stdout();
|
||||||
|
|
@ -214,11 +214,7 @@ impl<W: AsyncWrite + Unpin> App<W> {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
|
|
||||||
send(
|
send(&mut self.tx, response).await;
|
||||||
&mut self.tx,
|
|
||||||
response,
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
send(&mut self.tx, PluginResponse::Finished).await;
|
send(&mut self.tx, PluginResponse::Finished).await;
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ use cosmic_protocols::{
|
||||||
use futures::channel::mpsc::UnboundedSender;
|
use futures::channel::mpsc::UnboundedSender;
|
||||||
use sctk::registry::{ProvidesRegistryState, RegistryState};
|
use sctk::registry::{ProvidesRegistryState, RegistryState};
|
||||||
use tracing::warn;
|
use tracing::warn;
|
||||||
use wayland_client::{globals::registry_queue_init, Connection, QueueHandle};
|
use wayland_client::{Connection, QueueHandle, globals::registry_queue_init};
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum ToplevelAction {
|
pub enum ToplevelAction {
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ use zbus::Connection;
|
||||||
use zvariant::{Signature, Type};
|
use zvariant::{Signature, Type};
|
||||||
|
|
||||||
mod config;
|
mod config;
|
||||||
pub use config::{load, Config};
|
pub use config::{Config, load};
|
||||||
|
|
||||||
const DEST: &str = "com.System76.PopShell";
|
const DEST: &str = "com.System76.PopShell";
|
||||||
const PATH: &str = "/com/System76/PopShell";
|
const PATH: &str = "/com/System76/PopShell";
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
use pop_launcher::*;
|
use pop_launcher::*;
|
||||||
use recently_used_xbel::{parse_file, RecentlyUsed};
|
use recently_used_xbel::{RecentlyUsed, parse_file};
|
||||||
use slab::Slab;
|
use slab::Slab;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ impl App {
|
||||||
None => return,
|
None => return,
|
||||||
};
|
};
|
||||||
|
|
||||||
use fork::{daemon, Fork};
|
use fork::{Fork, daemon};
|
||||||
|
|
||||||
crate::send(&mut self.out, PluginResponse::Close).await;
|
crate::send(&mut self.out, PluginResponse::Close).await;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ use url::Url;
|
||||||
|
|
||||||
use pop_launcher::*;
|
use pop_launcher::*;
|
||||||
|
|
||||||
pub use config::{load, Config, Definition};
|
pub use config::{Config, Definition, load};
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
|
|
||||||
mod config;
|
mod config;
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,10 @@ use crate::priority::Priority;
|
||||||
use crate::recent::RecentUseStorage;
|
use crate::recent::RecentUseStorage;
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use flume::{Receiver, Sender};
|
use flume::{Receiver, Sender};
|
||||||
use futures::{future, SinkExt, Stream, StreamExt};
|
use futures::{SinkExt, Stream, StreamExt, future};
|
||||||
use pop_launcher::{
|
use pop_launcher::{
|
||||||
json_input_stream, plugin_paths, ContextOption, IconSource, Indice, PluginResponse,
|
ContextOption, IconSource, Indice, PluginResponse, PluginSearchResult, Request, Response,
|
||||||
PluginSearchResult, Request, Response, SearchResult,
|
SearchResult, json_input_stream, plugin_paths,
|
||||||
};
|
};
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use slab::Slab;
|
use slab::Slab;
|
||||||
|
|
|
||||||
2
service/src/plugins/external/load.rs
vendored
2
service/src/plugins/external/load.rs
vendored
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
use crate::PluginConfig;
|
use crate::PluginConfig;
|
||||||
|
|
||||||
use futures::{stream, Stream, StreamExt};
|
use futures::{Stream, StreamExt, stream};
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
|
|
||||||
4
service/src/plugins/external/mod.rs
vendored
4
service/src/plugins/external/mod.rs
vendored
|
|
@ -8,8 +8,8 @@ use std::{
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
process::Stdio,
|
process::Stdio,
|
||||||
sync::{
|
sync::{
|
||||||
atomic::{AtomicBool, Ordering},
|
|
||||||
Arc,
|
Arc,
|
||||||
|
atomic::{AtomicBool, Ordering},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -22,7 +22,7 @@ use tokio::{
|
||||||
process::{Child, Command},
|
process::{Child, Command},
|
||||||
task::JoinHandle,
|
task::JoinHandle,
|
||||||
};
|
};
|
||||||
use tracing::{event, Level};
|
use tracing::{Level, event};
|
||||||
|
|
||||||
pub struct ExternalPlugin {
|
pub struct ExternalPlugin {
|
||||||
id: usize,
|
id: usize,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||||
use std::collections::{hash_map::DefaultHasher, HashMap};
|
use std::collections::{HashMap, hash_map::DefaultHasher};
|
||||||
use std::hash::{Hash, Hasher};
|
use std::hash::{Hash, Hasher};
|
||||||
|
|
||||||
const SHORTTERM_CAP: usize = 20;
|
const SHORTTERM_CAP: usize = 20;
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
// Copyright © 2021 System76
|
// Copyright © 2021 System76
|
||||||
|
|
||||||
use fork::{daemon, Fork};
|
use fork::{Fork, daemon};
|
||||||
use pop_launcher::{Indice, PluginResponse, PluginSearchResult};
|
use pop_launcher::{Indice, PluginResponse, PluginSearchResult};
|
||||||
use pop_launcher_toolkit::plugin_trait::{async_trait, PluginExt};
|
use pop_launcher_toolkit::plugin_trait::{PluginExt, async_trait};
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::os::unix::process::CommandExt;
|
use std::os::unix::process::CommandExt;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::process::{exit, Command};
|
use std::process::{Command, exit};
|
||||||
|
|
||||||
// This example demonstrate how to write a pop-launcher plugin using the `PluginExt` helper trait.
|
// This example demonstrate how to write a pop-launcher plugin using the `PluginExt` helper trait.
|
||||||
// We are going to build a plugin to display man pages descriptions and open them on activation.
|
// We are going to build a plugin to display man pages descriptions and open them on activation.
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use pop_launcher::{async_stdin, async_stdout, json_input_stream, Indice, PluginResponse, Request};
|
use pop_launcher::{Indice, PluginResponse, Request, async_stdin, async_stdout, json_input_stream};
|
||||||
|
|
||||||
pub use async_trait::async_trait;
|
pub use async_trait::async_trait;
|
||||||
use pop_launcher_plugins as plugins;
|
use pop_launcher_plugins as plugins;
|
||||||
|
|
@ -122,7 +122,7 @@ where
|
||||||
);
|
);
|
||||||
|
|
||||||
if let Ok(file) = logfile {
|
if let Ok(file) = logfile {
|
||||||
use tracing_subscriber::{fmt, EnvFilter};
|
use tracing_subscriber::{EnvFilter, fmt};
|
||||||
fmt()
|
fmt()
|
||||||
.with_env_filter(EnvFilter::from_default_env())
|
.with_env_filter(EnvFilter::from_default_env())
|
||||||
.with_writer(file)
|
.with_writer(file)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue