Bug 264981

Summary: Activities break "remember" rules
Product: [Plasma] kwin Reporter: Danny Auble <da>
Component: generalAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: chanika, fax.k.root, texstar, tommi.nieminen
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed In: 4.7.4
Sentry Crash Report:
Attachments: xprop right after applying remember on all desktops
xwininfo right after applying remember on all desktops
xprop after a close and start again
xwininfo after a close and restart

Description Danny Auble 2011-01-31 18:20:10 UTC
Version:           unspecified (using KDE 4.6.0) 
OS:                Linux

I have many applications with specific rules done from
right click on title bar -> 
goto Advanced ->
click on Special Application Settings
goto Geometry Tab
check Desktop set Remember set All Desktop

I can see the rules in the System Settings under the Window Behaviour / Window Rules setting, but when I open a new window of the application the rules never get applied.

This appears to happen for every application I try.  This used to work in 4.5.

Reproducible: Always

Steps to Reproduce:
choose a window.
right click on title bar
goto Advanced ->
click on Special Application Settings
goto Geometry Tab
check Desktop set Remember set All Desktop
click OK

close application down, and bring the same application back up.


Actual Results:  
Rule not applied, application stays on current desktop. Following the steps above show no rule was set.

Expected Results:  
Application to be visible on all desktops.

OS: Linux (x86_64) release 2.6.35-25-server
Compiler: cc
Comment 1 Thomas Lübking 2011-01-31 18:54:08 UTC
works for me (tried xterm)- maybe activity related?

@danny
- you're aware that "remember" remembers the setting, ie. it has to be set sticky before closing?
- what applications did you try?
Comment 2 Danny Auble 2011-01-31 19:07:25 UTC
before 4.6 I had this set for pidgin, kontact, and firefox.  None of those work now, but they did work before.  What exactly does sticky mean, I don't see anything named that in the settings?  I just tried xterm with no luck either, even though it shows up in the system settings it doesn't appear when I right click on the title bar again.  Even if I set it in a window and then immediately go look at the setting it isn't set.

Perhaps something has changed here in the functionality, I have no activities I am aware of.
Comment 3 Thomas Lübking 2011-01-31 22:10:43 UTC
sorry, "sticky" means "on all desktops" - ie. the attribute has to be set when the window closes, otherwise it would not be re-attached.
if you want them to be sticky in all cases, you have to force the setting (or "apply initially"), however the fact that it does not appear on the window (but in the systemsettings) worries me.

