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

gnomeExtensions.no-title-bar: init at 8 #35281

Merged
merged 2 commits into from Feb 23, 2018

Conversation

svsdep
Copy link
Contributor

@svsdep svsdep commented Feb 21, 2018

Motivation for this change

I do need this extension for my Gnome Shell setup.
Tested locally.
The run-time dependencies are specified as it is required here.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@GrahamcOfBorg GrahamcOfBorg added the 6.topic: GNOME GNOME desktop environment and its underlying platform label Feb 21, 2018
@jtojnar
Copy link
Contributor

jtojnar commented Feb 21, 2018

This seems to be a fork of pixel-saver, which we already have packaged, but much more active. Maybe we could replace it?

cc @jonafato

@svsdep
Copy link
Contributor Author

svsdep commented Feb 21, 2018

@jtojnar yes, this fork seems to be active.

@svsdep svsdep force-pushed the gnomeExtensions-no-title-bar branch 2 times, most recently from eabf0f9 to c86ea92 Compare February 21, 2018 18:34
];

buildInputs = [
xorg.xprop xorg.xwininfo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not work – buildInputs simply adds the package to PATH and other relevant variables during build so that the build process (e.g. configure script) could pick it up. In this case, the path is ignored during build so we need to patch the extension manually:

--- a/decoration.js
+++ b/decoration.js
@@ -181,7 +181,7 @@
         let act = win.get_compositor_private();
         let xwindow = act && act['x-window'];
         if (xwindow) {
-            let xwininfo = GLib.spawn_command_line_sync('xwininfo -children -id 0x%x'.format(xwindow));
+            let xwininfo = GLib.spawn_command_line_sync('@xwininfo@ -children -id 0x%x'.format(xwindow));
             if (xwininfo[0]) {
                 let str = xwininfo[1].toString();
 
@@ -207,7 +207,7 @@
         // Try enumerating all available windows and match the title. Note that this
         // may be necessary if the title contains special characters and `x-window`
         // is not available.
-        let result = GLib.spawn_command_line_sync('xprop -root _NET_CLIENT_LIST');
+        let result = GLib.spawn_command_line_sync('@xprop@ -root _NET_CLIENT_LIST');
         if (result[0]) {
             let str = result[1].toString();
 
@@ -218,7 +218,7 @@
 
             // For each window ID, check if the title matches the desired title.
             for (var i = 0; i < windowList.length; ++i) {
-                let cmd = 'xprop -id "' + windowList[i] + '" _NET_WM_NAME _NO_TITLE_BAR_ORIGINAL_STATE';
+                let cmd = '@xprop@ -id "' + windowList[i] + '" _NET_WM_NAME _NO_TITLE_BAR_ORIGINAL_STATE';
                 let result = GLib.spawn_command_line_sync(cmd);
 
                 if (result[0]) {
@@ -258,7 +258,7 @@
         }
 
         let id = this._guessWindowXID(win);
-        let cmd = 'xprop -id ' + id;
+        let cmd = '@xprop@ -id ' + id;
 
         let xprops = GLib.spawn_command_line_sync(cmd);
         if (!xprops[0]) {
@@ -277,7 +277,7 @@
         m = str.match(/^_GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED(\(CARDINAL\))? = ([0-9]+)$/m);
         if (m) {
             let state = !!parseInt(m[2]);
-            cmd = ['xprop', '-id', id,
+            cmd = ['@xprop@', '-id', id,
                   '-f', '_NO_TITLE_BAR_ORIGINAL_STATE', '32c',
                   '-set', '_NO_TITLE_BAR_ORIGINAL_STATE',
                   (state ? '0x1' : '0x0')];
@@ -358,7 +358,7 @@
         let winXID = this._guessWindowXID(win);
         if (winXID == null)
             return;
-        let cmd = ['xprop', '-id', winXID,
+        let cmd = ['@xprop@', '-id', winXID,
                    '-f', '_GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED', '32c',
                    '-set', '_GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED',
                    (hide ? '0x1' : '0x0')];
patches = [
  (substituteAll {
    src = ./fix-paths.patch;
    xprop = "${xorg.xprop}/bin/xprop";
    xwininfo = "${xorg.xwininfo}/bin/xwininfo";
  })
];

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove the buildInputs then.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

license = licenses.gpl2;
maintainers = with maintainers; [ svsdep ];
platforms = platforms.linux;
homepage = https://github.com/franglais125/no-title-bar/;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The trailing slash is not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@svsdep svsdep force-pushed the gnomeExtensions-no-title-bar branch from c86ea92 to 0bb4b5c Compare February 21, 2018 20:58
@svsdep
Copy link
Contributor Author

svsdep commented Feb 21, 2018

Thanks for review! I applied all patched and adjusted the homepage url.

];

patches = [
(substituteAll {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be indented.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@svsdep svsdep force-pushed the gnomeExtensions-no-title-bar branch 2 times, most recently from 3ed7d79 to 7cffe15 Compare February 21, 2018 21:10
@jonafato
Copy link
Contributor

This does seem to be more actively maintained than pixel-saver (which was last updated 6 months ago and last released over a year ago). Replacing pixel-saver with no-title-bar probably makes sense.

@jtojnar
Copy link
Contributor

jtojnar commented Feb 21, 2018

@jonafato Do you want to be a maintainer of this?

@jonafato
Copy link
Contributor

@jtojnar I'd be happy to maintain it. I'll submit a PR to remove pixel-saver in favor of this extension as well.

@jtojnar
Copy link
Contributor

jtojnar commented Feb 23, 2018

Did you built this? There is missing substituteAll and even after adding it, the build still fails. Probably just something hecked up on my drive from a power failure.

@jtojnar
Copy link
Contributor

jtojnar commented Feb 23, 2018

Thanks.

jtojnar pushed a commit to jonafato/nixpkgs that referenced this pull request Feb 23, 2018
This extension is being replaced by gnomeExtensions.no-title-bar in NixOS#35281.
@jtojnar jtojnar merged commit 5118a47 into NixOS:master Feb 23, 2018
@svsdep svsdep deleted the gnomeExtensions-no-title-bar branch February 25, 2018 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: GNOME GNOME desktop environment and its underlying platform 10.rebuild-darwin: 0 10.rebuild-linux: 0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants