aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2020-09-20 11:13:53 -0400
committerB Stack <bgstack15@gmail.com>2020-09-20 11:13:53 -0400
commitfc36604e4522ab7b2cb8309e8727e6664a92dc92 (patch)
tree253150c367ba39724a7d91b04fe3aa94539b71c3
downloadthemedetector-fc36604e4522ab7b2cb8309e8727e6664a92dc92.tar.gz
themedetector-fc36604e4522ab7b2cb8309e8727e6664a92dc92.tar.bz2
themedetector-fc36604e4522ab7b2cb8309e8727e6664a92dc92.zip
initial commitHEADmaster
-rw-r--r--README.md15
-rw-r--r--debian/README.Debian5
-rw-r--r--debian/changelog5
-rw-r--r--debian/control19
-rw-r--r--debian/copyright17
-rw-r--r--debian/patches/series1
-rwxr-xr-xdebian/rules9
-rw-r--r--debian/source/format1
-rw-r--r--debian/source/lintian-overrides2
-rw-r--r--debian/source/local-options2
-rw-r--r--debian/themedetector+devuan.dsc14
-rw-r--r--debian/themedetector.install1
-rw-r--r--debian/themedetector.lintian-overrides3
-rw-r--r--debian/watch2
-rw-r--r--src/Makefile29
-rw-r--r--src/themedetector.1.txt18
-rw-r--r--src/themedetector.c9
-rwxr-xr-xsrc/themedetector.py6
18 files changed, 158 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..22e5f10
--- /dev/null
+++ b/README.md
@@ -0,0 +1,15 @@
+# README for themedetector
+## Overview
+This is a small utility that makes it easy to discover what the current default theme is for gtk3. Patches are welcome for providing support for other versions of gtk.
+
+Implementations exist in C and in Python3. You will need gtk3 development headers to compile the C one.
+
+## Purpose
+Because [reading](https://bgstack15.wordpress.com/2019/07/21/set-gtk2-and-gtk3-themes-in-fluxbox/) `~/.gtkrc-2.0` or `~/.config/gtk-3.0/settings.ini` should be a oneliner!
+
+## Additional thoughts
+You should run these programs with stderr redirected to null (i.e., `2>/dev/null`) if your theme causes Gtk minor indigestion.
+
+## References
+### Weblinks
+1. C version lifted entirely from [stackoverflow #54365212](https://stackoverflow.com/questions/54365212/gtk2-vs-gtk3-detect-gtk3-theme-in-bash-script/54384946#54384946)
diff --git a/debian/README.Debian b/debian/README.Debian
new file mode 100644
index 0000000..eeefd18
--- /dev/null
+++ b/debian/README.Debian
@@ -0,0 +1,5 @@
+themedetector for Debian
+
+This is the reference package.
+
+ -- Ben Stack <bgstack15@gmail.com> Sun, 20 Sep 2020 10:11:58 -0400
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..c957060
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+themedetector (0.0.1-1+devuan) obs; urgency=low
+
+ * Initial release. Closes: packages-want#999
+
+ -- Ben Stack <bgstack15@gmail.com> Sun, 20 Sep 2020 10:11:58 -0400
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..8b3b4ed
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,19 @@
+Source: themedetector
+Section: x11
+Priority: optional
+Maintainer: Ben Stack <bgstack15@gmail.com>
+Build-Depends: debhelper-compat (= 12),
+ bgscripts-core (>= 1.5.0),
+ libgtk-3-dev,
+ txt2man
+Standards-Version: 4.5.0
+Homepage: https://bgstack15.wordpress.com/
+
+Package: themedetector
+Architecture: any
+Multi-Arch: foreign
+Depends: ${misc:Depends}, ${shlibs:Depends},
+ python3
+Description: Detect the default gtk3 theme
+ Implemented in C and Python, themedetector merely
+ prints to standard output the current gtk3 theme.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..72ce486
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,17 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: themedetector
+Upstream-Contact: <preferred name and address to reach the upstream project>
+Source: <url://example.com>
+#
+# Please double check copyright with the licensecheck(1) command.
+
+Files: README.md
+ src/Makefile
+ src/themedetector.c
+ src/themedetector.py
+Copyright: __NO_COPYRIGHT_NOR_LICENSE__
+License: __NO_COPYRIGHT_NOR_LICENSE__
+
+#----------------------------------------------------------------------------
+# Files marked as NO_LICENSE_TEXT_FOUND may be covered by the following
+# license/copyright files.
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..4a97dfa
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+# You must remove unused comment lines for the released package.
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..aec532a
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,9 @@
+#!/usr/bin/make -f
+# You must remove unused comment lines for the released package.
+#export DH_VERBOSE = 1
+#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
+#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
+#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
+
+%:
+ dh $@ --sourcedirectory=src
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides
new file mode 100644
index 0000000..2da37ed
--- /dev/null
+++ b/debian/source/lintian-overrides
@@ -0,0 +1,2 @@
+file-without-copyright-information
+missing-license-paragraph-in-dep5-copyright
diff --git a/debian/source/local-options b/debian/source/local-options
new file mode 100644
index 0000000..00131ee
--- /dev/null
+++ b/debian/source/local-options
@@ -0,0 +1,2 @@
+#abort-on-upstream-changes
+#unapply-patches
diff --git a/debian/themedetector+devuan.dsc b/debian/themedetector+devuan.dsc
new file mode 100644
index 0000000..8cfdfd9
--- /dev/null
+++ b/debian/themedetector+devuan.dsc
@@ -0,0 +1,14 @@
+Format: 3.0 (quilt)
+Source: themedetector
+Binary: themedetector
+Architecture: any
+Version: 0.0.1-1+devuan
+Maintainer: Ben Stack <bgstack15@gmail.com>
+Homepage: https://bgstack15.wordpress.com/
+Standards-Version: 4.5.0
+Build-Depends: debhelper-compat (= 12), bgscripts-core (>= 1.5.0), libgtk-3-dev, txt2man
+Package-List:
+ themedetector deb x11 optional arch=any
+Files:
+ 00000000000000000000000000000000 1 themedetector.orig.tar.gz
+ 00000000000000000000000000000000 1 themedetector+devuan.debian.tar.xz
diff --git a/debian/themedetector.install b/debian/themedetector.install
new file mode 100644
index 0000000..b16b170
--- /dev/null
+++ b/debian/themedetector.install
@@ -0,0 +1 @@
+src/themedetector /usr/bin
diff --git a/debian/themedetector.lintian-overrides b/debian/themedetector.lintian-overrides
new file mode 100644
index 0000000..0613595
--- /dev/null
+++ b/debian/themedetector.lintian-overrides
@@ -0,0 +1,3 @@
+copyright-has-url-from-dh_make-boilerplate
+copyright-without-copyright-notice
+script-with-language-extension usr/bin/themedetector.py
diff --git a/debian/watch b/debian/watch
new file mode 100644
index 0000000..76575dc
--- /dev/null
+++ b/debian/watch
@@ -0,0 +1,2 @@
+# You must remove unused comment lines for the released package.
+version=3
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'))
bgstack15