stash: blocking persistent entries by window class

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964061bd97b4ffc4e84d835072331a966c6
This commit is contained in:
raf 2025-09-19 11:18:57 +03:00
commit 36c183742d
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
7 changed files with 483 additions and 19 deletions

View file

@ -10,6 +10,7 @@ use inquire::Confirm;
mod commands;
mod db;
#[cfg(feature = "use-toplevel")] mod wayland;
use crate::commands::{
decode::DecodeCommand,
@ -47,6 +48,11 @@ struct Cli {
#[arg(long)]
db_path: Option<PathBuf>,
/// Application names to exclude from clipboard history
#[cfg(feature = "use-toplevel")]
#[arg(long, value_delimiter = ',', env = "STASH_EXCLUDED_APPS")]
excluded_apps: Vec<String>,
/// Ask for confirmation before destructive operations
#[arg(long)]
ask: bool,
@ -160,7 +166,16 @@ fn main() {
Some(Command::Store) => {
let state = env::var("STASH_CLIPBOARD_STATE").ok();
report_error(
db.store(io::stdin(), cli.max_dedupe_search, cli.max_items, state),
db.store(
io::stdin(),
cli.max_dedupe_search,
cli.max_items,
state,
#[cfg(feature = "use-toplevel")]
&cli.excluded_apps,
#[cfg(not(feature = "use-toplevel"))]
&[],
),
"Failed to store entry",
);
},
@ -313,7 +328,14 @@ fn main() {
}
},
Some(Command::Watch) => {
db.watch(cli.max_dedupe_search, cli.max_items);
db.watch(
cli.max_dedupe_search,
cli.max_items,
#[cfg(feature = "use-toplevel")]
&cli.excluded_apps,
#[cfg(not(feature = "use-toplevel"))]
&[],
);
},
None => {
if let Err(e) = Cli::command().print_help() {