Skip to content

Commit b50bf3e

Browse files
committed
Run labwc-gtktheme.py if labwc-theme-name is GTK
1 parent 17ba688 commit b50bf3e

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ purposes of testing labwc during development. Don't expect too much :smile:
88

99
<img src="https://user-images.githubusercontent.com/1019119/151689576-e9934712-f134-44a7-b5e7-3c05181b1a38.png" />
1010

11+
If you install labwc-gtktheme.py and set labwc-theme to GTK it'll
12+
automatically sync with the selected GTK theme.
13+
1114
### build
1215

1316
```
@@ -23,6 +26,5 @@ ninja -C build install
2326

2427
This installs the binary to /usr/local/bin and data files to their respective locations.
2528

26-
2729
If you find it a useful tool and want to expand its scope, feel free.
2830

main.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#define _POSIX_C_SOURCE 200809L
2+
#include <assert.h>
23
#include <gio/gio.h>
34
#include <gtk/gtk.h>
45
#include <string.h>
@@ -21,6 +22,19 @@ static struct themes cursor_themes = { 0 };
2122

2223
static GSettings *settings;
2324

25+
void
26+
spawn_sync(char const *command)
27+
{
28+
GError *err = NULL;
29+
assert(command);
30+
g_spawn_command_line_sync(command, NULL, NULL, NULL, &err);
31+
if (err) {
32+
fprintf(stderr, "warn: could not find %s\n", command);
33+
g_error_free(err);
34+
}
35+
}
36+
37+
2438
static void
2539
environment_set(const char *key, const char *value)
2640
{
@@ -85,6 +99,11 @@ update(GtkWidget *widget, gpointer data)
8599
/* ~/.config/labwc/environment */
86100
environment_set("XCURSOR_THEME", COMBO_TEXT(cursor_theme_name));
87101

102+
103+
if (!strcmp(COMBO_TEXT(openbox_theme_name), "GTK")) {
104+
spawn_sync("labwc-gtktheme.py");
105+
}
106+
88107
/* reconfigure labwc */
89108
if (!fork()) {
90109
execl("/bin/sh", "/bin/sh", "-c", "killall -s SIGHUP labwc", (void *)NULL);

0 commit comments

Comments
 (0)