Commit 860eea03 authored by aleksana's avatar aleksana
Browse files

gmrun: 0.9.2 -> 1.4w

gmrun has been rewritten while maintaining compatibility with previous
version. The original author acknowledged this fork and grant permission
to modify the license, see https://github.com/wdlkmpx/gmrun/issues/2
parent e7d4c70b
Loading
Loading
Loading
Loading
+0 −18
Original line number Diff line number Diff line
diff -ur gmrun-0.9.2-orig/src/prefs.cc gmrun-0.9.2/src/prefs.cc
--- gmrun-0.9.2-orig/src/prefs.cc	2019-05-02 12:56:39.025088361 +0200
+++ gmrun-0.9.2/src/prefs.cc	2019-05-02 13:21:51.179778620 +0200
@@ -31,9 +31,11 @@
 
 Prefs::Prefs()
 {
-  string file_name = PACKAGE_DATA_DIR"/";
-  file_name += GMRUNRC;
-  init(file_name);
+  string file_name = "/etc/" GMRUNRC;
+  if (!init(file_name)) {
+    file_name = PACKAGE_DATA_DIR "/" GMRUNRC;;
+    init(file_name);
+  }
 
   file_name = getenv("HOME");
   if (!file_name.empty()) {

pkgs/by-name/gm/gmrun/gcc43.patch

deleted100644 → 0
+0 −51
Original line number Diff line number Diff line
--- a/src/gtkcompletionline.cc.orig	2003-11-16 11:55:07.000000000 +0100
+++ a/src/gtkcompletionline.cc	2008-05-08 08:51:22.000000000 +0200
@@ -29,6 +29,7 @@
 #include <set>
 #include <sstream>
 #include <string>
+#include <cstring>
 #include <vector>
 using namespace std;
 
--- a/src/ci_string.h.orig	2001-05-16 16:39:31.000000000 +0200
+++ a/src/ci_string.h	2008-05-08 08:51:33.000000000 +0200
@@ -7,6 +7,7 @@
 #define __CI_STRING_H__
 
 #include <string>
+#include <cstring>
 #include <ctype.h>
 
 struct ci_char_traits : public std::char_traits<char>
--- a/src/prefs.cc.orig	2002-08-16 12:48:22.000000000 +0200
+++ a/src/prefs.cc	2008-05-08 08:51:54.000000000 +0200
@@ -13,6 +13,7 @@
 #include <fstream>
 #include <iostream>
 #include <stdio.h>
+#include <stdlib.h>
 
 #include <list>
 
--- a/src/main.cc.orig	2003-11-16 11:55:07.000000000 +0100
+++ a/src/main.cc	2008-05-08 09:03:11.000000000 +0200
@@ -14,6 +14,7 @@
 #include <gdk/gdkkeysyms.h>
 
 #include <string>
+#include <cstring>
 #include <iostream>
 #include <sstream>
 #include <vector>

--- a/src/gtkcompletionline.cc.orig	2009-06-19 22:38:14.000000000 +0400
+++ a/src/gtkcompletionline.cc	2009-06-19 22:37:14.000000000 +0400
@@ -376,7 +377,7 @@
   return 0;
 }
 
-int my_alphasort(const void* va, const void* vb) {
+int my_alphasort(const dirent** va, const dirent** vb) {
   const struct dirent** a = (const struct dirent**)va;
   const struct dirent** b = (const struct dirent**)vb;
+0 −58
Original line number Diff line number Diff line
diff -ur a/src/history.cc src/history.cc
--- a/src/history.cc	2002-08-17 15:19:31.000000000 +0200
+++ a/src/history.cc	2012-06-04 23:42:35.314653414 +0200
@@ -24,8 +24,15 @@
 HistoryFile::HistoryFile()
 {
   m_file_entries = 0;
-  m_filename = g_get_home_dir();
-  m_filename += "/.gmrun_history";
+  const char* filename = getenv("XDG_CACHE_HOME");
+  if (filename != 0 && *filename != '\0') {
+    m_filename = filename;
+    m_filename += "/gmrun_history";
+  }
+  else {
+    m_filename = g_get_home_dir();
+    m_filename += "/.gmrun_history";
+  }
   m_current = 0;
   m_default_set = false;
   read_the_file();
diff -ur a/src/prefs.cc src/prefs.cc
--- a/src/prefs.cc	2012-06-04 22:35:00.671949439 +0200
+++ a/src/prefs.cc	2012-06-04 23:24:24.184445962 +0200
@@ -35,12 +35,29 @@
   file_name += GMRUNRC;
   init(file_name);
 
-  file_name = getenv("HOME");
-  if (!file_name.empty()) {
+  file_name.clear();
+  const char* filename = getenv("XDG_CONFIG_HOME");
+  if (filename != 0 && *filename != '\0') {
+    file_name = filename;
     string::iterator i = file_name.end() - 1;
-    if (*i == '/') file_name.erase(i);
-    file_name += "/.";
+    if (*i != '/') {
+      file_name += '/';
+    }
     file_name += GMRUNRC;
+  }
+  else {
+    filename = getenv("HOME");
+    if (filename != 0 && *filename != '\0') {
+      file_name = filename;
+      string::iterator i = file_name.end() - 1;
+      if (*i != '/') {
+        file_name += '/';
+      }
+      file_name += '.';
+      file_name += GMRUNRC;
+    }
+  }
+  if (!file_name.empty()) {
     init(file_name);
   }
 }
+22 −29
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchurl,
  glib,
  gtk2,
  fetchFromGitHub,
  pkg-config,
  popt,
  wrapGAppsHook3,
}:

let
  version = "0.9.2";
in

stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
  pname = "gmrun";
  inherit version;
  version = "1.4w";

  src = fetchurl {
    url = "mirror://sourceforge/gmrun/${pname}-${version}.tar.gz";
    sha256 = "180z6hbax1qypy5cyy2z6nn7fzxla4ib47ck8mqwr714ag77na8p";
  src = fetchFromGitHub {
    owner = "wdlkmpx";
    repo = "gmrun";
    rev = "refs/tags/${finalAttrs.version}";
    hash = "sha256-sp+Atod9ZKVF8sxNWIMrlewqZAGnoLo2mZUNkCtSkec=";
  };

  nativeBuildInputs = [ pkg-config ];
  buildInputs = [
    glib
    gtk2
    popt
  nativeBuildInputs = [
    pkg-config
    wrapGAppsHook3
  ];

  doCheck = true;

  enableParallelBuilding = true;

  patches = [
    ./gcc43.patch
    ./find-config-file-in-system-etc-dir.patch
    ./gmrun-0.9.2-xdg.patch
  ];
  # Problem with component size on wayland
  preFixup = ''
    gappsWrapperArgs+=(--set-default GDK_BACKEND x11)
  '';

  meta = with lib; {
  meta = {
    description = "Gnome Completion-Run Utility";
    longDescription = ''
      A simple program which provides a "run program" window, featuring a bash-like TAB completion.
@@ -46,10 +39,10 @@ stdenv.mkDerivation rec {
      Also, supports CTRL-R / CTRL-S / "!" for searching through history.
      Running commands in a terminal with CTRL-Enter. URL handlers.
    '';
    homepage = "https://sourceforge.net/projects/gmrun/";
    license = licenses.gpl2;
    maintainers = [ ];
    platforms = platforms.all;
    homepage = "https://github.com/wdlkmpx/gmrun";
    license = lib.licenses.isc;
    maintainers = with lib.maintainers; [ aleksana ];
    platforms = lib.platforms.linux;
    mainProgram = "gmrun";
  };
}
})