Skip to content

sway: pango markup not fully supported (span rendered as plain text) #157

Open

Description

@CastixGitHub

this works flawless in i3.
with sway however, only <b> and <i> seems to be supported, meanwhile span is rendered as text.

>>> vars(i3.command('rename workspace "i: work" to "<b>b</b><span font_desc=\"file-icons\">\ue926</span>"')[0])
{'ipc_data': {'success': True}, 'success': True, 'error': None}
>>> vars(i3.command('rename workspace "i: work" to "<b>b</b><i>i</i>"')[0])
{'ipc_data': {'success': True}, 'success': True, 'error': None}
>>> vars(i3.command('rename workspace "i: work" to "<span foreground=\"blue\">blue</span>"')[0])
{'ipc_data': {'success': True}, 'success': True, 'error': None}

tried also to put
bindsym $mod+Shift+i workspace <span foreground="blue">blue</span> in .config/sway/config and the blue blue text is there, so this is ipc related

Activity

  1. acrisci commented on Aug 30, 2020

    @acrisci
    Member

    I wonder if it has something to do with how sway unescapes those quotes. You don't have quote escapes in the example that works and that probably makes a difference.

  2. CastixGitHub commented on Aug 31, 2020

    @CastixGitHub
    Author

    well, you are right

    anyway, on i3 if I do

    >>> vars(i3.command('rename workspace i: work to <span foreground=\"blue\">blue</span>')[0])
    {'ipc_data': {'success': False, 'parse_error': True, 'error': "Expected one of these tokens: 'to'", 'input': 'rename workspace i: work to <span foreground="blue">blue</span>', 'errorposition': '                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'}, 'success': False, 'error': "Expected one of these tokens: 'to'"}
    
    >>> vars(i3.command('rename workspace "i: work" to <span foreground=\"blue\">blue</span>')[0])
    {'ipc_data': {'success': True}, 'success': True, 'error': None}
    # worked
    >>> vars(i3.command('rename workspace "i: work" to <span foreground="blue">blue</span>')[0])
    {'ipc_data': {'success': True}, 'success': True, 'error': None}
    # worked

    so i need to quote before to (now immagine doing the reverse):

    >>> vars(i3.command('rename workspace <span foreground="blue">blue</span> to i: work')[0])
    {'ipc_data': {'success': False, 'parse_error': True, 'error': "Expected one of these tokens: 'to'", 'input': 'rename workspace <span foreground="blue">blue</span> to i: work', 'errorposition': '                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'}, 'success': False, 'error': "Expected one of these tokens: 'to'"}
    >>> vars(i3.command('rename workspace <span foreground="blue">blue</span> to "i: work"')[0])
    {'ipc_data': {'success': False, 'parse_error': True, 'error': "Expected one of these tokens: 'to'", 'input': 'rename workspace <span foreground="blue">blue</span> to "i: work"', 'errorposition': '                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'}, 'success': False, 'error': "Expected one of these tokens: 'to'"}
    >>> vars(i3.command('rename workspace "<span foreground="blue">blue</span>" to "i: work"')[0])
    {'ipc_data': {'success': False, 'parse_error': True, 'error': "Expected one of these tokens: 'to'", 'input': 'rename workspace "<span foreground="blue">blue</span>" to "i: work"', 'errorposition': '                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'}, 'success': False, 'error': "Expected one of these tokens: 'to'"}
    >>> vars(i3.command('rename workspace "<span foreground=\"blue\">blue</span>" to "i: work"')[0])
    {'ipc_data': {'success': False, 'parse_error': True, 'error': "Expected one of these tokens: 'to'", 'input': 'rename workspace "<span foreground="blue">blue</span>" to "i: work"', 'errorposition': '                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'}, 'success': False, 'error': "Expected one of these tokens: 'to'"}
    >>> vars(i3.command('rename workspace "<span foreground=\\"blue\\">blue</span>" to i: work')[0])
    {'ipc_data': {'success': True}, 'success': True, 'error': None}

    if I do the same with sway, if I do \\"blue\\" or \"blue\" I see the literal <span in the bar. to make it become blue, i have to remove \ but then, if I press the button on the bar, a new workspace named as the literal <span is created 🤕 so I cannot access to it anymore until I rename it (but opposite to i3 i can't quote the input argument (the part before to) otherwise it says There is no workspace with that name)

    so do you agree it should work with:

    vars(i3.command('rename workspace "i: work" to <span foreground=\\"blue\\">blue</span>')[0])

    on i3 and with

    vars(i3.command('rename workspace i: work to <span foreground="blue">blue</span>')[0])

    on sway, then there is that click issue with sway... (swaywm/sway#5652)
    is this inconsintency about quotes before to something i'm wrong or should be reported to sway devs too?

  3. acrisci commented on Aug 31, 2020

    @acrisci
    Member

    Consider using raw strings to reduce confusion about the escapes.

    If there are any differences about escaped values in the parser, you can report it on sway because it's supposed to be compatible with the i3 config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions