Stunkymonkey/nautilus-open-any-terminal

Duplicate Terminal in Default Option and List of Terminals

Closed this issue · 3 comments

tnowad commented

Issue Description:
I have noticed a potential issue with the Nautilus Open Any Terminal extension regarding the default terminal option and the list of terminals. Currently, there seems to be a duplication of the default terminal in the list of terminals, and I believe it would be beneficial to address this issue.

Steps to Reproduce:

  1. Set the default terminal using the following command in the terminal:
gsettings set com.github.stunkymonkey.nautilus-open-any-terminal terminal <terminal>

Replace <terminal> with the desired terminal emulator (e.g., wezterm, xfce4-terminal, etc.).
2. Open Nautilus file manager.
3. Right-click on any directory to bring up the context menu.

Expected Behavior:
The "Open in Terminal" option should provide a single default terminal in the list of terminals, or remove it if the default terminal is empty.

Actual Behavior:
The "Open in Terminal" option displays a duplicate entry for the default terminal in the list of terminals.

Proposed Solution:

  • If the default terminal option in the gsettings path is the same as any other terminal in the list, keep only one instance of it.
  • If the default terminal is empty, remove it from the list of terminals.

Thank you for your attention to this matter. If you require any further information or clarification, please let me know.

how did you install the plugin? might be that you installed it system-wide and user-wide. This way two entries are shown.

tnowad commented

@Stunkymonkey

Thank you for your response and suggestion regarding the Nautilus Open Any Terminal extension.

To address your question about how I installed the plugin, I used the package manager 'paru', which is similar to 'yay'. I installed the following packages: wezterm, gnome-terminal, and nautilus-open-any-terminal.

In the default configuration, where no specific default terminal is set, the behavior of the "Open in Terminal" option in Nautilus is as follows:

  • "Open in WezTerm" opens the directory in WezTerm.
  • "Open Terminal Here" opens the directory in GNOME Terminal.
  • "Open in Terminal" corresponds to the default terminal set in the system if I have gnome-terminal installed.

Here is an image illustrating the default configuration:
Default Configuration

Alternatively, if I specifically set WezTerm as the default terminal using the gsettings command you mentioned, the behavior is modified as follows:

  • "Open in WezTerm" opens the directory in WezTerm.
  • "Open Wez's Terminal Emulator Here" also opens the directory in WezTerm.
  • "Open in Terminal" still corresponds to the default terminal set in the system if I have gnome-terminal installed.

Here is an image illustrating the configuration with WezTerm as the default:
Configuration with WezTerm

Based on these observations, it seems that the duplication issue you mentioned does not occur when using the default configuration. However, it does arise when a specific default terminal is set.

To address this issue, one potential solution could be to modify the extension's logic to exclude the default terminal from the list of selectable terminals if it matches any other terminal in the list. Additionally, if the default terminal is empty, it could be omitted from the list as well. These modifications would help ensure that only distinct terminals are displayed in the options.

Thank you once again for bringing this issue to our attention. If you have any further questions or require additional information, please let me know.

ok good.
I think I got the problem:

  • Open in WezTerm is provided by the wezterm package
  • Open Wez's Terminal Emulator Here is provided by this plugin
  • Open in Terminal is provided by the gnome-terminal package.

So it might be that the other context-entries were already installed a long time ago. By installing my plugin you simply installed the dependency nautilus-python and thereby the context entries are shown.

So my suggestion: uninstall this plugin, but keep the dependencies installed (, reboot) and have a look at it again.