Comments (2)
In the meantime, here's a quick POSIX sh script that does such a fix externally, allowing you to quickly test the impact such a change would have.
#!/bin/sh
printf 'exec %s\n' "$(j4-dmenu-desktop --no-exec "$@")" | ${SHELL:-sh} &
from j4-dmenu-desktop.
This is a interesting problem. J4dd executes the programs with <shell> -c <command_string>
. Some shells (like bash) automatically exec
the last component of the command string (in most cases the command string has only one component in j4dd so the program is always exec
ed). But some shells don't do that (like dash).
I think this is why no one (including me) has discovered this issue.
I've incorporated a fix into my PR #132. I would recommend You to compile and use the PR's version of j4dd because it contains many fixes and new features.
If don't want to use my version of j4dd you can apply this patch to j4dd:
--- a/src/Main.hh
+++ b/src/Main.hh
@@ -260,7 +260,9 @@ private:
}
this->dmenu->display();
- std::string command = get_command();
+ std::string command;
+ bool iscustom;
+ std::tie(command, iscustom) = get_command();
if (this->wrapper.length())
command = this->wrapper+" \""+command+"\"";
delete this->dmenu;
@@ -273,6 +275,8 @@ private:
static const char *shell = 0;
if((shell = getenv("SHELL")) == 0)
shell = "/bin/sh";
+ if (!iscustom)
+ command = "exec " + command;
fprintf(stderr, "%s -c '%s'\n", shell, command.c_str());
@@ -317,7 +321,7 @@ private:
return 0;
}
- std::string get_command() {
+ std::pair<std::string, bool> get_command() {
std::string choice;
std::string args;
Application *app;
@@ -326,13 +330,13 @@ private:
choice = dmenu->read_choice(); // Blocks
if(choice.empty())
- return "";
+ return std::make_pair("", false);
fprintf(stderr, "User input is: %s %s\n", choice.c_str(), args.c_str());
std::tie(app, args) = apps.search(choice, exclude_generic);
if (!app) {
- return args;
+ return std::make_pair(args, true);
}
if(usage_log) {
@@ -346,7 +350,7 @@ private:
}
ApplicationRunner app_runner(terminal, *app, args);
- return app_runner.command();
+ return std::make_pair(app_runner.command(), false);
}
private:
My code (both the patch and the fdb58ae commit in #132) only prepends "exec "
to programs which have a desktop file. I don't know if You knew this (it isn't documented anywhere as far as I know and I discovered it only after thoroughly reading the code) but when a command that doesn't match any desktop entry is entered, j4dd tries to execute it directly. Because You can provide custom commands to j4dd, prepending "exec " to them might produce unexpected results.
from j4-dmenu-desktop.
Related Issues (20)
- Performance: The inbuilt replace function can be improve HOT 1
- Start multiple processes as children of a single j4-dmenu-desktop HOT 6
- zsh: bad pattern error on app open HOT 2
- Debian testing (bullseye) HOT 2
- Honor $XDG_DATA_DIRS HOT 2
- Is there a way to sort entries by frequency? HOT 1
- unable to escape the command correctly for dmenu HOT 3
- Configure text shown in dmenu HOT 1
- Error when building makepkg -si:
- Passing --dmenu removes .desktop applications from results HOT 2
- j4-dmenu-desktop + dmenu works but does not show on screen HOT 4
- Options to configure font and colors HOT 3
- How can I show command names instead of desktop entry names? HOT 5
- J4dd leaves zombies behind when using --wait-on HOT 1
- Cannot compile j4-dmenu-desktop due to CMake Error HOT 2
- Add tag to application names to find them faster HOT 3
- Can you change the font size? HOT 4
- Cannot open display error HOT 4
- Sorting by display name case insensitively HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from j4-dmenu-desktop.