diff --git a/.gitignore b/.gitignore index 9dda417..509cdef 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,4 @@ /.idea /.flatpak-builder /cargo-sources.json -/repo -flatpak-builder-tools/ +/repo \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index de26b74..b11a87d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -807,6 +807,16 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" +[[package]] +name = "cfg-expr" +version = "0.15.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" +dependencies = [ + "smallvec", + "target-lexicon", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -1672,7 +1682,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59a98bbaacea1c0eb6a0876280051b892eb73594fd90cf3b20e9c817029c57d2" dependencies = [ - "toml", + "toml 0.5.11", ] [[package]] @@ -1685,6 +1695,18 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "flatpak-unsandbox" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83c07802b9ff8a2a7a73e3485521cc3aeeec7db91a4903f370a9a2b29c6683ea" +dependencies = [ + "gio", + "glib", + "log", + "thiserror", +] + [[package]] name = "float-cmp" version = "0.9.0" @@ -2049,6 +2071,37 @@ version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" +[[package]] +name = "gio" +version = "0.19.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c49f117d373ffcc98a35d114db5478bc223341cff53e39a5d6feced9e2ddffe" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "gio-sys", + "glib", + "libc", + "pin-project-lite", + "smallvec", + "thiserror", +] + +[[package]] +name = "gio-sys" +version = "0.19.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cd743ba4714d671ad6b6234e8ab2a13b42304d0e13ab7eba1dcdd78a7d6d4ef" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", + "windows-sys 0.52.0", +] + [[package]] name = "gl_generator" version = "0.14.0" @@ -2066,6 +2119,51 @@ version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "151665d9be52f9bb40fc7966565d39666f2d1e69233571b71b87791c7e0528b3" +[[package]] +name = "glib" +version = "0.19.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39650279f135469465018daae0ba53357942a5212137515777d5fdca74984a44" +dependencies = [ + "bitflags 2.6.0", + "futures-channel", + "futures-core", + "futures-executor", + "futures-task", + "futures-util", + "gio-sys", + "glib-macros", + "glib-sys", + "gobject-sys", + "libc", + "memchr", + "smallvec", + "thiserror", +] + +[[package]] +name = "glib-macros" +version = "0.19.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4429b0277a14ae9751350ad9b658b1be0abb5b54faa5bcdf6e74a3372582fad7" +dependencies = [ + "heck 0.5.0", + "proc-macro-crate 3.2.0", + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "glib-sys" +version = "0.19.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c2dc18d3a82b0006d470b13304fbbb3e0a9bd4884cf985a60a7ed733ac2c4a5" +dependencies = [ + "libc", + "system-deps", +] + [[package]] name = "glow" version = "0.13.1" @@ -2087,6 +2185,17 @@ dependencies = [ "gl_generator", ] +[[package]] +name = "gobject-sys" +version = "0.19.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e697e252d6e0416fd1d9e169bda51c0f1c926026c39ca21fbe8b1bb5c3b8b9e" +dependencies = [ + "glib-sys", + "libc", + "system-deps", +] + [[package]] name = "gpu-alloc" version = "0.6.0" @@ -2202,6 +2311,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" version = "0.3.9" @@ -3702,6 +3817,7 @@ name = "observatory" version = "0.1.0" dependencies = [ "env_logger", + "flatpak-unsandbox", "i18n-embed", "i18n-embed-fl", "libcosmic", @@ -3783,7 +3899,7 @@ version = "0.18.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39b0deead1528fd0e5947a8546a9642a9777c25f6e1e26f34c97b204bbb465bd" dependencies = [ - "heck", + "heck 0.4.1", "itertools", "proc-macro2", "proc-macro2-diagnostics", @@ -4595,6 +4711,15 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "serde_spanned" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +dependencies = [ + "serde", +] + [[package]] name = "sha1" version = "0.10.6" @@ -4910,6 +5035,19 @@ dependencies = [ "windows 0.57.0", ] +[[package]] +name = "system-deps" +version = "6.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" +dependencies = [ + "cfg-expr", + "heck 0.5.0", + "pkg-config", + "toml 0.8.19", + "version-compare", +] + [[package]] name = "taffy" version = "0.3.11" @@ -4921,6 +5059,12 @@ dependencies = [ "slotmap", ] +[[package]] +name = "target-lexicon" +version = "0.12.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" + [[package]] name = "temp-dir" version = "0.1.14" @@ -5102,11 +5246,26 @@ dependencies = [ "serde", ] +[[package]] +name = "toml" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.22.22", +] + [[package]] name = "toml_datetime" version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +dependencies = [ + "serde", +] [[package]] name = "toml_edit" @@ -5126,6 +5285,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ "indexmap", + "serde", + "serde_spanned", "toml_datetime", "winnow 0.6.20", ] @@ -5366,6 +5527,12 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" +[[package]] +name = "version-compare" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" + [[package]] name = "version_check" version = "0.9.5" diff --git a/Cargo.toml b/Cargo.toml index d2e7325..107a738 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,6 +15,7 @@ serde = { version = "1.0.215", features = ["derive"] } log = "0.4.22" env_logger = "0.11.5" shlex = "1.3.0" +flatpak-unsandbox = "0.1.0" [dependencies.libcosmic] git = "https://github.com/pop-os/libcosmic.git" diff --git a/io.github.cosmic_utils.Observatory.json b/io.github.cosmic_utils.Observatory.json new file mode 100644 index 0000000..abceb85 --- /dev/null +++ b/io.github.cosmic_utils.Observatory.json @@ -0,0 +1,44 @@ +{ + "id": "io.github.cosmic_utils.observatory", + "runtime": "org.freedesktop.Platform", + "runtime-version": "24.08", + "sdk": "org.freedesktop.Sdk", + "sdk-extensions": ["org.freedesktop.Sdk.Extension.rust-stable"], + "command": "observatory", + "finish-args": [ + "--share=ipc", + "--socket=fallback-x11", + "--socket=wayland", + "--device=dri", + "--filesystem=host", + "--filesystem=xdg-config/cosmic:ro", + "--talk-name=org.freedesktop.Flatpak" + ], + "build-options": { + "append-path": "/usr/lib/sdk/rust-stable/bin", + "env": { + "CARGO_HOME": "/run/build/observatory/cargo" + } + }, + "modules": [ + { + "name": "observatory", + "buildsystem": "simple", + "build-commands": [ + "cargo --offline build --release --verbose", + "install -Dm0755 ./target/release/observatory -t /app/bin/", + "install -Dm0644 ./res/icons/hicolor/scalable/apps/icon.svg /app/share/icons/hicolor/scalable/apps/io.github.cosmic_utils.observatory.svg", + "install -Dm0644 ./res/metainfo.xml /app/share/metainfo/io.github.cosmic_utils.observatory.metainfo.xml", + "install -Dm0644 ./res/app.desktop /app/share/applications/io.github.cosmic_utils.observatory.desktop" + ], + "sources": [ + { + "type": "git", + "url": "https://github.com/cosmic-utils/observatory.git", + "commit": "b8b33e79ea0f5eacac38e339444f5792d649d200" + }, + "cargo-sources.json" + ] + } + ] +} \ No newline at end of file diff --git a/res/metainfo.xml b/res/metainfo.xml new file mode 100644 index 0000000..44061a5 --- /dev/null +++ b/res/metainfo.xml @@ -0,0 +1,69 @@ + + + io.github.cosmic_utils.observatory + Observatory + System Monitor application for the COSMIC Desktop + MIT + GPL-3.0-only + COSMIC + + Adam Cosner + + https://github.com/cosmic-utils/observatory + https://github.com/cosmic-utils/observatory/issues + https://github.com/cosmic-utils/observatory + + +

Feature full System Monitor application

+
    +
  • View usage per core, threads, processes handles, up time, speed and total usage.
  • +
  • View total memory and swap usage.
  • +
  • View usage per disk and total read and write.
  • +
  • View and manage running processes on your system.
  • +
+
+ + io.github.cosmic_utils.observatory.desktop + https://raw.githubusercontent.com/cosmic-utils/observatory/main/res/icons/hicolor/scalable/apps/icon.svg + + + https://raw.githubusercontent.com/cosmic-utils/observatory/main/res/screenshots/processor-dark.png + CPU Dark + + + https://raw.githubusercontent.com/cosmic-utils/observatory/main/res/screenshots/memory-dark.png + Memory Dark + + + https://raw.githubusercontent.com/cosmic-utils/observatory/main/res/screenshots/disks-dark.png + Disks Dark + + + https://raw.githubusercontent.com/cosmic-utils/observatory/main/res/screenshots/processes-dark.png + Processes Dark + + + + + Utility + + + com.system76.CosmicApplication + + + + +

Initial release! 🎉

+
    +
  • Save current color scheme
  • +
  • Import existing color schemes
  • +
  • Download color schemes from cosmic-themes.org
  • +
  • Customize the panel and dock
  • +
+
+
+
+
\ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 3d89201..7578e27 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,6 +6,9 @@ mod pages; mod widgets; fn main() -> cosmic::iced::Result { + if flatpak_unsandbox::unsandbox(None).is_ok() { + return Ok(()) + } settings::init(); cosmic::app::run::(settings::settings(), settings::flags()) }