Last active
November 1, 2024 15:53
-
-
Save Haelle/c2de432e1d5ad3af3fd36831d5a501ef to your computer and use it in GitHub Desktop.
Open .aseprite in a new tab with Ubuntu/Nemo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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