Add plugs to allow user to access ~/.java and ~/.openrocket
Add plugs which use the personal-files interface for snaps to allow the users to enable OpenRocket to access the ~/.java and ~/.openrocket directories. Currently, these must be manually connected by the user, so the launcher is updated to ensure the user experience degrades appropriately when they are not connected. This method allows for new installations to OpenRocket without any changes and for users migrating to the snap from the jar to be able to connect their existing preferences and databases. Signed-off-by: Billy Olsen <billy.olsen@gmail.com>
This commit is contained in:
parent
38ca68fd3c
commit
ed2f2cbf0a
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
JAVA_BIN="$JAVA_HOME/bin/java"
|
||||
|
||||
@ -6,8 +6,18 @@ export DESKTOP_SESSION=gnome
|
||||
export XDG_SESSION_DESKTOP=gnome
|
||||
export XDG_CURRENT_DESKTOP=GNOME
|
||||
|
||||
JAVA_OPTS="-Dsun.java2d.xrender=true -Dprism.useFontConfig=false -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dswing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Djava.io.tmpdir=$SNAP_USER_COMMON"
|
||||
|
||||
if ! snapctl is-connected preferences; then
|
||||
JAVA_OPTS="$JAVA_OPTS -Djava.util.prefs.userRoot=$SNAP_USER_COMMON/"
|
||||
fi
|
||||
|
||||
if ! snapctl is-connected openrocket-db; then
|
||||
JAVA_OPTS="$JAVA_OPTS -Duser.home=$SNAP_USER_COMMON/"
|
||||
fi
|
||||
|
||||
export _JAVA_OPTIONS=$JAVA_OPTS
|
||||
# Fix font / theme
|
||||
export _JAVA_OPTIONS="-Dsun.java2d.xrender=true -Dprism.useFontConfig=false -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dswing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Djava.util.prefs.userRoot=$SNAP_USER_COMMON/"
|
||||
export JAVA_FONTS=$SNAP/usr/share/fonts/truetype
|
||||
exec $JAVA_BIN -jar $SNAP/OpenRocket.jar "$@"
|
||||
|
||||
|
@ -20,6 +20,20 @@ base: core18
|
||||
grade: stable
|
||||
confinement: strict
|
||||
|
||||
plugs:
|
||||
preferences:
|
||||
interface: personal-files
|
||||
read:
|
||||
- $HOME/.java
|
||||
write:
|
||||
- $HOME/.java
|
||||
openrocket-db:
|
||||
interface: personal-files
|
||||
read:
|
||||
- $HOME/.openrocket
|
||||
write:
|
||||
- $HOME/.openrocket
|
||||
|
||||
apps:
|
||||
openrocket:
|
||||
extensions:
|
||||
@ -30,6 +44,8 @@ apps:
|
||||
- network
|
||||
- cups-control
|
||||
- opengl
|
||||
- preferences
|
||||
- openrocket-db
|
||||
environment:
|
||||
JAVA_HOME: "$SNAP/usr/lib/jvm/java-11-openjdk-amd64"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user