-
Notifications
You must be signed in to change notification settings - Fork 176
Open
Description
Mime type text/xml is far too generic to allow making file association with hydrogen.
I'd suggest defining clear mime types, such as
application/hydrogen-music-h2playlistapplication/hydrogen-music-h2drumkitapplication/hydrogen-music-h2songapplication/hydrogen-music-h2themeapplication/hydrogen-music-h2pattern
Since I found no installation scripts for the appimage, I created my own script to create better mime types and application desktop entries.
After running this script any h2song will be opened by hydrogen on double-click in file managers.
Please feel free to use this as template for your own installation script:
#!/bin/bash
#----------------------------------
# get the icons from github
#----------------------------------
ICONS="icon16.png icon24.png icon32.png icon48.png icon64.png"
for icon in $ICONS
do
if [ ! -f "$icon" ]
then
wget "https://raw.githubusercontent.com/hydrogen-music/hydrogen/refs/heads/master/data/img/gray/$icon"
fi
done
#----------------------------------
# install icons
#----------------------------------
for png in icon*.png
do
echo "png='${png}'"
name=$(basename "${png}" ".png")
size=$(convert "${png}" -print "%w" /dev/null)
item=hydrogen-music
echo "name='${name}' item='${item}' size='${size}'"
xdg-icon-resource install --mode user --size ${size} ${png} ${item}
done
#----------------------------------
# define mime type with icon
#----------------------------------
function create_mime
{
echo "-- create mime type application/hydrogen-music-$1 --"
cat << -EOF- > /tmp/hydrogen-music-$1.xml
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/hydrogen-music-$1">
<comment>$2</comment>
<glob pattern=$3/>
<icon name="hydrogen-music"/>
</mime-type>
</mime-info>
-EOF-
xdg-mime install --mode user /tmp/hydrogen-music-$1.xml
}
create_mime "h2song" "Hydrogen-Song" '"*.h2song"'
create_mime "h2pattern" "Hydrogen-Pattern" '"*.h2pattern"'
create_mime "h2playlist" "Hydrogen-Playlist" '"*.h2playlist"'
create_mime "h2drumkit" "Hydrogen-Drumkit" '"*.h2drumkit"'
create_mime "h2theme" "Hydrogen-Theme" '"*.h2theme"'
#----------------------------------
# define desktop file
#----------------------------------
echo "-- create application type --"
cat << -EOF- > /tmp/hydrogen-music-hydrogen.desktop
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
MimeType=application/hydrogen-music-h2song;application/hydrogen-music-h2pattern;application/hydrogen-music-h2playlist;application/hydrogen-music-h2drumkit;
Exec=hydrogen %F
Categories=AudioVideo;Audio;Qt;
Terminal=false
Icon=hydrogen-music
Name=Hydrogen
-EOF-
chmod +x /tmp/hydrogen-music-hydrogen.desktop
xdg-desktop-menu install --mode user /tmp/hydrogen-music-hydrogen.desktop
DESKTOP=$(xdg-user-dir DESKTOP)
cp /tmp/hydrogen-music-hydrogen.desktop ${DESKTOP}/
Metadata
Metadata
Assignees
Labels
No labels