Theme (Gtk-2) features in detail, revisited.

Themes, icons, wallpapers, etc.
Message
Author
User avatar
torm
Posts: 186
Joined: Sat 07 Mar 2015, 19:56

Theme (Gtk-2) features in detail, revisited.

#1 Post by torm »

Hello.

I'll try to collect here some basic tips for Gtk-2 themes (maybe some other theme or
desktop related things also.. ) for anyone who is adopting themes into Puppy,
or maybe trying to create something new.

For base system there will be 32bit TahrPup605PAE
http://murga-linux.com/puppy/viewtopic.php?t=96178
This is a version of Puppy that I use for everyday tasks.
-
For those on different version or make of Puppy -not all examples will work and/or some
workarounds may be needed. As example -> if it has different version of GtkDialog/Qt/JWM,
different or missing fonts, missing gtk2 engines, libraries and so on. I'll try to do my best
to help out on those occasions, then again, help from actual users of those systems may give
better results -and is most welcome.


As far as Gtk-2 is still used ;)
lets get started with Gtk-2 theme details..
Last edited by torm on Sat 27 Aug 2016, 18:17, edited 1 time in total.

User avatar
torm
Posts: 186
Joined: Sat 07 Mar 2015, 19:56

#2 Post by torm »

Un-themed "xml_info" color.

It gives that strange detail on some GtkDialog text background areas.
(-see the screenshot below-)
A real mystery for anyone not having pTheme on the system..
Well, those who have pTheme installed, can skip to next post :roll:
One way is to create a folder /root/.config/ptheme
and put a file named as "gtkdialog_active" there,
with the following content:

Code: Select all

BOX_SPLASH_BG='#82B0BB'
BOX_SPLASH_BG_GRADIENT=true
BOX_SPLASH_FG='#222'

SVG_BAR_COLOR_USED='#006793'
SVG_BAR_COLOR_TOTAL='#444'
SVG_BAR_COLOR_TEXT='#bbb'
SVG_BAR_HEIGHT=24

SVG_TEXT_COLOR='#002A4A'
SVG_TEXT_SHADOW_COLOR='#CFEFFF'

XML_BUTTON_ICON_HEIGHT_HUGE=60
XML_BUTTON_ICON_HEIGHT_BIG=35
XML_BUTTON_ICON_HEIGHT_MINI=16
XML_BUTTON_ICON_HEIGHT_NORMAL=20

XML_INFO_OPACITY=0.0 #background opacity
XML_INFO_COLOR1='#00FF00' #background color
XML_INFO_COLOR2='#000000' #gradient spot color
XML_INFO_MODE=flat #drawing mode: 'gradient' or 'flat'

XML_PIXMAP_HEIGHT_HUGE=100
XML_PIXMAP_HEIGHT_BIG=60
XML_PIXMAP_HEIGHT_ICON=48
XML_PIXMAP_HEIGHT_NORMAL=20

XML_SCALEGRIP_SIZE=20
..that should make it transparent and acceptable for most gtk2 themes.
The line with "XML_INFO_OPACITY=0.0 #background opacity" does it.
For TahrPup605 -just click the "ptheme-00.pet" below.
Also..
One can address it from favorite Gtk2 theme.
With "pixmap" engine it's something like this in
class "GtkNotebook*" style "notebook"
add the following:

Code: Select all

	image
	{
	function = BOX
	file     = "no.png"
	border   = {1, 1, 1, 1}
	stretch  = TRUE
	}

..where "no.png" is a transparent 4x4 pixmap. Can be any pixmap.
Replaces the background.
Attachments
ptheme-00.pet
ptheme fix for tahrpup605
(740 Bytes) Downloaded 786 times
xml-info_colors.png
background color
(22.79 KiB) Downloaded 1745 times
Last edited by torm on Sat 27 Aug 2016, 18:22, edited 1 time in total.

User avatar
torm
Posts: 186
Joined: Sat 07 Mar 2015, 19:56

#3 Post by torm »

Dark(or mixed) theme and combobox-menu text colors.

To set some drop-down-menu text color, so it would act the same as fg color.
(if actual "text" is normally set to black and "base" to white)
Using dark menu background, and blue text that should turn to white
when I move cursor over it (a PRELIGHT state):

Code: Select all

style "cbm_item_text"
 {
	text[NORMAL]   = "#00A2FF"
	text[PRELIGHT] = "#FFFFFF"
 }
widget "*.gtk-combobox-popup-menu.*" style "cbm_item_text"

A similar thing for the combobox label or preselected item:

Code: Select all

style "cbm_presel_item_text"
 {
	text[NORMAL]   = "#DFE1E6"
	text[PRELIGHT] = "#FFFFFF"
 }
widget_class "*.<GtkComboBox>.<GtkCellView>" style "cbm_presel_item_text"
Attachments
combo-text_color.png
illustration
(11.98 KiB) Downloaded 1730 times
Last edited by torm on Sat 27 Aug 2016, 18:25, edited 1 time in total.

User avatar
torm
Posts: 186
Joined: Sat 07 Mar 2015, 19:56

#4 Post by torm »

Dark (or mixed) theme and list item text color.

If the colors are mess...
these can be adjusted. Change colors to whatever looks best.

Code: Select all

style "some_list"
 {
	fg[NORMAL]   = "#000000"
	fg[SELECTED] = "#FFFFFF"
	bg[SELECTED] = "#004FCF"
	base[NORMAL] = "#C0C6CC"
 }
widget_class "*<GtkListItem>*" style "some_list"
widget_class "*<GtkList>*" style "some_list"

---------------------------------------------------------------------------

Something for XKB keyboard selection (dark or mixed) menu:

Code: Select all

style "col_clist"
{
	fg[NORMAL]		= "#000000"
	fg[SELECTED]	= "#61FF61"
	bg[SELECTED]	= "#1E2023"
	base[NORMAL]	= "#B1B2BA"
}
widget_class "*.<GtkScrolledWindow>.<GtkCList>" style "col_clist"
Last edited by torm on Sat 27 Aug 2016, 18:28, edited 1 time in total.

User avatar
torm
Posts: 186
Joined: Sat 07 Mar 2015, 19:56

#5 Post by torm »

Visible "focus" item on GtkButton and GtkNotebook*

For some theme I just want to remove it...
With "pixmap" engine
in style "default" or in style "button" and/or style "notebook":

Code: Select all

	image
	{
	function = FOCUS
	file     = "no.png"
	border   = {1, 1, 1, 1}
	stretch  = TRUE
	}
..will replace the focus that is drawn by the engine.
"no.png" can be just transparent 4x4 pixmap in gtk-2.0 dir.

For "murrine" engine -in style default, button.. and/or notebook:
focusstyle = 0
..will disable focus drawing.

Adding in style default:
GtkButton::focus-padding = 0
..will remove any extra space on buttons fill used for drawing focus.
(it will also make buttons smaller in default size)
Last edited by torm on Sat 27 Aug 2016, 18:30, edited 1 time in total.

User avatar
torm
Posts: 186
Joined: Sat 07 Mar 2015, 19:56

#6 Post by torm »

In-theme set icons.

Any custom Gtk icons can be used to appear with chosen theme only.
Just create a "icons" folder inside the theme "gtk-2.0" folder, and place icons there.
Inside "icons" folder create "iconrc" file with a similar text:

Code: Select all

 style "icons"
 {
## for Gtk
	stock["gtk-ok"] ={{ "ok.png" }}
	stock["gtk-apply"] = {{ "apply.png" }}
	stock["gtk-cancel"] = {{ "cancel.png" }}
	stock["gtk-about"] = {{ "about.png" }}
	stock["gtk-go-down"] = {{ "go-dn.png" }}
#	stock["gtk-dnd"] = {{ " .png" }}
#	stock["gtk-goto-bottom"] = {{ " .png"}}
#	stock["gtk-clear"] = {{ " .png" }}
#	stock["gtk-preferences"] = {{ " .png" }}
	stock["gtk-open"] ={{ "fld.png" }}
	stock["gtk-directory"] = {{ "fld.png" }}
	stock["gtk-dialog-question"] = {{ "what.png" }}
#	stock["gtk-missing-image"] = {{ "non.png" }} # use with care
## for RoxFM
	stock["rox-show-hidden"] = {{"hid.png"}}
	stock["rox-show-details"] = {{"det.png"}}
	stock["rox-select"] = {{"sel.png"}}
## for RoxFM and Gtk
	stock["gtk-close"] = {{ "cancel.png" }}
	stock["gtk-go-up"] = {{ "go-up.png" }}
	stock["gtk-home"] = {{ "home.png" }}
	stock["gtk-refresh"] = {{"refresh.png"}}
#	stock["gtk-zoom-in"] = {{" .png"}}
#	stock["gtk-zoom-fit"] = {{" .png"}}
#	stock["gtk-jump-to"] = {{" .png"}} # bookmarks
#	stock["gtk-sort-ascending"] = {{" .png"}}
#	stock["gtk-help"] = {{" .png"}}
 }
 class "GtkWidget" style "icons"
(note: any lines with a leading #-sign are not read by the engine)

One can pick just some of them, or add more, this is just an example.
Like only Rox-toolbar icons, etc. (any gtk icon can be changed, a
program called "Icon Finder" with: 'Menu->GTK stock icons' will give a
preview of all Gtk icons that are used on the system with correct names.)
Then inside theme "gtkrc" file add (before any style) the following line:

Code: Select all

	include "icons/iconrc"

so that engine would find and use this setting.
/--/


The same thing can be done from a "default" or some other single style.
For exaple to theme (rox-)toolbar with custom icons/font/text-color:
note: location inside gtkrc may matter here,
and pixmaps should probably be in size 24x24 for Rox toolbar

Code: Select all

style "tool_rox"
{
	stock["gtk-go-up"]			= {{ "icons/pix_0.png" }}
	stock["gtk-go-down"]		= {{ "icons/pix_1.png" }}
	stock["rox-show-details"]	= {{ "icons/pix_2.png" }}
	stock["rox-show-hidden"]	= {{ "icons/pix_3.png" }}
	stock["rox-select"]			= {{ "icons/pix_4.png" }}
	stock["gtk-close"]			= {{ "icons/pix_5.png" }}

	font_name = "Fjalla One 9"
	fg[NORMAL]		= "#474747"
	fg[PRELIGHT]	= "#000000"
	fg[ACTIVE]		= "#000000"
}
widget_class "GtkWindow.GtkVBox.GtkToolbar.GtkButton.GtkHBox.GtkLabel" style "tool_rox"
widget_class "GtkWindow.GtkVBox.GtkToolbar.GtkButton.GtkVBox.GtkLabel" style "tool_rox"
widget_class "GtkWindow.GtkVBox.GtkToolbar.GtkButton.GtkHBox.GtkImage" style "tool_rox"
widget_class "GtkWindow.GtkVBox.GtkToolbar.GtkButton.GtkVBox.GtkImage" style "tool_rox"

/--/


To set custom size for the icons, in "gtkrc" file (before any style) one may add:

Code: Select all

	gtk-icon-sizes = "panel-menu=24,24:panel=22,22:gtk-button=16,16:gtk-large-toolbar=22,22"

where 22,22 or 16,16... will be the sizes in pixels.
Scaling may blur the png images, so set to actual pixmap size if possible,
or even better -use images in correct sizes ( maybe not 256x256 Wink.
To remove button icons like on "Ok" and similar (works for some) add (before any style):

Code: Select all

	gtk-button-images = 0

Then..
Application can have its own set of "stock" icons.
For example - any GtkDialog based app..
Or even some feature to change these icons.
And it can (or not) be merged with the current global theme.
Last edited by torm on Sat 27 Aug 2016, 18:33, edited 1 time in total.

User avatar
torm
Posts: 186
Joined: Sat 07 Mar 2015, 19:56

#7 Post by torm »

In-theme set TTF-font.

Can be set in theme "gtkrc" in style "default" with:

Code: Select all

	font_name="DejaVu Sans 10"

where ten is the size. Changes font for this theme only.
Some wigets can support its own setting. As:

Code: Select all

style "menubar_font"
 {
	font_name="DejaVu Sans Bold 10"
 }
class "GtkMenubar" style "menubar_font"
widget_class "*<GtkMenuBar>.<GtkMenuItem>.<GtkLabel>" style "menubar_font"
will then set only menubar font to bold (can be also a different font or size),
while leaving all else as is.

Some gtk2 engines provide effects like shadows and similar for fonts.
Last edited by torm on Sat 27 Aug 2016, 18:34, edited 3 times in total.

User avatar
torm
Posts: 186
Joined: Sat 07 Mar 2015, 19:56

#8 Post by torm »

Gtk2 theme engines.

If some downloaded theme looks a lot different from what was expected..
look into (open with text editor..) /tmp/xerrs.log to see if there's something missing (scroll
to the bottom of the file) on the system.
It could be one of the following engines ( not a complete list.. ) :
  • murrine (libmurrine.so 199K)
    clearlooks (libclearlooks.so 153K)
    ubuntulooks (libubuntulooks.so 71K, libubuntulooks.la 1496B)
    equinox (libequinox.so 135K, libequinox.la 1105B)
    xfce (libxfce.so 48K, libxfce.la 1235B)
    crux-engine (libcrux-engine.so 51K)
    aurora (libaurora.so 96K)
    nodoka (libnodoka.so 79K)
    svg (libsvg.so 36K, libsvg.la 1716B)
    nimbus (libnimbus.so 110K)
    adwaita (libadwaita.so 9644B)
    galaxy (libgalaxy.so 52K)
    glide (libglide.so 68K)
    thinice (libthinice.so 43K)
    hcengine (libhcengine.so 47K)
    industrial (libindustrial.so 47K)
    mist (libmist.so 41K)
    luaengine (libluaengine.so 181K)
    redmond95 (libredmond95.so 51K)
    ia_ora (libia_ora.so 70K)
    smooth (libsmooth.so 197K)
    ......
...
needs to be installed first. Normally Puppy has pixmap engine (libpixmap.so 38K) as a
default preinstalled. Some of the above engines can be found on the forum, look into:
"Gtk themes for Puppy4+ Dingo"
If not there, one can just grab it from compatible distro, and paste into:
/usr/lib/gtk-2.0/2.10.0/engines/
folder, and change to the theme again to see if it looks okay now.

Semi-transparent menus (or window borders) and other bling seen on the theme exchange sites
may not be related to theme engines. Look for xcompmgr or kcompmgr...
PS.
"/tmp/xerrs.log" can also point out (including line numbers for Geany) some other useful
and detailed information (drag a link on the desktop for quick access?).
Last edited by torm on Sat 27 Aug 2016, 18:36, edited 1 time in total.

User avatar
torm
Posts: 186
Joined: Sat 07 Mar 2015, 19:56

#9 Post by torm »

Gtk2 engine defaults.

To see what the engine looks like "as-is", without any custom settings..
Create folder MyTest_00 (any "original" name, without spaces in it) in:
/usr/share/themes/
inside MyTest_00, create folder with a name:
gtk-2.0
in the folder "gtk-2.0", create blank file named:
gtkrc
open file "gtkrc" with text editor, and add following:

Code: Select all

style "default"
 {
 engine "ubuntulooks"
	{
	}
 }
class "GtkWidget" style "default"
..where engine name can be anything one does have on the system,
ubuntulooks was here just for example.
Save file "gtkrc" and select theme MyTest_00 with Chtheme or similar.
From there.. one can go and add some adjustments for widgets or colors..
Last edited by torm on Sat 27 Aug 2016, 18:37, edited 1 time in total.

User avatar
torm
Posts: 186
Joined: Sat 07 Mar 2015, 19:56

#10 Post by torm »

Test theme, using "pixmap" and "industrial" Gtk-2 theme engines.

-
Please install fonts pet first.
( does NOT include DejaVuSans fonts, size... )
"Industrial" 32bit lib (libindustrial.so) is included with the theme pet.
Attachments
s-shot-theme1.jpg
preview
(46.41 KiB) Downloaded 1749 times
fonts-01.pet
installs fonts to /usr/share/fonts/default/TTF
(59.18 KiB) Downloaded 730 times
pixmap-industrial-01.pet
installs gtk2 theme and libindustrial.so
(26.38 KiB) Downloaded 710 times
Last edited by torm on Sat 27 Aug 2016, 18:42, edited 2 times in total.

User avatar
torm
Posts: 186
Joined: Sat 07 Mar 2015, 19:56

#11 Post by torm »

(moved here)
Test theme 2 (version -03, minor clean-up of gtkrc)

Semi-inverted darkgray Gtk2 and JWM theme, wallpaper.

Preconfigured for older 17" CRT 4:3 displays with 1024x768@75.* resolution.

Credits.
bg_1024x768.png is inspired (not a copy) by a wallpaper found on Box-Look.org
Gtk2 theme is 'Murrine -fied' upon the apperarance of "mint-x-mod, mod by dirn" SVG theme.

JWM theme is for: jwm -v = JWM vgit-976 ( built-in = jwm-933-i686 )
To use png button-pixmaps for JWM, one may need to update JWMDesk ( to a version 2.* ).
Then place "btns4" folder (in my-documents/clipart/pixmaps_for..) to
/usr/local/jwmdesk/jwm_button_themes/..
If pixmaps look fuzzy, set window border area (using JWMDesk) to 25x5x5x5 pixel.

Please look for font-pet and pTheme-fix in above posts.

There is also a "murrine" engine below,
that is already pre-installed in tahrpup605 32bit, if needed.

PS.
One may use some pixmap tiles or a different color background for Rox filemanager,
example is at the end of the gtkrc.
Attachments
gtk2-jwm-wall_v03.pet
gtk2 and jwm theme, wallpaper 1024x768
(45.98 KiB) Downloaded 700 times
s-shot-theme2.png
preview
(37.25 KiB) Downloaded 1743 times
murrine32bit.pet
libmurrine.so engine
(61.07 KiB) Downloaded 730 times
Last edited by torm on Wed 14 Sep 2016, 14:13, edited 2 times in total.

User avatar
solo
Posts: 389
Joined: Thu 14 Nov 2013, 20:33

#12 Post by solo »

X11 color name list

Sometimes X11 color name descriptors are being used instead of the hex color name.
Here's an example from the .jwmrc-tray file:

Code: Select all

<Swallow name="xload" width="32">
xload -nolabel -bg "#444443" -fg DeepSkyBlue -hl white
</Swallow>
You can see both forms are being used in the same declaration.

There's a handy list of these X11 color names along with their RGB values, which is called rgb.txt, and can be found in the /usr/share/X11/ folder.

User avatar
torm
Posts: 186
Joined: Sat 07 Mar 2015, 19:56

#13 Post by torm »

(moved here)
Test theme 3

Gtk2 and JWM theme, wallpaper.

One can get (Murrine gtk2 engine,) fonts and pTheme-fix from above posts.

Credits:
Wallpaper uses Puppy logo as modified detail, from /usr/share/doc/..
Most Rox/gtk/desk icons are from Faenza icon theme, and
there's a small selection of Mad-Shiny-Black icons, for mime and drive icons.
Cursor theme is from LXPup.
Attachments
B3_test-03.pet
gtk2 and jwm theme, wallpaper 1024x768
(166.93 KiB) Downloaded 697 times
s-shot-theme3.jpg
preview
(62.41 KiB) Downloaded 1794 times
icons-cursor-02.pet
icons and cursor theme
(219.29 KiB) Downloaded 730 times

User avatar
torm
Posts: 186
Joined: Sat 07 Mar 2015, 19:56

#14 Post by torm »

Extended use of Gtk2 themes.

Theme splitting.
gtkrc can be split into several rc-files, like gtkrc + icons.rc + buttons.rc +.. etc.,
in different locations(folders), add the:

Code: Select all

include "icons/icons.rc"
include "button/buttons.rc"
to the main gtkrc file.
For that matter one could share the same iconset or any other detail for multiple
themes without the need to copy it from one (theme)folder to another,
using full path or "pixmap_path".

Filemanagers.
Using multiple rc-files may also speed up theme adjustment
when using custom widget sub-themes for filemanagers and/or panels.
Like when using XFCE with Thunar one could comment out

Code: Select all

# include "roxfm.rc" 
from gtkrc and vice versa, so that widget look-up time would be faster.

User avatar
torm
Posts: 186
Joined: Sat 07 Mar 2015, 19:56

#15 Post by torm »

Extended use example. (ROX filemanager)
This should work from include or directly from gtkrc.
For text shadows, one will need libmurrine.so
installed on the system.

---- To start with, there is Gtk2 lookup/merge:
- class styles
- wiget_class styles
- widget styles
More general styles should have "class" statement, while more specific styles
should use "widget_class" or "widget" statements.
---- Location inside gtkrc-file matters:
- if placed/read last, gets more of a priority..
So first there should be wide use defaults, then, -at the end of gtkrc, different
widget-specific details.

---------------------------

As an example we'll use ROX filemanager, as it is most likely around to play with.

ROX window and toolbar details.
Later we can combine these widgets in a few styles,
while for now I'll edit these one by one..
Notice that, example settings and pixmap-names are only theoretical,
and widget (class) names are direct and real.

1. Toolbar

Code: Select all

style "test-1"
{
 ...example settings
}
widget "rox-filer.GtkVBox.GtkToolbar" style "test-1"

Example settings:
font_name = "Fjalla One 9" # will set information area font, on the right from buttons
fg[NORMAL] = "#FFFFFF" # font color

GtkToolbar::button-relief=GTK_RELIEF_NORMAL # how the "button border" on the toolbar looks
# possible values:
# GTK_RELIEF_NORMAL
# GTK_RELIEF_HALF
# GTK_RELIEF_NONE

xthickness = 2 # size x
ythickness = 0 # size y

GtkToolbar::internal-padding = 3 # just experiment ;)

# ...and the background of ROX toolbar, not affecting any other app.
# just remember that toolbar may get resized with button label location change..
# 18 will hold on to upper edge, so that icon background on the buttons will follow
# toolbar design and vice versa, if resized. Pixmap vertical size 25+ pixels then..
engine "pixmap"
{
image
{
function = BOX
detail = "toolbar"
file = "somefile-name.png"
border = { 4, 4, 18, 4}
stretch = TRUE
}
}

----------------------------------------

2. Toolbar buttons

Code: Select all

style "test-2"
{
 ...example settings
}
widget "rox-filer.GtkVBox.GtkToolbar.GtkButton" style "test-2"
Example settings:
GtkButton::inner-border = { 2, 2, 2, 2 } # adjust size
GtkButton::default-border = { 0, 0, 0, 0 } #
# it is intended to combine these settings, so that way... we can have
# more direct control over size details

engine "pixmap"
{
image
{
function = BOX
detail = "button"
file = "some-otherfile-name.png"
border = { 4, 4, 18, 4}
stretch = TRUE
}
}
# if GtkToolbar::button-relief=GTK_RELIEF_NORMAL is set, then
# one may want to add NORMAL, PRELIGHT, ACTIVE, INSENSITIVE
# for the different button states..

------------------------------------------

3. Toolbar button icons

Code: Select all

style "test-3"
{
 ...example settings
}
widget "rox-filer.GtkVBox.GtkToolbar.GtkButton.GtkVBox.GtkImage" style "test-3"
widget "rox-filer.GtkVBox.GtkToolbar.GtkButton.GtkHBox.GtkImage" style "test-3"
# GtkVBox and GtkHBox depend on if the label is placed next or below the icon.
# It will share the same look, while it can look different depending on the placement.
# Now, we'll make it more interesting.. ;)

Example settings:
stock["gtk-go-up"] = {{"icon1.png", LTR, NORMAL},
{"icon2.png", LTR, PRELIGHT},
{"icon3.png", LTR, ACTIVE}}
stock["gtk-jump-to"] = {{"icon4.png", LTR, NORMAL},
{"icon5.png", LTR, PRELIGHT},
{"icon6.png", LTR, ACTIVE}}

# stock["rox-show-details"] =
# stock["rox-show-hidden"] =
# stock["rox-select"] =
# stock["gtk-close"] =
#...
# ..so we can have different icons for different states.
# It is purely design question using it that way,
# one may want to animate the size (using transparent border) for normal/hovered/pressed
# icons, other add a glow around hovered, etc.
# Icons can be 24x24 pixel png-s with transparency.
# That gives us icon theme that follows current Gtk2 theme on-the-fly ;)
# Icon folder can be shared by different themes, see my previous post up.
# NB! ..notice the ',' behind first two states.
# For Right-To-Left locales, use RTL instead of LTR.

-----------------------------------------------------------------------

4. Toolbar button labels

Code: Select all

style "test-4"
{
 ...example settings
}
widget "rox-filer.GtkVBox.GtkToolbar.GtkButton.GtkVBox.GtkLabel" style "test-4"
widget "rox-filer.GtkVBox.GtkToolbar.GtkButton.GtkHBox.GtkLabel" style "test-4"
Example settings:
font_name = "Fjalla One 9" # if standandalone style

fg[NORMAL] = "#FFFFFF" # font colors, example..
fg[ACTIVE] = "#FFFFFF"
fg[PRELIGHT] = "#FFFFFF"
fg[INSENSITIVE] = "#FFFFFF"

# if set as a standalone style after rox-button style,
# one may add also:

engine "murrine"
{
textstyle = 1
text_shade = 0.01
}

# .. to add subtle shadow under glyphs,
# just don't mix different engines inside the same style.



--------------------------------------------------------------

Now combine them..
( only for reference, use real colors and pixmaps in gtkrc.. )

Code: Select all

style "comb_1"
{
 stock["gtk-go-up"] = {{"icon1.png", LTR, NORMAL},
						{"icon2.png", LTR, PRELIGHT},
						{"icon3.png", LTR, ACTIVE}}
 stock["gtk-jump-to"] = {{"icon4.png", LTR, NORMAL},
						{"icon5.png", LTR, PRELIGHT},
						{"icon6.png", LTR, ACTIVE}}
 stock["rox-show-details"] = {{"icon7.png", LTR, NORMAL},
						{"icon8.png", LTR, PRELIGHT},
						{"icon9.png", LTR, ACTIVE}}
 stock["rox-show-hidden"] = {{"icon10.png", LTR, NORMAL},
						{"icon11.png", LTR, PRELIGHT},
						{"icon12.png", LTR, ACTIVE}}
 stock["rox-select"] = {{"icon13.png"}}
 stock["gtk-close"] = {{"icon14.png"}}  # no different states, only one icon
	xthickness = 2
	ythickness = 0
	GtkButton::inner-border  = { 2, 2, 2, 2 }
	GtkButton::default-border = { 0, 0, 0, 0 }
	GtkToolbar::internal-padding = 3
 engine "pixmap"
 {
	image
	{
	function	= BOX
	detail		= "toolbar"
	file		= "somefile-name.png"
	border		= { 4, 4, 18, 4}
	stretch		= TRUE
	}
	image
	{
	function	= BOX
	detail		= "button"
	file		= "some-otherfile-name.png"
	border		= { 4, 4, 18, 4}
	stretch		= TRUE
	}
 }
}
widget "rox-filer.GtkVBox.GtkToolbar" style "comb_1"
widget "rox-filer.GtkVBox.GtkToolbar.GtkButton" style "comb_1"
widget "rox-filer.GtkVBox.GtkToolbar.GtkButton.GtkVBox.GtkImage" style "comb_1"
widget "rox-filer.GtkVBox.GtkToolbar.GtkButton.GtkHBox.GtkImage" style "comb_1"


style "comb_2"
{
	font_name		= "Fjalla One 9"
	fg[NORMAL]		= "#FFFFFF"
	fg[ACTIVE]		= "#FFFFFF"
	fg[PRELIGHT]	= "#FFFFFF"
	fg[INSENSITIVE]	= "#FFFFFF"
  engine "murrine"
 {
	textstyle = 1
	text_shade = 0.01
 }
}
widget "rox-filer.GtkVBox.GtkToolbar.GtkButton.GtkVBox.GtkLabel" style "comb_2"
widget "rox-filer.GtkVBox.GtkToolbar.GtkButton.GtkHBox.GtkLabel" style "comb_2"

style "comb_3" # different color for info-text on toolbar
{
	font_name		= "Fjalla One 9"
	fg[NORMAL]		= "#FF0000"
  engine "murrine"
 {
	textstyle = 1
	text_shade = 0.01
 }
}
widget "rox-filer.GtkVBox.GtkToolbar.GtkLabel" style "comb_3"
--------------------------------------------------------------

5. Toolbar view-details
# toolbar area that appears if details button was clicked
# TODO: no wildcards...

Code: Select all

style "test-5"
{
 ...example settings
}
widget_class "*ViewDetails*GtkButton" style "test-5"
widget_class "*ViewDetails*GtkButton.*.GtkLabel" style "test-5"

Example settings:
font_name = "Fjalla One 8" # make it use a smaller font
GtkButton::inner-border = { 6, 6, 2, 2 } # adjust label placement
fg[NORMAL] = "#A0A6AE"
fg[PRELIGHT] = "#FFFFFF"
fg[ACTIVE] = "#0000FF"
engine "pixmap"
{
image
{
function = BOX
file = "anotherfile-name.png"
border = { 1, 1, 1, 1 }
stretch = TRUE
}
}
# can have more states for button, while change of label color may do the trick here..

--------------------------------------------------------------


Now that we have toolbar configured to our likes..
some notes about other rox widgets..

--------------------------------------------------------------

6. ROX window ViewCollection background.

Code: Select all

style "test-6"
{
	bg_pixmap[NORMAL]	= "some_tile.png" # bg_pixmap to tile in rox window
	bg[INSENSITIVE]		= "#DFE3E8"       # may need adjusting..
	fg[NORMAL]			= "#000000"       # 
}
widget_class "<GtkWindow>.<GtkVBox>.<GtkHBox>.<ViewCollection>*" style "test-6"
--------------------------------------------------------------

7. ROX window scrollbar

Code: Select all

style "test-7"
{
 ...usual scrollbar settings, for ROX window only, different color/size.. etc.
}
widget "rox-filer*Scrollbar" style "test-7"
# one may want to set this right after default scrollbar style,
# and it could help if default scrollbar style is defined at "class" level

--------------------------------------------------------------

8. ROX window progressbar
# may appear with multiple-file operations

Code: Select all

style "test-8"
{
 ... settings for ROX window progressbar only.
}
widget "rox-filer*GtkProgressBar" style "test-8"
# one may want to set this right after default progressbar style,
# and it could help if default progressbar style is defined at "class" level

--------------------------------------------------------------

9. ROX panel
# there are some who may use it.. :)

Code: Select all

# rox panel border color and background area
style "roxpanel_0"
{
 fg[NORMAL] = "#ff0000"
 engine "pixmap"
 {
	image
	{
	function	= FLAT_BOX
	file		= "panel_tile1.png"
	border		= { 1, 1, 1, 1 }
	stretch		= TRUE
	}
 }
}
widget "rox-panel.GtkAlignment" style "roxpanel_0"
widget "rox-panel.GtkAlignment.GtkViewport" style "roxpanel_0"


# icon(button) background area
style "roxpanel_1"
{
 engine "pixmap"
 {
	image
	{
	function	= FLAT_BOX
	state 		= NORMAL
	file		= "panel_button_normal.png"
	border		= { 2, 2, 2, 2 }
	stretch		= TRUE
	}
	image
	{
	function	= FLAT_BOX
	state 		= PRELIGHT
	file		= "panel_button_prelight.png"
	border		= { 2, 2, 2, 2 }
	stretch		= TRUE
	}
 }
}
widget "rox-panel.GtkAlignment.GtkViewport.GtkHBox.GtkHBox.panel-icon" style "roxpanel_1"
widget "rox-panel.GtkAlignment.GtkViewport.GtkVBox.GtkVBox.panel-icon" style "roxpanel_1"


# icon(button) label color, font and shadow
style "roxpanel_text"
{
	font_name		= "Fjalla One 9"
	fg[NORMAL]		= "#FF0000"
	fg[PRELIGHT]	= "#FFFFFF"
  engine "murrine"
 {
	textstyle = 1
	text_shade = 0.01
 }
}
widget "rox-panel.GtkAlignment.GtkViewport.GtkHBox.GtkHBox.panel-icon.GtkLabel" style "roxpanel_text"
widget "rox-panel.GtkAlignment.GtkViewport.GtkVBox.GtkVBox.panel-icon.GtkLabel" style "roxpanel_text"


# separator ( -ish thing.. ) background
style "roxpanel_2"
{
 engine "pixmap"
 {
	image
	{
	function	= FLAT_BOX
	file		= "panel_tile3.png"
	border		= { 1, 1, 1, 1 }
	stretch		= TRUE
	}
 }
}
widget "rox-panel.GtkAlignment.GtkViewport.GtkHBox.GtkEventBox" style "roxpanel_2"
widget "rox-panel.GtkAlignment.GtkViewport.GtkVBox.GtkEventBox" style "roxpanel_2"
--------------------------------------------------------------

10. Custom ROX folders.
It should be well known, then again, I'll point it out here anyway..
Just place some I-like-this-icon-for-mydocuments-folder.png in folder for
what it should appear for, then rename it to .DirIcon there.
It will "disappear" and folder should now be presented with this new icon,
independent from icon theme.

--------------------------------------------------------------

I hope.. it was interesting to read ;)
Attachments
rox-example-1.png
scrollbar example for ROX
(140.79 KiB) Downloaded 1496 times

User avatar
torm
Posts: 186
Joined: Sat 07 Mar 2015, 19:56

#16 Post by torm »

GtkCalendar details.

It is possible to theme GtkCalendar widget.
Also if a program uses some unique namespace, it can be accessed directly from
global gtkrc, aside from "class" level design of GtkCalendar.

Note that using different font or dpi will reshape the window to a different size.
For GtkCalendar widget it is okay to use any .ttf font that is installed on the system.
The example style has all the detail comments.

Code: Select all

style "gtk_calendar_example"
{
	xthickness = 8				# border width
	ythickness = 8				# border height
	font_name = "Fjalla One 9"	# TTF fontname, number 9 stands for fontsize

	fg[NORMAL] = "#FFFFFF"		# month, year -text
	bg[NORMAL] = "#434343"		# month, year, arrow -backg. ; leading/next-month dates-text ; window border 
	bg[PRELIGHT] = "#434343"	# arrow -backg., with mouse-over
	bg[ACTIVE] = "#434343"		# arrow -backg., clicking

	text[NORMAL] = "#CCCCCC"	# dates -text
	base[NORMAL] = "#000000"	# dates -backg.
	text[SELECTED] = "#FFFFFF"	# weekday-names, clicked-date -text
	base[SELECTED] = "#26282E"	# weekday-names, clicked-date -backg.
	text[ACTIVE] = "#FFFFFF"	# may appear... for weekday-names
	base[ACTIVE] = "#000000"	#               if clicking outside of calendar area

 engine "pixmap"
 {
	image
	{
	function	= SHADOW		# outer border
	detail		= "calendar"
	recolorable	= FALSE
	shadow		= IN
	file		= "cb_1.png"
	border		= { 8, 8, 8, 8} # notice border width/height above..
	stretch		= TRUE
	}
	image
	{
	function	= SHADOW		# month, year border
	detail		= "calendar"
	recolorable	= FALSE
	shadow		= OUT
	file		= "cb_2.png"
	border		= { 3, 3, 3, 3} # to bring inner borders together..
	stretch		= TRUE
	}
	image
	{
	function	= FOCUS			# clicked date border, must be transparent on the inside
	detail		= "calendar-day"
	file		= "cf_1.png"
	border		= { 2, 2, 2, 2}
	stretch		= TRUE
	}
	image
	{
	function	= ARROW			# arrow size is 8x8 pixel for this theme
	detail		= "calendar"
	state		= NORMAL		# states are: normal and prelight ( same for active/selected )
	file		= "arn.png"
	border		= { 1, 1, 1, 1}
	stretch		= TRUE
	arrow_direction	= RIGHT
	}
	image
	{
	function	= ARROW
	detail		= "calendar"
	state		= NORMAL
	file		= "aln.png"
	border		= { 1, 1, 1, 1}
	stretch		= TRUE
	arrow_direction	= LEFT
	}
	image
	{
	function	= ARROW
	detail		= "calendar"
	state		= PRELIGHT
	file		= "arp.png"
	border		= { 1, 1, 1, 1}
	stretch		= TRUE
	arrow_direction	= RIGHT
	}
	image
	{
	function	= ARROW
	detail		= "calendar"
	state		= PRELIGHT
	file		= "alp.png"
	border		= { 1, 1, 1, 1}
	stretch		= TRUE
	arrow_direction	= LEFT
	}
 }
}
class "GtkCalendar" style "gtk_calendar_example"


Screenshot shows gsimplecal with different themes, appearing on BMPanel2 click above clock.
Attachments
gtkcalendar-examples.png
(36.35 KiB) Downloaded 1017 times

User avatar
torm
Posts: 186
Joined: Sat 07 Mar 2015, 19:56

#17 Post by torm »

Below is a .pet package of gsimplecal-v2.1 precompiled for tahrpup605(32bit) with Gtk-2
and configured settings to look/act the same as on screenshot.
Executable is modified to have direct theme support from global gtkrc, so it
can have any look possible -without altering any other widget or application that
uses GtkCalendar widget.
gsimplecal will install to "my-applications/bin" folder, documentation like
README and example sub-theme.rc will go in "my-documents" folder, under "gsimplecal_plus".
Setting to current locale should be automatic (including week-start-day, etc. ) .
If selected font does not support locale glyphs, edit sub-theme.rc to use some
other font that does.
Double-clicking on calendar dates-area will bring up "Osmo" and close calendar.
To use with BMPanel2 add to bmpanel2rc ( in /root/.config/bmpanel2/.. ) a simple line:
clock_prog gsimplecal
For JWM change in /root/.jwmrc-tray from: <Clock format="%H:%M">PupClockset</Clock>
to: <Clock format="%H:%M">gsimplecal</Clock>

