blob: 9df9e996af7f44a3bd1d1237043bafc21dd11f44 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#!/bin/sh
# for matlab version R2022a
# 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
# https://faq.i3wm.org/question/2564/cant-open-matlab-from-dmenu.1.html
# https://wiki.archlinux.org/title/MATLAB#Desktop_entry
# use /tmp as working (startup) directory and save simulink files there to avoid cross filesystem hardlink error:
# https://bbs.archlinux.org/viewtopic.php?id=277970
cmd () {
_JAVA_AWT_WM_NONREPARENTING=1 LD_PRELOAD=/lib64/libfreetype.so exec "$bin_dir/matlab" -sd "$startup_dir" -desktop -nosplash "$@"
}
startup_dir=/tmp/matlab
bin_dir="$HOME/programs/MATLAB/R2022a/bin"
addon_dir="$HOME/MATLAB Add-Ons"
[ -d "$startup_dir" ] || mkdir "$startup_dir"
# my workaround for simulink gyroscope compile errors:
# "avr-gcc: error: I2Cdev.o: No such file or directory" (also for other .o files)
# "Code generation information file does not exist." (caused by no .o file error before I guess)
# I guess it is still cross filesystem hardlink error
# need to set path in matlab manually once for "$startup_dir/$addon_dir" sub dirs inside
[ -d "$startup_dir/$addon_dir" ] || cp -r "$addon_dir" "$startup_dir"
if ! cmd "$@"; then
"$bin_dir/activate_matlab.sh"
cmd "$@"
fi
|