GithubHelp home page GithubHelp logo

job79 / jetbrains-flatpak-wrapper Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lctrs/jetbrains-flatpak-wrapper

0.0 0.0 0.0 39 KB

Fork of jetbrains-flatpak-wrapper that fixes the inbuild shell.

License: MIT License

Shell 57.20% Meson 42.80%

jetbrains-flatpak-wrapper's Introduction

Flatpak Jetbrains IDE wrapper

This wrapper sets up development environment before launching the editor inside flatpak sandbox.

Current functions:

  • Show up a readme on first launch
  • Show up a notice after SDK update
  • Enable installed SDK extensions (from /usr/lib/sdk)
    • FLATPAK_ENABLE_SDK_EXT must be set to a comma-separated list or *
  • Enable installed development tools (from /app/tools)
  • Isolate npm/pip/cargo/etc packages from host environment

Usage

Usage of this module consists of:

  1. Sourcing this repository as a git submodule or using flatpak-builder's built-in git source.
  2. Creating a module in your flatpak's build file that specifies the options you want to use.
  3. Overwriting your flatpak's entry points to run the wrapper instead of the actual program's executable. This must be done on the "command" key of your build file as well as on the ".desktop" file of your upstream.

Some aspects of this module's behaviour may be changed using environment variables, see the full listing in the "Environment Variables" section below.

Sourcing this Repository

To use this repository as a git submodule, you may clone it inside of your flatpak's build directory with the command:

git submodule add https://github.com/Lctrs/jetbrains-flatpak-wrapper.git

Then, you will bring it into your build file using flatpak-builder's "dir" source. Example:

  - name: jetbrains-flatpak-wrapper
    buildsystem: meson
    config-opts:
      # your config opts (more on this later)
    sources:
      - type: dir
        path: jetbrains-flatpak-wrapper

If you prefer, you may use the git source instead. Exemple:

  - name: jetbrains-flatpak-wrapper
    buildsystem: meson
    config-opts:
      # your config opts (more on this later)
    sources:
      - type: git
        url: https://github.com/Lctrs/jetbrains-flatpak-wrapper.git
        branch: master

Specifying Config Options

For this module to work properly, we must specify a minimum of 2 options - the path to your editor's binary and a name to install the wrapper under:

  - name: jetbrains-flatpak-wrapper
    buildsystem: meson
    config-opts:
      # Path to the editor executable
      - -Deditor_binary=/app/extra/phpstorm/bin/phpstorm.sh
      # Install wrapper under this name (must be different from the above)
      - -Dprogram_name=phpstorm-wrapper
    sources:
      # your source choice

Additionally, you may specify the following options:

  • -Deditor_args Command line args to append to the editor executable.
  • -Deditor_title Human readable title of the editor. This will be interpolated into the "first run template" file (more on this file later).
  • -Dfirst_run_template Name of the file that will be opened on your editor's first run.
  • -Dsdk_update_template Name of the file that will be opened when your flatpak updates its SDK. This can be used to inform the user that the SDK extensions they were using before must be updated as well.
  • -Dflagfile_prefix An arbitrary string prepended to -first-run and -sdk-update- files names that indicate that we already did show the corresponding readme.
  • -Ddefault_loglevel The default loglevel. May be overwritten by user with FLATPAK_JETBRAINS_LOGLEVEL environment variable.

Overwriting the Flatpak's Entry Points

Now that you have your wrapper configured, you must ensure it is executed instead of your actual editor's binary. Typically your flatpak will have two entry points: the command key of your build file which is used when the flatpak is executed using the flatpak run command and the desktop file which is used when the user clicks on your editor's icon from their desktop environment. If the desktop file comes from upstream you will need to patch the Exec line to call the wrapper.

First Run and SDK Update Templates

To inform your user of the particulars of flatpaks, you can include a first run template and an SDK update template which will be run once after each of those events. You must include those files in the sources section of the module:

  - name: jetbrains-flatpak-wrapper
    buildsystem: meson
    config-opts:
      # your options
    sources:
      # your source choice
      - type: file
        path: ide-first-run.txt
      - type: file
        path: sdk-update.txt

Those template files have string interpolation for the EDITOR_TITLE and FLATPAK_ID using the @ symbol. For example, using an editor title of "VS Code" and a flatpak ID of "com.visualstudio.code" the template file would go from this:

------------------------------------------------------------------------------------
| Warning: You are running an unofficial Flatpak version of @EDITOR_TITLE@ !!! |
------------------------------------------------------------------------------------

Please open issues under: https://github.com/flathub/@FLATPAK_ID@/issues

To this:

------------------------------------------------------------------------------------
| Warning: You are running an unofficial Flatpak version of PhpStorm !!! |
------------------------------------------------------------------------------------

Please open issues under: https://github.com/flathub/com.jetbrains.PhpStorm/issues

Environment Variables

You may use the following environment variables to change the behaviour of the ide-flatpak-wrapper:

  • FLATPAK_JETBRAINS_LOGLEVEL (= 1)

    Controls verbosity of the module, 0 supresses all module-originated outputs to stdout.

    • Type: Number (0 | 1)
  • FLATPAK_PREFER_USER_PACKAGES (= 0)

  • FLATPAK_ISOLATE_PACKAGES (= 1)

  • FLATPAK_ISOLATE_NPM (= FLATPAK_ISOLATE_PACKAGES)

  • FLATPAK_PREFER_USER_NPM (= FLATPAK_PREFER_USER_PACKAGES)

  • FLATPAK_ISOLATE_CARGO (= FLATPAK_ISOLATE_PACKAGES)

  • FLATPAK_PREFER_USER_CARGO (= FLATPAK_PREFER_USER_PACKAGES)

  • FLATPAK_ISOLATE_PIP (= FLATPAK_ISOLATE_PACKAGES)

  • FLATPAK_PREFER_USER_PIP (= FLATPAK_PREFER_USER_PACKAGES)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.