12

How can I control the height of the title bar in xfce?

I only have medium experience with linux desktops, I could change some settings in a text file or install a package, but an instruction that would outline the major steps would be great.

I could not find an answer that I could understand or follow to this question during my searching.

Kevdog777
  • 447

6 Answers6

4

Go to Settings > Window Manager > Style (first tab)

The height of the title bar in XFCE depends on the "Theme" you choose.

4

I found out it is not possible by changeing some numerical height value, because the height of the window title bar is not dynamically generated. It is drawn based on a graphical element that is part of the theme and this has a fixed height.

To do what I was asking for, it would be necessary to create a new theme that has the desired proportions.

There are also "compact" themes that have more space because they draw some elements smaller, but they are hard to find and it is still not as small as I would like.

3

I solved this issue by editing the xpm-files in /usr/share/themes/

xpm-files can be edited in a text editor.

Mirco
  • 31
1

Navigate to ~/usr/share/themes/, find the folder for the theme that you want to change (Greybird-dark in my case) and edit the themerc.txt file in that folder in a text editor opened as root.

The parameters that you want to set/change are detailed here. Replacing defaults where needed, I added

frame_border_top=10
title_vertical_offset_active=6
title_vertical_offset_inactive=6
button_offset=6
button_spacing=2

Once you are done, exit the text editor. Then, change your theme to something else and then change back to the one that you've just changed. That should activate your changes.

Note that these settings will sometimes be overwritten by significant upgrades. For example, I lost them to the Xubuntu 20.04 -> Xubuntu 22.04 jump.

J. Mini
  • 282
1

Put the following in a script and run it, providing your desired height and the path to your theme directory (you will need to have ImageMagick installed):

#!/bin/bash

if [ $# -ne 2 ]; then echo "Usage: $0 titleheight /path/to/theme" echo " (eg: $0 40 /usr/share/themes/mytheme/xfwm4)" exit 1 fi

height=$1 directory=$2

hscale=1.00

title_names=("title-1-active" "title-1-inactive" "title-2-active" "title-2-inactive" "title-3-active" "title-3-inactive" "title-4-active" "title-4-inactive" "title-5-active" "title-5-inactive" ) top_names=("top-left-active" "top-left-inactive" "top-right-active" "top-right-inactive") menu_names=("menu-active" "menu-inactive" "menu-normal" "menu-pressed") button_names=("close-active" "close-inactive" "close-pressed" "close-prelight" "hide-active" "hide-inactive" "hide-prelight" "hide-pressed" "maximize-active" "maximize-inactive" "maximize-prelight" "maximize-pressed" "maximize-toggled-active" "maximize-toggled-inactive" "maximize-toggled-prelight" "maximize-toggled-pressed") top_menu_button_names=("${top_names[@]}" "${menu_names[@]}" "${button_names[@]}") extensions=("xpm" "png")

for name in "${title_names[@]}"; do for ext in "${extensions[@]}"; do if [ -f "${directory}/${name}.${ext}" ]; then width=$(identify -format "%[fx:w]" "${directory}/${name}.${ext}") curheight=$(identify -format "%[fx:h]" "${directory}/${name}.${ext}") if [[ $(bc <<< "$hscale == 1.00") -eq 1 ]]; then hscale=$(echo "scale=2; ($height / $curheight)" | bc)
fi echo "${name}.${ext}" $width"x"$curheight "==>" $width"x"$height # Resize the file mogrify -resize ${width}X${height}! "${directory}/${name}.${ext}" fi done done

for name in "${top_menu_button_names[@]}"; do for ext in "${extensions[@]}"; do if [ -f "${directory}/${name}.${ext}" ]; then curwidth=$(identify -format "%[fx:w]" "${directory}/${name}.${ext}") curheight=$(identify -format "%[fx:h]" "${directory}/${name}.${ext}") width=$(echo "scale=2; ($hscale) * $curwidth / 1" | bc) width=$(echo "scale=0; ($width + 0.5) / 1" | bc) height=$(echo "scale=2; ($hscale) * $curheight / 1" | bc) height=$(echo "scale=0; ($height + 0.5) / 1" | bc) echo "${name}.${ext}" $curwidth"x"$curheight "==>" $width"x"$height # Resize the file mogrify -resize ${width}X${height}! "${directory}/${name}.${ext}" fi done done

Shun Feng
  • 108
  • 1
  • 4
mnistic
  • 133
0

This answer expands on the advice given in earlier ones, namely, "create a new theme that has the desired proportions" and "[edit] the xpm-files in /usr/share/themes/".

  1. Determine the theme you want to modify. It's the one you've selected in "Settings" > "Window Manager", tab "Style", setting "Theme".

  2. Find the directory where that theme is stored. It's probably either ~/.themes/, ~/.local/share/themes/, or /usr/share/themes/. Open your terminal and cd to that directory.

  3. Assuming that <theme_name> is the subdirectory that contains the theme you want to modify, in your terminal, command cp -a <theme_name> <theme_name>_modified. (If the directory it's contained in is /usr/share/themes/, instead command cp -a <theme_name> ~/.themes/<theme_name>_modified, so you don't have to use sudo.)

  4. In the new directory <theme_name>_modified, there should be five files named title-N-active.xpm and five files named title-N-inactive.xpm, where N is a digit from 1 to 5. There should also be four files named top-left-active.xpm, top-right-active.xpm, top-left-inactive.xpm, and top-right-inactive.xpm. Open all these 14 files for editing. The contents of one of the files should look something like the following. (This example is taken from theme xfwm4-theme-pixa-master.)

    /* XPM */
    static char *title_1_active[] = {
    "1 26 1 1 ",
    ".      c #2878C8 s active_color_1",
    ".",
    ".",
    ".",
    [20 identical lines omitted]
    ".",
    ".",
    "."};
    
  5. The number 26 on the third row means the height of the title bar in pixels. In each of the 14 files, change it to what you want the new title bar height to be. Also, in each of the 14 files, add or delete lines containing ".", so as to keep the number of those lines equal to the new height in pixels. Save the edited files.

  6. Open the settings editor "Settings" > "Window Manager", and go to tab "Style". The theme <theme_name>_modified should appear in the list widget of setting "Theme". Select it. Your modified theme should now become active, with the height of the title bar changed from that of the original theme.