Search This Blog

2013-05-10

theme font setting for gtk3 apps on linux kde

Contents  [+]

1 Desc

1.1 Problem

i installed some GTK3 based applications: Bluefish, Emacs, Wireshark. but the menu/toolbar text is too small to read.
i cost several hours to solve it, so there's this post.

1.2 Env

notebook, display resolution: 1920x1080
openSUSE 12.3 x86_64, KDE 4.10

2 Solution

steps:
(1) install "kde-gtk-config", via zypper or yast.
(2) start a new terminal (konsole on KDE).

(3) config for current user:
> systemsettings
"System Settings > Application Appearance > Gtk Configuration", select "Adwaita" as GTK3 Theme, choose Font, "Apply".
Notice: change theme if some application doesn't appear after starting, oxygen-gtk3 is not compatible with Emacs 24.2 on my computer.

(4) do the same configuration for root:
> kdesu systemsettings

3 References

GTK+ - wiki.archlinux.org
GtkSettings # properties - developer.gnome.org
Uniform Look for Qt and GTK Applications - wiki.archlinux.org
Gtk-3 integration in kde - Author: tancrackers - forum.kde.org
调整KDE中GTK+程序的样式 - Author: Chenxing - linux-wiki.cn

4 Some details of failure

4.1 local settings

create ~/.gtkrc-3.0-kde4, doesn't work.

add gtk-font-name="Monospace 14" in "/etc/gtk-3.0/settings.ini", doesn't work. the format may be wrong.

edit files listed by "export | grep gtk", doesn't work.

at "Fonts - System Settings", enable subpixel and hinting, doesn't work; enable "Force fonts DPI", doesn't work.

4.2 oxygen-gtk3 vs emacs

i installed gtk3-engine-oxygen v1.1.1, gtk3-theme-oxygen v1.1.1, and configured "~/.config/gtk-3.0/settings.ini" as described in "/usr/share/doc/packages/gtk3-engine-oxygen/README".
Bluefish works. but Emacs 24.2 doesn't work, no gui will be shown.

> ps axjf | less
# no child process

> ps -ef | grep emacs
u1 6510 1088 0 19:05 ? 00:00:00 /usr/bin/emacs

