mirror of
https://github.com/winapps-org/winapps.git
synced 2026-11-29 10:55:45 -05:00
Add WinApp's icon to the notification messages
Signed-off-by: nmendozam <mendozamejian@gmail.com>
This commit is contained in:
+44
-43
@@ -29,6 +29,7 @@ readonly COMPOSE_PATH="${HOME}/.config/winapps/compose.yaml"
|
||||
readonly SCRIPT_DIR_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
|
||||
readonly SLEEP_DETECT_PATH="${APPDATA_PATH}/last_activity"
|
||||
readonly SLEEP_MARKER="${APPDATA_PATH}/sleep_marker"
|
||||
readonly APP_ICON_PATH="${SCRIPT_DIR_PATH}/../docs/readme/winapps.svg"
|
||||
|
||||
# OTHER
|
||||
readonly CONTAINER_NAME="WinApps" # FOR 'docker' AND 'podman' ONLY
|
||||
@@ -220,66 +221,66 @@ function waThrowExit() {
|
||||
"$EC_MISSING_CONFIG")
|
||||
# Missing WinApps configuration file.
|
||||
dprint "ERROR: MISSING WINAPPS CONFIGURATION FILE. EXITING."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --urgency="low" "WinApps" "The WinApps configuration file is missing.\nPlease create a WinApps configuration file at '${CONFIG_PATH}'."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "The WinApps configuration file is missing.\nPlease create a WinApps configuration file at '${CONFIG_PATH}'."
|
||||
;;
|
||||
"$EC_MISSING_FREERDP")
|
||||
dprint "ERROR: FREERDP VERSION 3 IS NOT INSTALLED. EXITING."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --urgency="low" "WinApps" "FreeRDP version 3 is not installed."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "FreeRDP version 3 is not installed."
|
||||
;;
|
||||
"$EC_NOT_IN_GROUP")
|
||||
dprint "ERROR: USER NOT PART OF REQUIRED GROUPS. EXITING."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --urgency="low" "WinApps" "The user $(whoami) is not part of the required groups.
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "The user $(whoami) is not part of the required groups.
|
||||
Please run:
|
||||
sudo usermod -a -G libvirt $(whoami)
|
||||
sudo usermod -a -G kvm $(whoami)"
|
||||
;;
|
||||
"$EC_FAIL_START")
|
||||
dprint "ERROR: WINDOWS FAILED TO START. EXITING."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --urgency="low" "WinApps" "Windows failed to start."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Windows failed to start."
|
||||
;;
|
||||
"$EC_FAIL_RESUME")
|
||||
dprint "ERROR: WINDOWS FAILED TO RESUME. EXITING."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --urgency="low" "WinApps" "Windows failed to resume."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Windows failed to resume."
|
||||
;;
|
||||
"$EC_FAIL_DESTROY")
|
||||
dprint "ERROR: FAILED TO FORCE STOP WINDOWS. EXITING."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --urgency="low" "WinApps" "Failed to forcibly stop Windows."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Failed to forcibly stop Windows."
|
||||
;;
|
||||
"$EC_SD_TIMEOUT")
|
||||
dprint "ERROR: WINDOWS TOOK TOO LONG TO SHUT DOWN. EXITING."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --urgency="low" "WinApps" "Windows took too long to shut down."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Windows took too long to shut down."
|
||||
;;
|
||||
"$EC_DIE_TIMEOUT")
|
||||
dprint "ERROR: WINDOWS TOOK TOO LONG TO DIE. EXITING."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --urgency="low" "WinApps" "Windows took too long to die."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Windows took too long to die."
|
||||
;;
|
||||
"$EC_RESTART_TIMEOUT")
|
||||
dprint "ERROR: WINDOWS TOOK TOO LONG TO RESTART. EXITING."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --urgency="low" "WinApps" "Windows took too long to restart."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Windows took too long to restart."
|
||||
;;
|
||||
"$EC_NOT_EXIST")
|
||||
dprint "ERROR: WINDOWS NONEXISTENT. EXITING."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --urgency="low" "WinApps" "Windows VM named '${VM_NAME}' does not exist."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Windows VM named '${VM_NAME}' does not exist."
|
||||
;;
|
||||
"$EC_UNKNOWN")
|
||||
dprint "ERROR: UNKNOWN CONTAINER ERROR. EXITING."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --urgency="low" "WinApps" "Unknown Windows container error."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Unknown Windows container error."
|
||||
;;
|
||||
"$EC_NO_IP")
|
||||
dprint "ERROR: WINDOWS UNREACHABLE. EXITING."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --urgency="low" "WinApps" "Windows is unreachable.\nPlease ensure Windows is assigned an IP address."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Windows is unreachable.\nPlease ensure Windows is assigned an IP address."
|
||||
;;
|
||||
"$EC_BAD_PORT")
|
||||
dprint "ERROR: RDP PORT CLOSED. EXITING."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --urgency="low" "WinApps" "The Windows RDP port '${RDP_PORT}' is closed.\nPlease ensure Remote Desktop is correctly configured on Windows."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "The Windows RDP port '${RDP_PORT}' is closed.\nPlease ensure Remote Desktop is correctly configured on Windows."
|
||||
;;
|
||||
"$EC_UNSUPPORTED_APP")
|
||||
dprint "ERROR: APPLICATION NOT FOUND. EXITING."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --urgency="low" "WinApps" "Application not found.\nPlease ensure the program is correctly configured as an officially supported application."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Application not found.\nPlease ensure the program is correctly configured as an officially supported application."
|
||||
;;
|
||||
"$EC_INVALID_FLAVOR")
|
||||
dprint "ERROR: INVALID FLAVOR. EXITING."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --urgency="low" "WinApps" "Invalid WinApps flavor.\nPlease ensure 'docker', 'podman' or 'libvirt' are specified as the flavor in the WinApps configuration file."
|
||||
notify-send --expire-time=8000 --icon="dialog-error" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Invalid WinApps flavor.\nPlease ensure 'docker', 'podman' or 'libvirt' are specified as the flavor in the WinApps configuration file."
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -357,7 +358,7 @@ function waFixScale() {
|
||||
|
||||
# Print feedback.
|
||||
dprint "WARNING: Unsupported RDP_SCALE value '${OLD_SCALE}'. Defaulting to '${RDP_SCALE}'."
|
||||
notify-send --expire-time=4000 --icon="dialog-warning" --app-name="WinApps" --urgency="low" "WinApps" "Unsupported RDP_SCALE value '${OLD_SCALE}'.\nDefaulting to '${RDP_SCALE}'."
|
||||
notify-send --expire-time=4000 --icon="dialog-warning" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Unsupported RDP_SCALE value '${OLD_SCALE}'.\nDefaulting to '${RDP_SCALE}'."
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -501,28 +502,28 @@ function waCheckVMRunning() {
|
||||
if (virsh list --all --name | grep -Fxq -- "$VM_NAME"); then
|
||||
if (virsh list --state-shutoff --name | grep -Fxq -- "$VM_NAME"); then
|
||||
dprint "WINDOWS SHUT OFF. BOOTING WINDOWS."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --urgency="low" "WinApps" "Booting Windows."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Booting Windows."
|
||||
NEEDED_BOOT=true
|
||||
virsh start "$VM_NAME" &>/dev/null || EXIT_STATUS=$EC_FAIL_START
|
||||
if (virsh list --state-paused --name | grep -Fxq -- "$VM_NAME"); then
|
||||
dprint "WINDOWS PAUSED. RESUMING WINDOWS."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --urgency="low" "WinApps" "Resuming Windows."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Resuming Windows."
|
||||
virsh resume "$VM_NAME" &>/dev/null || EXIT_STATUS=$EC_FAIL_RESUME
|
||||
fi
|
||||
elif (virsh list --state-paused --name | grep -Fxq -- "$VM_NAME"); then
|
||||
dprint "WINDOWS PAUSED. RESUMING WINDOWS."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --urgency="low" "WinApps" "Resuming Windows."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Resuming Windows."
|
||||
virsh resume "$VM_NAME" &>/dev/null || EXIT_STATUS=$EC_FAIL_RESUME
|
||||
elif (virsh list --state-other --name | grep -Fxq -- "$VM_NAME"); then
|
||||
if (virsh domstate "$VM_NAME" | grep -Fxq "in shutdown"); then
|
||||
dprint "WINDOWS SHUTTING DOWN. WAITING."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --urgency="low" "WinApps" "Windows is currently shutting down.\nIt will automatically restart once the shutdown process is complete."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Windows is currently shutting down.\nIt will automatically restart once the shutdown process is complete."
|
||||
EXIT_STATUS=$EC_SD_TIMEOUT
|
||||
while (( TIME_ELAPSED < TIME_LIMIT )); do
|
||||
if (virsh list --state-shutoff --name | grep -Fxq -- "$VM_NAME"); then
|
||||
EXIT_STATUS=0
|
||||
dprint "WINDOWS SHUT OFF. BOOTING WINDOWS."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --urgency="low" "WinApps" "Booting Windows."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Booting Windows."
|
||||
virsh start "$VM_NAME" &>/dev/null || EXIT_STATUS=$EC_FAIL_START
|
||||
NEEDED_BOOT=true
|
||||
break
|
||||
@@ -532,27 +533,27 @@ function waCheckVMRunning() {
|
||||
done
|
||||
elif (virsh domstate "$VM_NAME" | grep -Fxq "crashed"); then
|
||||
dprint "WINDOWS CRASHED. DESTROYING WINDOWS."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --urgency="low" "WinApps" "Windows experienced an unexpected crash.\nAttempting to restart Windows."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Windows experienced an unexpected crash.\nAttempting to restart Windows."
|
||||
virsh destroy "$VM_NAME" &>/dev/null || EXIT_STATUS=$EC_FAIL_DESTROY
|
||||
if [ "$EXIT_STATUS" -eq 0 ]; then
|
||||
dprint "WINDOWS DESTROYED. BOOTING WINDOWS."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --urgency="low" "WinApps" "Booting Windows."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Booting Windows."
|
||||
virsh start "$VM_NAME" &>/dev/null || EXIT_STATUS=$EC_FAIL_START
|
||||
NEEDED_BOOT=true
|
||||
fi
|
||||
elif (virsh domstate "$VM_NAME" | grep -Fxq "dying"); then
|
||||
dprint "WINDOWS DYING. WAITING."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --urgency="low" "WinApps" "Windows is currently shutting down unexpectedly.\nIt will try to restart once the shutdown process finishes."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Windows is currently shutting down unexpectedly.\nIt will try to restart once the shutdown process finishes."
|
||||
EXIT_STATUS=$EC_DIE_TIMEOUT
|
||||
while (( TIME_ELAPSED < TIME_LIMIT )); do
|
||||
if (virsh domstate "$VM_NAME" | grep -Fxq "crashed"); then
|
||||
EXIT_STATUS=0
|
||||
dprint "WINDOWS CRASHED. DESTROYING WINDOWS."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --urgency="low" "WinApps" "Windows experienced an unexpected crash.\nAttempting to restart Windows."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Windows experienced an unexpected crash.\nAttempting to restart Windows."
|
||||
virsh destroy "$VM_NAME" &>/dev/null || EXIT_STATUS=$EC_FAIL_DESTROY
|
||||
if [ "$EXIT_STATUS" -eq 0 ]; then
|
||||
dprint "WINDOWS DESTROYED. BOOTING WINDOWS."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --urgency="low" "WinApps" "Booting Windows."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Booting Windows."
|
||||
virsh start "$VM_NAME" &>/dev/null || EXIT_STATUS=$EC_FAIL_START
|
||||
NEEDED_BOOT=true
|
||||
fi
|
||||
@@ -560,7 +561,7 @@ function waCheckVMRunning() {
|
||||
elif (virsh list --state-shutoff --name | grep -Fxq -- "$VM_NAME"); then
|
||||
EXIT_STATUS=0
|
||||
dprint "WINDOWS SHUT OFF. BOOTING WINDOWS."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --urgency="low" "WinApps" "Booting Windows."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Booting Windows."
|
||||
virsh start "$VM_NAME" &>/dev/null || EXIT_STATUS=$EC_FAIL_START
|
||||
NEEDED_BOOT=true
|
||||
break
|
||||
@@ -583,7 +584,7 @@ function waCheckVMRunning() {
|
||||
# Wait for VM to be fully ready
|
||||
if [[ "$NEEDED_BOOT" == "true" ]]; then
|
||||
dprint "WAITING FOR VM TO BE FULLY READY..."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --urgency="low" "WinApps" "Waiting for Windows to be ready..."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Waiting for Windows to be ready..."
|
||||
|
||||
TIME_ELAPSED=0
|
||||
|
||||
@@ -597,7 +598,7 @@ function waCheckVMRunning() {
|
||||
# Try to connect to RDP port to verify it's ready
|
||||
if timeout 1 bash -c ">/dev/tcp/$RDP_IP/$RDP_PORT" 2>/dev/null; then
|
||||
dprint "VM IS READY"
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --urgency="low" "WinApps" "Windows is ready."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Windows is ready."
|
||||
# Add a delay after Windows is ready
|
||||
if [ "$NEEDED_BOOT" = "true" ]; then
|
||||
sleep 10
|
||||
@@ -611,14 +612,14 @@ function waCheckVMRunning() {
|
||||
|
||||
# Show progress every 30 seconds
|
||||
if (( TIME_ELAPSED % 30 == 0 )); then
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --urgency="low" "WinApps" "Still waiting for Windows to be ready... ($TIME_ELAPSED seconds elapsed)"
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Still waiting for Windows to be ready... ($TIME_ELAPSED seconds elapsed)"
|
||||
fi
|
||||
done
|
||||
|
||||
# If we timed out waiting for the VM
|
||||
if (( TIME_ELAPSED >= BOOT_TIMEOUT )); then
|
||||
dprint "TIMEOUT WAITING FOR VM TO BE READY"
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --urgency="low" "WinApps" "Timeout waiting for Windows to be ready. Please try again."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Timeout waiting for Windows to be ready. Please try again."
|
||||
waThrowExit $EC_FAIL_START
|
||||
fi
|
||||
fi
|
||||
@@ -651,19 +652,19 @@ function waCheckContainerRunning() {
|
||||
case "$CONTAINER_STATE" in
|
||||
"created")
|
||||
dprint "WINDOWS CREATED. BOOTING WINDOWS."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --urgency="low" "WinApps" "Booting Windows."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Booting Windows."
|
||||
$COMPOSE_COMMAND --file "$COMPOSE_PATH" start &>/dev/null
|
||||
NEEDED_BOOT=true
|
||||
;;
|
||||
"restarting")
|
||||
dprint "WINDOWS RESTARTING. WAITING."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --urgency="low" "WinApps" "Windows is currently restarting. Please wait."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Windows is currently restarting. Please wait."
|
||||
EXIT_STATUS=$EC_RESTART_TIMEOUT
|
||||
while (( TIME_ELAPSED < TIME_LIMIT )); do
|
||||
if [[ $("$WAFLAVOR" inspect --format='{{.State.Status}}' "$CONTAINER_NAME") == "running" ]]; then
|
||||
EXIT_STATUS=0
|
||||
dprint "WINDOWS RESTARTED."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --urgency="low" "WinApps" "Restarted Windows."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Restarted Windows."
|
||||
NEEDED_BOOT=true
|
||||
break
|
||||
fi
|
||||
@@ -673,18 +674,18 @@ function waCheckContainerRunning() {
|
||||
;;
|
||||
"paused")
|
||||
dprint "WINDOWS PAUSED. RESUMING WINDOWS."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --urgency="low" "WinApps" "Resuming Windows."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Resuming Windows."
|
||||
$COMPOSE_COMMAND --file "$COMPOSE_PATH" unpause &>/dev/null
|
||||
;;
|
||||
"exited")
|
||||
dprint "WINDOWS SHUT OFF. BOOTING WINDOWS."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --urgency="low" "WinApps" "Booting Windows."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Booting Windows."
|
||||
$COMPOSE_COMMAND --file "$COMPOSE_PATH" start &>/dev/null
|
||||
NEEDED_BOOT=true
|
||||
;;
|
||||
"dead")
|
||||
dprint "WINDOWS DEAD. RECREATING WINDOWS CONTAINER."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --urgency="low" "WinApps" "Re-creating and booting Windows."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Re-creating and booting Windows."
|
||||
$COMPOSE_COMMAND --file "$COMPOSE_PATH" down &>/dev/null && $COMPOSE_COMMAND --file "$COMPOSE_PATH" up -d &>/dev/null
|
||||
NEEDED_BOOT=true
|
||||
;;
|
||||
@@ -699,7 +700,7 @@ function waCheckContainerRunning() {
|
||||
# Wait for container to be fully ready
|
||||
if [[ "$CONTAINER_STATE" == "created" || "$CONTAINER_STATE" == "exited" || "$CONTAINER_STATE" == "dead" || "$CONTAINER_STATE" == "restarting" ]]; then
|
||||
dprint "WAITING FOR CONTAINER TO BE FULLY READY..."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --urgency="low" "WinApps" "Waiting for Windows to be ready..."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Waiting for Windows to be ready..."
|
||||
|
||||
TIME_ELAPSED=0
|
||||
|
||||
@@ -709,7 +710,7 @@ function waCheckContainerRunning() {
|
||||
# Try to connect to RDP port to verify it's ready
|
||||
if timeout 1 bash -c ">/dev/tcp/$RDP_IP/$RDP_PORT" 2>/dev/null; then
|
||||
dprint "CONTAINER IS READY"
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --urgency="low" "WinApps" "Windows is ready."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Windows is ready."
|
||||
# Add a delay after Windows is ready
|
||||
if [ "$NEEDED_BOOT" = "true" ]; then
|
||||
sleep 10
|
||||
@@ -723,14 +724,14 @@ function waCheckContainerRunning() {
|
||||
|
||||
# Show progress every 30 seconds
|
||||
if (( TIME_ELAPSED % 30 == 0 )); then
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --urgency="low" "WinApps" "Still waiting for Windows to be ready... ($TIME_ELAPSED seconds elapsed)"
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Still waiting for Windows to be ready... ($TIME_ELAPSED seconds elapsed)"
|
||||
fi
|
||||
done
|
||||
|
||||
# If we timed out waiting for the container
|
||||
if (( TIME_ELAPSED >= BOOT_TIMEOUT )); then
|
||||
dprint "TIMEOUT WAITING FOR CONTAINER TO BE READY"
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --urgency="low" "WinApps" "Timeout waiting for Windows to be ready. Please try again."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Timeout waiting for Windows to be ready. Please try again."
|
||||
waThrowExit $EC_FAIL_START
|
||||
fi
|
||||
fi
|
||||
@@ -750,7 +751,7 @@ function waCheckPortOpen() {
|
||||
|
||||
while (( TIME_ELAPSED < TIME_LIMIT )); do
|
||||
if [ "$TIME_ELAPSED" -eq "$TIME_INTERVAL" ]; then
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --urgency="low" "WinApps" "Requesting Windows IP address..."
|
||||
notify-send --expire-time=4000 --icon="dialog-info" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Requesting Windows IP address..."
|
||||
fi
|
||||
RDP_IP=$(waFindVMIP)
|
||||
[ -n "$RDP_IP" ] && break
|
||||
@@ -949,7 +950,7 @@ function waCheckIdle() {
|
||||
# Hibernate/Pause Windows.
|
||||
if [ "$SUSPEND_WINDOWS" -eq 1 ]; then
|
||||
dprint "IDLE FOR ${AUTOPAUSE_TIME} SECONDS. SUSPENDING WINDOWS."
|
||||
notify-send --expire-time=8000 --icon="info" --app-name="WinApps" --urgency="low" "WinApps" "Pausing Windows due to inactivity."
|
||||
notify-send --expire-time=8000 --icon="info" --app-name="WinApps" --app-icon="$APP_ICON_PATH" --urgency="low" "WinApps" "Pausing Windows due to inactivity."
|
||||
if [ "$WAFLAVOR" = "docker" ]; then
|
||||
docker compose --file "$COMPOSE_PATH" pause &>/dev/null
|
||||
elif [ "$WAFLAVOR" = "podman" ]; then
|
||||
|
||||
Reference in New Issue
Block a user