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 syntax matching: Class, Name, Resource, Icon, WindowID #1162

Merged
merged 1 commit into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 49 additions & 2 deletions doc/fvwm3_manpage_source.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3451,8 +3451,6 @@ fvwm used. _verbose_ can be 1 or 2.
+
_nls_ which prints information on the locale catalogs that fvwm used
+
_style_ which prints information on fvwm styles. _verbose_ can be 1.
+
_bindings_ which prints information on all the bindings fvwm has: key
and mouse bindings. _verbose_ has no effect with this option.
+
Expand Down Expand Up @@ -4942,6 +4940,55 @@ For readability, the commands in this section are not sorted
alphabetically. The description of the *Style* command can be found at
the end of this section.

The commands: *FocusStyle*, *Style*, and *WindowStyle* can accept optional
conditional components to match some properties of a window.

For example:

....
Style (Name mc) Sticky
....

Will make a window whose name matched 'mc' _Sticky_.

....
Style (Name mc, Class XTerm) StartIconic
....

This example will start an xterm(1) window whose WM_CLASS matches 'XTerm' and
name is 'mc'.

A valid list of properties to test against are:

* Resource
* Class
* Name
* Icon
* WindowID

The matching of the properties specified for any *Style* line are ANDed
together, and for styles to be applied, *all* properties must match.

**NOTE**: To destroy a style line with window properties, *DestroyStyle*
should be used. For example:

....
DestroyStyle (Name mc, Class XTerm)
....

It is not required to specify the style arguments when destroying a style,
only the property components are required.

Existing *Style* lines in the form:

....
Style Application* Sticky, StartIconic
....

are still supported, and their behaviour remains unchanged.

'''

*FocusStyle* _stylename_ _options_::
works exactly like the *Style* command, but accepts only the focus
policy related styles beginning with "FP". The prefix can be removed,
Expand Down
4 changes: 0 additions & 4 deletions fvwm/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -2651,10 +2651,6 @@ void CMD_PrintInfo(F_CMD_ARGS)
{
FGettextPrintLocalePath(verbose);
}
else if (StrEquals(subject, "style"))
{
print_styles(verbose);
}
else if (StrEquals(subject, "ImageCache"))
{
PicturePrintImageCache(verbose);
Expand Down
29 changes: 23 additions & 6 deletions fvwm/fvwm.h
Original file line number Diff line number Diff line change
Expand Up @@ -570,15 +570,24 @@ typedef struct style_flags
unsigned initial_placement_done : 1;
} style_flags;

typedef struct style_id_flags
{
unsigned has_name:1;
unsigned has_window_id:1;
unsigned has_class:1;
unsigned has_resource:1;
unsigned has_icon:1;
unsigned is_compatibility_mode:1;
} style_id_flags;

typedef struct style_id_t
{
char *name;
XID window_id;
struct
{
unsigned has_name:1;
unsigned has_window_id:1;
} flags;
style_id_flags flags;
char *name;
char *class;
char *resource;
char *icon;
} style_id_t;

typedef struct snap_attraction_t
Expand Down Expand Up @@ -679,6 +688,14 @@ typedef struct window_style
unsigned has_icon_title_format_string : 1;
} window_style;

typedef struct window_style_list
{
struct window_style_list *next;
style_id_t flags;
window_style *first_style;
window_style *last_style;
} window_style_list;

typedef struct window_g
{
rectangle frame;
Expand Down
Loading