Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions install.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cp *.thumbnailer /usr/share/thumbnailers/
cp *-thumbnailer-script /usr/local/bin/
chmod +x /usr/local/bin/*-thumbnailer-script
cp *-thumbnailer-script /usr/bin/
chmod +x /usr/bin/*-thumbnailer-script

xdg-mime install --novendor stl-mime.xml
xdg-mime install --novendor scad-mime.xml
Expand Down
14 changes: 3 additions & 11 deletions scad-thumbnailer-script
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
#!/bin/bash

in_file="$1"
in_file="${1#file://}"
size="$2"
out_file="$3"

Xvfb :100 -ac &
PID1=$!
export DISPLAY=:100.0
/bin/openscad --colorscheme="Nature" --imgsize=$size,$size --export-format=png -o $out_file $in_file
/usr/bin/convert $out_file -fuzz 20% -transparent white $out_file

rm -f /tmp/.X100-lock
rm -rf /tmp/.X11-unix

kill -9 $PID1
xvfb-run --auto-servernum -w 0 openscad --colorscheme="Nature" --imgsize=$size,$size --export-format=png -o $out_file $in_file
magick convert $out_file -fuzz 20% -transparent white $out_file
4 changes: 2 additions & 2 deletions scad.thumbnailer
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[Thumbnailer Entry]
TryExec=/usr/local/bin/scad-thumbnailer-script
Exec=/usr/local/bin/scad-thumbnailer-script %i %s %o
TryExec=/usr/bin/scad-thumbnailer-script
Exec=/usr/bin/scad-thumbnailer-script %u %s %o
MimeType=text/x-scad;application/x-openscad;
14 changes: 3 additions & 11 deletions stl-thumbnailer-script
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
#!/bin/bash

in_file="$1"
in_file="${1#file://}"
size="$2"
out_file="$3"

Xvfb :100 -ac &
PID1=$!
export DISPLAY=:100.0
/bin/openscad --colorscheme="Tomorrow" --imgsize=$size,$size --export-format=png -o $out_file <(echo "import(\"/tmp/$(basename $in_file)\");")
/usr/bin/convert $out_file -fuzz 20% -transparent white $out_file

rm -f /tmp/.X100-lock
rm -rf /tmp/.X11-unix

kill -9 $PID1
xvfb-run --auto-servernum -w 0 openscad --colorscheme="Tomorrow" --imgsize=$size,$size --export-format=png -o $out_file <(echo "import(\"$in_file\");")
magick convert $out_file -fuzz 20% -transparent white $out_file
4 changes: 2 additions & 2 deletions stl.thumbnailer
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[Thumbnailer Entry]
TryExec=/usr/local/bin/stl-thumbnailer-script
Exec=/usr/local/bin/stl-thumbnailer-script %i %s %o
TryExec=/usr/bin/stl-thumbnailer-script
Exec=/usr/bin/stl-thumbnailer-script %u %s %o
MimeType=application/sla;model/x.stl-binary;model/stl;model/x.stl-ascii;