This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Apply Initially attribute ignored in Window Rules

Tags: None
(comma "," separated)
User avatar
yochaigal
Registered Member
Posts
8
Karma
0
OS
I have two monitors; my primary (screen 1) and secondary (screen 2). Default Window placement is set to Centered, not that it makes a difference.
I also use KRDC daily; for whatever reason it has decided to start in the top-left side of screen 2 (x=0, y=0) I think.
I can workaround this with Window Rules - basically by specifying what screen, initial placement or geometry it should have. This works - but only if I use the Force attribute - Apply Initially is completely ignored, regardless of the attribute being set.

Any idea why? Thanks.
alavarre
Registered Member
Posts
5
Karma
0
OS
Thank you for your posting, I don't know the answer but have a similar question, so nice to know I am not alone. More generally:
~~~~~
How might plasma windows be forced to follow the rules when they start, not waiting until they explicitly receive focus?

KDE 5.5 plasma kwin does not always follow the rules in kwinrulesrc unless it is set to Force (2).

Even then it does not follow the rule for some applications until you give the application focus explicitly by clicking on its window.

• I would like to find where the default ([$d]) values are saved. They aren't hard coded because they change.
• I would like for each application to take focus long enough to obey the kwinrulesrc rules and then relinquish focus to the next application.
~~~~~
To answer http://tinyurl.com/yayja6en
pretty much all "rules not working" bug reports so far have turned out "rules are complicated" =)
it would help to have more documentation than I have found:
http://tinyurl.com/y7grzh6o
I have presented my best interpretation of these rules to date at:
https://privustech.com/index.php/kde-window-rules-attributes-and-codes/
For example, in Chapter 6 of documentation it would be helpful to:
• Present a cross correlation table between numerical and text attribute rules (¶6.1) e.g.,
3 Apply initially
• Present a table of default values for each attribute and attribute rule
• Present a definition of “the global window placement strategy” (¶6.2.1)
http://tinyurl.com/yaj9ghjp
This "strategy" is widely cited in the document, but neither Google nor I can find such a thing...
So, it is very difficult to make sense of it all absent more explicit definitions such as these.

A kwinrulesrc excerpt is here: all other values are either missing or Default [$d]
Code: Select all
   [81]
   Description=Geany Devel
   activity=739788af-c322-4139-9b83-82d8109720ba
   activityrule=2
   position=179,111
   positionrule=2
   size=1250,700
   sizerule=3
   title=Devel
   titlematch=2
   wmclass=geany
   wmclasscomplete=false
   wmclassmatch=1

I have set the same size and position rules for each application.
~~~~~
Matching is complicated, generally I set it to substring to make matching easier for class, title, leaving the rest to defaults.
Placement is complicated: I've tried Initial placement Centered, Ignore requested geometry, Obey geometry restrictions, each with its options of Force, Force temporarily, etc.
~~~~~
The only reliable way I have found to get what I want is to (in a series of scripts, of course):
1. Set the attribute rule of interest to Force (xxxrule=2) for all the rules in a proxy file ~/.config/kwinrulesrc.lcd
Code: Select all
      sed -i 's/sizerule[][]$d[]]/sizerule=3/g' ~/.config/kwinrulesrc.lcd
      sed -i 's/sizerule=.*/sizerule=3/g' ~/.config/kwinrulesrc.lcd

2. Stop kwin, replace kwinrulesrc with the proxy, and restart kwin and plasma:
Code: Select all
      kill -9 $kwin_PID
      cp ./kwinrulesrc.lcd ./kwinrulesrc
      kwin --replace &
      kquitapp5 plasmashell && kstart plasmashell

This is a bit of a pain because of the time it takes and the fact that it leaves the attribute frozen, so you have to edit the rule to be able to change the attribute.
So it would be much nicer if it would only do what I tell it to do.
Thanks in advance.
Andy
~~~~~ Details ~~~~~
Linux Mint KDE 18 (Sarah)
KDE 5.8

I have a set up a number of different activities. I have a number of scripts that bring up the applications for each activity. I start these scripts running and go fix a coffee while the machine brings everything up. Then the machine is all set up for my work routine when I return in a few minutes.

Very very cool. But only in theory.

It doesn't work. The windows are scattered all over the screen and some appear in the wrong activity until we click on them.

So brute force: xxxrule=2. But even then some applications do not obey. Very Microsoftian...

So we need a way to have applications follow the rule when each starts, not only after it explicitly receives focus and a way to have it follow other rules (e.g., Apply initially) that we have set.
• We tried including kwinrulesrc in /etc/xdg but that has no effect. That version is completely ignored.
• I've worked through all the other settings, the only one that behaves reliably is Force:

| Rule | Description |
| 1 | Do not affect |
| 2 | Force |
| 3 | Apply initially |
| 4 | Remember |
| 5 | Apply now |
| 6 | Force temporarily |


• The defaults are applied if the rule is [$d] but the default value changes for different applications.

• The most flagrant class are applications which appear in all activities despite their activity rule being Force (2) but switch to the correct activity when clicked, then re-clicked after it moves.

• The next more flagrant class are activities whose position is wrong despite having positionrule=Apply Initially (3), Remember (4), Apply now (5), or Force Temporarily (6)
◇ The rule is simply ignored in the first two cases. The rule is changed to Default ([$d] in the last two cases.

So in general, Window Rules do not work for me unless forced. I'm willing to work harder at documenting all this but I need to know:
• What are the defaults?
• Where are they saved?
• How to make kwin follow the rules when the app starts, not instead only when the app is explicitly given focus?


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]