Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style commands don't search WM_WINDOW_ROLE X window properties #43

Open
morgant opened this issue Mar 4, 2024 · 1 comment
Open

Style commands don't search WM_WINDOW_ROLE X window properties #43

morgant opened this issue Mar 4, 2024 · 1 comment
Assignees

Comments

@morgant
Copy link
Owner

morgant commented Mar 4, 2024

It doesn't appear that the built-in Style command appname string (which accepts '*' & '?' wildcards; see mlvwm(1) manual page) can match against the WM_WINDOW_ROLE X window property. I believe it currently only matches against WM_CLASS or WM_NAME.

There are many X11 applications that have different types of windows which should have different styles, including the menu bar itself as well as various window features. For example, Claws Mail has WM_CLASS(STRING) = "claws-mail", "Claws-mail" set on all windows, but the WM_WINDOW_ROLE differs by the various window types:

  • The main account/mailbox view has WM_WINDOW_ROLE(STRING) = "mainwindow"
  • A new message has WM_WINDOW_ROLE(STRING) = "compose"
  • Opening an existing message has WM_WINDOW_ROLE(STRING) = "messageview"

A window with a mainwindow role should have different menu bar options than messageview or compose. So, it'd be very helpful to be able to define multiple Style commands for the same WM_CLASS, but differing WM_WINDOW_ROLE.


It appears that WM_WINDOW_ROLE is part of the ICCCM specification, see section 5. Session Management.

@morgant morgant self-assigned this Mar 4, 2024
@morgant
Copy link
Owner Author

morgant commented Sep 30, 2024

Looking at this again for another mlvwmrc issue and wanted to note the following for future me:

  • Parsing of Style ... END configuration blocks is implemented in config.c's SetStyles(). Each line's parsing includes:
    • The first quoted portion of the line is used as the Style name (including * & ? wildcard characters) and either:
      • Scr.style_list is searched for an existing style with name and the matching style is used
      • If one isn't found, a new style is created with the name and appended to the Scr.style_list linked list
    • The rest of the comma-separated options are parsed and the appropriate function will be executed for the style
  • Styles are destroyed in config.c's FreeStyles()
  • add_window.c's lookupstyles() searches Scr.style_list for matching name (using matchWildcards() to support * & ? wildcard characters), returning the style where any of the following match:
    1. Matches against the window name
    2. If the window has a class (an XClassHint), it then matches:
      a. class->res_name
      b. class->res_class
  • add_window.c's AddWindow() uses lookupstyles() to find the matching style, then applies the Style's configuration to the window

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

No branches or pull requests

1 participant