From 835e4660da7880092b7fb57aa9d8492f8fa7670d Mon Sep 17 00:00:00 2001 From: ochibani <11yzyv86j@relay.firefox.com> Date: Fri, 14 Oct 2022 10:50:28 +0200 Subject: [PATCH] remove wayland from ffmpeg-interface --- Cargo.lock | 757 +++--------------------- Cargo.toml | 5 +- data/screenshot-ui-area-symbolic.svg | 4 + data/screenshot-ui-display-symbolic.svg | 4 + data/screenshot-ui-window-symbolic.svg | 4 + interfaces/main.ui | 145 ++++- src/area_capture.rs | 11 + src/config_management.rs | 7 +- src/ffmpeg_interface.rs | 229 ++----- src/main.rs | 235 ++++---- src/styles/global.css | 15 + 11 files changed, 423 insertions(+), 993 deletions(-) create mode 100644 data/screenshot-ui-area-symbolic.svg create mode 100644 data/screenshot-ui-display-symbolic.svg create mode 100644 data/screenshot-ui-window-symbolic.svg diff --git a/Cargo.lock b/Cargo.lock index 4582325..12b08ce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -26,67 +26,12 @@ dependencies = [ "libc", ] -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - [[package]] name = "anyhow" version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98161a4e3e2184da77bb14f02184cdd111e83bbbcc9979dfee3c44b9a85f5602" -[[package]] -name = "async-io" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83e21f3a490c72b3b0cf44962180e60045de2925d8dff97918f7ee43c8f637c7" -dependencies = [ - "autocfg", - "concurrent-queue", - "futures-lite", - "libc", - "log", - "once_cell", - "parking", - "polling", - "slab", - "socket2", - "waker-fn", - "winapi", -] - -[[package]] -name = "atk" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812b4911e210bd51b24596244523c856ca749e6223c50a7fbbba3f89ee37c426" -dependencies = [ - "atk-sys 0.10.0", - "bitflags", - "glib 0.10.3", - "glib-sys 0.10.1", - "gobject-sys 0.10.0", - "libc", -] - -[[package]] -name = "atk-sys" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f530e4af131d94cc4fa15c5c9d0348f0ef28bac64ba660b6b2a1cf2605dedfce" -dependencies = [ - "glib-sys 0.10.1", - "gobject-sys 0.10.0", - "libc", - "system-deps 1.3.2", -] - [[package]] name = "atk-sys" version = "0.15.1" @@ -99,47 +44,12 @@ dependencies = [ "system-deps 6.0.2", ] -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - [[package]] name = "autocfg" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" -[[package]] -name = "bindgen" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1c85344eb535a31b62f0af37be84441ba9e7f0f4111eb0530f43d15e513fe57" -dependencies = [ - "bitflags", - "cexpr", - "cfg-if 0.1.10", - "clang-sys", - "clap", - "env_logger", - "lazy_static", - "lazycell", - "log", - "peeking_take_while", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "which", -] - [[package]] name = "bitflags" version = "1.3.2" @@ -154,7 +64,7 @@ checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" [[package]] name = "blue-recorder" -version = "0.1.0" +version = "0.2.0" dependencies = [ "chrono", "dirs", @@ -163,14 +73,11 @@ dependencies = [ "gettext-rs", "gio 0.15.12", "glib 0.10.3", - "gtk-sys 0.15.3", + "gtk-sys", "gtk4", - "libappindicator", "regex", "rust-ini", "subprocess", - "zbus", - "zvariant", ] [[package]] @@ -179,33 +86,6 @@ version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d" -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "cache-padded" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c" - -[[package]] -name = "cairo-rs" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5c0f2e047e8ca53d0ff249c54ae047931d7a6ebe05d00af73e0ffeb6e34bdb8" -dependencies = [ - "bitflags", - "cairo-sys-rs 0.10.0", - "glib 0.10.3", - "glib-sys 0.10.1", - "gobject-sys 0.10.0", - "libc", - "thiserror", -] - [[package]] name = "cairo-rs" version = "0.15.12" @@ -222,7 +102,7 @@ dependencies = [ [[package]] name = "cairo-rs" version = "0.16.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core#12148df3e029a763fb1fdeb4252abccb4b2d28c7" +source = "git+https://github.com/gtk-rs/gtk-rs-core#588a146fd86fd6adaa7e682505f3b65f036bd2bf" dependencies = [ "bitflags", "cairo-sys-rs 0.16.0", @@ -232,17 +112,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "cairo-sys-rs" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ed2639b9ad5f1d6efa76de95558e11339e7318426d84ac4890b86c03e828ca7" -dependencies = [ - "glib-sys 0.10.1", - "libc", - "system-deps 1.3.2", -] - [[package]] name = "cairo-sys-rs" version = "0.15.1" @@ -257,7 +126,7 @@ dependencies = [ [[package]] name = "cairo-sys-rs" version = "0.16.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core#12148df3e029a763fb1fdeb4252abccb4b2d28c7" +source = "git+https://github.com/gtk-rs/gtk-rs-core#588a146fd86fd6adaa7e682505f3b65f036bd2bf" dependencies = [ "glib-sys 0.16.0", "libc", @@ -270,15 +139,6 @@ version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" -[[package]] -name = "cexpr" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fce5b5fb86b0c57c20c834c1b412fd09c77c8a59b9473f86272709e78874cd1d" -dependencies = [ - "nom", -] - [[package]] name = "cfg-expr" version = "0.10.3" @@ -316,38 +176,13 @@ dependencies = [ ] [[package]] -name = "clang-sys" -version = "0.28.1" +name = "codespan-reporting" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81de550971c976f176130da4b2978d3b524eaa0fd9ac31f3ceb5ae1231fb4853" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" dependencies = [ - "glob", - "libc", - "libloading", -] - -[[package]] -name = "clap" -version = "2.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" -dependencies = [ - "ansi_term", - "atty", - "bitflags", - "strsim", - "textwrap", + "termcolor", "unicode-width", - "vec_map", -] - -[[package]] -name = "concurrent-queue" -version = "1.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af4780a44ab5696ea9e28294517f1fffb421a83a25af521333c838635509db9c" -dependencies = [ - "cache-padded", ] [[package]] @@ -357,10 +192,43 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] -name = "derivative" -version = "2.2.0" +name = "cxx" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +checksum = "19f39818dcfc97d45b03953c1292efc4e80954e1583c4aa770bac1383e2310a4" +dependencies = [ + "cc", + "cxxbridge-flags", + "cxxbridge-macro", + "link-cplusplus", +] + +[[package]] +name = "cxx-build" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e580d70777c116df50c390d1211993f62d40302881e54d4b79727acb83d0199" +dependencies = [ + "cc", + "codespan-reporting", + "once_cell", + "proc-macro2", + "quote", + "scratch", + "syn", +] + +[[package]] +name = "cxxbridge-flags" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56a46460b88d1cec95112c8c363f0e2c39afdb237f60583b0b36343bf627ea9c" + +[[package]] +name = "cxxbridge-macro" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "747b608fecf06b0d72d440f27acc99288207324b793be2c17991839f3d4995ea" dependencies = [ "proc-macro2", "quote", @@ -402,49 +270,6 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" -[[package]] -name = "enumflags2" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83c8d82922337cd23a15f88b70d8e4ef5f11da38dd7cdb55e84dd5de99695da0" -dependencies = [ - "enumflags2_derive", - "serde", -] - -[[package]] -name = "enumflags2_derive" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "946ee94e3dbf58fdd324f9ce245c7b238d46a66f00e86a020b71996349e46cce" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "env_logger" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - -[[package]] -name = "fastrand" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" -dependencies = [ - "instant", -] - [[package]] name = "field-offset" version = "0.3.4" @@ -503,21 +328,6 @@ version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68" -[[package]] -name = "futures-lite" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" -dependencies = [ - "fastrand", - "futures-core", - "futures-io", - "memchr", - "parking", - "pin-project-lite", - "waker-fn", -] - [[package]] name = "futures-macro" version = "0.3.24" @@ -559,26 +369,6 @@ dependencies = [ "slab", ] -[[package]] -name = "gdk" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db00839b2a68a7a10af3fa28dfb3febaba3a20c3a9ac2425a33b7df1f84a6b7d" -dependencies = [ - "bitflags", - "cairo-rs 0.9.1", - "cairo-sys-rs 0.10.0", - "gdk-pixbuf 0.9.0", - "gdk-sys 0.10.0", - "gio 0.9.1", - "gio-sys 0.10.1", - "glib 0.10.3", - "glib-sys 0.10.1", - "gobject-sys 0.10.0", - "libc", - "pango 0.9.1", -] - [[package]] name = "gdk-pixbuf" version = "0.9.0" @@ -610,7 +400,7 @@ dependencies = [ [[package]] name = "gdk-pixbuf" version = "0.16.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core#12148df3e029a763fb1fdeb4252abccb4b2d28c7" +source = "git+https://github.com/gtk-rs/gtk-rs-core#588a146fd86fd6adaa7e682505f3b65f036bd2bf" dependencies = [ "bitflags", "gdk-pixbuf-sys 0.16.0", @@ -648,7 +438,7 @@ dependencies = [ [[package]] name = "gdk-pixbuf-sys" version = "0.16.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core#12148df3e029a763fb1fdeb4252abccb4b2d28c7" +source = "git+https://github.com/gtk-rs/gtk-rs-core#588a146fd86fd6adaa7e682505f3b65f036bd2bf" dependencies = [ "gio-sys 0.16.0", "glib-sys 0.16.0", @@ -657,23 +447,6 @@ dependencies = [ "system-deps 6.0.2", ] -[[package]] -name = "gdk-sys" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a9653cfc500fd268015b1ac055ddbc3df7a5c9ea3f4ccef147b3957bd140d69" -dependencies = [ - "cairo-sys-rs 0.10.0", - "gdk-pixbuf-sys 0.10.0", - "gio-sys 0.10.1", - "glib-sys 0.10.1", - "gobject-sys 0.10.0", - "libc", - "pango-sys 0.10.0", - "pkg-config", - "system-deps 1.3.2", -] - [[package]] name = "gdk-sys" version = "0.15.1" @@ -710,7 +483,7 @@ dependencies = [ [[package]] name = "gdk4" version = "0.5.0" -source = "git+https://github.com/gtk-rs/gtk4-rs.git#b03db11e40e49c4e621dd4c2b742809bae966287" +source = "git+https://github.com/gtk-rs/gtk4-rs.git#8dfb3a93de747137cf213e077902c2d993796c15" dependencies = [ "bitflags", "cairo-rs 0.16.0", @@ -742,7 +515,7 @@ dependencies = [ [[package]] name = "gdk4-sys" version = "0.5.0" -source = "git+https://github.com/gtk-rs/gtk4-rs.git#b03db11e40e49c4e621dd4c2b742809bae966287" +source = "git+https://github.com/gtk-rs/gtk4-rs.git#8dfb3a93de747137cf213e077902c2d993796c15" dependencies = [ "cairo-sys-rs 0.16.0", "gdk-pixbuf-sys 0.16.0", @@ -827,7 +600,7 @@ dependencies = [ [[package]] name = "gio" version = "0.16.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core#12148df3e029a763fb1fdeb4252abccb4b2d28c7" +source = "git+https://github.com/gtk-rs/gtk-rs-core#588a146fd86fd6adaa7e682505f3b65f036bd2bf" dependencies = [ "bitflags", "futures-channel", @@ -839,6 +612,7 @@ dependencies = [ "libc", "once_cell", "pin-project-lite", + "smallvec", "thiserror", ] @@ -871,7 +645,7 @@ dependencies = [ [[package]] name = "gio-sys" version = "0.16.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core#12148df3e029a763fb1fdeb4252abccb4b2d28c7" +source = "git+https://github.com/gtk-rs/gtk-rs-core#588a146fd86fd6adaa7e682505f3b65f036bd2bf" dependencies = [ "glib-sys 0.16.0", "gobject-sys 0.16.0", @@ -922,7 +696,7 @@ dependencies = [ [[package]] name = "glib" version = "0.16.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core#12148df3e029a763fb1fdeb4252abccb4b2d28c7" +source = "git+https://github.com/gtk-rs/gtk-rs-core#588a146fd86fd6adaa7e682505f3b65f036bd2bf" dependencies = [ "bitflags", "futures-channel", @@ -930,6 +704,7 @@ dependencies = [ "futures-executor", "futures-task", "futures-util", + "gio-sys 0.16.0", "glib-macros 0.16.0", "glib-sys 0.16.0", "gobject-sys 0.16.0", @@ -973,7 +748,7 @@ dependencies = [ [[package]] name = "glib-macros" version = "0.16.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core#12148df3e029a763fb1fdeb4252abccb4b2d28c7" +source = "git+https://github.com/gtk-rs/gtk-rs-core#588a146fd86fd6adaa7e682505f3b65f036bd2bf" dependencies = [ "anyhow", "heck 0.4.0", @@ -1007,18 +782,12 @@ dependencies = [ [[package]] name = "glib-sys" version = "0.16.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core#12148df3e029a763fb1fdeb4252abccb4b2d28c7" +source = "git+https://github.com/gtk-rs/gtk-rs-core#588a146fd86fd6adaa7e682505f3b65f036bd2bf" dependencies = [ "libc", "system-deps 6.0.2", ] -[[package]] -name = "glob" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" - [[package]] name = "gobject-sys" version = "0.10.0" @@ -1044,7 +813,7 @@ dependencies = [ [[package]] name = "gobject-sys" version = "0.16.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core#12148df3e029a763fb1fdeb4252abccb4b2d28c7" +source = "git+https://github.com/gtk-rs/gtk-rs-core#588a146fd86fd6adaa7e682505f3b65f036bd2bf" dependencies = [ "glib-sys 0.16.0", "libc", @@ -1106,62 +875,16 @@ dependencies = [ "system-deps 6.0.2", ] -[[package]] -name = "gtk" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f022f2054072b3af07666341984562c8e626a79daa8be27b955d12d06a5ad6a" -dependencies = [ - "atk", - "bitflags", - "cairo-rs 0.9.1", - "cairo-sys-rs 0.10.0", - "cc", - "gdk", - "gdk-pixbuf 0.9.0", - "gdk-pixbuf-sys 0.10.0", - "gdk-sys 0.10.0", - "gio 0.9.1", - "gio-sys 0.10.1", - "glib 0.10.3", - "glib-sys 0.10.1", - "gobject-sys 0.10.0", - "gtk-sys 0.10.0", - "libc", - "once_cell", - "pango 0.9.1", - "pango-sys 0.10.0", - "pkg-config", -] - -[[package]] -name = "gtk-sys" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89acda6f084863307d948ba64a4b1ef674e8527dddab147ee4cdcc194c880457" -dependencies = [ - "atk-sys 0.10.0", - "cairo-sys-rs 0.10.0", - "gdk-pixbuf-sys 0.10.0", - "gdk-sys 0.10.0", - "gio-sys 0.10.1", - "glib-sys 0.10.1", - "gobject-sys 0.10.0", - "libc", - "pango-sys 0.10.0", - "system-deps 1.3.2", -] - [[package]] name = "gtk-sys" version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5bc2f0587cba247f60246a0ca11fe25fb733eabc3de12d1965fc07efab87c84" dependencies = [ - "atk-sys 0.15.1", + "atk-sys", "cairo-sys-rs 0.15.1", "gdk-pixbuf-sys 0.15.10", - "gdk-sys 0.15.1", + "gdk-sys", "gio-sys 0.15.10", "glib-sys 0.15.10", "gobject-sys 0.15.10", @@ -1251,44 +974,28 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "humantime" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" -dependencies = [ - "quick-error", -] - [[package]] name = "iana-time-zone" -version = "0.1.50" +version = "0.1.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd911b35d940d2bd0bea0f9100068e5b97b51a1cbe13d13382f132e0365257a0" +checksum = "f5a6ef98976b22b3b7f2f3a806f858cb862044cfa66805aa3ad84cb3d3b785ed" dependencies = [ "android_system_properties", "core-foundation-sys", + "iana-time-zone-haiku", "js-sys", "wasm-bindgen", "winapi", ] [[package]] -name = "instant" -version = "0.1.12" +name = "iana-time-zone-haiku" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +checksum = "fde6edd6cef363e9359ed3c98ba64590ba9eecba2293eb5a723ab32aee8926aa" dependencies = [ - "cfg-if 1.0.0", + "cxx", + "cxx-build", ] [[package]] @@ -1315,50 +1022,19 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - -[[package]] -name = "libappindicator" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52d3fc57353f50e2faf5741438df9d2b628d896e2c5bb31156306b015f59d037" -dependencies = [ - "glib 0.10.3", - "gtk", - "gtk-sys 0.10.0", - "libappindicator-sys", - "log", -] - -[[package]] -name = "libappindicator-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9719ba201a6cb121f59a36bae0bd2bd91762c4af6fbdaaffe804cfe2f9c8651d" -dependencies = [ - "bindgen", - "gtk-sys 0.10.0", - "pkg-config", -] - [[package]] name = "libc" -version = "0.2.133" +version = "0.2.134" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0f80d65747a3e43d1596c7c5492d95d5edddaabd45a7fcdb02b95f644164966" +checksum = "329c933548736bc49fd575ee68c89e8be4d260064184389a5b77517cddd99ffb" [[package]] -name = "libloading" -version = "0.5.2" +name = "link-cplusplus" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" +checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" dependencies = [ "cc", - "winapi", ] [[package]] @@ -1407,39 +1083,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "nb-connect" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1bb540dc6ef51cfe1916ec038ce7a620daf3a111e2502d745197cd53d6bca15" -dependencies = [ - "libc", - "socket2", -] - -[[package]] -name = "nix" -version = "0.22.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf" -dependencies = [ - "bitflags", - "cc", - "cfg-if 1.0.0", - "libc", - "memoffset", -] - -[[package]] -name = "nom" -version = "4.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6" -dependencies = [ - "memchr", - "version_check 0.1.5", -] - [[package]] name = "num-integer" version = "0.1.45" @@ -1504,21 +1147,6 @@ dependencies = [ "hashbrown", ] -[[package]] -name = "pango" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9937068580bebd8ced19975938573803273ccbcbd598c58d4906efd4ac87c438" -dependencies = [ - "bitflags", - "glib 0.10.3", - "glib-sys 0.10.1", - "gobject-sys 0.10.0", - "libc", - "once_cell", - "pango-sys 0.10.0", -] - [[package]] name = "pango" version = "0.15.10" @@ -1535,7 +1163,7 @@ dependencies = [ [[package]] name = "pango" version = "0.16.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core#12148df3e029a763fb1fdeb4252abccb4b2d28c7" +source = "git+https://github.com/gtk-rs/gtk-rs-core#588a146fd86fd6adaa7e682505f3b65f036bd2bf" dependencies = [ "bitflags", "gio 0.16.0", @@ -1545,18 +1173,6 @@ dependencies = [ "pango-sys 0.16.0", ] -[[package]] -name = "pango-sys" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d2650c8b62d116c020abd0cea26a4ed96526afda89b1c4ea567131fdefc890" -dependencies = [ - "glib-sys 0.10.1", - "gobject-sys 0.10.0", - "libc", - "system-deps 1.3.2", -] - [[package]] name = "pango-sys" version = "0.15.10" @@ -1572,7 +1188,7 @@ dependencies = [ [[package]] name = "pango-sys" version = "0.16.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core#12148df3e029a763fb1fdeb4252abccb4b2d28c7" +source = "git+https://github.com/gtk-rs/gtk-rs-core#588a146fd86fd6adaa7e682505f3b65f036bd2bf" dependencies = [ "glib-sys 0.16.0", "gobject-sys 0.16.0", @@ -1580,23 +1196,11 @@ dependencies = [ "system-deps 6.0.2", ] -[[package]] -name = "parking" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" - -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - [[package]] name = "pest" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb779fcf4bb850fbbb0edc96ff6cf34fd90c4b1a112ce042653280d9a7364048" +checksum = "dbc7bc69c062e492337d74d59b120c274fd3d261b6bf6d3207d499b4b379c41a" dependencies = [ "thiserror", "ucd-trie", @@ -1620,20 +1224,6 @@ version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" -[[package]] -name = "polling" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "899b00b9c8ab553c743b3e11e87c5c7d423b2a2de229ba95b24a756344748011" -dependencies = [ - "autocfg", - "cfg-if 1.0.0", - "libc", - "log", - "wepoll-ffi", - "winapi", -] - [[package]] name = "ppv-lite86" version = "0.2.16" @@ -1670,7 +1260,7 @@ dependencies = [ "proc-macro2", "quote", "syn", - "version_check 0.9.4", + "version_check", ] [[package]] @@ -1681,24 +1271,18 @@ checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ "proc-macro2", "quote", - "version_check 0.9.4", + "version_check", ] [[package]] name = "proc-macro2" -version = "1.0.44" +version = "1.0.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd7356a8122b6c4a24a82b278680c73357984ca2fc79a0f9fa6dea7dced7c58" +checksum = "94e2ef8dbfc347b10c094890f778ee2e36ca9bb4262e86dc99cd217e35f3470b" dependencies = [ "unicode-ident", ] -[[package]] -name = "quick-error" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" - [[package]] name = "quick-xml" version = "0.22.0" @@ -1794,12 +1378,6 @@ dependencies = [ "ordered-multimap", ] -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - [[package]] name = "rustc_version" version = "0.3.3" @@ -1810,10 +1388,10 @@ dependencies = [ ] [[package]] -name = "scoped-tls" -version = "1.0.0" +name = "scratch" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" +checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" [[package]] name = "semver" @@ -1838,37 +1416,6 @@ name = "serde" version = "1.0.145" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "728eb6351430bccb993660dfffc5a72f91ccc1295abaa8ce19b27ebe4f75568b" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.145" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fa1584d3d1bcacd84c277a0dfe21f5b0f6accf4a23d04d4c6d61f1af522b4c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_repr" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fe39d9fbb0ebf5eb2c7cb7e2a47e4f462fad1379f1166b8ae49ad9eae89a7ca" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "shlex" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" [[package]] name = "slab" @@ -1881,31 +1428,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" - -[[package]] -name = "socket2" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "strum" @@ -1937,9 +1462,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.101" +version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e90cde112c4b9690b8cbe810cba9ddd8bc1d7472e2cae317b69e9438c1cba7d2" +checksum = "3fcd952facd492f9be3ef0d0b7032a6e442ee9b361d4acc2b1d0c4aaa5f613a1" dependencies = [ "proc-macro2", "quote", @@ -1989,15 +1514,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - [[package]] name = "thiserror" version = "1.0.37" @@ -2046,9 +1562,9 @@ checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" [[package]] name = "unicode-ident" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcc811dc4066ac62f84f11307873c4850cb653bfa9b1719cee2bd2204a4bc5dd" +checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" [[package]] name = "unicode-segmentation" @@ -2062,12 +1578,6 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version-compare" version = "0.0.10" @@ -2080,24 +1590,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe88247b92c1df6b6de80ddc290f3976dbdf2f5f5d3fd049a9fb598c6dd5ca73" -[[package]] -name = "version_check" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" - [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "waker-fn" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" - [[package]] name = "wasi" version = "0.10.0+wasi-snapshot-preview1" @@ -2164,24 +1662,6 @@ version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" -[[package]] -name = "wepoll-ffi" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb" -dependencies = [ - "cc", -] - -[[package]] -name = "which" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724" -dependencies = [ - "libc", -] - [[package]] name = "winapi" version = "0.3.9" @@ -2212,64 +1692,3 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "zbus" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cbeb2291cd7267a94489b71376eda33496c1b9881adf6b36f26cc2779f3fc49" -dependencies = [ - "async-io", - "byteorder", - "derivative", - "enumflags2", - "fastrand", - "futures", - "nb-connect", - "nix", - "once_cell", - "polling", - "scoped-tls", - "serde", - "serde_repr", - "zbus_macros", - "zvariant", -] - -[[package]] -name = "zbus_macros" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa3959a7847cf95e3d51e312856617c5b1b77191176c65a79a5f14d778bbe0a6" -dependencies = [ - "proc-macro-crate 0.1.5", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "zvariant" -version = "2.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a68c7b55f2074489b7e8e07d2d0a6ee6b4f233867a653c664d8020ba53692525" -dependencies = [ - "byteorder", - "enumflags2", - "libc", - "serde", - "static_assertions", - "zvariant_derive", -] - -[[package]] -name = "zvariant_derive" -version = "2.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4ca5e22593eb4212382d60d26350065bf2a02c34b85bc850474a74b589a3de9" -dependencies = [ - "proc-macro-crate 1.2.1", - "proc-macro2", - "quote", - "syn", -] diff --git a/Cargo.toml b/Cargo.toml index 4af9cf4..42c9c26 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "blue-recorder" -version = "0.1.0" +version = "0.2.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -14,12 +14,9 @@ gettext-rs = "0.7.0" gtk = { version = "0.4.8", package = "gtk4" } gtk-sys = "0.15" glib = "0.10.3" -libappindicator = "0.5.2" rust-ini = "0.16" regex = "1.4.3" subprocess = "0.2.6" -zbus = "1.9.2" -zvariant = "2.10.0" [dependencies.gio] version = "0.15.0" diff --git a/data/screenshot-ui-area-symbolic.svg b/data/screenshot-ui-area-symbolic.svg new file mode 100644 index 0000000..6cf5870 --- /dev/null +++ b/data/screenshot-ui-area-symbolic.svg @@ -0,0 +1,4 @@ + + + + diff --git a/data/screenshot-ui-display-symbolic.svg b/data/screenshot-ui-display-symbolic.svg new file mode 100644 index 0000000..b8b3f4a --- /dev/null +++ b/data/screenshot-ui-display-symbolic.svg @@ -0,0 +1,4 @@ + + + + diff --git a/data/screenshot-ui-window-symbolic.svg b/data/screenshot-ui-window-symbolic.svg new file mode 100644 index 0000000..b667bed --- /dev/null +++ b/data/screenshot-ui-window-symbolic.svg @@ -0,0 +1,4 @@ + + + + diff --git a/interfaces/main.ui b/interfaces/main.ui index c376328..3554bfa 100644 --- a/interfaces/main.ui +++ b/interfaces/main.ui @@ -32,6 +32,8 @@ area_chooser_window True + 412 + 584 False True True @@ -40,13 +42,10 @@ True False - True - True - True area_set_button @@ -82,6 +81,35 @@ + + main_window + False + 300 + True + info + + + True + 0.0 + True + True + 10 + 10 + 10 + + + + + True + False + True + True + Finish Recording + 10 + True + + + True True @@ -124,7 +152,7 @@ - + True True True @@ -140,12 +168,12 @@ horizontal 5 - + start - + start @@ -174,27 +202,106 @@ 5 True - - button + + area_grab_button + area_grab_button True True True - 5 - 5 - 5 - 5 + 3 + 3 + 3 + 3 + + + True + True + horizontal + 5 + + + True + True + + + + + Select an Area + True + True + + + + - - button + + screen_grab_button + area_grab_button True True True - 5 - 5 - 5 - 5 + 3 + 3 + 3 + 3 + True + + + True + True + 3 + True + + + True + True + + + + + Select Screen + True + True + + + + + + + + + window_grab_button + area_grab_button + True + True + True + 3 + 3 + 3 + 3 + + + True + True + 3 + True + + + True + True + + + + + Select a Window + True + True + + + + @@ -453,7 +560,7 @@ - + About True True diff --git a/src/area_capture.rs b/src/area_capture.rs index b2ecb0d..1490caf 100644 --- a/src/area_capture.rs +++ b/src/area_capture.rs @@ -46,6 +46,17 @@ impl AreaCapture { self.height = coordinate.3; *self } + + pub fn reset(&mut self) -> Self { + let coordinate = xwininfo_to_coordinate( + String::from_utf8(Command::new("xwininfo").arg("-root").output().unwrap().stdout).unwrap() + ); + self.x = coordinate.0; + self.y = coordinate.1; + self.width = coordinate.2; + self.height = coordinate.3; + *self + } } fn xwininfo_to_coordinate(xwininfo_output: String) -> (u16, u16, u16, u16) { diff --git a/src/config_management.rs b/src/config_management.rs index 0d91bc4..fa6e9da 100755 --- a/src/config_management.rs +++ b/src/config_management.rs @@ -4,7 +4,6 @@ extern crate dirs; use glib::get_user_data_dir; use ini::Ini; -use dirs::home_dir; use std::ops::Add; use std::path::{Path, PathBuf}; @@ -34,7 +33,7 @@ fn default() { String::from("file://") .add( glib::get_user_special_dir(glib::UserDirectory::Videos) - .unwrap_or(PathBuf::from(std::env::var("HOME").unwrap_or("/".to_string()).as_str())) + .unwrap_or_else(|| PathBuf::from(std::env::var("HOME").unwrap_or_else(|_| "/".to_string()).as_str())) .to_str() .unwrap(), ) @@ -78,7 +77,7 @@ pub fn get(selection: &str, key: &str) -> String { } pub fn get_bool(selection: &str, key: &str) -> bool { - get(&selection, &key).eq_ignore_ascii_case("1") + get(selection, key).eq_ignore_ascii_case("1") } pub fn set(selection: &str, key: &str, value: &str) -> bool { @@ -91,7 +90,7 @@ pub fn set(selection: &str, key: &str, value: &str) -> bool { } pub fn set_bool(selection: &str, key: &str, value: bool) -> bool { - set(&selection, &key, if value { "1" } else { "0" }) + set(selection, key, if value { "1" } else { "0" }) } pub fn folder_icon(folder_chooser_name: Option<&str>) -> &str { diff --git a/src/ffmpeg_interface.rs b/src/ffmpeg_interface.rs index 329f1d8..51db477 100644 --- a/src/ffmpeg_interface.rs +++ b/src/ffmpeg_interface.rs @@ -5,86 +5,45 @@ use gio::File; use gtk::prelude::*; use gtk::{ButtonsType, DialogFlags, MessageDialog, MessageType, ResponseType}; use gtk::{ - CheckButton, ComboBoxText, Entry, ProgressBar, SpinButton, Window}; -use std::collections::HashMap; + Button, CheckButton, ComboBoxText, Entry, ProgressBar, SpinButton, Window}; use std::path::PathBuf; use std::process::Command; -use std::sync::mpsc; -use std::sync::mpsc::{Receiver, Sender}; +use std::sync::mpsc::Sender; use std::thread::sleep; use std::time::Duration; use subprocess::Exec; -use zbus::dbus_proxy; -use zvariant::Value; #[derive(Clone)] pub struct ProgressWidget { - pub window: Window, - pub progress: ProgressBar, + pub progress_dialog: MessageDialog, + pub progressbar: ProgressBar, + pub progress_button: Button, } impl ProgressWidget { - pub fn new(window: &Window) -> ProgressWidget { + pub fn new(progress_dialog: MessageDialog, progressbar: ProgressBar, progress_button: Button) -> ProgressWidget { ProgressWidget { - window: Window::new(), - progress: ProgressBar::new(), + progress_dialog, + progressbar, + progress_button, } - .init(&window) - } - - pub fn init(self, window: &Window) -> ProgressWidget { - self.window.set_title(Some("Progress")); - self.window.set_transient_for(Some(window)); - self.progress.set_fraction(0.0); - self.progress.set_show_text(true); - self.progress.set_margin_start(10); - self.progress.set_margin_top(10); - self.progress.set_margin_end(10); - self.progress.set_margin_bottom(10); - self.window.set_child(Some(&self.progress)); - self.window.set_deletable(false); - self.window.set_modal(true); - self.window.set_default_size(200, 50); - self } pub fn set_progress(&self, title: String, value: i32, max: i32) { let progress_precentage: f64 = value as f64 / max as f64; - self.progress.set_text(Some(&title)); - self.progress.set_fraction(progress_precentage); + self.progressbar.set_text(Some(&title)); + self.progressbar.set_fraction(progress_precentage); } pub fn show(&self) { - self.progress.set_fraction(0.0); - self.window.show(); + self.progressbar.set_fraction(0.0); + self.progress_dialog.show(); } pub fn hide(&self) { - self.window.hide(); + self.progress_button.set_sensitive(true); } -} -#[dbus_proxy( - interface = "org.gnome.Shell.Screencast", - default_path = "/org/gnome/Shell/Screencast" -)] -trait GnomeScreencast { - fn screencast( - &self, - file_template: &str, - options: HashMap<&str, Value>, - ) -> zbus::Result<(bool, String)>; - - fn screencast_area( - &self, - x: i32, - y: i32, - width: i32, - height: i32, - file_template: &str, - options: HashMap<&str, Value>, - ) -> zbus::Result<(bool, String)>; - fn stop_screencast(&self) -> zbus::Result; } #[derive(Clone)] @@ -125,19 +84,18 @@ impl Ffmpeg { .join(PathBuf::from(format!( "{}.{}", if self.filename.1.text().to_string().trim().eq("") { - Utc::now().to_string().replace(" UTC", "").replace(" ", "-") + Utc::now().to_string().replace(" UTC", "").replace(' ', "-") } else { self.filename.1.text().to_string().trim().to_string() }, - self.filename.2.active_id().unwrap().to_string() - ))) + self.filename.2.active_id().unwrap()))) .as_path() .display() .to_string(), ); let is_file_already_exists = - std::path::Path::new(format!("{}", self.saved_filename.clone().unwrap()).as_str()) + std::path::Path::new(self.saved_filename.clone().unwrap().as_str()) .exists(); if is_file_already_exists { @@ -164,38 +122,17 @@ impl Ffmpeg { ffmpeg_command.arg("-f"); ffmpeg_command.arg("pulse"); ffmpeg_command.arg("-i"); - ffmpeg_command.arg(self.audio_id.active_id().unwrap().to_string()); + ffmpeg_command.arg(self.audio_id.active_id().unwrap()); ffmpeg_command.arg("-f"); ffmpeg_command.arg("ogg"); ffmpeg_command.arg(format!( "{}.temp.audio", - self.saved_filename.as_ref().unwrap().to_string() + self.saved_filename.as_ref().unwrap() )); ffmpeg_command.arg("-y"); self.audio_process_id = Some(ffmpeg_command.spawn().unwrap().id()); } - if is_wayland() { - if self.record_video.is_active() { - if self.unbound.is_some() { - self.clone() - .unbound - .unwrap() - .send(false) - .unwrap_or_default(); - } - self.record_wayland( - format!("{}.temp", self.saved_filename.as_ref().unwrap().to_string()), - x, - y, - width, - height, - ); - } - - return (None, self.audio_process_id); - } - if self.record_video.is_active() { let mut ffmpeg_command: Command = Command::new("ffmpeg"); @@ -210,7 +147,7 @@ impl Ffmpeg { ffmpeg_command.arg(format!( "{}+{},{}", std::env::var("DISPLAY") - .unwrap_or(":0".to_string()) + .unwrap_or_else(|_| ":0".to_string()) .as_str(), x, y @@ -231,7 +168,7 @@ impl Ffmpeg { } ffmpeg_command.arg("-crf"); ffmpeg_command.arg("1"); - ffmpeg_command.arg(self.saved_filename.as_ref().unwrap().to_string()); + ffmpeg_command.arg(self.saved_filename.as_ref().unwrap()); ffmpeg_command.arg("-y"); // sleep for delay sleep(Duration::from_secs(self.record_delay.value() as u64)); @@ -244,10 +181,10 @@ impl Ffmpeg { } pub fn stop_record(&self) { - &self.progress_widget.show(); + self.progress_widget.show(); // kill the process to stop recording if self.video_process_id.is_some() { - &self + self .progress_widget .set_progress("Stop Recording Video".to_string(), 1, 6); Command::new("kill") @@ -257,7 +194,7 @@ impl Ffmpeg { } if self.audio_process_id.is_some() { - &self + self .progress_widget .set_progress("Stop Recording Audio".to_string(), 2, 6); Command::new("kill") @@ -270,7 +207,7 @@ impl Ffmpeg { format!( "{}{}", self.saved_filename.as_ref().unwrap_or(&String::from("")), - if is_wayland() { ".temp" } else { "" } + { "" } ) .as_str(), ) @@ -284,58 +221,13 @@ impl Ffmpeg { ) .exists(); - if is_video_record && is_wayland() { - // create new dbus session - let connection = zbus::Connection::new_session().unwrap(); - // bind the connection to gnome screencast proxy - let gnome_screencast_proxy = GnomeScreencastProxy::new(&connection).unwrap(); - gnome_screencast_proxy.stop_screencast().unwrap(); - if self.unbound.is_some() { - &self.progress_widget.set_progress( - "Stop Wayland Video Recording".to_string(), - 3, - 6, - ); - self.unbound - .as_ref() - .unwrap() - .send(true) - .unwrap_or_default(); - // convert webm to the format user choose using ffmpeg - if is_video_record { - let mut ffmpeg_convert_command = Command::new("ffmpeg"); - ffmpeg_convert_command.arg("-f"); - ffmpeg_convert_command.arg("webm"); - ffmpeg_convert_command.arg("-i"); - ffmpeg_convert_command - .arg(format!("{}.temp", self.saved_filename.as_ref().unwrap())); - ffmpeg_convert_command.arg(format!( - "{}{}", - self.saved_filename.as_ref().unwrap_or(&String::new()), - if is_audio_record { - format!( - ".temp.without.audio.{}", - self.filename.2.active_id().unwrap().to_string() - ) - } else { - "".to_string() - } - )); - ffmpeg_convert_command.arg("-y"); - ffmpeg_convert_command.output().unwrap(); - std::fs::remove_file(format!("{}.temp", self.saved_filename.as_ref().unwrap())) - .unwrap(); - } - } - } - - if is_video_record && !is_wayland() { + if is_video_record { let mut move_command = Command::new("mv"); move_command.arg(format!( "{}{}", self.saved_filename.as_ref().unwrap(), - if is_wayland() { ".temp" } else { "" } + { "" } )); move_command.arg(format!( "{}{}", @@ -343,7 +235,7 @@ impl Ffmpeg { if is_audio_record { format!( ".temp.without.audio.{}", - self.filename.2.active_id().unwrap().to_string() + self.filename.2.active_id().unwrap() ) } else { "".to_string() @@ -353,7 +245,7 @@ impl Ffmpeg { // if audio record, then merge video with audio if is_audio_record && is_video_record { - &self + self .progress_widget .set_progress("Save Audio Recording".to_string(), 4, 6); @@ -362,7 +254,7 @@ impl Ffmpeg { ffmpeg_audio_merge_command.arg(format!( "{}.temp.without.audio.{}", self.saved_filename.as_ref().unwrap(), - self.filename.2.active_id().unwrap().to_string() + self.filename.2.active_id().unwrap() )); ffmpeg_audio_merge_command.arg("-i"); ffmpeg_audio_merge_command.arg(format!( @@ -385,14 +277,14 @@ impl Ffmpeg { std::fs::remove_file(format!( "{}.temp.without.audio.{}", self.saved_filename.as_ref().unwrap(), - self.filename.2.active_id().unwrap().to_string() + self.filename.2.active_id().unwrap() )) .unwrap(); } } // if only audio is recording then convert it to chosen fromat else if is_audio_record && !is_video_record { - &self + self .progress_widget .set_progress("Convert Audio to choosen format".to_string(), 4, 6); sleep(Duration::from_secs(1)); @@ -404,7 +296,7 @@ impl Ffmpeg { "{}.temp.audio", self.saved_filename.as_ref().unwrap() )) - .arg(format!("{}", self.saved_filename.as_ref().unwrap())) + .arg(self.saved_filename.as_ref().unwrap()) .output() .unwrap(); std::fs::remove_file(format!( @@ -415,55 +307,20 @@ impl Ffmpeg { } // execute command after finish recording - if !(self.command.text().trim() == "") { - &self.progress_widget.set_progress( + if self.command.text().trim() != "" { + self.progress_widget.set_progress( "execute custom command after finish".to_string(), 5, - 6, + 6 ); Exec::shell(self.command.text().trim()).popen().unwrap(); } - &self + self .progress_widget .set_progress("Finish".to_string(), 6, 6); - &self.progress_widget.hide(); - } + self.progress_widget.hide(); - // Gnome screencast for record wayland - pub fn record_wayland(&mut self, filename: String, x: u16, y: u16, width: u16, height: u16) { - // create new dbus session - let connection = zbus::Connection::new_session().unwrap(); - // bind the connection to gnome screencast proxy - let gnome_screencast_proxy = GnomeScreencastProxy::new(&connection).unwrap(); - // options for gnome screencast - let mut screencast_options: HashMap<&str, Value> = HashMap::new(); - screencast_options.insert("framerate", Value::new(self.record_frames.value())); - screencast_options.insert("draw-cursor", Value::new(self.record_mouse.is_active())); - screencast_options.insert("pipeline", Value::new("vp8enc min_quantizer=10 max_quantizer=50 cq_level=13 cpu-used=5 deadline=1000000 threads=%T ! queue ! webmmux")); - // make unbound channel for communication with record thread - let (tx, tr): (Sender, Receiver) = mpsc::channel(); - self.unbound = Some(tx); - - // start recording in another thread - std::thread::spawn(move || { - gnome_screencast_proxy - .screencast_area( - x.into(), - y.into(), - width.into(), - height.into(), - &filename, - screencast_options, - ) - .unwrap(); - - loop { - if tr.recv().unwrap_or(false) { - break; - } - } - }); } pub fn play_record(self) { @@ -477,7 +334,7 @@ impl Ffmpeg { .unwrap(); } else { Command::new("xdg-open") - .arg(self.saved_filename.unwrap()) + .arg(self.saved_filename.as_ref().unwrap()) .spawn() .unwrap(); } @@ -485,12 +342,6 @@ impl Ffmpeg { } } -fn is_wayland() -> bool { - std::env::var("XDG_SESSION_TYPE") - .unwrap_or_default() - .eq_ignore_ascii_case("wayland") -} - fn is_snap() -> bool { - std::env::var("SNAP").unwrap_or_default().len() > 0 + std::env::var("SNAP").unwrap_or_default().is_empty() } diff --git a/src/main.rs b/src/main.rs index c8ee411..e9345fe 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,8 +9,7 @@ mod ffmpeg_interface; use ffmpeg_interface::{Ffmpeg, ProgressWidget}; use gettextrs::{bindtextdomain, gettext, LocaleCategory, setlocale, textdomain}; use gtk::{prelude::*, Application}; -use gtk::{AboutDialog, Builder, Button, CheckButton, ComboBoxText, CssProvider, Entry, FileChooserNative, FileChooserAction, Image, Label, SpinButton, Window}; -//use libappindicator::{AppIndicator, AppIndicatorStatus}; +use gtk::{AboutDialog, Builder, Button, CheckButton, ComboBoxText, CssProvider, Entry, FileChooserNative, FileChooserAction, Image, Label, MessageDialog, ProgressBar, SpinButton, ToggleButton, Window}; use std::cell::RefCell; use std::ops::Add; use std::path::Path; @@ -31,6 +30,7 @@ pub fn build_ui(application: &Application) { println!("Failed to initialize GTK."); return; } + // TODO: add wayland screen record support let ui_src = include_str!("../interfaces/main.ui").to_string(); let builder: Builder = Builder::from_string(ui_src.as_str()); @@ -45,7 +45,7 @@ pub fn build_ui(application: &Application) { if !po_path_abs.exists() { po_path_abs = std::fs::canonicalize(Path::new( - &std::env::var("PO_DIR").unwrap_or(String::from("po")), + &std::env::var("PO_DIR").unwrap_or_else(|_| String::from("po")), )) .unwrap(); } @@ -60,9 +60,10 @@ pub fn build_ui(application: &Application) { // get Objects from UI let main_window: Window = builder.object("main_window").unwrap(); let area_chooser_window: Window = builder.object("area_chooser_window").unwrap(); - let area_grab_button: Button = builder.object("area_grab_button").unwrap(); + let area_grab_button: ToggleButton = builder.object("area_grab_button").unwrap(); + let area_grab_icon: Image = builder.object("area_grab_icon").unwrap(); let area_set_button: Button = builder.object("area_set_button").unwrap(); - let about_menu_item: Button = builder.object("about_menu_item").unwrap(); + let about_button: Button = builder.object("aboutbutton").unwrap(); let about_dialog: AboutDialog = builder.object("about_dialog").unwrap(); let audio_source_combobox: ComboBoxText = builder.object("audiosource").unwrap(); let audio_source_label: Label = builder.object("audio_source_label").unwrap(); @@ -72,20 +73,25 @@ pub fn build_ui(application: &Application) { let delay_label: Label = builder.object("delay_label").unwrap(); let delay_spin: SpinButton = builder.object("delay").unwrap(); let filename_entry: Entry = builder.object("filename").unwrap(); - let folder_chooser_button: Button = builder.object("folderchooser").unwrap(); - let folder_chooser_image: Image = builder.object("folderchooserimage").unwrap(); - let folder_chooser_label: Label = builder.object("folderchooserlabel").unwrap(); + let folder_chooser_button: Button = builder.object("folder_chooser").unwrap(); + let folder_chooser_image: Image = builder.object("folder_chooser_image").unwrap(); + let folder_chooser_label: Label = builder.object("folder_chooser_label").unwrap(); let follow_mouse_switch: CheckButton = builder.object("followmouseswitch").unwrap(); let format_chooser_combobox: ComboBoxText = builder.object("comboboxtext1").unwrap(); let frames_label: Label = builder.object("frames_label").unwrap(); let frames_spin: SpinButton = builder.object("frames").unwrap(); let mouse_switch: CheckButton = builder.object("mouseswitch").unwrap(); let play_button: Button = builder.object("playbutton").unwrap(); + let progress_button: Button = builder.object("progressbutton").unwrap(); + let progress_dialog: MessageDialog = builder.object("progress_dialog").unwrap(); + let progressbar: ProgressBar = builder.object("progressbar").unwrap(); let record_button: Button = builder.object("recordbutton").unwrap(); + let screen_grab_button: ToggleButton = builder.object("screen_grab_button").unwrap(); + let screen_grab_icon: Image = builder.object("screen_grab_icon").unwrap(); let stop_button: Button = builder.object("stopbutton").unwrap(); let video_switch: CheckButton = builder.object("videoswitch").unwrap(); - let window_grab_button: Button = builder.object("window_grab_button").unwrap(); - // TODO: add recording mode indicator + let window_grab_icon: Image = builder.object("window_grab_icon").unwrap(); + let window_grab_button: ToggleButton = builder.object("window_grab_button").unwrap(); // TODO: add timer // --- default properties @@ -105,17 +111,17 @@ pub fn build_ui(application: &Application) { command_entry.set_text(&config_management::get("default", "command")); // CheckBox + format_chooser_combobox.append(Some("webm"), &gettext("WEBM (Open Web Media File)")); + format_chooser_combobox.append(Some("mp4"), &gettext("MP4 (MPEG-4 Part 14)")); + format_chooser_combobox.append(Some("gif"), &gettext("GIF (Graphics Interchange Format)")); format_chooser_combobox.append( Some("mkv"), &gettext("MKV (Matroska multimedia container format)"), ); format_chooser_combobox.append(Some("avi"), &gettext("AVI (Audio Video Interleaved)")); - format_chooser_combobox.append(Some("mp4"), &gettext("MP4 (MPEG-4 Part 14)")); format_chooser_combobox.append(Some("wmv"), &gettext("WMV (Windows Media Video)")); - format_chooser_combobox.append(Some("gif"), &gettext("GIF (Graphics Interchange Format)")); format_chooser_combobox.append(Some("nut"), &gettext("NUT (NUT Recording Format)")); format_chooser_combobox.set_active(Some(0)); - // TODO: add support for webm format // get audio sources let sources_descriptions: Vec = { @@ -124,7 +130,7 @@ pub fn build_ui(application: &Application) { .stdout(Stdio::piped()) .spawn(); let sources_descriptions = String::from_utf8( - if list_sources_child.is_ok() { + if let Ok(..) = list_sources_child { Command::new("grep") .args(&["-e", "device.description"]) .stdin( @@ -143,13 +149,13 @@ pub fn build_ui(application: &Application) { ) .unwrap(); sources_descriptions - .split("\n") + .split('\n') .map(|s| { s.trim() .replace("device.description = ", "") - .replace("\"", "") + .replace('\"', "") }) - .filter(|s| s != "") + .filter(|s| !s.is_empty()) .collect() }; @@ -160,6 +166,7 @@ pub fn build_ui(application: &Application) { audio_source_combobox.set_active(Some(0)); // Switchs + let _audio_switch = audio_switch.clone(); video_switch.set_label(Some(&gettext("Record Video"))); audio_switch.set_label(Some(&gettext("Record Audio"))); mouse_switch.set_label(Some(&gettext("Show Mouse"))); @@ -198,8 +205,57 @@ pub fn build_ui(application: &Application) { }); // Buttons - window_grab_button.set_label(&gettext("Select a Window")); - area_grab_button.set_label(&gettext("Select an Area")); + let mut area_icon_path = { + let mut current_exec_dir = std::env::current_exe().unwrap(); + current_exec_dir.pop(); + current_exec_dir + } + .join(Path::new("data/screenshot-ui-area-symbolic.svg")); + + if !area_icon_path.exists() { + area_icon_path = std::fs::canonicalize(Path::new( + &std::env::var("DATA_DIR") + .unwrap_or_else(|_| String::from("data/")) + .add("screenshot-ui-area-symbolic.svg"), + )) + .unwrap(); + } + + let mut screen_icon_path = { + let mut current_exec_dir = std::env::current_exe().unwrap(); + current_exec_dir.pop(); + current_exec_dir + } + .join(Path::new("data/screenshot-ui-display-symbolic.svg")); + + if !screen_icon_path.exists() { + screen_icon_path = std::fs::canonicalize(Path::new( + &std::env::var("DATA_DIR") + .unwrap_or_else(|_| String::from("data/")) + .add("screenshot-ui-display-symbolic.svg"), + )) + .unwrap(); + } + + let mut window_icon_path = { + let mut current_exec_dir = std::env::current_exe().unwrap(); + current_exec_dir.pop(); + current_exec_dir + } + .join(Path::new("data/screenshot-ui-window-symbolic.svg")); + + if !window_icon_path.exists() { + window_icon_path = std::fs::canonicalize(Path::new( + &std::env::var("DATA_DIR") + .unwrap_or_else(|_| String::from("data/")) + .add("screenshot-ui-window-symbolic.svg"), + )) + .unwrap(); + } + + area_grab_icon.set_from_file(Some(area_icon_path)); + screen_grab_icon.set_from_file(Some(screen_icon_path)); + window_grab_icon.set_from_file(Some(&window_icon_path)); // Labels command_label.set_label(&gettext("Run Command After Recording:")); @@ -208,18 +264,6 @@ pub fn build_ui(application: &Application) { audio_source_label.set_label(&gettext("Audio Input Source:")); // Spin - frames_spin.set_value( - config_management::get("default", "frame") - .to_string() - .parse::() - .unwrap(), - ); - delay_spin.set_value( - config_management::get("default", "delay") - .to_string() - .parse::() - .unwrap(), - ); let _frames_spin = frames_spin.to_owned(); frames_spin.connect_value_changed(move |_| { config_management::set( @@ -246,10 +290,10 @@ pub fn build_ui(application: &Application) { Some("Cancel"), ); folder_chooser_native.set_modal(true); - let mut folder_chooser = Some(gio::File::for_uri(&config_management::get("default", "folder"))).unwrap(); - let mut folder_chooser_name = folder_chooser.basename().unwrap(); + let folder_chooser = Some(gio::File::for_uri(&config_management::get("default", "folder"))).unwrap(); + let folder_chooser_name = folder_chooser.basename().unwrap(); folder_chooser_label.set_label(&folder_chooser_name.to_string_lossy()); - let mut folder_chooser_icon = config_management::folder_icon(folder_chooser_name.to_str()); + let folder_chooser_icon = config_management::folder_icon(folder_chooser_name.to_str()); folder_chooser_image.set_icon_name(Some(folder_chooser_icon)); // show file chooser dialog folder_chooser_button.connect_clicked(glib::clone!(@strong folder_chooser_native => move |_| { @@ -258,7 +302,7 @@ pub fn build_ui(application: &Application) { let folder_chooser = folder_chooser_native.file().unwrap(); let folder_chooser_name = folder_chooser.basename().unwrap(); folder_chooser_label.set_label(&folder_chooser_name.to_string_lossy()); - let mut folder_chooser_icon = config_management::folder_icon(folder_chooser_name.to_str()); + let folder_chooser_icon = config_management::folder_icon(folder_chooser_name.to_str()); folder_chooser_image.set_icon_name(Some(folder_chooser_icon)); }; folder_chooser_native.destroy(); @@ -269,7 +313,7 @@ pub fn build_ui(application: &Application) { // --- connections // show dialog window when about button clicked then hide it after close let _about_dialog: AboutDialog = about_dialog.to_owned(); - about_menu_item.connect_clicked(move |_| { + about_button.connect_clicked(move |_| { _about_dialog.show(); _about_dialog.set_hide_on_close(true); }); @@ -277,10 +321,6 @@ pub fn build_ui(application: &Application) { // Buttons let area_capture: Rc> = Rc::new(RefCell::new(area_capture::AreaCapture::new())); - let mut _area_capture = area_capture.clone(); - window_grab_button.connect_clicked(move |_| { - _area_capture.borrow_mut().get_area(); - }); let _area_chooser_window = area_chooser_window.clone(); let mut _area_capture = area_capture.clone(); @@ -297,6 +337,26 @@ pub fn build_ui(application: &Application) { _area_chooser_window.hide(); }); + let _area_chooser_window = area_chooser_window.clone(); + let mut _area_capture = area_capture.clone(); + screen_grab_button.connect_clicked(move |_| { + _area_chooser_window.hide(); + _area_capture.borrow_mut().reset(); + }); + + let _area_chooser_window = area_chooser_window.clone(); + let mut _area_capture = area_capture.clone(); + window_grab_button.connect_clicked(move |_| { + _area_chooser_window.hide(); + _area_capture.borrow_mut().get_area(); + }); + + let _progress_button = progress_button.clone(); + let _progress_dialog = progress_dialog.clone(); + _progress_button.connect_clicked(move |_| { + _progress_dialog.hide(); + }); + // init record struct let ffmpeg_record_interface: Rc> = Rc::new(RefCell::new(Ffmpeg { filename: (folder_chooser, filename_entry, format_chooser_combobox), @@ -312,63 +372,15 @@ pub fn build_ui(application: &Application) { audio_process_id: None, saved_filename: None, unbound: None, - progress_widget: ProgressWidget::new(&main_window), + progress_widget: ProgressWidget::new(progress_dialog, progressbar, progress_button), })); - // App Indicator - let mut indicator_icon_path = { - let mut current_exec_dir = std::env::current_exe().unwrap(); - current_exec_dir.pop(); - current_exec_dir - } - .join(Path::new("data/blue-recorder@x96.png")); - - if !indicator_icon_path.exists() { - indicator_icon_path = std::fs::canonicalize(Path::new( - &std::env::var("DATA_DIR") - .unwrap_or(String::from("data/")) - .add("blue-recorder@x96.png"), - )) - .unwrap(); - } - - //let indicator = Rc::new(RefCell::new(AppIndicator::new( - //"Blue Recorder", - //indicator_icon_path.to_str().unwrap(), - //))); - //indicator - //.clone() - //.borrow_mut() - //.set_status(AppIndicatorStatus::Passive); - //let mut menu = gtk::Popover::new(); - //let indicator_stop_recording = Label::new(Some(&gettext("stop recording"))); - //menu.set_child(Some(&indicator_stop_recording)); - //menu.show(); - //indicator.clone().borrow_mut().set_menu(&mut menu); // indicator support GtkMenu from Gtk3 - // when indictor stop recording button clicked - //let mut _ffmpeg_record_interface = ffmpeg_record_interface.clone(); - //let mut _indicator = indicator.clone(); - //let _stop_button = stop_button.clone(); - //let _play_button = play_button.clone(); - //let _record_button = record_button.clone(); - //indicator_stop_recording.connect_activate_current_link(move |_| { - //_ffmpeg_record_interface.borrow_mut().clone().stop_record(); - //_indicator - //.borrow_mut() - //.set_status(AppIndicatorStatus::Passive); - - //_record_button.show(); - //_stop_button.hide(); - //_play_button.show(); - //}); - let mut _ffmpeg_record_interface = ffmpeg_record_interface.clone(); let mut _area_capture = area_capture.clone(); - //let mut _indicator = indicator.clone(); let _stop_button = stop_button.clone(); let _record_button = record_button.clone(); record_button.connect_clicked(move |_| { - let _area_capture = _area_capture.borrow_mut().clone(); + let _area_capture = area_capture.borrow_mut(); match _ffmpeg_record_interface.borrow_mut().start_record( _area_capture.x, _area_capture.y, @@ -376,13 +388,13 @@ pub fn build_ui(application: &Application) { _area_capture.height, ) { (None, None) => { - // do nothing if the start_record function return nothing + // do nothing if the start_record function return nothing + if _audio_switch.is_active() { + _record_button.hide(); + _stop_button.show(); + } } _ => { - //_indicator - //.borrow_mut() - //.set_status(AppIndicatorStatus::Active); - _record_button.hide(); _stop_button.show(); } @@ -390,16 +402,11 @@ pub fn build_ui(application: &Application) { }); let mut _ffmpeg_record_interface = ffmpeg_record_interface.clone(); - //let mut _indicator = indicator.clone(); let _stop_button = stop_button.clone(); let _play_button = play_button.clone(); - let _record_button = record_button.clone(); stop_button.connect_clicked(move |_| { + let _record_button = record_button.clone(); _ffmpeg_record_interface.borrow_mut().clone().stop_record(); - //_indicator - //.borrow_mut() - //.set_status(AppIndicatorStatus::Passive); - _record_button.show(); _stop_button.hide(); _play_button.show(); @@ -411,7 +418,23 @@ pub fn build_ui(application: &Application) { }); // About Dialog - let logo = Image::from_file(&indicator_icon_path.to_str().unwrap()); + let mut about_icon_path = { + let mut current_exec_dir = std::env::current_exe().unwrap(); + current_exec_dir.pop(); + current_exec_dir + } + .join(Path::new("data/blue-recorder@x96.png")); + + if !about_icon_path.exists() { + about_icon_path = std::fs::canonicalize(Path::new( + &std::env::var("DATA_DIR") + .unwrap_or_else(|_| String::from("data/")) + .add("blue-recorder@x96.png"), + )) + .unwrap(); + } + + let logo = Image::from_file(&about_icon_path.to_str().unwrap()); about_dialog.set_transient_for(Some(&main_window)); about_dialog.set_program_name(Some(&gettext("Blue Recorder"))); about_dialog.set_version(Some("0.2.0")); @@ -444,14 +467,10 @@ pub fn build_ui(application: &Application) { }); // close the application when main window destroy - let mut _ffmpeg_record_interface = ffmpeg_record_interface.clone(); - //let mut _indicator = indicator.clone(); main_window.connect_destroy(move |main_window| { - // stop recording before close the application + let mut _ffmpeg_record_interface = ffmpeg_record_interface.clone(); + // stop recording before close the application _ffmpeg_record_interface.borrow_mut().clone().stop_record(); - //_indicator - //.borrow_mut() - //.set_status(AppIndicatorStatus::Passive); main_window.close(); }); diff --git a/src/styles/global.css b/src/styles/global.css index 6feff8a..938344a 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -7,3 +7,18 @@ color: rgba(255, 255, 255, 1); background: rgba(255, 255, 255, 0); } + +#area_grab_button:checked{ + color: rgba(255, 255, 255, 1); + background: rgba(32.0, 74.0, 135, 1); +} + +#screen_grab_button:checked{ + color: rgba(255, 255, 255, 1); + background: rgba(32.0, 74.0, 135, 1); +} + +#window_grab_button:checked{ + color: rgba(255, 255, 255, 1); + background: rgba(32.0, 74.0, 135, 1); +}