mirror of
https://github.com/winapps-org/winapps.git
synced 2025-09-07 02:06:33 +02:00
Compare commits
5 Commits
feat-drop-
...
fix-setup-
Author | SHA1 | Date | |
---|---|---|---|
![]() |
53e980a8e8 | ||
![]() |
bc8ac155d4 | ||
![]() |
5104e0d400 | ||
![]() |
a6a51b2ccf | ||
![]() |
b203b6d252 |
26
bin/winapps
26
bin/winapps
@@ -322,28 +322,28 @@ function waCheckVMRunning() {
|
||||
|
||||
# Attempt to run the Windows virtual machine.
|
||||
# Note: States 'running' and 'idle' do not require intervention, and are not checked for.
|
||||
if (virsh list --all --name | xargs | grep -wq "$VM_NAME"); then
|
||||
if (virsh list --state-shutoff --name | xargs | grep -wq "$VM_NAME"); then
|
||||
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."
|
||||
NEEDED_BOOT=true
|
||||
virsh start "$VM_NAME" &>/dev/null || EXIT_STATUS=$EC_FAIL_START
|
||||
if (virsh list --state-paused --name | xargs | grep -wq "$VM_NAME"); then
|
||||
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."
|
||||
virsh resume "$VM_NAME" &>/dev/null || EXIT_STATUS=$EC_FAIL_RESUME
|
||||
fi
|
||||
elif (virsh list --state-paused --name | xargs | grep -wq "$VM_NAME"); then
|
||||
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."
|
||||
virsh resume "$VM_NAME" &>/dev/null || EXIT_STATUS=$EC_FAIL_RESUME
|
||||
elif (virsh list --state-other --name | xargs | grep -wq "$VM_NAME"); then
|
||||
if (virsh domstate "$VM_NAME" | xargs | grep -wq "shutdown"); then
|
||||
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."
|
||||
EXIT_STATUS=$EC_SD_TIMEOUT
|
||||
while (( TIME_ELAPSED < TIME_LIMIT )); do
|
||||
if (virsh list --state-shutoff --name | xargs | grep -wq "$VM_NAME"); then
|
||||
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."
|
||||
@@ -354,7 +354,7 @@ function waCheckVMRunning() {
|
||||
sleep $TIME_INTERVAL
|
||||
TIME_ELAPSED=$((TIME_ELAPSED + TIME_INTERVAL))
|
||||
done
|
||||
elif (virsh domstate "$VM_NAME" | xargs | grep -wq "crashed"); then
|
||||
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."
|
||||
virsh destroy "$VM_NAME" &>/dev/null || EXIT_STATUS=$EC_FAIL_DESTROY
|
||||
@@ -364,12 +364,12 @@ function waCheckVMRunning() {
|
||||
virsh start "$VM_NAME" &>/dev/null || EXIT_STATUS=$EC_FAIL_START
|
||||
NEEDED_BOOT=true
|
||||
fi
|
||||
elif (virsh domstate "$VM_NAME" | xargs | grep -wq "dying"); then
|
||||
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."
|
||||
EXIT_STATUS=$EC_DIE_TIMEOUT
|
||||
while (( TIME_ELAPSED < TIME_LIMIT )); do
|
||||
if (virsh domstate "$VM_NAME" | xargs | grep -wq "crashed"); then
|
||||
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."
|
||||
@@ -381,7 +381,7 @@ function waCheckVMRunning() {
|
||||
NEEDED_BOOT=true
|
||||
fi
|
||||
break
|
||||
elif (virsh list --state-shutoff --name | xargs | grep -wq "$VM_NAME"); then
|
||||
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."
|
||||
@@ -392,7 +392,7 @@ function waCheckVMRunning() {
|
||||
sleep $TIME_INTERVAL
|
||||
TIME_ELAPSED=$((TIME_ELAPSED + TIME_INTERVAL))
|
||||
done
|
||||
elif (virsh domstate "$VM_NAME" | xargs | grep -wq "pmsuspended" ); then
|
||||
elif (virsh domstate "$VM_NAME" | grep -Fxq "pmsuspended" ); then
|
||||
dprint "WINDOWS SUSPENDED. RESUMING WINDOWS."
|
||||
virsh resume "$VM_NAME" &>/dev/null || EXIT_STATUS=$EC_FAIL_RESUME
|
||||
fi
|
||||
@@ -413,7 +413,7 @@ function waCheckVMRunning() {
|
||||
|
||||
while (( TIME_ELAPSED < BOOT_TIMEOUT )); do
|
||||
# Check if VM is running
|
||||
if (virsh list --state-running --name | xargs | grep -wq "$VM_NAME"); then
|
||||
if (virsh list --state-running --name | grep -Fxq -- "$VM_NAME"); then
|
||||
# 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"
|
||||
|
@@ -1,11 +1,13 @@
|
||||
diff --git a/WinApps-Launcher.sh b/WinApps-Launcher.sh
|
||||
index 1d3a929..a5d7d4c 100755
|
||||
--- a/WinApps-Launcher.sh
|
||||
+++ b/WinApps-Launcher.sh
|
||||
@@ -19,7 +19,7 @@ declare -rx EC_WIN_NOT_SPEC=6
|
||||
declare -rx EC_NO_WIN_FOUND=7
|
||||
|
||||
|
||||
# Paths
|
||||
-declare -rx ICONS_PATH="./Icons"
|
||||
+declare -rx ICONS_PATH="@out@/Icons"
|
||||
declare -rx APPDATA_PATH="${HOME}/.local/share/winapps"
|
||||
declare -rx CONFIG_PATH="${HOME}/.config/winapps"
|
||||
declare -rx APPDATA_PATH="${XDG_DATA_HOME:-$HOME/.local/share}/winapps"
|
||||
declare -rx CONFIG_PATH="${XDG_CONFIG_HOME:-$HOME/.config}/winapps"
|
||||
declare -rx CONFIG_FILE="${CONFIG_PATH}/winapps.conf"
|
||||
|
@@ -9,12 +9,12 @@
|
||||
...
|
||||
}:
|
||||
let
|
||||
rev = "9b3f6c581791222a3a04508606755d6d0519f322";
|
||||
hash = "sha256-Hy/o5IY9HmTWaX54Ek5ABmppPpzgM+MdCrhzEzVmtwY=";
|
||||
rev = "87f92a80c7e421ab7d1b8801e647dcbfaaa6ee34";
|
||||
hash = "sha256-aZ8uusg5yQOD1xYfaX2IQCbcPdHuVA0tiy1NDkdGCCs=";
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "winapps-launcher";
|
||||
version = "0-unstable-2025-03-11";
|
||||
version = "0-unstable-2025-09-01";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "winapps-org";
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git a/setup.sh b/setup.sh
|
||||
index d514bcc..ff53ead 100755
|
||||
index 3a871c8..71a8fa0 100755
|
||||
--- a/setup.sh
|
||||
+++ b/setup.sh
|
||||
@@ -39,8 +39,8 @@ readonly SYS_BIN_PATH="/usr/local/bin" # UNIX path to 'bin' dir
|
||||
@@ -68,7 +68,7 @@ index d514bcc..ff53ead 100755
|
||||
# Complete the previous line.
|
||||
echo -e "${FAIL_TEXT}Failed!${CLEAR_TEXT}\n"
|
||||
|
||||
@@ -1242,11 +1222,11 @@ function waConfigureWindows() {
|
||||
@@ -1239,11 +1219,11 @@ function waConfigureWindows() {
|
||||
# Populate variables.
|
||||
WIN_BASH="\
|
||||
#!/usr/bin/env bash
|
||||
@@ -82,7 +82,7 @@ index d514bcc..ff53ead 100755
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Icon=${APPDATA_PATH}/icons/windows.svg
|
||||
@@ -1293,13 +1273,13 @@ function waConfigureApp() {
|
||||
@@ -1290,13 +1270,13 @@ function waConfigureApp() {
|
||||
# Determine the content of the bash script for the application.
|
||||
APP_BASH="\
|
||||
#!/usr/bin/env bash
|
||||
@@ -98,16 +98,17 @@ index d514bcc..ff53ead 100755
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Icon=${APP_ICON}
|
||||
@@ -1349,6 +1329,8 @@ function waConfigureOfficiallySupported() {
|
||||
@@ -1364,7 +1344,9 @@ function waConfigureOfficiallySupported() {
|
||||
fi
|
||||
|
||||
# Copy the protocol handler to the appropriate directory.
|
||||
+ # Fix permissions for nix.
|
||||
+ $SUDO chmod u+w "$TARGET_DIR/ms-office-protocol-handler.desktop"
|
||||
$SUDO cp "./apps/ms-office-protocol-handler.desktop" "$TARGET_DIR/ms-office-protocol-handler.desktop"
|
||||
+ $SUDO chmod u+w "$TARGET_DIR/ms-office-protocol-handler.desktop"
|
||||
fi
|
||||
|
||||
@@ -1566,7 +1548,7 @@ function waInstall() {
|
||||
# Print feedback.
|
||||
@@ -1596,7 +1578,7 @@ function waInstall() {
|
||||
echo -e "${BOLD_TEXT}Installing WinApps.${CLEAR_TEXT}"
|
||||
|
||||
# Check for existing conflicting WinApps installations.
|
||||
@@ -116,21 +117,19 @@ index d514bcc..ff53ead 100755
|
||||
|
||||
# Load the WinApps configuration file.
|
||||
waLoadConfig
|
||||
@@ -1635,8 +1617,11 @@ function waInstall() {
|
||||
@@ -1664,9 +1646,8 @@ function waInstall() {
|
||||
# Check for installed applications.
|
||||
waFindInstalled
|
||||
|
||||
# Install the WinApps bash scripts.
|
||||
- # Install the WinApps bash scripts.
|
||||
- $SUDO ln -sf "${SOURCE_PATH}/bin/winapps" "${BIN_PATH}/winapps"
|
||||
- $SUDO ln -sf "${SOURCE_PATH}/setup.sh" "${BIN_PATH}/winapps-setup"
|
||||
+
|
||||
+
|
||||
+
|
||||
+ # Fix permissions for nix.
|
||||
+ $SUDO chmod u+w -R "${APPDATA_PATH}"
|
||||
|
||||
# Configure the Windows RDP session application launcher.
|
||||
waConfigureWindows
|
||||
@@ -1697,18 +1682,15 @@ function waUninstall() {
|
||||
@@ -1727,18 +1708,15 @@ function waUninstall() {
|
||||
local DESKTOP_FILE_NAME="" # Stores the name of the '.desktop' file for the application.
|
||||
local BASH_SCRIPT_NAME="" # Stores the name of the application.
|
||||
|
||||
@@ -151,7 +150,7 @@ index d514bcc..ff53ead 100755
|
||||
|
||||
# Remove each '.desktop' file.
|
||||
for DESKTOP_FILE_PATH in "${WINAPPS_DESKTOP_FILES[@]}"; do
|
||||
@@ -1729,7 +1711,7 @@ function waUninstall() {
|
||||
@@ -1759,7 +1737,7 @@ function waUninstall() {
|
||||
done
|
||||
|
||||
# Store the paths of bash scripts calling 'WinApps' to launch specific applications in an array, returning an empty array if no such files exist.
|
||||
@@ -160,7 +159,7 @@ index d514bcc..ff53ead 100755
|
||||
|
||||
# Remove each bash script.
|
||||
for BASH_SCRIPT_PATH in "${WINAPPS_APP_BASH_SCRIPTS[@]}"; do
|
||||
@@ -1750,10 +1732,9 @@ function waUninstall() {
|
||||
@@ -1780,10 +1758,9 @@ function waUninstall() {
|
||||
done
|
||||
|
||||
# Print caveats.
|
||||
|
6
setup.sh
6
setup.sh
@@ -840,11 +840,11 @@ function waCheckVMRunning() {
|
||||
|
||||
# Obtain VM Status
|
||||
VM_PAUSED=0
|
||||
virsh list --state-paused --name | grep -Fxq "$VM_NAME" || VM_PAUSED="$?"
|
||||
virsh list --state-paused --name | grep -Fxq -- "$VM_NAME" || VM_PAUSED="$?"
|
||||
VM_RUNNING=0
|
||||
virsh list --state-running --name | grep -Fxq "$VM_NAME" || VM_RUNNING="$?"
|
||||
virsh list --state-running --name | grep -Fxq -- "$VM_NAME" || VM_RUNNING="$?"
|
||||
VM_SHUTOFF=0
|
||||
virsh list --state-shutoff --name | grep -Fxq "$VM_NAME" || VM_SHUTOFF="$?"
|
||||
virsh list --state-shutoff --name | grep -Fxq -- "$VM_NAME" || VM_SHUTOFF="$?"
|
||||
|
||||
if [[ $VM_SHUTOFF == "0" ]]; then
|
||||
# Complete the previous line.
|
||||
|
Reference in New Issue
Block a user