jun7 / rox-filer

ROX file manager
24 stars 6 forks source link

Themes #156

Closed step- closed 7 years ago

step- commented 7 years ago

Hi,

I would like to theme some ROX-Filer widgets. For instance the tool bar; I want larger text and a different font than the default ones. However, I not want for the theme to also affect the applications that ROX-Filer starts. Is this possible using ROX-Filer alone? Obviously, if I change the font size and color of the ROX-Filer toolbar, I don't want to also change the toolbar of my media player, or text editor or any other program that starts when I click a file icon in rox.

I run GTK-2, this is what I tried.

  1. env GTK2_RC_FILES=$HOME/.gtkrc.ROX-Filer:$HOME/.gtkrc-2.0 rox This applies the modified tool bar styles in ~/.gtkrc.ROX-Filer to ROX-Filer and its children. How to exclude the children?

  2. Theme a ROX-Filer specific widget, for instance by adding to ~/.gtkrc-2.0: widget "rox-filer-label" style "my-toolbar-label". But I couldn't find any ROX-Filer specific widgets, so I assume there aren't any.

So, I put together a kludge, as follows. I add a tool bar theme for the general toolbar class widget_class "*Toolbar*Label" style "my-toolbar-label"

then run rox from a script, which comments in/out the line above

sed -e "s/#\(widget_class.*my-toolbar-label.*\)/\1/" -i $HOME/.gtkrc-2.0
/usr/local/apps/ROX-Filer/AppRun "$@" &
sleep 0.2
sed -e "s/^widget_class.*my-toolbar-label.*/#&/" -i /$HOME/.gtkrc-2.0

This works by applying my-toolbar-label to ROX-Filer without affecting its children, as long as ROX-Filer is always started from the script, and not by clicking the AppDir icon. But it's a kludge, it doesn't scale well, and it doesn't work with rox option -n

I was wondering if there already is a better solution. If not, can something be enhanced in ROX-Filer to achieve my goal?

File ~/.gtkrc-2.0

gtk-theme-name = "default"
gtk-font-name = "DejaVu Sans 10"
gtk-icon-theme-name="default"
gtk-can-change-accels = 1
style "my-toolbar-label" = "default"
{
  font_name = "DejaVu Sans 14"
  fg[NORMAL] = "#3535A8"
}
widget_class "*Toolbar*Label" style "my-toolbar-label"
jun7 commented 7 years ago

I don't get it well, but I saw like below in some gtk themes and also may be in a document of rox.

style "rox"
{
  base[NORMAL] = "#000000"
  text[NORMAL] = "#ffffff"
}
widget "rox-filer*Collection" style "rox"

style "vim" {GtkScrollbar::slider_width = 16}
widget "vim-main-window*" style "vim"

So adding app name (window name?) is normal way I think.

jun7 commented 7 years ago
"rox"
{
font_name = "DejaVu Sans 14"
}
widget "rox-filer*Toolbar*" style "rox"

is works

step- commented 7 years ago

Yes, it works without affecting children apps. Good find, thank you! Now I need to figure out colors for the tool bar only. I will post here when I find a solution.

jun7 commented 7 years ago

I skipped colors because I think setting colors is same the font_name. Is there any special?

jun7 commented 7 years ago

Ah, I forgot what I saw Fatdog64 in Distrowatch. Congratulations!!

step- commented 7 years ago

Thanks for the congrats! Is your rox fork featured in any other distros yet?

And for the color, yes it's just like in my first post, I though it wasn't working because I saw all filenames green. I didn't realize that I was testing in /usr/bin and green is configured for executable files :()

jun7 commented 7 years ago

Only Fatdog64. So I'm happy. thank you.

step- commented 7 years ago

Oh well, thank you!

So this is what I'm doing with this theme stuff

rox-toolbar

style "rox-toolbar-btn-lbl" = "default"
{
font_name = "DejaVu Sans 16"
fg[NORMAL] = "#3535a8"
}
widget "rox-filer*Toolbar*Button*VBox*Label" style "rox-toolbar-btn-lbl"

I need to explain. This tool bar has no icons. I created a .po file with a reduced set of messages, just the ones that concern tool bar labels (#155). Then I translated each label into a one-character unicode string and picked some iconic characters, like the ones above. Then I set rox configuration to display tool bar text with no icons. Then I added the styles (#156). That is the result. It doesn't look perfect, but it's promising. Next I want to experiment with real iconic characters, like Fontelico, Font Awesome, etc.

In the above picture you'll notice that the "133 items" label is black and normal size. That's intentional. Your code puts a VBox around all buttons except the button that contains "133 items". So the style targets very precisely Toolbar*Button*VBox*Label to select just the buttons with an icon, and leave "133 items" unchanged. You should keep the widget hierarchy exactly as it is, otherwise my theme will break.

One last thing, look at the rectangle around the fifth iconic label. You can see that the blue character is followed by white space. I didn't put it there. I think it's padding, but I don't want that padding. I want the label to be snug around the text. It should be possible, because the sixth button, the dark disk with the up-side-down L is perfectly snug, there is no padding. But just that one! All other iconic labels have right padding. What I'm trying to achieve is a shorter tool bar. The extra space makes it unnecessarily longer.

jun7 commented 7 years ago

Because all buttons on Toolbar will be same width. Changing the dark disk to blank solves it may be. It wants also changing 'L' s though.

Addition: fg'[]' has NORMAL PRELIGHT SELECTED ACTIVE INSENSITIVE

step- commented 7 years ago
style "rox-toolbar-lbl" = "default"
{
fg[NORMAL] = "#4e81c6"
fg[PRELIGHT] = "#4e81c6"
fg[ACTIVE] = "#4e81c6"
}
style "rox-toolbar-btn-lbl" = "rox-toolbar-lbl"
{
font_name = "DejaVu Sans 16"
}
widget "rox-filer*Toolbar*Button*GtkLabel" style "rox-toolbar-btn-lbl"
widget "rox-filer*Toolbar.GtkLabel" style "rox-toolbar-lbl"
jun7 commented 7 years ago

Sorry, I don't get what your post means. It works?

step- commented 7 years ago

Yes, it works. That's the final version of my theme file.