kamiyaa / joshuto

ranger-like terminal file manager written in Rust
https://crates.io/crates/joshuto
GNU Lesser General Public License v3.0
3.35k stars 151 forks source link

Environment variable not found #480

Closed fatualux closed 5 months ago

fatualux commented 5 months ago

Environment variable not found when I choose 'bulk rename'

Steps to reproduce the issue

bindsym $alt+Control+a exec dunstify -r 333 "File Manager" && foot -e joshuto
 { keys = [ "b", "b" ],  command = "bulk_rename" },

Expected behavior

Until three days ago, I would like to be able to rename multiple files at once with this command, but now, if I choose 'bulk rename' I get an error:

environment variable not found

If I open a shell, (using either foot or alacritty) and launch Joshuto, the command will work as expected.

Unfortunately, I do not remember what I changed in my config files to cause this error.

Could you help me?

Thanks in advance,

FZ

kamiyaa commented 5 months ago

bulk_rename uses the EDITOR environment variable to determine what editor to use.

You may need to set this environment variable in your script for it to work.

Reference: https://github.com/kamiyaa/joshuto/blob/main/docs/configuration/keymap.toml.md#bulk_rename-rename-all-selected-files

fatualux commented 5 months ago

Pardon my noobish, doubt, but I set this environment variable in my .bashrc

# Default apps

export BROWSER='firefox'
export VISUAL=vim
export EDITOR=vim

and in my sway config

# SET $mod key on SUPER
set $alt Mod1
set $mod Mod4
set $EDITOR vim
set $TERMINAL alacritty

but nothing changes, I cannot figure where I am to add the environment variable...

Plus, i do not understand whi this issue occur only when I start joshuto from sway with a shortcut Thanks for your time and support

kamiyaa commented 5 months ago

You can try debugging it by changing foot -e joshuto

to foot -e path/to/a/script

inside the script:

#!/bin/bash

echo "EDITOR: $EDITOR"

and see if it prints anything. If it does, then you can use this script to launch joshuto. If not, then export it in the script

#!/bin/bash

echo "EDITOR: $EDITOR"

export EDITOR=vim

joshuto
fatualux commented 5 months ago

Thanks!

I fixed the issu by following your advice; i put this in my sway config:

bindsym $alt+Control+a exec dunstify -r 333 "File Manager" && export EDITOR=vim && foot -e joshuto

and now it works. I missed the "export" of the variable. Thanks again!