diff --git a/Cargo.lock b/Cargo.lock index d0e27bf3..1029a993 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "ahash" -version = "0.8.6" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", "once_cell", @@ -31,27 +31,15 @@ checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" - -[[package]] -name = "arrayref" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" - -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" +checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" [[package]] name = "async-channel" -version = "2.2.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28243a43d821d11341ab73c80bed182dc015c514b951616cf79bd4af39af0c3" +checksum = "136d4d23bcc79e27423727b36823d86233aad06dfea531837b038394d11e9928" dependencies = [ "concurrent-queue", "event-listener", @@ -66,29 +54,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - [[package]] name = "bitflags" version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" -[[package]] -name = "blake2b_simd" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afa748e348ad3be8263be728124b24a24f268266f6f5d58af9d75f6a40b5c587" -dependencies = [ - "arrayref", - "arrayvec", - "constant_time_eq", -] - [[package]] name = "block" version = "0.1.6" @@ -186,17 +157,11 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" dependencies = [ - "getrandom 0.2.11", + "getrandom", "once_cell", "tiny-keccak", ] -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - [[package]] name = "crossbeam-utils" version = "0.8.17" @@ -233,7 +198,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] @@ -244,18 +209,7 @@ checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" dependencies = [ "darling_core", "quote", - "syn 2.0.41", -] - -[[package]] -name = "dirs" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901" -dependencies = [ - "libc", - "redox_users", - "winapi 0.3.9", + "syn 2.0.60", ] [[package]] @@ -328,17 +282,6 @@ dependencies = [ "pin-project-lite", ] -[[package]] -name = "expanduser" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14e0b79235da57db6b6c2beed9af6e5de867d63a973ae3e91910ddc33ba40bc0" -dependencies = [ - "dirs", - "lazy_static", - "pwd", -] - [[package]] name = "field-offset" version = "0.3.6" @@ -395,7 +338,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] @@ -475,17 +418,6 @@ dependencies = [ "system-deps", ] -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - [[package]] name = "getrandom" version = "0.2.11" @@ -494,7 +426,7 @@ checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" dependencies = [ "cfg-if", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", ] [[package]] @@ -580,7 +512,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] @@ -672,9 +604,9 @@ checksum = "da5bf7748fd4cd0b2490df8debcc911809dbcbee4ece9531b96c29a9c729de5a" [[package]] name = "gtk4" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa82753b8c26277e4af1446c70e35b19aad4fb794a7b143859e7eeb9a4025d83" +checksum = "b04e11319b08af11358ab543105a9e49b0c491faca35e2b8e7e36bfba8b671ab" dependencies = [ "cairo-rs", "field-offset", @@ -726,9 +658,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", "allocator-api2", @@ -844,9 +776,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.154" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" [[package]] name = "libloading" @@ -873,9 +805,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "malloc_buf" @@ -1127,9 +1059,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.70" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" dependencies = [ "unicode-ident", ] @@ -1151,47 +1083,20 @@ dependencies = [ "uzers", ] -[[package]] -name = "pwd" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72c71c0c79b9701efe4e1e4b563b2016dd4ee789eb99badcb09d61ac4b92e4a2" -dependencies = [ - "libc", - "thiserror", -] - [[package]] name = "quote" -version = "1.0.33" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] -[[package]] -name = "redox_syscall" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" - -[[package]] -name = "redox_users" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d" -dependencies = [ - "getrandom 0.1.16", - "redox_syscall", - "rust-argon2", -] - [[package]] name = "regex" -version = "1.10.2" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", @@ -1201,9 +1106,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", @@ -1222,7 +1127,6 @@ version = "1.4.0" dependencies = [ "anyhow", "async-channel", - "expanduser", "gettext-rs", "glob", "gtk-macros", @@ -1246,14 +1150,13 @@ dependencies = [ "strum", "strum_macros", "sysconf", - "unescape", ] [[package]] name = "rmp" -version = "0.8.12" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9860a6cc38ed1da53456442089b4dfa35e7cedaa326df63017af88385e6b20" +checksum = "228ed7c16fa39782c3b3468e974aec2795e9089153cd08ee2e9aefb3613334c4" dependencies = [ "byteorder", "num-traits", @@ -1262,27 +1165,15 @@ dependencies = [ [[package]] name = "rmp-serde" -version = "1.1.2" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bffea85eea980d8a74453e5d02a8d93028f3c34725de143085a844ebe953258a" +checksum = "52e599a477cf9840e92f2cde9a7189e67b42c57532749bf90aea6ec10facd4db" dependencies = [ "byteorder", "rmp", "serde", ] -[[package]] -name = "rust-argon2" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b18820d944b33caa75a71378964ac46f58517c92b6ae5f762636247c09e78fb" -dependencies = [ - "base64", - "blake2b_simd", - "constant_time_eq", - "crossbeam-utils", -] - [[package]] name = "rust-ini" version = "0.21.0" @@ -1317,22 +1208,22 @@ checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" [[package]] name = "serde" -version = "1.0.193" +version = "1.0.200" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "ddc6f9cc94d67c0e21aaf7eda3a010fd3af78ebf6e096aa6e2e13c79749cce4f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.200" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "856f046b9400cee3c8c94ed572ecdb752444c24528c035cd35882aad6f492bcb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] @@ -1343,7 +1234,7 @@ checksum = "3081f5ffbb02284dda55132aa26daecedd7372a42417bbbab6f14ab7d6bb9145" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] @@ -1398,7 +1289,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] @@ -1414,9 +1305,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.41" +version = "2.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c8b28c477cc3bf0e7966561e3460130e1255f7a1cf71931075f1c5e7a7e269" +checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" dependencies = [ "proc-macro2", "quote", @@ -1425,9 +1316,9 @@ dependencies = [ [[package]] name = "syscalls" -version = "0.6.15" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56b389b38331a454883a34fd19f25cbd1510b3510ff7aa28cb8d6de85d888439" +checksum = "43d0e35dc7d73976a53c7e6d7d177ef804a0c0ee774ec77bcc520c2216fd7cbe" dependencies = [ "serde", "serde_repr", @@ -1496,7 +1387,7 @@ checksum = "01742297787513b79cf8e29d1056ede1313e2420b7b3b15d0a768b4921f549df" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] @@ -1573,9 +1464,9 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "uzers" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d283dc7e8c901e79e32d077866eaf599156cbf427fffa8289aecc52c5c3f63" +checksum = "7d85875e16d59b3b1549efce83ff8251a64923b03bef94add0a1862847448de4" dependencies = [ "libc", "log", @@ -1593,12 +1484,6 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -1626,7 +1511,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", "wasm-bindgen-shared", ] @@ -1648,7 +1533,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -1796,7 +1681,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", ] [[package]] @@ -1816,5 +1701,5 @@ checksum = "b3c129550b3e6de3fd0ba67ba5c81818f9805e58b8d7fee80a3a59d2c9fc601a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.60", ] diff --git a/Cargo.toml b/Cargo.toml index 1cbb5233..e9d7db3f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,30 +15,28 @@ lto = true [dependencies] process-data = { path = "lib/process_data" } glob = "0.3.1" -anyhow = "1.0.75" -log = "0.4.20" +anyhow = "1.0.82" +log = "0.4.21" pretty_env_logger = "0.5" gettext-rs = { version = "0.7", features = ["gettext-system"] } -gtk = { version = "0.8.1", features = ["v4_10"], package = "gtk4" } +gtk = { version = "0.8.2", features = ["v4_10"], package = "gtk4" } adw = { version = "0.6.0", features = ["v1_5"], package = "libadwaita" } -regex = "1.10.2" +regex = "1.10.4" sysconf = "0.3.4" nvml-wrapper = "0.10.0" -unescape = "0.1.0" nix = { version = "0.28", default_features = false, features = ["signal"] } plotters = { version = "0.3.5", default_features = false, features = [ "area_series", ] } plotters-cairo = "0.6.0" -serde = { version = "1.0.193", features = ["serde_derive"] } -rmp-serde = "1.1.2" +serde = { version = "1.0.200", features = ["serde_derive"] } +rmp-serde = "1.3.0" rust-ini = "0.21.0" gtk-macros = "0.3.0" strum = "0.26.2" strum_macros = "0.26.2" once_cell = "1.19.0" -hashbrown = "0.14.3" -expanduser = "1.2.2" +hashbrown = "0.14.5" paste = "1.0.14" num_cpus = "1.16.0" -async-channel = "2.2.0" +async-channel = "2.2.1" diff --git a/lib/process_data/Cargo.toml b/lib/process_data/Cargo.toml index 479e0092..823a8ee3 100644 --- a/lib/process_data/Cargo.toml +++ b/lib/process_data/Cargo.toml @@ -14,13 +14,13 @@ lto = true [dependencies] unescape = "0.1.0" -anyhow = "1.0.71" +anyhow = "1.0.82" glob = "0.3.1" -once_cell = "1.18.0" -regex = "1.8.4" +once_cell = "1.19.0" +regex = "1.10.4" sysconf = "0.3.4" -serde = { version = "1.0.180", features = ["serde_derive"] } +serde = { version = "1.0.200", features = ["serde_derive"] } nvml-wrapper = "0.10.0" -syscalls = { version = "0.6.15", features = ["all"] } -libc = "0.2.150" -uzers = "0.11.3" +syscalls = { version = "0.6.18", features = ["all"] } +libc = "0.2.154" +uzers = "0.12.0" diff --git a/src/gui.rs b/src/gui.rs index 296c6bc5..638f648e 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -1,6 +1,10 @@ +use std::ffi::OsString; + use crate::application; #[rustfmt::skip] use crate::config; +use crate::utils::app::DATA_DIRS; +use crate::utils::IS_FLATPAK; use gettextrs::{gettext, LocaleCategory}; use gtk::{gio, glib}; @@ -12,6 +16,19 @@ pub fn main() { // Initialize logger pretty_env_logger::init(); + // reset XDG_DATA_DIRS to use absolute paths instead of relative paths because Flatpak seemingly cannot resolve them + // this must happen now because once the GTK app is loaded, it's too late + if *IS_FLATPAK { + std::env::set_var( + "XDG_DATA_DIRS", + DATA_DIRS + .iter() + .map(|pathbuf| pathbuf.as_os_str().to_owned()) + .collect::>() + .join(&OsString::from(":")), + ); + } + // Prepare i18n gettextrs::setlocale(LocaleCategory::LcAll, ""); gettextrs::bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR).expect("Unable to bind the text domain"); diff --git a/src/utils/app.rs b/src/utils/app.rs index ec30a03e..49a6c01d 100644 --- a/src/utils/app.rs +++ b/src/utils/app.rs @@ -26,6 +26,7 @@ const DESKTOP_EXEC_BLOCKLIST: &[&str] = &["bash", "zsh", "fish", "sh", "ksh", "f const APP_ID_BLOCKLIST: &[&str] = &[ "org.gnome.Terminal.Preferences", // Prevents the actual Terminal app "org.gnome.Terminal" from being shown "org.freedesktop.IBus.Panel.Extension.Gtk3", // Technical application + "org.gnome.RemoteDesktop.Handover", // Technical application ]; static RE_ENV_FILTER: Lazy = Lazy::new(|| Regex::new(r"env\s*\S*=\S*\s*(.*)").unwrap()); @@ -34,11 +35,12 @@ static RE_FLATPAK_FILTER: Lazy = Lazy::new(|| Regex::new(r"flatpak run .* --command=(\S*)").unwrap()); // Adapted from Mission Center: https://gitlab.com/mission-center-devs/mission-center/ -static DATA_DIRS: Lazy> = Lazy::new(|| { +pub static DATA_DIRS: Lazy> = Lazy::new(|| { let home = std::env::var("HOME").unwrap_or_else(|_| "/".to_string()); let mut data_dirs: Vec = std::env::var("XDG_DATA_DIRS") .unwrap_or_else(|_| format!("/usr/share:{home}/.local/share")) .split(':') + .map(|s| s.replace('~', &home)) .map(PathBuf::from) .collect(); data_dirs.push(PathBuf::from(format!("{home}/.local/share"))); @@ -154,9 +156,7 @@ impl App { .iter() .filter_map(|path| { let applications_path = path.join("applications"); - let expanded_path = expanduser::expanduser(applications_path.to_string_lossy()) - .unwrap_or(applications_path); - expanded_path.read_dir().ok().map(|read| { + applications_path.read_dir().ok().map(|read| { read.filter_map(|file_res| { file_res .ok() diff --git a/src/utils/mod.rs b/src/utils/mod.rs index e4f6b0a9..bc8bd5d4 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -44,7 +44,7 @@ static TICK_RATE: Lazy = Lazy::new(|| sysconf::sysconf(sysconf::SysconfVariable::ScClkTck).unwrap_or(100) as usize); // Adapted from Mission Center: https://gitlab.com/mission-center-devs/mission-center/ -static IS_FLATPAK: Lazy = Lazy::new(|| { +pub static IS_FLATPAK: Lazy = Lazy::new(|| { let is_flatpak = std::path::Path::new("/.flatpak-info").exists(); if is_flatpak {