From 5118a47baa64f853ff5f208e48b3e214d44a7447 Mon Sep 17 00:00:00 2001 From: Vasyl Solovei Date: Wed, 21 Feb 2018 19:55:39 +0200 Subject: [PATCH] gnomeExtensions.no-title-bar: init at 8 --- .../extensions/no-title-bar/default.nix | 35 ++++++++++++ .../extensions/no-title-bar/fix-paths.patch | 56 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 1 + 3 files changed, 92 insertions(+) create mode 100644 pkgs/desktops/gnome-3/extensions/no-title-bar/default.nix create mode 100644 pkgs/desktops/gnome-3/extensions/no-title-bar/fix-paths.patch diff --git a/pkgs/desktops/gnome-3/extensions/no-title-bar/default.nix b/pkgs/desktops/gnome-3/extensions/no-title-bar/default.nix new file mode 100644 index 000000000000..43e94ce6bfbb --- /dev/null +++ b/pkgs/desktops/gnome-3/extensions/no-title-bar/default.nix @@ -0,0 +1,35 @@ +{ stdenv, fetchFromGitHub, substituteAll, glib, gettext, xorg }: + +stdenv.mkDerivation rec { + name = "gnome-shell-extension-no-title-bar-${version}"; + version = "8"; + + src = fetchFromGitHub { + owner = "franglais125"; + repo = "no-title-bar"; + rev = "v${version}"; + sha256 = "0n3ayf7k2icy913sjl1d6iwm21i8fivv0f7wj7gck8q7q2j7i3bz"; + }; + + nativeBuildInputs = [ + glib gettext + ]; + + patches = [ + (substituteAll { + src = ./fix-paths.patch; + xprop = "${xorg.xprop}/bin/xprop"; + xwininfo = "${xorg.xwininfo}/bin/xwininfo"; + }) + ]; + + makeFlags = [ "INSTALLBASE=$(out)/share/gnome-shell/extensions" ]; + + meta = with stdenv.lib; { + description = "Integrates maximized windows with the top panel"; + homepage = https://github.com/franglais125/no-title-bar; + license = licenses.gpl2; + maintainers = with maintainers; [ jonafato svsdep ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/desktops/gnome-3/extensions/no-title-bar/fix-paths.patch b/pkgs/desktops/gnome-3/extensions/no-title-bar/fix-paths.patch new file mode 100644 index 000000000000..9a53d63860da --- /dev/null +++ b/pkgs/desktops/gnome-3/extensions/no-title-bar/fix-paths.patch @@ -0,0 +1,56 @@ +--- 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')]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6aeec322adc5..ef4fb974f99e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19190,6 +19190,7 @@ with pkgs; icon-hider = callPackage ../desktops/gnome-3/extensions/icon-hider { }; mediaplayer = callPackage ../desktops/gnome-3/extensions/mediaplayer { }; nohotcorner = callPackage ../desktops/gnome-3/extensions/nohotcorner { }; + no-title-bar = callPackage ../desktops/gnome-3/extensions/no-title-bar { }; pixel-saver = callPackage ../desktops/gnome-3/extensions/pixel-saver { }; remove-dropdown-arrows = callPackage ../desktops/gnome-3/extensions/remove-dropdown-arrows { }; taskwhisperer = callPackage ../desktops/gnome-3/extensions/taskwhisperer { };