🔧 chore(update): restart colorshell if there's an instance running after updating
This commit is contained in:
+3
-12
@@ -1,18 +1,9 @@
|
|||||||
|
source ./scripts/utils.sh
|
||||||
|
|
||||||
file="${1:-./build/colorshell}"
|
file="${1:-./build/colorshell}"
|
||||||
|
|
||||||
function is_running() {
|
|
||||||
if gdbus introspect --session \
|
|
||||||
--dest io.github.retrozinndev.colorshell \
|
|
||||||
--object-path /io/github/retrozinndev/colorshell > /dev/null 2>&1
|
|
||||||
then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
function start() {
|
function start() {
|
||||||
if is_running; then
|
if Is_running; then
|
||||||
echo "[info] killing previous instance"
|
echo "[info] killing previous instance"
|
||||||
colorshell quit || killall gjs
|
colorshell quit || killall gjs
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -63,6 +63,21 @@ function Ask() {
|
|||||||
export answer
|
export answer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# -------------
|
||||||
|
# Checks if there's currently a colorshell instance running
|
||||||
|
# Returns code 0 if none, 1 if there is one
|
||||||
|
# -------------
|
||||||
|
function Is_running() {
|
||||||
|
if gdbus introspect --session \
|
||||||
|
--dest io.github.retrozinndev.colorshell \
|
||||||
|
--object-path /io/github/retrozinndev/colorshell > /dev/null 2>&1
|
||||||
|
then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
# -------------
|
# -------------
|
||||||
# Check if colorshell is installed
|
# Check if colorshell is installed
|
||||||
# Returns code 0 if installed, 1 if not
|
# Returns code 0 if installed, 1 if not
|
||||||
|
|||||||
@@ -121,6 +121,14 @@ if [[ "$answer" == y ]] || [[ "$skip_prompts" ]]; then
|
|||||||
mkdir -p $APPS_HOME
|
mkdir -p $APPS_HOME
|
||||||
cp -f $repo_directory/build/release/colorshell.desktop $APPS_HOME
|
cp -f $repo_directory/build/release/colorshell.desktop $APPS_HOME
|
||||||
|
|
||||||
|
if Is_running; then
|
||||||
|
Send_log "colorshell is running, restarting shell..."
|
||||||
|
colorshell quit || killall gjs
|
||||||
|
# wait 2s, because the shell can take a little bit of time to close
|
||||||
|
# (the cli is closed before the action is completed)
|
||||||
|
sleep 2s && hyprctl dispatch exec "bash $XDG_CONFIG_HOME/hypr/scripts/exec.sh colorshell"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [[ -z "$skip_prompts" ]]; then
|
if [[ -z "$skip_prompts" ]]; then
|
||||||
echo "Colorshell is updated! :D"
|
echo "Colorshell is updated! :D"
|
||||||
|
|||||||
Reference in New Issue
Block a user