Opening .circ files in BrandonsimAugust 22, 2017
Sometimes you gotta have pretty icons and pretty buttons, y’know? In the case of Brandonsim on GNU/Linux, specifically to give it and
.circ files pretty icons which open Brandonsim when clicked, do one of the following:
Option 1: Use a Script
Brandonsim-X.Y.Z.jar from T-Square, put it somewhere permanent (moving it will break the files the script creates), and run the following command:
curl -Ls https://austinjadams.com/img/blog/open-circ-in-brandonsim/brandonsim-setup.sh | bash
After the script completes, log out and log back in, just in case.
Option 2: By Hand
If you don’t like piping random shell scripts from the internet into a shell, you can do the following instead:
mkdir -p ~/.local/share/applications/ ~/.local/share/mime/packages/
Install icons stolen from Brandon’s Brandonsim repo by running:
tmpfile=$(mktemp --suffix=.png); for size in 16 20 24 48 64 128; do curl -L https://austinjadams.com/img/blog/open-circ-in-brandonsim/brandonsim-icon-$size.png -o "$tmpfile" && xdg-icon-resource install --size $size "$tmpfile" brandonsim-icon; done; rm "$tmpfile"
~/.local/share/mime/packages/brandonsim.xmlwith the following contents:
<?xml version="1.0" encoding="UTF-8"?> <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'> <mime-type type="application/brandonsim"> <comment>Brandonsim circuit</comment> <glob pattern="*.circ"/> <icon name="brandonsim-icon"/> </mime-type> </mime-info>
~/.local/share/applications/brandonsim.desktopwith the following contents, except with your path to the Brandonsim jar instead of
[Desktop Entry] Version=1.0 Type=Application Name=Brandonsim Icon=brandonsim-icon GenericName=Logic circuit simulator Comment=Digital logic circuit simulator Categories=Development MimeType=application/brandonsim; Exec=java -jar /PATH/TO/YOUR/Brandonsim-2.7.4.jar %U Terminal=false StartupWMClass=com-cburch-logisim-Main
xdg-mime default brandonsim.desktop application/brandonsim
Might need to log out and log back in somewhere in there, YMMV. Just restarting gnome-shell at the end worked for me.