1# j4-dmenu-desktop 2 3[![Travis Build](https://api.travis-ci.org/enkore/j4-dmenu-desktop.png)](https://travis-ci.org/enkore/j4-dmenu-desktop/) 4 5j4-dmenu-desktop is a replacement for i3-dmenu-desktop. It's purpose 6is to find .desktop files and offer you a menu to start an application 7using dmenu. Since r2.7 j4-dmenu-desktop doesn't require i3wm anymore 8and should work just fine on about any desktop environment. 9 10You can also execute shell commands using it. 11 12## Project status 13 14I consider j4-dmenu-desktop pretty much feature complete since a few years: larger new features need 15a compelling reason and a good patch. Preferably discuss it before putting more work into it. 16 17## Build requirements 18 19* Compiler with basic C++11 support (GCC 4.77 or later required, Clang works, too) 20* CMake 21 22Building is the usual cmake/make thingy: 23 24 cmake . 25 make 26 sudo make install 27 28## Distribution packages 29 30### Archlinux <a href="https://repology.org/project/j4-dmenu-desktop/versions"><img src="https://repology.org/badge/vertical-allrepos/j4-dmenu-desktop.svg" alt="Packaging status" align="right"></a> 31 32 33The package is provided by the AUR. You can install it with an AUR helper of your choice: `j4-dmenu-desktop-git` or `j4-dmenu-desktop`. Else, you may install it manually by invoking the following commands as a regular user. (to build packages from the AUR, the `base-devel` package group is assumed to be installed) 34 35 git clone https://aur.archlinux.org/j4-dmenu-desktop.git 36 cd j4-dmenu-desktop 37 makepkg -si 38 39or for the latest: 40 41 git clone https://aur.archlinux.org/j4-dmenu-desktop-git.git 42 cd j4-dmenu-desktop-git 43 makepkg -si 44 45### FreeBSD 46 47j4-dmenu-desktop is now available in the FreeBSD Ports Collection. A prebuilt package can be installed via 48 49 pkg install j4-dmenu-desktop 50 51### Gentoo 52 53j4-dmenu-desktop is available in Portage for the `amd64` and `x86` architectures. You can install it via 54 55 echo "x11-misc/j4-dmenu-desktop ~amd64 ~x86" >> /etc/portage/package.accept_keywords 56 emerge --ask x11-misc/j4-dmenu-desktop 57 58The package is also provided by the `gentoo-el` overlay. You can install it with the following commands as root. (you need to have `layman` installed and configured) 59 60 layman -a gentoo-el 61 echo "=x11-misc/j4-dmenu-desktop-9999 **" >> /etc/portage/package.accept_keywords 62 emerge x11-misc/j4-dmenu-desktop 63 64### Ubuntu 65 66The package is now in the apt repository. You can install it via 67 68 sudo apt-get install j4-dmenu-desktop 69 70### Debian 71 72j4-dmenu-desktop is in Debian stable: 73 74 sudo apt install j4-dmenu-desktop 75 76### Nix / NixOS 77 78j4-dmenu-desktop is in [nixpkgs](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/misc/j4-dmenu-desktop/default.nix): 79 80 nix-env --install j4-dmenu-desktop 81 # Or use pkgs attribute of the same name in NixOS configuration 82 83 84## Invocation 85 86Usage: 87 88 j4-dmenu-desktop [--dmenu="dmenu -i"] [--term="i3-sensible-terminal"] 89 j4-dmenu-desktop --help 90 91Options: 92 93 --dmenu=<command> 94 Determines the command used to invoke dmenu 95 Executed with your shell ($SHELL) or /bin/sh 96 --use-xdg-de 97 Enables reading $XDG_CURRENT_DESKTOP to determine the desktop environment 98 --display-binary 99 Display binary name after each entry (off by default) 100 --no-generic 101 Do not include the generic name of desktop entries 102 --wrapper=<wrapper> 103 A wrapper binary. Useful in case you want to wrap into 'i3 exec' 104 --term=<command> 105 Sets the terminal emulator used to start terminal apps 106 --usage-log=<file> 107 Must point to a read-writeable file (will create if not exists). 108 In this mode entries are sorted by usage frequency. 109 --wait-on=<path> 110 Must point to a path where a file can be created. 111 In this mode no menu will be shown. Instead the program waits for <path> 112 to be written to (use echo > path). Every time this happens a menu will be shown. 113 Desktop files are parsed ahead of time. 114 Perfoming 'echo -n q > path' will exit the program. 115 --no-exec 116 Do not execute selected command, send to stdout instead 117 --help 118 Display this help message 119 120Environment variables 121 122- $SHELL is respected, and if absent /bin/sh is used 123- XDG-spec variables (XDG_CURRENT_DESKTOP, XDG_DATA_HOME, HOME) are respected 124 125## FAQ / RAQ / RMR 126 127### Case insensitivity? 128 129Add the `-i` option to the dmenu command 130 131### I want it to display normal binaries, too, yes? 132 133You can put this in a script file and use it instead of calling j4dd directly: 134 135 j4-dmenu-desktop --dmenu="(cat ; (stest -flx $(echo $PATH | tr : ' ') | sort -u)) | dmenu" 136 137Exchanging the `cat` and `(stest ... sort -u)` parts will swap the two parts (j4dd's output and the list of binaries). 138 139### Get the output into a pipe / launching a program by arbitrary user input 140 141[GOTO](https://github.com/enkore/j4-dmenu-desktop/issues/39#issuecomment-177164865) 142 143### How much faster is it? 144 145 % time i3-dmenu-desktop --dmenu="cat" 146 [{"success":true}] 147 i3-dmenu-desktop --dmenu="cat" 0.37s user 0.02s system 96% cpu 0.404 total 148 % time ./j4-dmenu-desktop --dmenu=cat 149 ./j4-dmenu-desktop --dmenu=cat 0.01s user 0.01s system 107% cpu 0.015 total 150 151More than 25 times faster :) 152 153