> gstack 6510
Pre[-]
Thread 3 (Thread 0x7f68bd1d6700 (LWP 6511)):
#0  0x00007f68c5f0387d in poll () from /lib64/libc.so.6
#1  0x00007f68ca4ebf7c in ?? () from /usr/lib64/libglib-2.0.so.0
#2  0x00007f68ca4ec45a in g_main_loop_run () from /usr/lib64/libglib-2.0.so.0
#3  0x00007f68cafe0d76 in ?? () from /usr/lib64/libgio-2.0.so.0
#4  0x00007f68ca50fc85 in ?? () from /usr/lib64/libglib-2.0.so.0
#5  0x00007f68c61d8e0f in start_thread () from /lib64/libpthread.so.0
#6  0x00007f68c5f0c7dd in clone () from /lib64/libc.so.6
Thread 2 (Thread 0x7f68b7fff700 (LWP 6513)):
#0  0x00007f68c5f0387d in poll () from /lib64/libc.so.6
#1  0x00007f68ca4ebf7c in ?? () from /usr/lib64/libglib-2.0.so.0
#2  0x00007f68ca4ec0a4 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#3  0x00007f68ca4ec101 in ?? () from /usr/lib64/libglib-2.0.so.0
#4  0x00007f68ca50fc85 in ?? () from /usr/lib64/libglib-2.0.so.0
#5  0x00007f68c61d8e0f in start_thread () from /lib64/libpthread.so.0
#6  0x00007f68c5f0c7dd in clone () from /lib64/libc.so.6
Thread 1 (Thread 0x7f68cbdb6a00 (LWP 6510)):
#0  0x00007f68c5f0387d in poll () from /lib64/libc.so.6
#1  0x00007f68ca4ebf7c in ?? () from /usr/lib64/libglib-2.0.so.0
#2  0x00007f68ca4ec45a in g_main_loop_run () from /usr/lib64/libglib-2.0.so.0
#3  0x00007f68ca52dd21 in g_spawn_sync () from /usr/lib64/libglib-2.0.so.0
#4  0x00007f68ca52e198 in g_spawn_command_line_sync () from /usr/lib64/libglib-2.0.so.0
#5  0x00007f68bc744214 in Oxygen::QtSettings::kdeConfigPathList() const () from /usr/lib64/gtk-3.0/3.0.0/theming-engines/liboxygen-gtk.so
#6  0x00007f68bc746a16 in Oxygen::QtSettings::initialize(unsigned int) () from /usr/lib64/gtk-3.0/3.0.0/theming-engines/liboxygen-gtk.so
#7  0x00007f68bc7588c5 in Oxygen::Style::initialize(unsigned int) () from /usr/lib64/gtk-3.0/3.0.0/theming-engines/liboxygen-gtk.so
#8  0x00007f68bc758cb5 in Oxygen::Style::instance() () from /usr/lib64/gtk-3.0/3.0.0/theming-engines/liboxygen-gtk.so
#9  0x00007f68bc78e799 in Oxygen::ThemingEngine::instanceInit(OxygenThemingEngine*) () from /usr/lib64/gtk-3.0/3.0.0/theming-engines/liboxygen-gtk.so
#10 0x00007f68ca7cf5af in g_type_create_instance () from /usr/lib64/libgobject-2.0.so.0
#11 0x00007f68ca7b43d8 in ?? () from /usr/lib64/libgobject-2.0.so.0
#12 0x00007f68ca7b59a1 in g_object_newv () from /usr/lib64/libgobject-2.0.so.0
#13 0x00007f68ca7b64dc in g_object_new () from /usr/lib64/libgobject-2.0.so.0
#14 0x00007f68bc78e18a in create_engine () from /usr/lib64/gtk-3.0/3.0.0/theming-engines/liboxygen-gtk.so
#15 0x00007f68cb77e999 in gtk_theming_engine_load () from /usr/lib64/libgtk-3.so.0
#16 0x00007f68cb6192ed in ?? () from /usr/lib64/libgtk-3.so.0
#17 0x00007f68cb623b18 in ?? () from /usr/lib64/libgtk-3.so.0
#18 0x00007f68cb624dda in gtk_css_provider_load_from_file () from /usr/lib64/libgtk-3.so.0
#19 0x00007f68cb624e96 in gtk_css_provider_load_from_path () from /usr/lib64/libgtk-3.so.0
#20 0x00007f68cb625137 in ?? () from /usr/lib64/libgtk-3.so.0
#21 0x00007f68cb720a0c in ?? () from /usr/lib64/libgtk-3.so.0
#22 0x00007f68cb720be2 in gtk_settings_get_for_screen () from /usr/lib64/libgtk-3.so.0
#23 0x00007f68be2cdf06 in ?? () from /usr/lib64/gtk-3.0/modules/libcanberra-gtk-module.so
#24 0x00007f68be2ce1e8 in gtk_module_init () from /usr/lib64/gtk-3.0/modules/libcanberra-gtk-module.so
#25 0x00007f68cb6cdbb1 in ?? () from /usr/lib64/libgtk-3.so.0
#26 0x00007f68ca7af2a0 in g_closure_invoke () from /usr/lib64/libgobject-2.0.so.0
#27 0x00007f68ca7c0ac0 in ?? () from /usr/lib64/libgobject-2.0.so.0
#28 0x00007f68ca7c8961 in g_signal_emit_valist () from /usr/lib64/libgobject-2.0.so.0
#29 0x00007f68ca7c8c12 in g_signal_emit () from /usr/lib64/libgobject-2.0.so.0
#30 0x00007f68ca7b3c45 in ?? () from /usr/lib64/libgobject-2.0.so.0
#31 0x00007f68ca7b552b in g_object_notify () from /usr/lib64/libgobject-2.0.so.0
#32 0x00007f68cb2b0f4b in ?? () from /usr/lib64/libgdk-3.so.0
#33 0x00007f68cb6a9e14 in gtk_init_check () from /usr/lib64/libgtk-3.so.0
#34 0x00007f68cb6a9e39 in gtk_init () from /usr/lib64/libgtk-3.so.0
#35 0x00000000004cc7b7 in ?? ()
#36 0x00000000004cde17 in ?? ()
#37 0x000000000057a677 in ?? ()
#38 0x00000000005b2acb in ?? ()
#39 0x000000000057a1a1 in ?? ()
#40 0x000000000057a4fb in ?? ()
#41 0x00000000005b2acb in ?? ()
#42 0x000000000057a08b in ?? ()
#43 0x000000000057a4fb in ?? ()
#44 0x0000000000579c6a in ?? ()
#45 0x000000000057cd01 in ?? ()
#46 0x00000000005b341e in ?? ()
#47 0x000000000057a08b in ?? ()
#48 0x000000000057a4fb in ?? ()
#49 0x00000000005b2acb in ?? ()
#50 0x000000000057a08b in ?? ()
#51 0x0000000000579504 in ?? ()
#52 0x00000000005798fb in ?? ()
#53 0x000000000057c600 in ?? ()
#54 0x0000000000505977 in ?? ()
#55 0x0000000000578861 in ?? ()
#56 0x0000000000505e96 in ?? ()
#57 0x000000000057875b in ?? ()
#58 0x0000000000506ca7 in ?? ()
#59 0x0000000000506ff5 in ?? ()
#60 0x00000000004183ed in ?? ()
#61 0x00007f68c5e45a15 in __libc_start_main () from /lib64/libc.so.6
#62 0x0000000000418fd9 in ?? ()
# i don't know what's wrong

4.3 kde-gtk-config

i installed kde-gtk-config, it use oxygen as them by default, Emacs still doesn't work. then i changed gtk3 theme, Emacs works, i still don't know what's wrong now.

5 GTK+ style switching

5.1 kcm_gtk

the default program to switch GTK+ style in the system.
kcm_gtk - KDE control module for switching GTK+ style

> less /usr/share/kde4/services/kcmgtk4.desktop
snippet:
Name=GTK Styles and Fonts
Comment=Control the style and fonts used by GTK applications
Exec=kcmshell4 kcmgtk4

> less /usr/share/kde4/env/kcm_gtk.suse.sh
snippet:
GTK2_THEME_RC="$HOME/.gtkrc-2.0-kde4"

5.2 kde-gtk-config

kde-gtk-config - KCM Module to Configure GTK2 and GTK3 Applications Appearance Under KDE

> less /usr/share/kde4/env/kde_gtk_config.suse.sh
snippet:
GTK2_THEME_RC="$HOME/.gtkrc-2.0"
GTK3_THEME_RC="$HOME/.config/gtk-3.0/settings.ini"

> less /usr/share/kde4/services/kde-gtk-config.desktop
snippet:
Categories=Qt;KDE;X-KDE-settings-looknfeel;
Comment=Configuration of Gtk apps style
Exec=kcmshell4 kde-gtk-config
Name=Gtk Configuration

=Revisions=

20130428
20130510 change to html format

No comments:

Post a Comment