After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 704831 - Always on Top window option needs keyboard shortcut
Always on Top window option needs keyboard shortcut
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: general
3.8.x
Other Linux
: Normal normal
: ---
Assigned To: Sindhu S
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2013-07-24 19:43 UTC by Sindhu S
Modified: 2013-11-19 18:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add keyboard shortcut for Always on Top (3.80 KB, patch)
2013-07-24 19:43 UTC, Sindhu S
needs-work Details | Review
Add keyboard shortcut for Always on Top (3.02 KB, patch)
2013-09-02 12:17 UTC, Sindhu S
reviewed Details | Review
Add Always on Top key to gsettings-desktop-schemas module (767 bytes, patch)
2013-09-02 12:18 UTC, Sindhu S
accepted-commit_now Details | Review
Add keyboard shortcut for Always on Top (3.27 KB, patch)
2013-11-16 15:47 UTC, Sindhu S
none Details | Review
Add Always on Top key (767 bytes, patch)
2013-11-16 16:23 UTC, Sindhu S
reviewed Details | Review
Add keyboard shortcut for Always on Top (2.65 KB, patch)
2013-11-16 16:24 UTC, Sindhu S
reviewed Details | Review
Add Always on Top key (910 bytes, patch)
2013-11-16 17:25 UTC, Sindhu S
accepted-commit_now Details | Review
Add keyboard shortcut for Always on Top (2.65 KB, patch)
2013-11-16 17:25 UTC, Sindhu S
accepted-commit_now Details | Review

Description Sindhu S 2013-07-24 19:43:45 UTC
Created attachment 250066 [details] [review]
Add keyboard shortcut for Always on Top

I have made a patch that allows one to set a keyboard shortcut via the gsettings) for the Always on Top window option. The default is Super + W. I have coded this in stable branch of mutter (gnome-3-8), built and tested it. It works correctly except for some harmless warnings in the terminal.

This is the first time I am hacking on mutter so I might have messed up where the code must be added, please let me know your suggestions so I can fix it and also if my code (the idea of having a keybinding for the window option) is good to be accepted to git master...if not I can always use this custom version of mutter for my personal use :)

Thanks!
Comment 1 Jasper St. Pierre (not reading bugmail) 2013-08-26 13:53:54 UTC
Review of attachment 250066 [details] [review]:

If you want this keybinding to appear in gnome-control-center, you're going to patch 50-metacity-windows.xml.in to have the keybinding.

