Merge branch 'gsettings'

This commit is contained in:
Mars-Wave
2026-09-15 19:27:20 +02:00
5 changed files with 48 additions and 0 deletions
+4
View File
@@ -27,3 +27,7 @@ License: MIT
Files: protocol/wlr-screencopy-unstable-v1.xml
Copyright: 2018 Simon Ser
License: MIT
Files: resources/wdisplays.gschema.xml
Copyright: 2026 Lauren Lagarde <lauren@lagarde.dev>
License: MIT
+8
View File
@@ -48,3 +48,11 @@ install_data(
output: '@0@.desktop'.format(meson.project_name()),
configuration: conf),
install_dir: get_option('datadir') / 'applications')
install_data('wdisplays.gschema.xml',
rename: '@0@.gschema.xml'.format(meson.project_name()),
install_dir: get_option('datadir') / 'glib-2.0' / 'schemas')
gnome.post_install(
glib_compile_schemas: true
)
+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<schemalist>
<schema id="network.cycles.wdisplays" path="/network/cycles/wdisplays/">
<key name="auto-apply" type="b">
<default>false</default>
</key>
<key name="capture-screens" type="b">
<default>true</default>
</key>
<key name="show-overlay" type="b">
<default>true</default>
</key>
</schema>
</schemalist>
+20
View File
@@ -486,6 +486,7 @@ static void cleanup(GtkWidget *window, gpointer data) {
g_object_unref(state->grab_cursor);
g_object_unref(state->grabbing_cursor);
g_object_unref(state->move_cursor);
g_clear_object(&state->settings);
wd_state_destroy(state);
}
@@ -915,6 +916,9 @@ static void info_bar_animation_done(GObject *object, GParamSpec *pspec, gpointer
static void auto_apply_selected(GSimpleAction *action, GVariant *param, gpointer data) {
struct wd_state *state = data;
if (state->settings != NULL) {
g_settings_set_boolean(state->settings, "auto-apply", g_variant_get_boolean(param));
}
state->autoapply = g_variant_get_boolean(param);
g_simple_action_set_state(action, param);
}
@@ -928,6 +932,9 @@ static gboolean redraw_canvas(GtkWidget *widget, GdkFrameClock *frame_clock, gpo
static void capture_selected(GSimpleAction *action, GVariant *param, gpointer data) {
struct wd_state *state = data;
if (state->settings != NULL) {
g_settings_set_boolean(state->settings, "capture-screens", g_variant_get_boolean(param));
}
state->capture = g_variant_get_boolean(param);
g_simple_action_set_state(action, param);
update_tick_callback(state);
@@ -935,6 +942,9 @@ static void capture_selected(GSimpleAction *action, GVariant *param, gpointer da
static void overlay_selected(GSimpleAction *action, GVariant *param, gpointer data) {
struct wd_state *state = data;
if (state->settings != NULL) {
g_settings_set_boolean(state->settings, "show-overlay", g_variant_get_boolean(param));
}
state->show_overlay = g_variant_get_boolean(param);
g_simple_action_set_state(action, param);
@@ -1075,6 +1085,16 @@ static void activate(GtkApplication* app, gpointer user_data) {
g_signal_connect(action, "activate", G_CALLBACK(zoom_in), state);
g_action_map_add_action(G_ACTION_MAP(main_actions), G_ACTION(action));
GSettingsSchemaSource *schemas = g_settings_schema_source_get_default();
g_autoptr(GSettingsSchema) schema = schemas == NULL ? NULL :
g_settings_schema_source_lookup(schemas, WDISPLAYS_APP_ID, TRUE);
if (schema != NULL) {
state->settings = g_settings_new(WDISPLAYS_APP_ID);
state->autoapply = g_settings_get_boolean(state->settings, "auto-apply");
state->capture = g_settings_get_boolean(state->settings, "capture-screens");
state->show_overlay = g_settings_get_boolean(state->settings, "show-overlay");
}
action = g_simple_action_new_stateful("auto-apply", NULL,
g_variant_new_boolean(state->autoapply));
g_signal_connect(action, "change-state", G_CALLBACK(auto_apply_selected), state);
+2
View File
@@ -221,6 +221,8 @@ struct wd_state {
GtkWidget *info_label;
GtkWidget *menu_button;
GSettings *settings;
GdkCursor *grab_cursor;
GdkCursor *grabbing_cursor;
GdkCursor *move_cursor;