Skip to content

Commit

Permalink
clipmenud: Allow specifying which selections to own
Browse files Browse the repository at this point in the history
This will supplant the old CM_SYNC_* options.
  • Loading branch information
cdown committed Apr 10, 2024
1 parent c06e363 commit 1ac45bd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/clipmenud.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ static int handle_property_notify(const XPropertyEvent *pe) {
*/
enum selection_type sel =
storage_atom_to_selection_type(pe->atom, sels);
if (sel == CM_SEL_CLIPBOARD && cfg.own_clipboard) {
if (cfg.owned_selections[sel].active && cfg.own_clipboard) {
run_clipserve(hash);
}
} else {
Expand Down
3 changes: 3 additions & 0 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ int config_setup_internal(FILE *file, struct config *cfg) {
"0", 0},
{"selections", "CM_SELECTIONS", &cfg->selections, convert_selections,
"clipboard primary", 0},
{"own_selections", "CM_OWN_SELECTIONS", &cfg->owned_selections,
convert_selections, "clipboard", 0},
{"ignore_window", "CM_IGNORE_WINDOW", &cfg->ignore_window,
convert_ignore_window, NULL, 0},
{"launcher", "CM_LAUNCHER", &cfg->launcher, convert_launcher, "dmenu",
Expand Down Expand Up @@ -307,6 +309,7 @@ void config_free(struct config *cfg) {
free(cfg->runtime_dir);
free(cfg->launcher.custom);
free(cfg->selections);
free(cfg->owned_selections);
if (cfg->ignore_window.set) {
regfree(&cfg->ignore_window.rgx);
}
Expand Down
1 change: 1 addition & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ struct config {
int max_clips_batch;
int oneshot;
bool own_clipboard;
struct selection *owned_selections;
struct selection *selections;
struct ignore_window ignore_window;
struct launcher launcher;
Expand Down

0 comments on commit 1ac45bd

Please sign in to comment.