Quick switch between Krita 4<>Krita 5 under Linux

Hi

As I’m a lazy guy and I often switch between Krita 4 and Krita 5, today I finally made a small python script to execute Krita :slight_smile:

Script works under Linux and for appimages only
It might be easy to update it for Windows :thinking:


What the script does? Why do you need a script to execute Krita? :crazy_face:

Execute Krita

The script search for the last available appimage (krita 4 or krita 5 according to command line option)
If you have like me 4 or 5 Krita 5 appimage because you’re updating the lasted appimage practically every day, script will always execute the most recent appimage:

  • No need to check anymore which one is the right one
  • Easy command line: always the same command without having to modify anything; especially useful with Krita 5 for which git commit number is included in the appimage file name

Do backup

When switching between Krita 4/Krita 5, there’s a risk to loose resources or to put a mess in configurations.

The interesting thing with the script, it’s if a backup file exists the will script restore it before starting Krita, and will create a new backup when Krita is closed.

Note: in this case it means that both version are completely isolated, change made on a version are not available to the other one

Script options

There’s some command line options:

Option Description
-k4 Execute Krita 4
-k5 Execute Krita 5
-nb Do not restore backup before execution, do not create backup after execution
-r Reset configuration, do not create backup after execution

Notes:

  • -k4 and -k5 options are mutually exclusive
  • -nb and -r options are mutually exclusive

Configuration

For a small script like this, path are hardcoded :grimacing:
Also, it’s possible to define different option for different appimages.

So before using it, please read comments written in script and update path according to how your directories tree is organized.

I consider that people using Linux command line and testing Krita 4/Krita 5 somewhere are advanced users and might be able to do it without difficulties :slight_smile:

Just be careful on first execution, if configured path are not valid… just do a manual backup of your files before :sweat_smile:

Where to find script?

Here, it’s just a gist link to script:

The very lazy guy tips

Yes, I’m more lazy than lazy, it might explain why I didn’t wrote this script before :sweat_smile:

I’ve just added in my .bashrc some aliases:

# Add scripts to PATH
export PATH=~/Applications/Systeme/Scripts:$PATH

alias k4="klauncher.py -k4"
alias k5="klauncher.py -k5"

Now, in a console, I just type k4 or k5 to launch Krita :slight_smile:

And use of alias allows to pass additional arguments, k4 -r for example

Note: I’ve also applied chmod +x to my python script

Grum999

4 Likes

Don’t worry - you’re in good company! :yum:

‘Sod’s Law’ though that you posted this the day the impasto stuff has been committed; I could probably have used it the past few weeks! :sweat_smile:

Honestly though - I haven’t had many crashes with the Krita 5 builds, and I only lost work once because I didn’t save a test sketch and don’t use autosave.

@halla had given me some bash export one liners. I’ll search and put them here. I got lazy and then I started using flatpak-noghtlirs. Which by default keeps stuff separate

You can set the following XDG variables:

XDG_DATA_DIRS
XDG_CONFIG_DIRS
XDG_DATA_HOME
XDG_CONFIG_HOME
XDG_CACHE_HOME

See Environment variables