linuxubuntuhardlinkkateappimage

How do I redirect from a built-in bin to execute an AppImage instead?


Scenario: the current version of Kate in Ubuntu 18LTS points at their customized version (which doesn't appear to support regex search capability). The bin is: /usr/bin/kate.

Desired solution: run the Kate AppImage (which has the regex search/replace functionality). The AppImage currently resides in ~/Downloads.

Question: how do I redirect the system to execute the AppImage version of Kate, instead of the built-in version?

Can I simply create a link to the AppImage in /usr/bin?


Solution

  • Yes, it appears you can... i.e. in my case I replaced the existing kate bin with a link that points to the appimage:

    # 1st remove the existing kate binary
    # (cp kate somewhere first if you want to keep a copy)
    sudo rm /usr/bin/kate
    
    # 2nd create a link in the system bin that points to the appimage
    sudo link [directory where the appimage resides]/Kate.AppImage /usr/bin/kate
    

    Done! The system will now execute the appimage when 'kate' is executed (e.g. via context menus).

    =========================

    UPDATE...

    The above solution kinda works... it does run the appimage, however the parameters normally passed to kate (i.e. file to open) are lost in the hard link.

    So... the better solution is to create a simple executable shell script (named 'kate' in the /usr/bin directory) to execute the appimage:

    #!/bin/sh
    exec [directory where the appimage resides]/Kate.AppImage "$@"
    

    This passes any provided parms to the appimage.