diff --git a/.direnv/flake-profile b/.direnv/flake-profile index e289079..b9f8d1a 120000 --- a/.direnv/flake-profile +++ b/.direnv/flake-profile @@ -1 +1 @@ -flake-profile-4-link \ No newline at end of file +flake-profile-10-link \ No newline at end of file diff --git a/.direnv/flake-profile-4-link b/.direnv/flake-profile-10-link similarity index 100% rename from .direnv/flake-profile-4-link rename to .direnv/flake-profile-10-link diff --git a/Cargo.lock b/Cargo.lock index 1db083a..9545054 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -204,27 +204,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "directories-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" -dependencies = [ - "cfg-if", - "dirs-sys-next", -] - -[[package]] -name = "dirs-sys-next" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - [[package]] name = "equivalent" version = "1.0.1" @@ -396,17 +375,6 @@ dependencies = [ "system-deps", ] -[[package]] -name = "getrandom" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - [[package]] name = "gimli" version = "0.28.1" @@ -744,16 +712,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "libredox" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" -dependencies = [ - "bitflags 2.5.0", - "libc", -] - [[package]] name = "lock_api" version = "0.4.11" @@ -968,19 +926,19 @@ dependencies = [ [[package]] name = "re_set-lib" -version = "4.0.1" +version = "5.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06cb3803fff21953f1c17a685ae01e92b6b4d3231b99726d389520c48fbc1310" +checksum = "01fb110dc5087cdb0d8df799c3855c13e4ecb41f987e9691bf3d101c2dad1b3a" dependencies = [ "dbus", "dbus-crossroads", - "directories-next", "gtk4", "libloading", "libpulse-binding", "once_cell", "serial_test", "toml", + "xdg", ] [[package]] @@ -992,20 +950,9 @@ dependencies = [ "bitflags 1.3.2", ] -[[package]] -name = "redox_users" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" -dependencies = [ - "getrandom", - "libredox", - "thiserror", -] - [[package]] name = "reset" -version = "1.2.0" +version = "1.2.1" dependencies = [ "dbus", "fork", @@ -1021,9 +968,9 @@ dependencies = [ [[package]] name = "reset_daemon" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c9858fdb8b54d8d81a2e0c16f5f2f16837c627da54ea9f3e7a27a888c0ef1fa" +checksum = "e555b347b8b0b67081aeb570096338eae68a8db4b877661254ce17c59e5134dd" dependencies = [ "crossbeam", "dbus", @@ -1479,3 +1426,9 @@ checksum = "f0c976aaaa0e1f90dbb21e9587cdaf1d9679a1cde8875c0d6bd83ab96a208352" dependencies = [ "memchr", ] + +[[package]] +name = "xdg" +version = "2.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213b7324336b53d2414b2db8537e56544d981803139155afa84f76eeebb7a546" diff --git a/Cargo.toml b/Cargo.toml index a2f45b9..559d755 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,8 +8,8 @@ license = "GPL-3.0-or-later" [dependencies] reset_daemon = "1.5.0" -#re_set-lib = "5.0.0" -re_set-lib = { git = "https://github.com/Xetibo/ReSet-Lib" } +re_set-lib = "5.2.1" +# re_set-lib = { git = "https://github.com/Xetibo/ReSet-Lib" } adw = { version = "0.6.0", package = "libadwaita", features = ["v1_4"] } dbus = "0.9.7" gtk = { version = "0.8.1", package = "gtk4", features = ["v4_12"] } diff --git a/flake.nix b/flake.nix index 02083e9..0baa555 100644 --- a/flake.nix +++ b/flake.nix @@ -35,7 +35,7 @@ inputsFrom = builtins.attrValues self'.packages; packages = with pkgs; [ # (rust-bin.selectLatestNightlyWith - # (toolchain: toolchain.default)) + # (toolchain: toolchain.default)) rust-bin.nightly."2024-05-10".default ]; }; diff --git a/nix/default.nix b/nix/default.nix index 7523311..23adde3 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -44,10 +44,9 @@ rustPlatform.buildRustPackage rec { nativeBuildInputs = [ pkg-config wrapGAppsHook4 - # (rust-bin.selectLatestNightlyWith - # (toolchain: toolchain.default)) rust-bin.nightly."2024-05-10".default ]; + copyLibs = true; postInstall = '' @@ -55,6 +54,10 @@ rustPlatform.buildRustPackage rec { install -D --mode=444 $src/src/resources/icons/ReSet.svg $out/share/pixmaps/ReSet.svg ''; + # test is broken in nix for some reason + doInstallCheck = false; + doCheck = false; + meta = with lib; { description = "A wip universal Linux settings application."; homepage = "https://github.com/Xetibo/ReSet"; diff --git a/nix/hm.nix b/nix/hm.nix index e059cd5..b056b1b 100644 --- a/nix/hm.nix +++ b/nix/hm.nix @@ -26,7 +26,7 @@ in config = { plugins = mkOption { - type = with types; nullOr (listOf package); + type = with types; listOf package; default = null; description = mdDoc '' List of plugins to use, represented as a list of packages. @@ -46,7 +46,7 @@ in config = let fetchedPlugins = - if cfg.config.plugins == null + if cfg.config.plugins == [ ] then [ ] else builtins.map @@ -55,19 +55,23 @@ in then "lib${lib.replaceStrings ["-"] ["_"] entry.pname}.so" else "") cfg.config.plugins; - path = - if cfg.config.plugins == null - then "" - else - "${lib.lists.last cfg.config.plugins}/lib"; in - lib.mkIf cfg.enable { - home.packages = lib.optional (cfg.package != null) cfg.package; + lib.mkIf + cfg.enable + { + home.packages = lib.optional (cfg.package != null) cfg.package ++ cfg.config.plugins; + home.file = builtins.listToAttrs (builtins.map + (pkg: { + name = ".config/reset/plugins/lib${lib.replaceStrings ["-"] ["_"] pkg.pname}.so"; + value = { + source = "${pkg}/lib/lib${lib.replaceStrings ["-"] ["_"] pkg.pname}.so"; + }; + }) + cfg.config.plugins); - xdg.configFile."reset/ReSet.toml".source = (pkgs.formats.toml cfg.config.plugin_config).generate "reset" - { - plugins = fetchedPlugins; - plugin_path = path; - }; - }; + xdg.configFile."reset/ReSet.toml".source = (pkgs.formats.toml cfg.config.plugin_config).generate "reset" + { + plugins = fetchedPlugins; + }; + }; } diff --git a/src/components/window/reset_window.rs b/src/components/window/reset_window.rs index fa39a91..9ac8b90 100644 --- a/src/components/window/reset_window.rs +++ b/src/components/window/reset_window.rs @@ -21,6 +21,7 @@ use crate::components::utils::get_capabilities; use crate::components::window::handle_sidebar_click::*; use crate::components::window::reset_window_impl; use crate::components::window::sidebar_entry::SidebarEntry; +use crate::VERSION; use super::consts::{ AUDIO_SIDEBAR, BLUETOOTH_SIDEBAR, CONNECTIVITY_SIDEBAR, SINK_SIDEBAR, SOURCE_SIDEBAR, @@ -316,7 +317,7 @@ impl ReSetWindow { .license_type(gtk::License::Gpl30) .website("https://github.com/Xetibo/ReSet") .issue_url("https://github.com/Xetibo/ReSet/issues") - .version("1.0.0") + .version(VERSION) .transient_for(window) .modal(true) .copyright("© 2022-2023 Xetibo") diff --git a/src/main.rs b/src/main.rs index 3cd3b0e..156b953 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,6 +15,10 @@ mod tests; const APP_ID: &str = "org.Xetibo.ReSet"; +/// Version of the current package. +/// Use this to avoid version mismatch conflicts. +pub const VERSION: &str = env!("CARGO_PKG_VERSION"); + #[tokio::main] async fn main() { tokio::task::spawn(daemon_check()); diff --git a/src/resources/resetMainWindow.ui b/src/resources/resetMainWindow.ui index 2325aaf..6f2f2b4 100644 --- a/src/resources/resetMainWindow.ui +++ b/src/resources/resetMainWindow.ui @@ -39,6 +39,7 @@ True True open-menu-symbolic + main_menu end True diff --git a/src/resources/resetUI.cmb b/src/resources/resetUI.cmb index 7b89980..168868b 100644 --- a/src/resources/resetUI.cmb +++ b/src/resources/resetUI.cmb @@ -347,7 +347,7 @@ (3,33,"GtkMenuButton","can-shrink","True",None,None,None,None,None,None,None,None,None), (3,33,"GtkMenuButton","has-frame","False",None,None,None,None,None,None,None,None,None), (3,33,"GtkMenuButton","icon-name","open-menu-symbolic",None,None,None,None,None,None,None,None,None), - (3,33,"GtkMenuButton","menu-model",None,None,None,None,None,None,None,None,None,None), + (3,33,"GtkMenuButton","menu-model","54",None,None,None,None,None,None,None,None,None), (3,33,"GtkWidget","halign","end",None,None,None,None,None,None,None,None,None), (3,33,"GtkWidget","hexpand","True",None,None,None,None,None,None,None,None,None), (3,33,"GtkWidget","hexpand-set","True",None,None,None,None,None,None,None,None,None), diff --git a/src/tests.rs b/src/tests.rs index ed26a22..83b6e88 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -1,12 +1,11 @@ -use std::thread; -use std::time::Duration; -use re_set_lib::utils::plugin_setup::FRONTEND_PLUGINS; -use crate::daemon_check; - #[tokio::test] #[cfg(test)] async fn test_plugins() { + use crate::daemon_check; use re_set_lib::utils::plugin::plugin_tests; + use re_set_lib::utils::plugin_setup::FRONTEND_PLUGINS; + use std::thread; + use std::time::Duration; tokio::task::spawn(daemon_check()); thread::sleep(Duration::from_millis(2000)); unsafe {