swaywm / sway

i3-compatible Wayland compositor
https://swaywm.org
MIT License
14.77k stars 1.11k forks source link

Sway fails to apply multiple pango tags, unless they're surrounded by spaces #7698

Open ismay opened 1 year ago

ismay commented 1 year ago

Please fill out the following:

i3 PR:

This concerns existing i3 functionality.

Description:

In certain cases sway renders pango markup in the binding mode indicator and the status_command output area differently from i3, unless the pango markup is surrounded by spaces.

The problem is that sway renders this incorrect: "<small><b>text</b></small>", and this correct: " <small><b>text</b></small> ". Sway applies the <b> tag but fails to apply the <small> tag, unless the tag is surrounded by spaces. i3 does not do this, it applies both tags, regardless of them being surrounded by spaces or not.

Below I've included examples of this for the mode indicator and status command output, for both sway and i3. Note that only sway fails to apply the small tag, and only when it is not surrounded by spaces. i3 applies it in all cases, as expected.

Screenshots

Binding mode

Sway binding mode indicator, with spaces:

sway-mode-with-spaces

set $wmmode " <small><b>wm: [l]ock [r]estart e[x]it</b></small> "
mode --pango_markup $wmmode {
  ...
}

❌ Sway binding mode indicator, without spaces:

sway-mode-without-spaces

set $wmmode "<small><b>wm: [l]ock [r]estart e[x]it</b></small>"
mode --pango_markup $wmmode {
  ...
}

i3 binding mode indicator, with spaces:

i3-mode-with-spaces

set $wmmode " <small><b>wm: [l]ock [r]estart e[x]it</b></small> "
mode --pango_markup $wmmode {
  ...
}

i3 binding mode indicator, without spaces:

i3-mode-without-spaces

set $wmmode "<small><b>wm: [l]ock [r]estart e[x]it</b></small>"
mode --pango_markup $wmmode {
  ...
}

Status_command output

Sway status_command output, with spaces:

sway-swaybar-with-spaces

time=$(date +"%d %b %H:%M")
echo " <small><b>${time}</b></small> "

❌ Sway status_command output, without spaces:

sway-swaybar-without-spaces

time=$(date +"%d %b %H:%M")
echo "<small><b>${time}</b></small>"

i3 status_command output, with spaces:

i3-i3bar-with-spaces

time=$(date +"%d %b %H:%M")
echo " <small><b>${time}</b></small> "

i3 status_command output, without spaces:

i3-i3bar-without-spaces

time=$(date +"%d %b %H:%M")
echo "<small><b>${time}</b></small>"
ismay commented 1 year ago

To clarify, the screenshots were made with i3bar and swaybar. Both with i3blocks as status_command.

rpigott commented 1 year ago

I think the small tag doesn't apply unless there is some non-small text.

ismay commented 1 year ago

I think the small tag doesn't apply unless there is some non-small text.

Just in sway you mean? Because i3 does apply it. Or is i3 in violation of how pango tags should be applied and is sway actually doing it correctly?

rpigott commented 1 year ago

In sway. I mean that the spaces in particular aren't relevant.

What font line is in your config?

ismay commented 1 year ago

What font line is in your config?

I'll include the whole sway bar configuration, for context:

# theme
#######

set $blue #5294E2
set $dkblue #383C4A
set $brgray #D3DAE3
set $gray #666A74
set $red #FC4138
set $white #FFFFFF

#                       bd ---- bg ---- txt --- indic - childbd
client.focused          $gray   $gray   $gray   $blue   $blue
client.focused_inactive $gray   $gray   $gray   $gray   $gray
client.unfocused        $gray   $gray   $gray   $gray   $gray
client.urgent           $gray   $gray   $gray   $red    $red

# bar
#####

bar {
  font pango:Hack Nerd Font 12
  position top
  status_command i3blocks
  status_padding 8
  strip_workspace_numbers yes
  tray_output none
  workspace_min_width 50

  colors {
    background $dkblue
    statusline $brgray
    separator  $brgray

    # class            bd      bg      txt
    focused_workspace  $blue   $blue   $white
    active_workspace   $blue   $blue   $white
    inactive_workspace $dkblue $dkblue $brgray
    urgent_workspace   $red    $red    $white
    binding_mode       $red    $red    $white
  }
}

In sway. I mean that the spaces in particular aren't relevant.

I see. So you mean that any characters that are outside of the small tag would trigger the application of the small tag, right? So since i3 seems to do this differently, which wm is in the right here? Should sway emulate what i3 is doing (always apply the small tag), or is what i3 is doing a bug?

rpigott commented 1 year ago

Both should match whatever pango-view does I think, but it seems pretty clear this is a sway bug.

On Fri, Aug 4, 2023, 11:46 ismay @.***> wrote:

What font line is in your config?

I'll include the whole sway bar configuration, for context:

theme

#######

set $blue #5294E2 set $dkblue #383C4A set $brgray #D3DAE3 set $gray #666A74 set $red #FC4138 set $white #FFFFFF

bd ---- bg ---- txt --- indic - childbd

client.focused $gray $gray $gray $blue $blue client.focused_inactive $gray $gray $gray $gray $gray client.unfocused $gray $gray $gray $gray $gray client.urgent $gray $gray $gray $red $red

bar

bar { font pango:Hack Nerd Font 12 position top status_command i3blocks status_padding 8 strip_workspace_numbers yes tray_output none workspace_min_width 50

colors { background $dkblue statusline $brgray separator $brgray

# class            bd      bg      txt
focused_workspace  $blue   $blue   $white
active_workspace   $blue   $blue   $white
inactive_workspace $dkblue $dkblue $brgray
urgent_workspace   $red    $red    $white
binding_mode       $red    $red    $white

} }

In sway. I mean that the spaces in particular aren't relevant.

I see. So you mean that any characters that are outside of the small tag would trigger the application of the small tag, right? So since i3 seems to do this differently, which wm is in the right here? Should sway emulate what i3 is doing (always apply the small tag), or is what i3 is doing a bug?

— Reply to this email directly, view it on GitHub https://github.com/swaywm/sway/issues/7698#issuecomment-1666037662, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC76V6KNLAUFMPKMHUTCQJLXTU7RPANCNFSM6AAAAAA3EAZ6CY . You are receiving this because you commented.Message ID: @.***>

ismay commented 1 year ago

Ok, yeah. Yeah that's what it seemed like to me as well. Let me know if there's anything I can do to help debug.