Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Toggle between joshuto and shell mode #550

Open
alctny opened this issue Jul 1, 2024 · 0 comments
Open

Feature Request: Toggle between joshuto and shell mode #550

alctny opened this issue Jul 1, 2024 · 0 comments

Comments

@alctny
Copy link

alctny commented Jul 1, 2024

Description:

I would like to request a feature where joshuto can toggle between joshuto and shell mode. Similar to ranger's 'S' key -- pressing 'S' enters command line and cd to the current directory. In command line, executing exit or Ctrl-d back to ranger, and exiting ranger returns to the directory from which ranger was initially started.

This feature is highly beneficial because there are many complex tasks that can only be accomplished in command line. The current :shell command in joshuto is limited and cannot execute shell functions defined in configuration files like /etc/profile or /etc/bashrc.

Although the following joshuto shell function achieves a similar effect, it exits joshuto, and the working directory of the shell environment switches to the current directory instead of the directory from which joshuto was initially started.

function joshuto ()
{
    ID="$$";
    mkdir -p /tmp/$USER;
    OUTPUT_FILE="/tmp/$USER/joshuto-cwd-$ID";
    env joshuto --output-file "$OUTPUT_FILE" $@;
    exit_code=$?;
    case "$exit_code" in
        0)

        ;;
        101)
            JOSHUTO_CWD=$(cat "$OUTPUT_FILE");
            cd "$JOSHUTO_CWD"
        ;;
        102)

        ;;
        *)
            echo "Exit code: $exit_code"
        ;;
    esac
}

Ranger keybinding configuration for switching to shell mode:

# rs.conf
map S shell $SHELL --login

Thank you for considering this feature request. It would greatly enhance the functionality and usability of joshuto.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant