1
0
mirror of https://codeberg.org/vyivel/dulcepan/ synced 2025-12-23 10:16:47 +02:00

Add option to disable persistence

This commit is contained in:
Alexey Yerin
2024-06-30 17:47:31 +03:00
parent 4c7575b10e
commit 56860d672f
4 changed files with 13 additions and 2 deletions

View File

@@ -33,6 +33,9 @@ animation-duration = 0
# or when a whole output is selected with a mouse button.
quick-select = false
# If true, dulcepan will remember selection between runs
persistence = true
# PNG (zlib) compression level, 0-9
png-compression = 6

View File

@@ -98,6 +98,7 @@ void dp_config_load(struct dp_state *state, const char *user_path) {
.animation_duration = 0,
.png_compression = 6,
.quick_select = false,
.persistence = true,
};
bytes_to_color((uint8_t[]){0xff, 0xff, 0xff, 0x40}, config->unselected_color);
bytes_to_color((uint8_t[]){0x00, 0x00, 0x00, 0x00}, config->selected_color);
@@ -211,6 +212,8 @@ void dp_config_load(struct dp_state *state, const char *user_path) {
load_int(value, line_idx, 0, 9, &config->png_compression);
} else if (strcmp(key, "quick-select") == 0) {
load_bool(value, line_idx, &config->quick_select);
} else if (strcmp(key, "persistence") == 0) {
load_bool(value, line_idx, &config->persistence);
} else if (strcmp(key, "quit-key") == 0) {
load_key(value, line_idx, &config->quit_key);
} else if (strcmp(key, "save-key") == 0) {

View File

@@ -156,6 +156,7 @@ struct dp_config {
int png_compression;
bool quick_select;
bool persistence;
};
struct dp_state {

View File

@@ -108,7 +108,9 @@ static void run(struct dp_state *state) {
}
}
dp_persistent_load(state);
if (state->config.persistence) {
dp_persistent_load(state);
}
wl_list_for_each (output, &state->outputs, link) {
dp_output_redraw(output);
@@ -128,7 +130,9 @@ static void run(struct dp_state *state) {
dp_save(state);
}
dp_persistent_save(state);
if (state->config.persistence) {
dp_persistent_save(state);
}
struct dp_seat *seat, *seat_tmp;
wl_list_for_each_safe (seat, seat_tmp, &state->seats, link) {