sh: 1: exec: xterm: not found

I'm running wofi with the drun mode. wofi is correctly finding the desktop files of the Htop and Neovim packages my distribution (Void Linux) includes.

But when I attempt to launch them by clicking on their entries or pressing [Enter] when their entry is selected, I get a console output of sh: 1: exec: xterm: not found.

My terminal being used is kitty, and I've explicitly set it in the config file as well as left the default behavior and they both result in this error being shown.

For kicks and giggles, I switched to using run mode. I select the entry from that wofi instance and it successfully executes (opens up a kitty terminal window with that program running).

I've read from https://todo.sr.ht/~scoopta/wofi/4 and https://todo.sr.ht/~scoopta/wofi/2 about the way that wofi might be trying to launch from this drun mode. I could be wrong, but it appears maybe the gappinfogetexecutatble maybe what is trying to fire off the selected entry executable with xterm?

If so, then that's a configuration issue on my part and I would happily resort to figuring out how to resolve that on my end.

If not, there may be an opportunity here to utilize the TERMINAL key of the desktop file, and if true, execute the entry in the terminal desired by the config (or the default fallbacks?).

Thanks for your time, and this is just 1 of 2 issues I have with wofi amid a MYRIAD of problems that it solves. So, fantastic work by this whole community.

Assigned to
2 years ago
2 years ago
No labels applied.

~scoopta 2 years ago

Wofi does not deal with terminal execution for drun mode, terminal execution is only handled internally for run mode, for drun it's all up to the desktop file and GIO which wofi uses to execute desktop files. It also does not use g_app_info_get_executable() anymore. It used to however now it starts desktop files with g_app_info_launch_uris_async() and g_desktop_app_info_launch_action() depending on whether or not a primary action is used or not. I'm not entirely sure what GIO's behavior is when dealing with terminal execution but it sounds like it might not be what most expect based on https://www.reddit.com/r/swaywm/comments/fgk3w0/gio/ however there's probably not a lot I could do without some serious work arounds.

~nathanblair REPORTED NOT_OUR_BUG 2 years ago

I agree. Workarounds should be in the protocol, not the client. Thanks for the info. Its not a deal breaker for me at all, very minor issue. I'll resolve it as Not Your Bug.

~nathanblair 2 years ago

Sorry, can't edit that comment, but I meant to say that workarounds should not be in the client*, and rather that fixes should be relied on in the protocol* haha

~nathanblair 2 years ago

The error of the sh: 1 xterm not found was because I didn't have the gsettings org.gnome.desktop.default-applications.terminal exec key set correctly. Gnome is such a PITA :/.

~nathanblair 2 years ago

AND I had to symlink /usr/bin/xterm to my actual terminal. Honestly, what's the point of a desktop spec if the spec isn't applicable outside of the gnome desktop environment?

~scoopta 2 years ago

I'm not sure it's a problem with the desktop spec so much as a lack of specification in the desktop spec. The desktop spec doesn't seem to specify how the desktop should find the terminal to be used, GIO decided that using gnome-terminal, mate-terminal, nxterm, color-xterm, rxvt, dtterm, and then finally xterm if no other could be found in that order was the best, the reddit post mentions this. They also link their preferred term to gnome-terminal as it's the highest priority one. GIO doesn't actually seem to check org.gnome.desktop.default-applications.terminal but maybe I just overlooked that part of the code. Either way I think there should be some standard way to set a terminal to be used but apparently not, GIO isn't the only thing that has this problem. Wofi's internal terminal lookup code also has it, I just use common wayland terminals instead of common X terms and provide a config override. It'd be nice if there was some $XDG_ variable for this but alas not.

~appelgriebsch 2 years ago

I just use common wayland terminals instead of common X terms and provide a config override

Hey, just figured this issue on my Manjaro Sway setup. Creating a symlink from my terminal emulator 'termite' to 'xterm' seems to make it working, but I want to ask you if there might be some other way to configure the terminal emulator to be used for drun / run mode in wofi (you mentioned a config override in the response above?)

Thanks a lot, Andreas

~cloudninja 2 years ago

Scoopta's referring to the terminal execution of run mode. It has a config option to specify a terminal to use. Drun mode does not have this, unfortunately.

~scoopta 2 years ago*

As ~cloudninja pointed out. Run mode has the ability to manually specify a terminal using the term config option, if none is specified the order is kitty, termite, alacritty, gnome-terminal, weston-terminal. Drun mode relies on GIO for desktop launching and GIO picks the terminal to use when running a desktop file with Terminal=true. GIO unfortunately does not provide an option to override its order which was mentioned earlier and is as follows gnome-terminal, mate-terminal, nxterm, color-xterm, rxvt, dtterm, xterm. Unfortunately the best solution is to symlink your actual terminal to gnome-terminal or one of the others.

Register here or Log in to comment, or comment via email.