Skip to content

Commit

Permalink
chore: code tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
Decodetalkers committed Oct 17, 2024
1 parent e227b3f commit 95ccf0b
Show file tree
Hide file tree
Showing 9 changed files with 252 additions and 224 deletions.
414 changes: 224 additions & 190 deletions Cargo.lock

Large diffs are not rendered by default.

23 changes: 10 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ accessdialog = { path = "libs/accessdialog" }

zbus = { version = "4", default-features = false, features = ["tokio", "url"] }
tokio = { version = "1.40.0", features = ["full"] }
serde = { version = "1.0.204", features = ["derive"] }
serde = { version = "1.0.210", features = ["derive"] }
tracing = "0.1.40"
tracing-subscriber = "0.3.18"
url = { version = "2.5", features = ["serde"] }
Expand All @@ -26,35 +26,32 @@ image = { version = "0.25", default-features = false, features = [

bitflags = "2.6.0"
enumflags2 = "0.7.10"
once_cell = "1.20.1"
anyhow = "1.0.86"
anyhow = "1.0.89"

# pipewire
pipewire = "0.8.0"
libspa-sys = "0.8.0"

libwayshot = { version = "0.3.0" }
rustix = { version = "0.38.34", features = ["fs", "use-libc"] }
rustix = { version = "0.38.37", features = ["fs", "use-libc"] }

# REMOTE
wayland-protocols = { version = "0.32.3", default-features = false, features = [
wayland-protocols = { version = "0.32.4", default-features = false, features = [
"unstable",
"client",
] }
#wayland-protocols = { version = "=0.30.0-beta.13", features = ["client", "unstable"] }


wayland-protocols-wlr = { version = "0.3.3", default-features = false, features = [
wayland-protocols-wlr = { version = "0.3.4", default-features = false, features = [
"client",
] }
wayland-client = { version = "0.31.5" }
wayland-client = { version = "0.31.6" }

wayland-protocols-misc = { version = "0.3.3", features = ["client"] }
wayland-protocols-misc = { version = "0.3.4", features = ["client"] }
xkbcommon = "0.8.0"
tempfile = "3.13.0"
thiserror = "1.0.63"
toml = "0.8.15"
thiserror = "1.0.64"
toml = "0.8.19"
csscolorparser = "0.7.0"
notify = "6.1.1"
futures = "0.3.30"
futures = "0.3.31"
libwaysip = "0.2.3"
4 changes: 2 additions & 2 deletions libs/accessdialog/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
slint = "1.7.0"
slint = "1.8.0"

[build-dependencies]
slint-build = "1.7.0"
slint-build = "1.8.0"
4 changes: 2 additions & 2 deletions libs/screenshotdialog/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
slint = "1.7.0"
slint = "1.8.0"

[build-dependencies]
slint-build = "1.7.0"
slint-build = "1.8.0"
7 changes: 3 additions & 4 deletions src/remotedesktop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ use zbus::zvariant::{DeserializeDict, ObjectPath, OwnedValue, SerializeDict, Typ

use serde::{Deserialize, Serialize};

use once_cell::sync::Lazy;
use std::sync::Arc;
use std::sync::{Arc, LazyLock};
use tokio::sync::Mutex;

use crate::pipewirethread::ScreencastThread;
Expand Down Expand Up @@ -69,8 +68,8 @@ pub struct SelectDevicesOptions {
}

pub type RemoteSessionData = (String, ScreencastThread, RemoteControl);
pub static REMOTE_SESSIONS: Lazy<Arc<Mutex<Vec<RemoteSessionData>>>> =
Lazy::new(|| Arc::new(Mutex::new(Vec::new())));
pub static REMOTE_SESSIONS: LazyLock<Arc<Mutex<Vec<RemoteSessionData>>>> =
LazyLock::new(|| Arc::new(Mutex::new(Vec::new())));

pub async fn append_remote_session(session: RemoteSessionData) {
let mut sessions = REMOTE_SESSIONS.lock().await;
Expand Down
6 changes: 3 additions & 3 deletions src/screencast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use enumflags2::BitFlags;

use serde::{Deserialize, Serialize};

use once_cell::sync::Lazy;
use std::sync::Arc;
use std::sync::LazyLock;
use tokio::sync::Mutex;

use crate::pipewirethread::ScreencastThread;
Expand Down Expand Up @@ -67,8 +67,8 @@ struct StartReturnValue {
}

pub type CastSessionData = (String, ScreencastThread);
pub static CAST_SESSIONS: Lazy<Arc<Mutex<Vec<CastSessionData>>>> =
Lazy::new(|| Arc::new(Mutex::new(Vec::new())));
pub static CAST_SESSIONS: LazyLock<Arc<Mutex<Vec<CastSessionData>>>> =
LazyLock::new(|| Arc::new(Mutex::new(Vec::new())));

pub async fn append_cast_session(session: CastSessionData) {
let mut sessions = CAST_SESSIONS.lock().await;
Expand Down
8 changes: 3 additions & 5 deletions src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,16 @@ use serde::{Deserialize, Serialize};
use serde_repr::{Deserialize_repr, Serialize_repr};
use zbus::zvariant::Type;

use once_cell::sync::Lazy;

use std::sync::Arc;
use std::sync::{Arc, LazyLock};
use tokio::sync::Mutex;

use crate::{
remotedesktop::{remove_remote_session, SelectDevicesOptions},
screencast::{remove_cast_session, SelectSourcesOptions},
};

pub static SESSIONS: Lazy<Arc<Mutex<Vec<Session>>>> =
Lazy::new(|| Arc::new(Mutex::new(Vec::new())));
pub static SESSIONS: LazyLock<Arc<Mutex<Vec<Session>>>> =
LazyLock::new(|| Arc::new(Mutex::new(Vec::new())));

pub async fn append_session(session: Session) {
let mut sessions = SESSIONS.lock().await;
Expand Down
6 changes: 3 additions & 3 deletions src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ const APPEARANCE: &str = "org.freedesktop.appearance";
const COLOR_SCHEME: &str = "color-scheme";
const ACCENT_COLOR: &str = "accent-color";

use once_cell::sync::Lazy;
use std::collections::HashMap;
use std::sync::Arc;
use std::sync::LazyLock;

pub use self::config::SettingsConfig;

pub static SETTING_CONFIG: Lazy<Arc<Mutex<SettingsConfig>>> =
Lazy::new(|| Arc::new(Mutex::new(SettingsConfig::config_from_file())));
pub static SETTING_CONFIG: LazyLock<Arc<Mutex<SettingsConfig>>> =
LazyLock::new(|| Arc::new(Mutex::new(SettingsConfig::config_from_file())));

#[derive(DeserializeDict, SerializeDict, Clone, Copy, PartialEq, Type, OwnedValue, Value)]
pub struct AccentColor {
Expand Down
4 changes: 2 additions & 2 deletions src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::path::PathBuf;

use once_cell::sync::Lazy;
use std::sync::LazyLock;

pub static USER_RUNNING_DIR: Lazy<PathBuf> = Lazy::new(|| {
pub static USER_RUNNING_DIR: LazyLock<PathBuf> = LazyLock::new(|| {
let cache_dir = std::env::var("XDG_RUNTIME_DIR").unwrap_or("/tmp".to_string());
PathBuf::from(cache_dir)
});

0 comments on commit 95ccf0b

Please sign in to comment.