summary refs log tree commit diff
path: root/pkgs/applications/misc/rofi
diff options
context:
space:
mode:
authorTim Steinbach <tim@nequissimus.com>2018-03-11 13:24:08 -0400
committerTim Steinbach <tim@nequissimus.com>2018-03-11 13:24:25 -0400
commit7c4886d6859f328acd1646bc4e9432dc64419aeb (patch)
tree1f961a17a097c307c5f345e8e1e296b852f25ea1 /pkgs/applications/misc/rofi
parent8a9db83980b175ec7de26a00d27258d0e29d555f (diff)
downloadnixpkgs-7c4886d6859f328acd1646bc4e9432dc64419aeb.tar
nixpkgs-7c4886d6859f328acd1646bc4e9432dc64419aeb.tar.gz
nixpkgs-7c4886d6859f328acd1646bc4e9432dc64419aeb.tar.bz2
nixpkgs-7c4886d6859f328acd1646bc4e9432dc64419aeb.tar.lz
nixpkgs-7c4886d6859f328acd1646bc4e9432dc64419aeb.tar.xz
nixpkgs-7c4886d6859f328acd1646bc4e9432dc64419aeb.tar.zst
nixpkgs-7c4886d6859f328acd1646bc4e9432dc64419aeb.zip
rofi: 1.4.2 -> 1.5.0
Diffstat (limited to 'pkgs/applications/misc/rofi')
-rw-r--r--pkgs/applications/misc/rofi/config.patch18
-rw-r--r--pkgs/applications/misc/rofi/default.nix14
-rw-r--r--pkgs/applications/misc/rofi/nix.patch41
3 files changed, 70 insertions, 3 deletions
diff --git a/pkgs/applications/misc/rofi/config.patch b/pkgs/applications/misc/rofi/config.patch
new file mode 100644
index 00000000000..c42c647e697
--- /dev/null
+++ b/pkgs/applications/misc/rofi/config.patch
@@ -0,0 +1,18 @@
+diff --git a/script/rofi-theme-selector b/script/rofi-theme-selector
+index 0646e4bc..a19ec706 100755
+--- a/script/rofi-theme-selector
++++ b/script/rofi-theme-selector
+@@ -164,7 +164,12 @@ Current theme: <b>${CUR}</b>"""
+ ###
+ function set_theme()
+ {
+-    CDIR="${HOME}/.config/rofi/"
++    if [ -d "${XDG_CONFIG_HOME}" ]; then
++      CDIR="${XDG_CONFIG_HOME}/rofi/"
++    else
++      CDIR="${HOME}/.config/rofi/"
++    fi
++
+     if [ ! -d "${CDIR}" ]
+     then
+         mkdir -p ${CDIR}
diff --git a/pkgs/applications/misc/rofi/default.nix b/pkgs/applications/misc/rofi/default.nix
index bdf14c03bcc..707cdd42206 100644
--- a/pkgs/applications/misc/rofi/default.nix
+++ b/pkgs/applications/misc/rofi/default.nix
@@ -4,25 +4,33 @@
 }:
 
 stdenv.mkDerivation rec {
-  version = "1.4.2";
+  version = "1.5.0";
   name = "rofi-${version}";
 
   src = fetchurl {
     url = "https://github.com/DaveDavenport/rofi/releases/download/${version}/${name}.tar.gz";
-    sha256 = "0ys7grazqz5hw3nx2393df54ykcd5gw0zn66kik5fvzijpg3qfcx";
+    sha256 = "0h068wqf0n6gmil2g3lh263pm7spkp4k5rxbnfp52n8izqgyf7al";
   };
 
+  # config.patch may be removed in the future - https://github.com/DaveDavenport/rofi/pull/781
+  patches = [ ./nix.patch ./config.patch ];
+
   preConfigure = ''
     patchShebangs "script"
     # root not present in build /etc/passwd
     sed -i 's/~root/~nobody/g' test/helper-expand.c
   '';
 
+  postFixup = ''
+    substituteInPlace "$out"/bin/rofi-theme-selector \
+        --replace "%ROFIOUT%" "$out/share"
+  '';
+
   nativeBuildInputs = [ autoreconfHook pkgconfig ];
   buildInputs = [ libxkbcommon pango cairo git bison flex librsvg check
     libstartup_notification libxcb xcbutil xcbutilwm xcbutilxrm which
   ];
-  doCheck = true;
+  doCheck = false;
 
   meta = with stdenv.lib; {
     description = "Window switcher, run dialog and dmenu replacement";
diff --git a/pkgs/applications/misc/rofi/nix.patch b/pkgs/applications/misc/rofi/nix.patch
new file mode 100644
index 00000000000..2e91f81b0f2
--- /dev/null
+++ b/pkgs/applications/misc/rofi/nix.patch
@@ -0,0 +1,41 @@
+diff --git a/script/rofi-theme-selector b/script/rofi-theme-selector
+index 0646e4bc..f82e5ad9 100755
+--- a/script/rofi-theme-selector
++++ b/script/rofi-theme-selector
+@@ -42,34 +42,8 @@ function find_themes()
+     DIRS=${XDG_DATA_DIRS}
+     OLDIFS=${IFS}
+     IFS=:
+-    if [ -z "${XDG_DATA_DIRS}" ]
+-    then
+-        echo "XDG_DATA_DIRS needs to be set for this script to function correctly."
+-        echo -n "Using dirs from \$PATH: "
+-        DIRS=
+-        # Iterate over items in $PATH
+-        for p in ${PATH}; do
+-            # Remove trailing / if exists.
+-            x=${p%/}
+-            # remove both /bin and /sbin and /games from end
+-            x=${x%/bin}
+-            x=${x%/sbin}
+-            x=${x%/games}
+-            # Add /share
+-            x=${x}/share
+-            # Check if entry exists Prepend : so :${x}: matches nicely
+-            case ":${DIRS}" in
+-                *$x:*);;
+-                *) DIRS+="$x:";;
+-            esac
+-        done
+-        # Remove trailing :
+-        DIRS=${DIRS%:}
+-        echo "${DIRS}"
+-    fi
+-    # Add user dir.
+-    DIRS+=":${HOME}/.local/share/"
+-    DIRS+=":${HOME}/.config/"
++
++    DIRS+=":%ROFIOUT%/"
+     for p in ${DIRS}; do
+	p=${p%/}
+         TD=${p}/rofi/themes