diff options
author | B Stack <bgstack15@gmail.com> | 2020-09-20 11:13:53 -0400 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2020-09-20 11:13:53 -0400 |
commit | fc36604e4522ab7b2cb8309e8727e6664a92dc92 (patch) | |
tree | 253150c367ba39724a7d91b04fe3aa94539b71c3 /src | |
download | themedetector-master.tar.gz themedetector-master.tar.bz2 themedetector-master.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 29 | ||||
-rw-r--r-- | src/themedetector.1.txt | 18 | ||||
-rw-r--r-- | src/themedetector.c | 9 | ||||
-rwxr-xr-x | src/themedetector.py | 6 |
4 files changed, 62 insertions, 0 deletions
diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..df15bbf --- /dev/null +++ b/src/Makefile @@ -0,0 +1,29 @@ +LDFLAGS = -g $(shell pkg-config gtk+-3.0 --cflags --libs 2>/dev/null) +txt2manwrapper :=$(shell which txt2man-wrapper ) + +.PHONY: clean install + +all: themedetector + +themedetector: + $(CC) -o $@ $@.c $(LDFLAGS) + +MAN_TXT=$(wildcard *.txt) +MAN_GZ=$(subst .txt,.gz,$(MAN_TXT)) + +$(MAN_GZ): %.gz: %.txt + ${txt2manwrapper} - < $< | $(shell which gzip) > $@ + +install: themedetector $(MAN_GZ) + install -d $(DESTDIR)/usr/bin $(DESTDIR)/usr/share/man/man1 + install -m0755 -t $(DESTDIR)/usr/bin themedetector themedetector.py + install -m0644 -t $(DESTDIR)/usr/share/man/man1 themedetector.1.gz + ln -s themedetector.1.gz $(DESTDIR)/usr/share/man/man1/themedetector.py.1.gz + +uninstall: + rm -f $(DESTDIR)/usr/bin/themedetector $(DESTDIR)/usr/bin/themedetector.py \ + $(DESTDIR)/usr/share/man/man1/themedetector.1.gz \ + $(DESTDIR)/usr/share/man/man1/themedetector.py.1.gz + +clean: + rm -f themedetector themedetector.1.gz diff --git a/src/themedetector.1.txt b/src/themedetector.1.txt new file mode 100644 index 0000000..96a7b38 --- /dev/null +++ b/src/themedetector.1.txt @@ -0,0 +1,18 @@ +title themedetector +section 1 +project themedetector +date September 2020 +volume General Commands Manual +===== +NAME + themedetector - show default gtk3 theme +SYNOPSIS + themedetector +DESCRIPTION + `themedetector` merely loads gtk3 enough to print to standard output the default theme. +AUTHOR + <bgstack15@gmail.com> +COPYRIGHT + CC-BY-SA 4.0 +BUGS +* Does not support gtk2 diff --git a/src/themedetector.c b/src/themedetector.c new file mode 100644 index 0000000..04a1aba --- /dev/null +++ b/src/themedetector.c @@ -0,0 +1,9 @@ +// https://stackoverflow.com/questions/54365212/gtk2-vs-gtk3-detect-gtk3-theme-in-bash-script/54384946#54384946 +#include <stdio.h> +#include <gtk/gtk.h> +int main() { + gchar *prop; + gtk_init(0, 0); + g_object_get(gtk_settings_get_default(), "gtk-theme-name", &prop, 0); + return !printf("%s\n", prop); +} diff --git a/src/themedetector.py b/src/themedetector.py new file mode 100755 index 0000000..1d22a67 --- /dev/null +++ b/src/themedetector.py @@ -0,0 +1,6 @@ +#!/usr/bin/python3 +import gi +gi.require_version("Gtk","3.0") +from gi.repository import Gtk +settings=Gtk.Settings.get_default() +print(settings.get_property('gtk-theme-name')) |