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:
@@ -33,6 +33,9 @@ animation-duration = 0
|
|||||||
# or when a whole output is selected with a mouse button.
|
# or when a whole output is selected with a mouse button.
|
||||||
quick-select = false
|
quick-select = false
|
||||||
|
|
||||||
|
# If true, dulcepan will remember selection between runs
|
||||||
|
persistence = true
|
||||||
|
|
||||||
# PNG (zlib) compression level, 0-9
|
# PNG (zlib) compression level, 0-9
|
||||||
png-compression = 6
|
png-compression = 6
|
||||||
|
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ void dp_config_load(struct dp_state *state, const char *user_path) {
|
|||||||
.animation_duration = 0,
|
.animation_duration = 0,
|
||||||
.png_compression = 6,
|
.png_compression = 6,
|
||||||
.quick_select = false,
|
.quick_select = false,
|
||||||
|
.persistence = true,
|
||||||
};
|
};
|
||||||
bytes_to_color((uint8_t[]){0xff, 0xff, 0xff, 0x40}, config->unselected_color);
|
bytes_to_color((uint8_t[]){0xff, 0xff, 0xff, 0x40}, config->unselected_color);
|
||||||
bytes_to_color((uint8_t[]){0x00, 0x00, 0x00, 0x00}, config->selected_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);
|
load_int(value, line_idx, 0, 9, &config->png_compression);
|
||||||
} else if (strcmp(key, "quick-select") == 0) {
|
} else if (strcmp(key, "quick-select") == 0) {
|
||||||
load_bool(value, line_idx, &config->quick_select);
|
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) {
|
} else if (strcmp(key, "quit-key") == 0) {
|
||||||
load_key(value, line_idx, &config->quit_key);
|
load_key(value, line_idx, &config->quit_key);
|
||||||
} else if (strcmp(key, "save-key") == 0) {
|
} else if (strcmp(key, "save-key") == 0) {
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ struct dp_config {
|
|||||||
|
|
||||||
int png_compression;
|
int png_compression;
|
||||||
bool quick_select;
|
bool quick_select;
|
||||||
|
bool persistence;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dp_state {
|
struct dp_state {
|
||||||
|
|||||||
@@ -108,7 +108,9 @@ static void run(struct dp_state *state) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (state->config.persistence) {
|
||||||
dp_persistent_load(state);
|
dp_persistent_load(state);
|
||||||
|
}
|
||||||
|
|
||||||
wl_list_for_each (output, &state->outputs, link) {
|
wl_list_for_each (output, &state->outputs, link) {
|
||||||
dp_output_redraw(output);
|
dp_output_redraw(output);
|
||||||
@@ -128,7 +130,9 @@ static void run(struct dp_state *state) {
|
|||||||
dp_save(state);
|
dp_save(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (state->config.persistence) {
|
||||||
dp_persistent_save(state);
|
dp_persistent_save(state);
|
||||||
|
}
|
||||||
|
|
||||||
struct dp_seat *seat, *seat_tmp;
|
struct dp_seat *seat, *seat_tmp;
|
||||||
wl_list_for_each_safe (seat, seat_tmp, &state->seats, link) {
|
wl_list_for_each_safe (seat, seat_tmp, &state->seats, link) {
|
||||||
|
|||||||
Reference in New Issue
Block a user