GNOME Bugzilla – Bug 704831
Always on Top window option needs keyboard shortcut
Last modified: 2013-11-19 18:56:56 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!
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?
Created attachment 253832 [details] [review] Add keyboard shortcut for Always on Top Made changes as suggested. Please review thanks.
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.
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.
Review of attachment 253833 [details] [review]: Looks good.
Created attachment 260006 [details] [review] Add keyboard shortcut for Always on Top Final patch.
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! :)
Re-opening bug to fix incorrect commit.
Created attachment 260011 [details] [review] Add Always on Top key Gsettings patch.
Created attachment 260012 [details] [review] Add keyboard shortcut for Always on Top Mutter patch.
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.
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.
Created attachment 260013 [details] [review] Add Always on Top key Gsettings patch revised.
Created attachment 260014 [details] [review] Add keyboard shortcut for Always on Top Mutter patch revised.
Review of attachment 260014 [details] [review]: Looks good.
Review of attachment 260013 [details] [review]: Looks good.
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!).
Reopening bug, build failed for gsettings-desktop-schemas :(
https://git.gnome.org/browse/gsettings-desktop-schemas/commit/?id=75084132d2c025f6a6e446661886258985ab712c > reverts faulty gsettings-desktop-schemas commit https://git.gnome.org/browse/gsettings-desktop-schemas/commit/?id=7ee4d84fbc4f6f243462c6b787fcfc570e307eb6 > adds gsettings-desktop-schemas commit which builds fine.
(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
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