i3: Rule based title_format doesn't support i3 container title bars

I’m submitting a…

[x] Bug
[ ] Feature Request
[ ] Documentation Request
[ ] Other (Please describe in detail)

Current Behavior

I’m using title_format to add 1 space indentation to titles. But I see no way to match i3: X[....] titles, even a .* class rule misses them.

This makes vertically stacked window titles ill-aligned.

Environment

Output of i3 --moreversion 2>&-:

Binary i3 version:  4.15 (2018-03-10) © 2009 Michael Stapelberg and contributors
Running i3 version: 4.15 (2018-03-10) (pid 11418) abort…)
Loaded i3 config: /home/carlos/.config/i3/config (Last modified: Tue 24 Jul 2018 03:58:40 PM -03, 459 seconds ago)

The i3 binary you just called: /usr/bin/i3
The i3 binary you are running: i3

Configuration file:

# General settings
set $mod Mod4
floating_modifier $mod
font pango:DejaVu Sans Bold 10
default_border normal 1
hide_edge_borders both
workspace_auto_back_and_forth yes
set $nexec exec --no-startup-id

# Theme
set $bg #13191c
set $border #101619
set $fg #83898c
set $fg_high #cfd7d3
set $fg_urg #cc6666
#                       Border  Background Text     Indicator Child border
client.focused          $border $bg        $fg_high $fg       $border
client.focused_inactive $border $bg        $fg      $fg       $border
client.unfocused        $border $bg        $fg      $fg       $border
client.urgent           $border $bg        $fg_urg  $fg       $border
client.placeholder      $border $bg        $fg      $fg       $border
client.background       $border

# App shortcuts
bindsym $mod+l $nexec emacsclient -c
bindsym $mod+Control+l exec xfce4-terminal
bindsym $mod+Shift+l exec firefox
bindsym $mod+Mod1+l exec spotify
bindsym $mod+Tab $nexec rofi -no-fixed-num-lines -location 7 -show window -yoffset -25
bindsym $mod+Return $nexec "rofi -location 7 -combi-modi drun,run -show combi -yoffset -25"
bindsym $mod+Control+Return $nexec music toggle
bindsym $mod+Shift+Return $nexec music mute
bindsym $mod+Mod1+Return $nexec dual
bindsym $mod+Shift+Control+Return $nexec passmenu
bindsym $mod+Left $nexec music prev
bindsym $mod+Right $nexec music next
bindsym $mod+Down $nexec music down
bindsym $mod+Up $nexec music up
bindsym $mod+Shift+Down $nexec xbacklight -dec 2
bindsym $mod+Shift+Up $nexec xbacklight -inc 2
bindsym $mod+s $nexec search $(xclip -o)
bindsym $mod+Control+s $nexec search -r
bindsym $mod+o $nexec shot %c
bindsym $mod+Control+o $nexec shot %d
bindsym $mod+Shift+o $nexec shot %c 5
bindsym $mod+Mod1+o $nexec shot %d 5

# Change focus
bindsym $mod+b focus left
bindsym $mod+n focus down
bindsym $mod+Shift+Control+n focus child
bindsym $mod+p focus up
bindsym $mod+Shift+Control+p focus parent
bindsym $mod+f focus right
bindsym $mod+grave focus right

# Change layout
bindsym $mod+w layout splith
bindsym $mod+Control+w layout splitv
bindsym $mod+a layout tabbed
bindsym $mod+Control+a layout stacking
bindsym $mod+d split h
bindsym $mod+Control+d split v
bindsym $mod+m fullscreen toggle
bindsym $mod+Control+m border toggle
bindsym $mod+space focus mode_toggle
bindsym $mod+Control+space floating toggle

# Move window
bindsym $mod+Control+b move left
bindsym $mod+Control+n move down
bindsym $mod+Control+p move up
bindsym $mod+Control+f move right
bindsym $mod+Control+1 move container to workspace 1
bindsym $mod+Control+2 move container to workspace 2
bindsym $mod+Control+3 move container to workspace 3
bindsym $mod+Control+4 move container to workspace 4
bindsym $mod+Control+5 move container to workspace 5
bindsym $mod+Control+6 move container to workspace 6
bindsym $mod+Control+7 move container to workspace 7
bindsym $mod+Control+8 move container to workspace 8
bindsym $mod+Control+9 move container to workspace 9
bindsym $mod+Control+0 move container to workspace 10