::: src/core/keybindings.c
@@ +3144,3 @@
+handle_always_on_top (MetaDisplay    *display,
+                              MetaScreen     *screen,
+                              MetaWindow     *window,

Not aligned to the above.

@@ +3151,3 @@
+  if (window->wm_state_above == FALSE)
+  {
+        meta_window_make_above (window);

You don't need braces, and the indentation is a bit off here.

::: src/org.gnome.mutter.gschema.xml.in
@@ +96,3 @@
+    <key name="always-on-top" type="s">
+      <default>'Super_W'</default>
+      <_summary>Modifier to toggle Always on Top status on windows</_summary>

This key adds an unused setting. Don't add it.

@@ +115,3 @@
     </key>
 
+    <key name="always-on-top" type="as">

This setting should be in org.gnome.desktop.wm.keybindings, so we would need a patch to the gsettings-desktop-schemas module.

@@ +116,3 @@
 
+    <key name="always-on-top" type="as">
+      <default><![CDATA[['<Super>W']]]></default>

Can you make it empty by default?
Comment 2 Sindhu S 2013-09-02 12:17:17 UTC
Created attachment 253832 [details] [review]
Add keyboard shortcut for Always on Top

Made changes as suggested. Please review thanks.
Comment 3 Sindhu S 2013-09-02 12:18:51 UTC
Created attachment 253833 [details] [review]
Add Always on Top key to gsettings-desktop-schemas module

Add Always on Top key to gsettings-desktop-schemas module

I am attaching this patch here as it was asked on this bug page.
I am not sure how good my commit message is, I will change it if required.

Please review, thanks.
Comment 4 Jasper St. Pierre (not reading bugmail) 2013-11-16 15:40:33 UTC
Review of attachment 253832 [details] [review]:

::: src/org.gnome.mutter.gschema.xml.in
@@ +117,3 @@
     </key>
 
+    <key name="always-on-top" type="as">

You don't need this key anymore, given that it's in gsettings-desktop-schemas.
Comment 5 Jasper St. Pierre (not reading bugmail) 2013-11-16 15:40:58 UTC
Review of attachment 253833 [details] [review]:

Looks good.
Comment 6 Sindhu S 2013-11-16 15:47:47 UTC
Created attachment 260006 [details] [review]
Add keyboard shortcut for Always on Top

Final patch.
Comment 7 Sindhu S 2013-11-16 15:50:08 UTC
Pushed to master in https://git.gnome.org/browse/mutter/commit/?id=b7e3f627f1b4248ff477b5856e19ddb374ae034a

Closing bug as RESOLVED and FIXED.

Thank you, Jasper for the reviews! :)
Comment 8 Sindhu S 2013-11-16 16:01:33 UTC
Re-opening bug to fix incorrect commit.
Comment 9 Sindhu S 2013-11-16 16:23:33 UTC
Created attachment 260011 [details] [review]
Add Always on Top key

Gsettings patch.
Comment 10 Sindhu S 2013-11-16 16:24:00 UTC
Created attachment 260012 [details] [review]
Add keyboard shortcut for Always on Top

Mutter patch.
Comment 11 Jasper St. Pierre (not reading bugmail) 2013-11-16 16:24:52 UTC
Review of attachment 260012 [details] [review]:

::: src/core/keybindings.c
@@ +4667,3 @@
   add_builtin_keybinding (display,
+                          "always-on-top",
+                          mutter_keybindings,

This needs to be common_keybindings.
Comment 12 Jasper St. Pierre (not reading bugmail) 2013-11-16 16:25:18 UTC
Review of attachment 260011 [details] [review]:

::: schemas/org.gnome.desktop.wm.keybindings.gschema.xml.in.in
@@ +319,3 @@
     </key>
+    <key name="always-on-top" type="as">
+      <default></default>

Adding a _summary and _description would be nice.
Comment 13 Sindhu S 2013-11-16 17:25:09 UTC
Created attachment 260013 [details] [review]
Add Always on Top key

Gsettings patch revised.
Comment 14 Sindhu S 2013-11-16 17:25:38 UTC
Created attachment 260014 [details] [review]
Add keyboard shortcut for Always on Top

Mutter patch revised.
Comment 15 Jasper St. Pierre (not reading bugmail) 2013-11-16 20:35:46 UTC
Review of attachment 260014 [details] [review]:

Looks good.
Comment 16 Jasper St. Pierre (not reading bugmail) 2013-11-16 20:36:00 UTC
Review of attachment 260013 [details] [review]:

Looks good.
Comment 17 Sindhu S 2013-11-17 05:21:13 UTC
Pushed to relevant repositories:

https://git.gnome.org/browse/mutter/commit/?id=4373916d9db88c2b6d8b09190cc51e2cfc0f8de4

https://git.gnome.org/browse/gsettings-desktop-schemas/commit/?id=6e18c3b4a4194f25f24a2618771b6b75b2685fe3

Again, apologies I messed up, will confirm next time before pushing.

and closing bug again! (hopefully this time it will stay closed!).
Comment 18 Sindhu S 2013-11-17 05:24:31 UTC
Reopening bug, build failed for gsettings-desktop-schemas :(
Comment 20 Sindhu S 2013-11-17 08:08:14 UTC
(In reply to comment #4)
> Review of attachment 253832 [details] [review]:
> 
> ::: src/org.gnome.mutter.gschema.xml.in
> @@ +117,3 @@
>      </key>
> 
> +    <key name="always-on-top" type="as">
> 
> You don't need this key anymore, given that it's in gsettings-desktop-schemas.

Currently though mutter builds fine, it wont run with ./src/mutter --replace, it says:

➜  mutter git:(master) ./src/mutter --replace
Gtk-Message: Failed to load module "canberra-gtk-module"

(lt-mutter:712): GLib-GIO-ERROR **: Settings schema 'org.gnome.desktop.wm.keybindings' does not contain a key named 'always-on-top'
[1]    712 trace trap (core dumped)  ./src/mutter --replace
Comment 21 Sindhu S 2013-11-17 08:10:34 UTC
and I need to add the default shortcut to Super + T as suggested by Alberto [1]
to gsettings-desktop-schemas.

[1] http://markmail.org/message/4czjw5vutjwiduj7