diff --git a/append5.diff b/append5.diff deleted file mode 100644 index 84d0090..0000000 --- a/append5.diff +++ /dev/null @@ -1,94 +0,0 @@ -diff --git a/gtk3proxies/CMakeLists.txt b/gtk3proxies/CMakeLists.txt -index 62becb4..2e8d236 100644 ---- a/gtk3proxies/CMakeLists.txt -+++ b/gtk3proxies/CMakeLists.txt -@@ -2,7 +2,7 @@ find_package(GTK3 REQUIRED) - - include_directories(${GTK3_INCLUDE_DIRS}) - --add_executable(gtk3_preview preview3.c) --target_compile_definitions(gtk3_preview PRIVATE "-DDATA_DIR=\"${DATA_INSTALL_DIR}/kcm-gtk-module/\"") --target_link_libraries(gtk3_preview ${GTK3_LIBRARY} ${GOBJECT2_LIBRARY} ${GLIB2_LIBRARY}) --install(TARGETS gtk3_preview RUNTIME DESTINATION "${LIBEXEC_INSTALL_DIR}") -+add_executable(gtk3_preview5 preview3.c) -+target_compile_definitions(gtk3_preview5 PRIVATE "-DDATA_DIR=\"${DATA_INSTALL_DIR}/kcm-gtk-module/\"") -+target_link_libraries(gtk3_preview5 ${GTK3_LIBRARY} ${GOBJECT2_LIBRARY} ${GLIB2_LIBRARY}) -+install(TARGETS gtk3_preview5 RUNTIME DESTINATION "${LIBEXEC_INSTALL_DIR}") -diff --git a/gtk3proxies/preview3.c b/gtk3proxies/preview3.c -index f5b10d0..a8b80fb 100644 ---- a/gtk3proxies/preview3.c -+++ b/gtk3proxies/preview3.c -@@ -32,7 +32,7 @@ void printHelp() - "Small utility for previewing Gtk3 theme.\n" - "\n" - "Using:\n" -- "gtk3_preview \n" -+ "gtk3_preview5 \n" - "\n" - "Arguments:\n" - " -h, --help\tShows this help\n" -@@ -62,7 +62,7 @@ int main(int argc, char **argv) - return 0; - } - else if(strcmp("-V", argv[i])==0 || strcmp("--version", argv[i])==0) { -- printf("gtk2_preview version 1.0\n"); -+ printf("gtk2_preview5 version 1.0\n"); - return 0; - } else if(argc>1) - sscanf(argv[1], "%ld", &wid); -diff --git a/gtkproxies/CMakeLists.txt b/gtkproxies/CMakeLists.txt -index fe8e1a0..1ff5a78 100644 ---- a/gtkproxies/CMakeLists.txt -+++ b/gtkproxies/CMakeLists.txt -@@ -7,10 +7,10 @@ target_link_libraries(reload_gtk_apps ${GTK2_LIBRARIES}) - install(TARGETS reload_gtk_apps RUNTIME DESTINATION "${LIBEXEC_INSTALL_DIR}") - - --add_executable(gtk_preview preview.c) --target_compile_definitions(gtk_preview PRIVATE "-DDATA_DIR=\"${DATA_INSTALL_DIR}/kcm-gtk-module/\"") --target_link_libraries(gtk_preview ${GTK2_LIBRARIES} ${GTK2_GIOMM_LIBRARY}) --install(TARGETS gtk_preview RUNTIME DESTINATION "${LIBEXEC_INSTALL_DIR}") -+add_executable(gtk_preview5 preview.c) -+target_compile_definitions(gtk_preview5 PRIVATE "-DDATA_DIR=\"${DATA_INSTALL_DIR}/kcm-gtk-module/\"") -+target_link_libraries(gtk_preview5 ${GTK2_LIBRARIES} ${GTK2_GIOMM_LIBRARY}) -+install(TARGETS gtk_preview5 RUNTIME DESTINATION "${LIBEXEC_INSTALL_DIR}") - - # preview file used for the gtk3 version too - install(FILES preview.ui -diff --git a/gtkproxies/preview.c b/gtkproxies/preview.c -index 5b40a44..55825b6 100644 ---- a/gtkproxies/preview.c -+++ b/gtkproxies/preview.c -@@ -55,7 +55,7 @@ void printHelp() - "Small utility for previewing Gtk2 theme.\n" - "\n" - "Using:\n" -- "gtk_preview \n" -+ "gtk_preview5 \n" - "\n" - "Arguments:\n" - " -h, --help\tShows this help\n" -@@ -76,7 +76,7 @@ int main(int argc, char **argv) - return 0; - } - else if(strcmp("-V", argv[i])==0 || strcmp("--version", argv[i])==0) { -- printf("gtk_preview version 1.0\n"); -+ printf("gtk_preview5 version 1.0\n"); - return 0; - } else if(argc>1) - sscanf(argv[1], "%ld", &wid); -diff --git a/src/gtkconfigkcmodule.cpp b/src/gtkconfigkcmodule.cpp -index aea7f1c..a65a2a7 100644 ---- a/src/gtkconfigkcmodule.cpp -+++ b/src/gtkconfigkcmodule.cpp -@@ -82,8 +82,8 @@ GTKConfigKCModule::GTKConfigKCModule(QWidget* parent, const QVariantList& args ) - ui->gtk2Preview->setIcon(previewIcon); - ui->gtk3Preview->setIcon(previewIcon); - -- QString gtk2Preview = QStandardPaths::findExecutable("gtk_preview"); -- QString gtk3Preview = QStandardPaths::findExecutable("gtk3_preview"); -+ QString gtk2Preview = QStandardPaths::findExecutable("gtk_preview5"); -+ QString gtk3Preview = QStandardPaths::findExecutable("gtk3_preview5"); - - m_p2 = new KProcess(this); - m_p2->setEnv("GTK2_RC_FILES", m_tempGtk2Preview, true); diff --git a/gtk3-settings.ini-kde4.template b/gtk3-settings.ini-kde4.template new file mode 100644 index 0000000..6c4fc08 --- /dev/null +++ b/gtk3-settings.ini-kde4.template @@ -0,0 +1,8 @@ +[Settings] +gtk-font-name=Oxygen Regular 9 +gtk-theme-name=@@THEME_NAME@@ +gtk-icon-theme-name=breeze +gtk-fallback-icon-theme=gnome +gtk-toolbar-style=GTK_TOOLBAR_BOTH_HORIZ +gtk-menu-images=1 +gtk-button-images=1 diff --git a/gtkrc-2.0-kde4.template b/gtkrc-2.0-kde4.template new file mode 100644 index 0000000..203f1c3 --- /dev/null +++ b/gtkrc-2.0-kde4.template @@ -0,0 +1,14 @@ +include "/usr/share/themes/@@THEME_NAME@@/gtk-2.0/gtkrc" +include "/etc/gtk-2.0/gtkrc" +style "user-font" +{ + font_name="Oxygen Regular" +} +widget_class "*" style "user-font" +gtk-font-name="Oxygen Regular 9" +gtk-theme-name="@@THEME_NAME@@" +gtk-icon-theme-name="breeze" +gtk-fallback-icon-theme="gnome" +gtk-toolbar-style=GTK_TOOLBAR_BOTH_HORIZ +gtk-menu-images=1 +gtk-button-images=1 diff --git a/kde-gtk-config5.changes b/kde-gtk-config5.changes index 92383eb..79cb1b3 100644 --- a/kde-gtk-config5.changes +++ b/kde-gtk-config5.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Oct 3 17:23:35 UTC 2014 - hrvoje.senjan@gmail.com + +- Add templates for automagic GTK settings in Plasma5 session + ------------------------------------------------------------------- Fri Aug 1 21:34:38 UTC 2014 - hrvoje.senjan@gmail.com diff --git a/kde-gtk-config5.spec b/kde-gtk-config5.spec index ab5ce89..e72f27e 100644 --- a/kde-gtk-config5.spec +++ b/kde-gtk-config5.spec @@ -23,9 +23,11 @@ Summary: KCM Module to Configure GTK2 and GTK3 Applications Appearance Un License: LGPL-3.0+ and GPL-3.0+ Group: System/GUI/KDE Url: https://projects.kde.org/projects/playground/base/kde-gtk-config/ +Source1: kde_gtk_config.suse.sh +Source2: gtkrc-2.0-kde4.template +Source3: gtk3-settings.ini-kde4.template Source: kde-gtk-config-%{version}.tar.xz Source99: kde-gtk-config5-rpmlintrc -Patch0: append5.diff BuildRequires: extra-cmake-modules BuildRequires: karchive-devel BuildRequires: kcmutils-devel @@ -38,6 +40,7 @@ BuildRequires: pkgconfig(Qt5Test) >= 5.2.0 BuildRequires: pkgconfig(Qt5Widgets) >= 5.2.0 BuildRequires: pkgconfig(gtk+-2.0) BuildRequires: pkgconfig(gtk+-3.0) +Conflicts: kde-gtk-config BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -54,7 +57,6 @@ Among its many features, it lets you: %lang_package %prep %setup -q -n kde-gtk-config-%{version} -%patch0 -p1 %build %cmake_kf5 -d build -- -DCMAKE_INSTALL_LOCALEDIR=share/locale/kf5 @@ -63,6 +65,10 @@ Among its many features, it lets you: %install %kf5_makeinstall -C build +install -Dpm 0755 %{SOURCE1} %{buildroot}%{_kf5_configdir}/env/kde_gtk_config.suse.sh +install -Dpm 0644 %{SOURCE2} %{buildroot}%{_kf5_sharedir}/%{name}/gtkrc-2.0-kde4.template +install -Dpm 0644 %{SOURCE3} %{buildroot}%{_kf5_sharedir}/%{name}/gtk3-settings.ini-kde4.template + %post -p /sbin/ldconfig %postun -p /sbin/ldconfig @@ -70,6 +76,8 @@ Among its many features, it lets you: %files %defattr(-,root,root) %doc COPYING* +%{_kf5_configdir}/env/kde_gtk_config.suse.sh +%{_kf5_sharedir}/%{name}/ %config %{_kf5_configdir}/cgcicon.knsrc %config %{_kf5_configdir}/cgctheme.knsrc %config %{_kf5_configdir}/cgcgtk3.knsrc diff --git a/kde_gtk_config.suse.sh b/kde_gtk_config.suse.sh new file mode 100644 index 0000000..2d920cf --- /dev/null +++ b/kde_gtk_config.suse.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +# Defaults for openSUSE +GTK2_SYSCONFDIR=/etc +GTK2_DATADIR=/usr/share/themes/ +GTK3_HOME_CONFDIR="$HOME/.config/gtk-3.0" +GTK3_DATADIR=/usr/share/themes/ + +# Files used by kde-gtk-config +GTK2_THEME_RC="$HOME/.gtkrc-2.0" +GTK3_THEME_RC="$HOME/.config/gtk-3.0/settings.ini" + +# GTK2 +if [ "$GTK2_RC_FILES" ]; then + export GTK2_RC_FILES="$GTK2_RC_FILES:$GTK2_THEME_RC" +else + export GTK2_RC_FILES="$GTK2_SYSCONFDIR/gtk-2.0/gtkrc:$GTK2_THEME_RC" +fi + +# Create the file if it doesn't exist +if [ ! -e "$GTK2_THEME_RC" ]; then + # oxygen-gtk, the default + if [ -e "$GTK2_DATADIR/oxygen-gtk/gtk-2.0/gtkrc" ] ; then + THEME="oxygen-gtk" + # else use QtCurve engine + elif [ -e "$GTK2_DATADIR/QtCurve/gtk-2.0/gtkrc" ] ; then + THEME="QtCurve" + fi + if [ -n "$THEME" ]; then + cp -f /usr/share/kde-gtk-config5/gtkrc-2.0-kde4.template "$GTK2_THEME_RC" + sed -i -e "s,@@THEME_NAME@@,$THEME," "$GTK2_THEME_RC" + fi +fi + +# GTK3 +# Create the file if it doesn't exist +if [ ! -e "$GTK3_THEME_RC" ]; then + # oxygen-gtk, the default + if [ -e "$GTK3_DATADIR/oxygen-gtk/gtk-3.0/oxygenrc" ] ; then + THEME="oxygen-gtk" + fi + if [ -n "$THEME" ]; then + mkdir -p "$GTK3_HOME_CONFDIR" + cp -f /usr/share/kde-gtk-config5/gtk3-settings.ini-kde4.template "$GTK3_THEME_RC" + sed -i -e "s,@@THEME_NAME@@,$THEME," "$GTK3_THEME_RC" + fi +fi