summaryrefslogtreecommitdiff
path: root/home/xyz/.local/bin/matlab
diff options
context:
space:
mode:
authorxyz <gky44px1999@gmail.com>2022-09-16 15:50:25 -0700
committerxyz <gky44px1999@gmail.com>2022-09-16 15:50:25 -0700
commita458c57e5407a10ad861ed21799f8dd445ad287a (patch)
tree95075000f837c3414813544e218b9541578790f3 /home/xyz/.local/bin/matlab
parentc2a53abfd0ec62b7aabe42b8b17459ed59a56f4f (diff)
refactor
Diffstat (limited to 'home/xyz/.local/bin/matlab')
-rwxr-xr-xhome/xyz/.local/bin/matlab17
1 files changed, 14 insertions, 3 deletions
diff --git a/home/xyz/.local/bin/matlab b/home/xyz/.local/bin/matlab
index 6423ecc7..44af8bdf 100755
--- a/home/xyz/.local/bin/matlab
+++ b/home/xyz/.local/bin/matlab
@@ -3,6 +3,17 @@
# https://wiki.archlinux.org/title/MATLAB#Blank/grey_UI_when_using_WM_(non-reparenting_window_manager)
# https://wiki.archlinux.org/title/Java#Gray_window,_applications_not_resizing_with_WM,_menus_immediately_closing
# https://wiki.archlinux.org/title/MATLAB#Unable_to_launch_the_MATLABWindow_application
-# LD_PRELOAD put before firejail does not work
-#firejail env _JAVA_AWT_WM_NONREPARENTING=1 LD_PRELOAD=/lib64/libfreetype.so ~/programs/MATLAB/R2022a/bin/matlab
-env _JAVA_AWT_WM_NONREPARENTING=1 LD_PRELOAD=/lib64/libfreetype.so ~/programs/MATLAB/R2022a/bin/matlab
+# https://faq.i3wm.org/question/2564/cant-open-matlab-from-dmenu.1.html
+
+cmd () {
+ _JAVA_AWT_WM_NONREPARENTING=1 LD_PRELOAD=/lib64/libfreetype.so "$bin_dir/matlab" -desktop "$@"
+}
+
+startup_dir=/tmp/matlab
+bin_dir="$HOME/programs/MATLAB/R2022a/bin"
+[ -d "$startup_dir" ] || mkdir -p "$startup_dir"
+
+if ! cmd "$@"; then
+ "$bin_dir/activate_matlab.sh"
+ cmd "$@"
+fi