diff --git a/.rustfmt.toml b/.rustfmt.toml index 324bf8b..9d5c77e 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -1,26 +1,26 @@ -condense_wildcard_suffixes = true +condense_wildcard_suffixes = true doc_comment_code_block_width = 80 -edition = "2024" # Keep in sync with Cargo.toml. +edition = "2024" # Keep in sync with Cargo.toml. enum_discrim_align_threshold = 60 -force_explicit_abi = false -force_multiline_blocks = true -format_code_in_doc_comments = true -format_macro_matchers = true -format_strings = true -group_imports = "StdExternalCrate" -hex_literal_case = "Upper" -imports_granularity = "Crate" -imports_layout = "HorizontalVertical" -inline_attribute_width = 60 -match_block_trailing_comma = true -max_width = 80 -newline_style = "Unix" -normalize_comments = true -normalize_doc_attributes = true -overflow_delimited_expr = true +force_explicit_abi = false +force_multiline_blocks = true +format_code_in_doc_comments = true +format_macro_matchers = true +format_strings = true +group_imports = "StdExternalCrate" +hex_literal_case = "Upper" +imports_granularity = "Crate" +imports_layout = "HorizontalVertical" +inline_attribute_width = 60 +match_block_trailing_comma = true +max_width = 80 +newline_style = "Unix" +normalize_comments = true +normalize_doc_attributes = true +overflow_delimited_expr = true struct_field_align_threshold = 60 -tab_spaces = 2 -unstable_features = true -use_field_init_shorthand = true -use_try_shorthand = true -wrap_comments = true +tab_spaces = 2 +unstable_features = true +use_field_init_shorthand = true +use_try_shorthand = true +wrap_comments = true diff --git a/.taplo.toml b/.taplo.toml index b19e6b9..fae0c57 100644 --- a/.taplo.toml +++ b/.taplo.toml @@ -11,4 +11,3 @@ keys = [ "package" ] [rule.formatting] reorder_keys = false - diff --git a/Cargo.lock b/Cargo.lock index c2882f3..3c67fbf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -386,9 +386,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "clap" -version = "4.5.56" +version = "4.5.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75ca66430e33a14957acc24c5077b503e7d374151b2b4b3a10c83b4ceb4be0e" +checksum = "2797f34da339ce31042b27d23607e051786132987f595b02ba4f6a6dffb7030a" dependencies = [ "clap_builder", "clap_derive", @@ -406,9 +406,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.56" +version = "4.5.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793207c7fa6300a0608d1080b858e5fdbe713cdc1c8db9fb17777d8a13e63df0" +checksum = "24a241312cea5059b13574bb9b3861cabf758b879c15190b37b6d6fd63ab6876" dependencies = [ "anstream", "anstyle", @@ -430,9 +430,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.7" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3e64b0cc0439b12df2fa678eae89a1c56a529fd067a9115f7827f1fffd22b32" +checksum = "3a822ea5bc7590f9d40f1ba12c0dc3c2760f3482c6984db1573ad11031420831" [[package]] name = "color-eyre" @@ -1056,9 +1056,9 @@ dependencies = [ [[package]] name = "inquire" -version = "0.9.2" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae51d5da01ce7039024fbdec477767c102c454dbdb09d4e2a432ece705b1b25d" +checksum = "6654738b8024300cf062d04a1c13c10c8e2cea598ec1c47dc9b6641159429756" dependencies = [ "bitflags 2.10.0", "crossterm", @@ -1160,9 +1160,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.180" +version = "0.2.182" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" +checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112" [[package]] name = "libredox" @@ -1196,9 +1196,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" [[package]] name = "litrs" @@ -1346,9 +1346,9 @@ dependencies = [ [[package]] name = "notify-rust" -version = "4.11.7" +version = "4.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6442248665a5aa2514e794af3b39661a8e73033b1cc5e59899e1276117ee4400" +checksum = "21af20a1b50be5ac5861f74af1a863da53a11c38684d9818d82f1c42f7fdc6c2" dependencies = [ "futures-lite", "log", @@ -1860,9 +1860,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.12.2" +version = "1.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" dependencies = [ "aho-corasick", "memchr", @@ -1929,9 +1929,9 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" dependencies = [ "bitflags 2.10.0", "errno", @@ -2224,9 +2224,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.24.0" +version = "3.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c" +checksum = "82a72c767771b47409d2345987fda8628641887d5466101319899796367354a0" dependencies = [ "fastrand", "getrandom 0.3.4", diff --git a/Cargo.toml b/Cargo.toml index d2bfe15..51e12ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ authors = [ "NotAShelf " ] license = "MPL-2.0" readme = true repository = "https://github.com/notashelf/stash" -rust-version = "1.90" +rust-version = "1.91.0" [[bin]] name = "stash" # actual binary name for Nix, Cargo, etc. @@ -15,7 +15,7 @@ path = "src/main.rs" [dependencies] base64 = "0.22.1" -clap = { version = "4.5.56", features = [ "derive", "env" ] } +clap = { version = "4.5.60", features = [ "derive", "env" ] } clap-verbosity-flag = "3.0.4" color-eyre = "0.6.5" crossterm = "0.29.0" @@ -24,12 +24,12 @@ dirs = "6.0.0" env_logger = "0.11.8" humantime = "2.3.0" imagesize = "0.14.0" -inquire = { version = "0.9.2", default-features = false, features = [ "crossterm" ] } -libc = "0.2.180" +inquire = { version = "0.9.4", default-features = false, features = [ "crossterm" ] } +libc = "0.2.182" log = "0.4.29" -notify-rust = { version = "4.11.7", optional = true } +notify-rust = { version = "4.12.0", optional = true } ratatui = "0.30.0" -regex = "1.12.2" +regex = "1.12.3" rusqlite = { version = "0.38.0", features = [ "bundled" ] } serde = { version = "1.0.228", features = [ "derive" ] } serde_json = "1.0.149" @@ -42,7 +42,7 @@ wayland-protocols-wlr = { version = "0.3.10", default-features = false, optional wl-clipboard-rs = "0.9.3" [dev-dependencies] -tempfile = "3.24.0" +tempfile = "3.26.0" [features] default = [ "notifications", "use-toplevel" ] diff --git a/build.rs b/build.rs index f777a7c..b511acb 100644 --- a/build.rs +++ b/build.rs @@ -4,6 +4,9 @@ use std::{env, fs, path::Path}; const MULTICALL_LINKS: &[&str] = &["stash-copy", "stash-paste", "wl-copy", "wl-paste"]; +/// Wayland-specific symlinks that can be disabled separately +const WAYLAND_LINKS: &[&str] = &["wl-copy", "wl-paste"]; + fn main() { // OUT_DIR is something like .../target/debug/build//out // We want .../target/debug or .../target/release @@ -16,8 +19,24 @@ fn main() { // Path to the main stash binary let stash_bin = bin_dir.join("stash"); + // Check for environment variables to disable symlinking + let disable_all_symlinks = env::var("STASH_NO_SYMLINKS").is_ok(); + let disable_wayland_symlinks = env::var("STASH_NO_WL_SYMLINKS").is_ok(); + // Create symlinks for each multicall binary for link in MULTICALL_LINKS { + if disable_all_symlinks { + println!("cargo:warning=Skipping symlink {link} (all symlinks disabled)"); + continue; + } + + if disable_wayland_symlinks && WAYLAND_LINKS.contains(link) { + println!( + "cargo:warning=Skipping symlink {link} (wayland symlinks disabled)" + ); + continue; + } + let link_path = bin_dir.join(link); // Remove existing symlink or file if present let _ = fs::remove_file(&link_path); diff --git a/nix/package.nix b/nix/package.nix index 336926a..b068d4a 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -4,9 +4,10 @@ stdenv, mold, versionCheckHook, + createSymlinks ? true, }: let pname = "stash"; - version = (builtins.fromTOML (builtins.readFile ../Cargo.toml)).package.version; + version = (lib.importTOML ../Cargo.toml).package.version; src = let fs = lib.fileset; s = ../.; @@ -36,7 +37,7 @@ in # generated by the build wrapper are correctly linked, we should link # them *manually*. The postInstallCheck phase that follows will check # to verify if all of those links are in place. - postInstall = '' + postInstall = lib.optionalString createSymlinks '' mkdir -p $out for bin in stash-copy stash-paste wl-copy wl-paste; do ln -sf $out/bin/stash $out/bin/$bin @@ -48,7 +49,7 @@ in # After the version check, let's see if all binaries are linked correctly. # We could probably add a check phase to get the versions of each. - postInstallCheck = '' + postInstallCheck = lib.optionalString createSymlinks '' for bin in stash stash-copy stash-paste wl-copy wl-paste; do [ -x "$out/bin/$bin" ] || { echo "$bin missing"; exit 1; } done @@ -65,5 +66,6 @@ in license = lib.licenses.mpl20; maintainers = [lib.maintainers.NotAShelf]; mainProgram = "stash"; + platforms = lib.platforms.linux; }; }