✨ feat: add support for desktop entry
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Name=colorshell
|
||||||
|
Type=Application
|
||||||
|
Comment=A Desktop Shell for Hyprland that has colors from your wallpaper!
|
||||||
|
Exec=sh -c '$COLORSHELL_BINARY'
|
||||||
|
NoDisplay=true
|
||||||
|
StartupWMClass=io.github.retrozinndev.colorshell
|
||||||
+18
-7
@@ -2,7 +2,7 @@ set -e
|
|||||||
|
|
||||||
socket_support=true
|
socket_support=true
|
||||||
|
|
||||||
while getopts o:r:hn args; do
|
while getopts o:r:e:hn args; do
|
||||||
case "$args" in
|
case "$args" in
|
||||||
o)
|
o)
|
||||||
outdir=${OPTARG}
|
outdir=${OPTARG}
|
||||||
@@ -10,6 +10,9 @@ while getopts o:r:hn args; do
|
|||||||
r)
|
r)
|
||||||
gresource_file=${OPTARG}
|
gresource_file=${OPTARG}
|
||||||
;;
|
;;
|
||||||
|
e)
|
||||||
|
bin_target=${OPTARG}
|
||||||
|
;;
|
||||||
n)
|
n)
|
||||||
unset socket_support
|
unset socket_support
|
||||||
;;
|
;;
|
||||||
@@ -17,26 +20,30 @@ while getopts o:r:hn args; do
|
|||||||
echo "\
|
echo "\
|
||||||
colorshell's automated release-build script.
|
colorshell's automated release-build script.
|
||||||
|
|
||||||
|
help:
|
||||||
|
'literal': the argument should have environment variables sent as a literal string,
|
||||||
|
they're replaced at runtime.
|
||||||
|
'default': argument's default value, they're used if none are provided.
|
||||||
|
|
||||||
options:
|
options:
|
||||||
-r \$file: gresource's target path (shell-only, file is kept in \$output. default: \$XDG_DATA_HOME/colorshell/resources.gresource)
|
-r \$file: gresource's target path (literal; kept in \$output; default: \$XDG_DATA_HOME/colorshell/resources.gresource)
|
||||||
-n: disable socket communication support(use the slower remote instance communication)
|
-n: disable socket communication support(use the slower remote instance communication)
|
||||||
-o \$path: build output path (default: \`./build/release\`)
|
-o \$path: build output path (default: \`./build/release\`)
|
||||||
|
-e: set desktop entry's executable target (literal; default: \$HOME/.local/bin/colorshell)
|
||||||
-h: show this help message"
|
-h: show this help message"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# send literal variable name, so it's interpreted in the shell rather than in the build
|
# send literal variable name, so it's interpreted at runtime
|
||||||
sh ./scripts/build.sh -o "${outdir:-./build/release}" -b -r "${gresource_file:-\$XDG_DATA_HOME/colorshell/resources.gresource}"
|
sh ./scripts/build.sh -o "${outdir:-./build/release}" -b -r "${gresource_file:-\$XDG_DATA_HOME/colorshell/resources.gresource}"
|
||||||
|
|
||||||
# add socket-communication support on executable
|
# add socket-communication support on executable
|
||||||
if [[ $socket_support ]]; then
|
if [[ $socket_support ]]; then
|
||||||
echo "[info] adding socket communication support"
|
echo "[info] adding socket communication support"
|
||||||
script="\
|
script="\
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/bash
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
if gdbus introspect --session \\
|
if gdbus introspect --session \\
|
||||||
--dest io.github.retrozinndev.colorshell \\
|
--dest io.github.retrozinndev.colorshell \\
|
||||||
@@ -46,9 +53,13 @@ if gdbus introspect --session \\
|
|||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
`cat "${outdir:-./build/release}/colorshell" | sed -e 's/^#.*//'`" # remove shebang
|
`cat "${outdir:-./build/release}/colorshell" | sed -e 's/^#.*//'`" # remove shebang
|
||||||
|
|
||||||
echo -en "$script" > "${outdir:-./build/release}/colorshell"
|
echo -en "$script" > "${outdir:-./build/release}/colorshell"
|
||||||
chmod +x "${outdir:-./build/release}/colorshell"
|
chmod +x "${outdir:-./build/release}/colorshell"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "[info] making desktop entry"
|
||||||
|
entry=`cat ./resources/colorshell.desktop`
|
||||||
|
entry=${entry/\$COLORSHELL_BINARY/${bin_target:-\$HOME/.local/bin/colorshell}}
|
||||||
|
echo -n "$entry" > ${outdir:-./build/release}/colorshell.desktop
|
||||||
|
|||||||
Reference in New Issue
Block a user