[solved] nnn from keybind doesn’t load .bashrc

Forum Forums General Software [solved] nnn from keybind doesn’t load .bashrc

Tagged: , ,

  • This topic has 7 replies, 4 voices, and was last updated Nov 28-3:33 am by fatboy.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #71703
    Member
    fatboy

    Good Day Folks,

    This is not an Antix problem, but maybe more a Linux issue or NNN issue, but I hope one of you can help figure out what it is?

    So in my .bashrc file I have a few lines that include some NNN configs, one example is

    export NNN_TRASH=1
    export NNN_USE_EDITOR="nano"
    export NNN_COLORS="1235" 

    Here is the weird part.
    1) If I launch NNN from a terminal, the configs load
    2) If I launch NNN from a keybinding, the .bashrc configs aren’t loaded.

    Is there any way to change the keybinding that it forces to load .bashrc before opening NNN?

    Thanks

    • This topic was modified 3 days, 17 hours ago by fatboy.
    • This topic was modified 16 hours, 56 minutes ago by christophe. Reason: solved

    "Spiral out, keep going"

    #71708
    Moderator
    christophe
    Helpful
    Up
    0
    ::

    This looks promising. The Arch wiki talks about that being a known potential situation:
    https://wiki.archlinux.org/title/Nnn

    and a follow-up link, referred-to in the first:
    https://github.com/jarun/nnn/wiki/Advanced-use-cases#desktop-integration

    • This reply was modified 3 days, 7 hours ago by christophe.

    confirmed antiX frugaler, since 2019

    #71710
    Moderator
    christophe
    Helpful
    Up
    0
    ::

    In particular, from the 2nd link above:

    On a bare X window manager (i3wm, bspwm, awesomewm …)

    On the keyboard shortcuts section of your WM config file, you need to add a shortcut to launch nnn in a terminal. Here’s is an example for sxhkd, you need to change xfce4-terminal to the terminal you want to use:

    ## File Manager
    super + n
    xfce4-terminal -e “nwrap $*”

    confirmed antiX frugaler, since 2019

    #71726
    Member
    Xecure
    Helpful
    Up
    0
    ::

    I think you can force .bashrc to load before any window manager or startup process by appending
    . $HOME/.bashrc
    at the end, inside the file ~/.desktop-session/desktop-session.conf

    Try it out and if it doesn’t work, remove said line from the file.

    antiX Live system enthusiast.
    General Live Boot Parameters for antiX.

    #71770
    Member
    fatboy
    Helpful
    Up
    0
    ::

    Hi Xecure, thanks for the suggestion, it didn’t work 🙁 It looked like a very elegant solution, but didn’t solve my problem

    "Spiral out, keep going"

    #71771
    Member
    fatboy
    Helpful
    Up
    0
    ::

    Hi cristophe, this looks like a solution, I just have to figure out how to perform the fixes suggested by Arch wiki.

    I was also looking at explicitly loading bash before executing the ‘nnn -d’ command, but have failed thus far. Looks like a script is the only way to go?

    "Spiral out, keep going"

    #71779
    Moderator
    BobC
    Helpful
    Up
    1
    ::

    fatboy, I just did this from /home/demo on a flashdrive. Maybe it includes good features that I don’t know about. To compare, try Midnight Commander, which antiX comes with already installed.

    To get nnn to work from IceWM menu or toolbar, add line below, save, and then restart icewm:
    prog "NNN File Manager" /usr/share/icons/papirus-antix/48x48/apps/file-manager.png x-terminal-emulator -e /home/demo/.icewm/nwrap

    To assign to Super+n add line below to keys file, and then restart icewm

    ## File Manager
    key	"Super+n" x-terminal-emulator -e /home/demo/.icewm/nwrap

    Add nwrap file and chmod +x

    #!/bin/sh
    
    ### USAGE: prog "NNN File Manager" /usr/share/icons/papirus-antix/48x48/apps/file-manager.png x-terminal-emulator -e /home/demo/.icewm/nwrap
    # If you use pywal, you need to restore the scheme here
    # (cat ~/.cache/wal/sequences &)
    
    export NNN_BMS="D:$HOME/Downloads;v:$HOME/Videos"
    export NNN_COLORS="5236"
    alias nsel="cat ${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection | tr '\0' '\n'"
    
    export NNN_TRASH=1
    export NNN_USE_EDITOR="nano"
    export NNN_COLORS="1235" 
    
    # To use a CLI opener, specify the <code>-c</code> option to <code>nnn</code>
    # export NNN_OPENER="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins/nuke"
    
    # Unmask ^Q (if required, see <code>stty -a</code>) to Quit nnn
    stty start undef
    stty stop undef
    
    # Start nnn with your preferred options
    nnn "$@"
    • This reply was modified 2 days ago by BobC. Reason: add keys entry
    #71837
    Member
    fatboy
    Helpful
    Up
    0
    ::

    Hi BobC,

    I am familiar with mc, it is a very good application, but nnn I use to quickly access and browse files. mc I use for file transfers mostly.

    You solution worked like a charm! Thanks! Now all my nnn configs load before I launch nnn. Awesome!

    This is solved!

    "Spiral out, keep going"

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.