# Resize window
bindsym $mod+Control+Left resize shrink width 10 px or 5 ppt
bindsym $mod+Control+Up resize grow height 10 px or 5 ppt
bindsym $mod+Control+Down resize shrink height 10 px or 5 ppt
bindsym $mod+Control+Right resize grow width 10 px or 5 ppt

# Switch to workspace
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10

# Move workspace
bindsym $mod+Shift+1 rename workspace to 1
bindsym $mod+Shift+2 rename workspace to 2
bindsym $mod+Shift+3 rename workspace to 3
bindsym $mod+Shift+4 rename workspace to 4
bindsym $mod+Shift+5 rename workspace to 5
bindsym $mod+Shift+6 rename workspace to 6
bindsym $mod+Shift+7 rename workspace to 7
bindsym $mod+Shift+8 rename workspace to 8
bindsym $mod+Shift+9 rename workspace to 9
bindsym $mod+Shift+0 rename workspace to 10
bindsym $mod+Mod1+p move workspace to output up
bindsym $mod+Mod1+n move workspace to output down
bindsym $mod+Mod1+f move workspace to output right
bindsym $mod+Mod1+b move workspace to output left

# Marks
bindsym $mod+Control+F1 mark --toggle 1
bindsym $mod+F1 [con_mark=1] focus
bindsym $mod+Control+F2 mark --toggle 2
bindsym $mod+F2 [con_mark=2] focus
bindsym $mod+Control+x mark --toggle x
bindsym $mod+Shift+x move window to mark x, unmark x
bindsym $mod+x swap container with mark x, unmark x

# Scratchpad
bindsym $mod+z scratchpad show
bindsym $mod+Control+z floating enable, move scratchpad
bindsym $mod+Shift+z scratchpad show, scratchpad show
bindsym $mod+e [title="^Scratchpad - Emacs"] scratchpad show
bindsym $mod+Control+e [title="^Scratchpad - Terminal$"] scratchpad show
bindsym $mod+Shift+e [title="(Gmail|Slack|WhatsApp)"] focus
bindsym $mod+Mod1+e [class="^Spotify$"] scratchpad show
bindsym $mod+Shift+Control+e $nexec emacsclient -F '((title . "Scratchpad - Emacs"))' -a '' -c ~/notes/inbox.org
bindsym $mod+Shift+Control+Mod1+e exec xfce4-terminal --title 'Scratchpad - Terminal'

# Control
bindsym $mod+r exec i3-input
bindsym $mod+Control+r reload
bindsym $mod+Shift+r restart
bindsym $mod+Shift+Control+r exit
bindsym $mod+c exec i3lock -c 1d1f21
bindsym $mod+Control+c exec systemctl sleep
bindsym $mod+Shift+c exec systemctl hibernate
bindsym $mod+Shift+Control+c exec systemctl poweroff
bindsym $mod+Control+q kill

# Rules
for_window [class="^Pavucontrol$"] floating enable
for_window [class="^qpaeq$"] floating enable
for_window [class="^Gpick$"] floating enable
for_window [class="^Connman-gtk$"] floating enable
for_window [class="^Xmag$"] floating enable
for_window [class="^Spotify$"] floating enable, resize set 1000 700, move position center
for_window [title="^Htop$"] floating enable
for_window [title="^Scratchpad - Terminal$"] floating enable, move scratchpad
for_window [title="^Scratchpad - Emacs$"] floating enable, move scratchpad

# Startup
$nexec emacsclient -F '((title . "Scratchpad - Emacs"))' -a '' -c ~/notes/inbox.org
$nexec xfce4-terminal --title 'Scratchpad - Terminal'
- Linux Distribution & Version: Linux archlinux 4.17.8-1-ARCH #1 SMP PREEMPT Wed Jul 18 09:56:24 UTC 2018 x86_64 GNU/Linux
- Are you using a compositor: compton

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Comments: 20 (9 by maintainers)

Most upvoted comments

Btw, this seems to work quite well as a workaround using the ipc interface from python:

#!/bin/python

import i3ipc


def format_title(i3, ev):
    for con in i3.get_tree():
        if con.type == 'con' and con.nodes:
            con.command('title_format " %title"')


i3 = i3ipc.Connection()
i3.on('window::move', format_title)
i3.main()

Not that I like it too much… Also it misses some cases when a container is created without a window being created nor moved, so I also added this to my i3 config:

bindsym $mod+d split h, focus parent, title_format " %title", focus child
bindsym $mod+Control+d split v, focus parent, title_format " %title", focus child

What about default_title_format as in default_border?