please attach dumps* of xprop & xwininfo of the window you apply the rule to (before closing it, check whether the rule's still present) and then of the window you'd expect them to see on.

xprop > old_props.txt
xwininfo > old_info.txt
[close, restart]
xprop > new_props.txt
xwininfo > new_info.txt

also check permissions of the rule config file
stat `kde4-config --path config | cut -d ":" -f1`kwinrulesrc

and maybe watch for possibly conflicting files
ls `kde4-config --path config | cut -d ":" -f1`*kwin*rule*
Comment 4 Danny Auble 2011-01-31 22:26:16 UTC
Created attachment 56711 [details]
xprop right after applying remember on all desktops
Comment 5 Danny Auble 2011-01-31 22:27:04 UTC
Created attachment 56712 [details]
xwininfo right after applying remember on all desktops
Comment 6 Danny Auble 2011-01-31 22:27:50 UTC
Created attachment 56713 [details]
xprop after a close and start again
Comment 7 Danny Auble 2011-01-31 22:28:28 UTC
Created attachment 56714 [details]
xwininfo after a close and restart
Comment 8 Danny Auble 2011-01-31 22:29:20 UTC
stat `kde4-config --path config | cut -d ":" -f1`kwinrulesrc
  File: `/home/da/.kde/share/config/kwinrulesrc'
  Size: 3338            Blocks: 8          IO Block: 4096   regular file
Device: 824h/2084d      Inode: 10946       Links: 1
Access: (0600/-rw-------)  Uid: ( 7558/      da)   Gid: ( 7558/      da)
Access: 2011-01-31 13:18:35.151023282 -0800
Modify: 2011-01-31 13:18:35.151023282 -0800
Change: 2011-01-31 13:18:35.151023282 -0800

ls `kde4-config --path config | cut -d ":" -f1`*kwin*rule* | more
/home/da/.kde/share/config/kwin_rules_dialogrc
/home/da/.kde/share/config/kwinrules_update
/home/da/.kde/share/config/kwinrulesrc

more /home/da/.kde/share/config/kwin_rules_dialogrc
[Notification Messages]
displayhints=false

more /home/da/.kde/share/config/kwinrules_update
[$Version]
update_info=kwin_fsp_workarounds_1.upd:kde351

more /home/da/.kde/share/config/kwinrulesrc
[$Version]
update_info=kubuntu-fix-kwin-default-size.upd:kubuntu-fix-kwin-default-size

[1]
Description=Application settings for firefox
clientmachine=snowflake
clientmachinematch=0
desktop=1
desktoprule=4
types=4294967295
wmclass=navigator firefox
wmclasscomplete=true
wmclassmatch=1
...
Comment 9 Thomas Lübking 2011-01-31 22:59:23 UTC
Ok, the client is sticky (before the close) and doesn't change any attributes (like wm_class or so) across the restart, but this:
...
desktop=1
...
is wrong wrong:
desktop should be "-1" (all) not "1" - when did you take this?
before or after the restart and how does it look before you close the application?

(the 2^32-1 "types" is ok, means: apply to all window types)
Comment 10 Danny Auble 2011-01-31 23:11:28 UTC
I viewed this after the restart.  It appears this might be the problem though.  It looks like no matter what I set that desktop var to it gets reset to 1 when I restart the app.  Any ideas?
Comment 11 Thomas Lübking 2011-01-31 23:16:48 UTC
the client get's unsticked while it's closed (is it _always_ one, even if you close the application from eg. desktop 2?)

try to set the rule, then 
chmod -w `kde4-config --path config | cut -d ":" -f1`kwinrulesrc
restart firefox (and watch the sticky state)
chmod +w `kde4-config --path config | cut -d ":" -f1`kwinrulesrc

a) it sure happens with any client and not only (*sigh* and especially) firefox?
b) which decoration do you use? (just a wild shot)
Comment 12 Danny Auble 2011-01-31 23:25:33 UTC
Even though the file doesn't change without write permissions it always goest to Desktop 1.  It happens for every app I have tried.  Pidgin, Firefox, aterm, xterm, Wine, amarok, etc...

I am using QTCurve, but I tried with Oxygen as well.  I have the same results on a different box with a similar setup as well.

On a different note, it appears if I set the param to Force instead of Remember it works, and sticks after the restart.  So it appears Remember is the problem.
Comment 13 Texstar 2011-05-10 15:36:13 UTC
"Force" and "Apply Initially" work but "Remember" does not and puts the application in the top left of the screen in a small rectangle with KDE 4.6.3. Seems something is not correct with kdelibs ruleswidget.cpp.
Comment 14 Thomas Lübking 2011-05-10 21:58:51 UTC
@texstar
Are you actually talking about a "sticky" rule?
Setting sticky to remember causes windows to appear in a tiny rect at 0,0 at your side??
Comment 15 Texstar 2011-05-10 23:29:14 UTC
I open an application say Firefox as example. I right click on the title bar and select Advanced -> Special Window Settings. I click on the Geometry. I check position and check size and select Remember for both. I click on OK. I close out Firefox and open it again and Firefox opens in a tiny rectangle in the top left corner of the screen. Pictures linked.

Configuration Screen:
http://i52.tinypic.com/1467p0.jpg

Result:
http://i53.tinypic.com/28u0gif.jpg

If I select Apply Initially or Force in the options, the application opens in the correct place and geometry.

Hope this helps.
Comment 16 Texstar 2011-05-12 13:43:11 UTC
kwinrules after setting konsole to remember setting.

[1]
Description=Window settings for konsole
clientmachine=thenudiebar
clientmachinematch=0
position=191,56
positionrule=4
size=811,517
sizerule=4
title=texstar : bash
titlematch=0
types=1
windowrole=mainwindow#1
windowrolematch=1
wmclass=konsole
wmclasscomplete=false
wmclassmatch=1

kwinrules after closing konsole and opening again with konsole now in the top left corner of the screen in a tiny rectangle:

[1]
Description=Window settings for konsole
clientmachine=thenudiebar
clientmachinematch=0
position=0,0
positionrule=4
size=139,100
sizerule=4
title=texstar : bash
titlematch=0
types=1
windowrole=mainwindow#1
windowrolematch=1
wmclass=konsole
wmclasscomplete=false
wmclassmatch=1
Comment 17 Thomas Lübking 2011-05-12 21:02:26 UTC
The critical moment is after the window closed, but before it's reopened (the rule after starting the application reflects its current state and is thus correct)

Are you using (and maybe alongside a rule)
- window tabbing (tabstrip, aurorae - iirc oxygen has an opt-out checkbox)
- window tiling
- multiple activities
Comment 18 Texstar 2011-05-13 02:14:46 UTC
That is it! Multiple Activities. I had two listed (odd). I removed one and remember started working.
Comment 19 Thomas Lübking 2011-05-13 02:31:42 UTC
yupp, can confirm. adding a 2nd activity breaks it here as well.
Comment 20 Thomas Lübking 2011-05-13 18:41:21 UTC
fix is to prevent Client::updateActivities() call Client::updateWindowRules() during Client::manage()

@chani
why does "updateActivities();" have to "updateWindowRules();" at all?
Comment 21 Thomas Lübking 2011-10-09 17:12:41 UTC
*** Bug 265098 has been marked as a duplicate of this bug. ***
Comment 22 Thomas Lübking 2011-11-14 11:50:46 UTC
Git commit b08fa7d0b5e53cec2950c3f0f3e2fc88a40c0ba8 by Thomas Lübking.
Committed on 14/11/2011 at 12:46.
Pushed by luebking into branch 'master'.

don't ::updateRules() in ::updateActivities()

breaks remember rules when called by ::setActivity() in ::manage()
TODO: add activity rules and make remember state applying more robust in 4.9

BUG: 264981

M  +1    -1    kwin/client.cpp

http://commits.kde.org/kde-workspace/b08fa7d0b5e53cec2950c3f0f3e2fc88a40c0ba8
Comment 23 Thomas Lübking 2011-11-14 11:52:48 UTC
Git commit 4ea7eadcd6c1666e5a3315a156588da1bca2d1a6 by Thomas Lübking.
Committed on 14/11/2011 at 12:46.
Pushed by luebking into branch 'KDE/4.7'.

don't ::updateRules() in ::updateActivities()

breaks remember rules when called by ::setActivity() in ::manage()
TODO: add activity rules and make remember state applying more robust in 4.9

BUG: 264981
FIXED-IN: 4.7.4
(cherry picked from commit b08fa7d0b5e53cec2950c3f0f3e2fc88a40c0ba8)

M  +1    -1    kwin/client.cpp

http://commits.kde.org/kde-workspace/4ea7eadcd6c1666e5a3315a156588da1bca2d1a6
Comment 24 Thomas Lübking 2012-03-11 05:18:14 UTC
*** Bug 267629 has been marked as a duplicate of this bug. ***