Please read the manual for more options.
When in doupt, use gsimplecal version provided in PPM of your flavor of PuppyLinuxOS.


-------------
CHANGELOG for gsimplecal mod.
-------------

MainWindow.cpp as line 101 added:

Code: Select all

    gtk_widget_set_name(widget, "gsimplecal");
Calendar.cpp as line 37 added:

Code: Select all

    gtk_widget_set_name(widget, "gsimplecalendar");
-------------
When compiling it from source, try:
./configure --enable-gtk2

------------------------------------------------

Mainwindow widget will appear if "show_timezones" is set to "1" and so there can be
a different look for font/color/bg of that item.
I don't think the clock label will update...

------------------------------------------------

Configuration file should be installed as /root/.config/gsimplecal/config

clock_format =%A %x
-notice extra whitespace after "%A" ?
-typing in terminal:
date --help
..will list all possible formats to use
-typing in terminal:
man gsimplecal
..should open the gsimplecal manual for more details

------------------------------------------------

To use included calendar sub-theme, copy the "calendar" folder to whatever theme in
/usr/share/themes/whatever-theme-name/gtk-2.0/..
then open the gtkrc of that theme and add at the top:
include "calendar/sub-theme.rc"
..and re-select the theme.

Note.
When editing the look of calendar, changes may appear without the need to restart
the gtk2 theme in the middle of process, just restart the calendar for that.
When done, don't forget to re-select the gtk2 theme ;)


PS.
Fjalla One.ttf and TekoRegular.ttf fonts are included in "fonts.pet" package in one of
previous posts.
Attachments
gsimplecal.pet
(21.3 KiB) Downloaded 635 times

User avatar
torm
Posts: 186
Joined: Sat 07 Mar 2015, 19:56

#18 Post by torm »

Edit: replaced with arktiswm_calendar, please see page 3
Last edited by torm on Mon 04 Feb 2019, 15:13, edited 2 times in total.

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#19 Post by zigbert »

Thank you for sharing all your knowledge. This thread is getting really good.
I need time to go through all this to learn gtk-theming deeper.

Sigmund

User avatar
torm
Posts: 186
Joined: Sat 07 Mar 2015, 19:56

#20 Post by torm »

Sometimes it helps to know where to hit in Gtk2. :)

Post Reply