Skip to content

Instantly share code, notes, and snippets.

@Haelle
Last active November 1, 2024 15:53
Show Gist options
  • Save Haelle/c2de432e1d5ad3af3fd36831d5a501ef to your computer and use it in GitHub Desktop.
Save Haelle/c2de432e1d5ad3af3fd36831d5a501ef to your computer and use it in GitHub Desktop.
Open .aseprite in a new tab with Ubuntu/Nemo
#!/bin/bash
# inspired by : https://github.com/aseprite/aseprite/issues/477
# To make it work in Nemo create a symlink like this :
# sudo ln -s /path/to/this/file/launch_aseprite /usr/bin/launch_aseprite
# and then in the default app of Nemo juste use `launch_aseprite` instead of Aseprite directly
# try to find the aseprite window by name
window_id=$(xdotool search --name "Aseprite v1" | tail -n 1)
if [ -n "$window_id" ]; then
# focus aseprite
xdotool windowactivate "$window_id"
# copy the file path to clipboard
echo -n "$1" | xclip -selection clipboard
# simulate opening file in aseprite
xdotool key ctrl+o # simulate "open" (ctrl+o)
# the first time a new file is opened the following steps need to be done manually and then it works...
xdotool key ctrl+v # paste file path
xdotool key Return # simulate press enter
xdotool key Return # simulate an extra press enter
else
# aseprite not running, launch it
# if trying to open file, then pass it to aseprite to open
if [ -n "$1" ]; then
/usr/bin/aseprite "$1" &
# else just open aseprite
else
/usr/bin/aseprite &
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment