From 273c01c3bc455db627ffcfc09dfe1129294dbeb5 Mon Sep 17 00:00:00 2001 From: Leonardo Di Gianfelice Stornelli <17832817+Leonardo-DGS@users.noreply.github.com> Date: Sat, 15 Jul 2023 15:11:32 +0200 Subject: [PATCH 001/187] Update RDPApps.reg link --- docs/KVM.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/KVM.md b/docs/KVM.md index 091e88d..9e2f9d6 100644 --- a/docs/KVM.md +++ b/docs/KVM.md @@ -135,7 +135,7 @@ Leave everything as default and click `Next` through the installer. This will in ![](kvm/25.png) -Once you finish the driver install, you will need to make some registry changes to enable RDP Applications to run on the system. Start by downloading the `RDPApps.reg` file from the WinApps repo by visiting https://github.com/Fmstrat/winapps/blob/main/install/RDPApps.reg, right clicking on the `Raw` button, and clicking on `Save target as`. +Once you finish the driver install, you will need to make some registry changes to enable RDP Applications to run on the system. Start by downloading the `RDPApps.reg` file from the WinApps repo by visiting https://github.com/winapps-org/winapps/blob/main/install/RDPApps.reg, right clicking on the `Raw` button, and clicking on `Save target as`. ![](kvm/26.png) From ec183d3528ef6c63b345cbb698d9e8678e4dda6c Mon Sep 17 00:00:00 2001 From: Leonardo Di Gianfelice Stornelli <17832817+Leonardo-DGS@users.noreply.github.com> Date: Sun, 16 Jul 2023 02:28:53 +0200 Subject: [PATCH 002/187] Change to relative link --- docs/KVM.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/KVM.md b/docs/KVM.md index 9e2f9d6..bd55a3a 100644 --- a/docs/KVM.md +++ b/docs/KVM.md @@ -135,7 +135,7 @@ Leave everything as default and click `Next` through the installer. This will in ![](kvm/25.png) -Once you finish the driver install, you will need to make some registry changes to enable RDP Applications to run on the system. Start by downloading the `RDPApps.reg` file from the WinApps repo by visiting https://github.com/winapps-org/winapps/blob/main/install/RDPApps.reg, right clicking on the `Raw` button, and clicking on `Save target as`. +Once you finish the driver install, you will need to make some registry changes to enable RDP Applications to run on the system. Start by downloading the [RDPApps.reg](/install/RDPApps.reg), right clicking on the `Raw` button, and clicking on `Save target as`. ![](kvm/26.png) From 70eb981c45fd17d0ec04d1f0b77f317e5bad7281 Mon Sep 17 00:00:00 2001 From: Leonardo Di Gianfelice Stornelli <17832817+Leonardo-DGS@users.noreply.github.com> Date: Sun, 16 Jul 2023 02:29:47 +0200 Subject: [PATCH 003/187] Update KVM.md --- docs/KVM.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/KVM.md b/docs/KVM.md index bd55a3a..dea6e93 100644 --- a/docs/KVM.md +++ b/docs/KVM.md @@ -135,7 +135,7 @@ Leave everything as default and click `Next` through the installer. This will in ![](kvm/25.png) -Once you finish the driver install, you will need to make some registry changes to enable RDP Applications to run on the system. Start by downloading the [RDPApps.reg](/install/RDPApps.reg), right clicking on the `Raw` button, and clicking on `Save target as`. +Once you finish the driver install, you will need to make some registry changes to enable RDP Applications to run on the system. Start by downloading the [RDPApps.reg](/install/RDPApps.reg) file, right clicking on the `Raw` button, and clicking on `Save target as`. ![](kvm/26.png) From 9148793941688b56e656518450b83cc55e5879a8 Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Tue, 25 Jul 2023 11:31:17 +0200 Subject: [PATCH 004/187] fix: add dummy pre-commit config to main branch --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..a62c209 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1 @@ +repos: [] \ No newline at end of file From eea300fec1d0dda6acba414d4000c87ac6abfbcc Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Tue, 25 Jul 2023 09:40:25 +0000 Subject: [PATCH 005/187] fix: point pre-commit.ci to rewrite branch --- .pre-commit-config.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a62c209..3cd863f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1 +1,4 @@ -repos: [] \ No newline at end of file +ci: + autoupdate_branch: "rewrite" + +repos: [] From 078e65a225851bb639e2f9b1474595639df3cbcf Mon Sep 17 00:00:00 2001 From: Hyperspeed1313 Date: Fri, 10 Nov 2023 12:16:18 -0600 Subject: [PATCH 006/187] Make it clear IP address is required if not using KVM --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5b727f5..acceac6 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ RDP_PASS="MyWindowsPassword" The username and password should be a full user account and password, such as the one created when setting up Windows or a domain user. It cannot be a user/PIN combination as those are not valid for RDP access. Options: -- When using a pre-existing non-KVM RDP server, you can use the `RDP_IP` to specify it's location +- When using a pre-existing non-KVM RDP server, you must use the `RDP_IP` to specify it's location - If you are running a VM in KVM with NAT enabled, leave `RDP_IP` commented out and WinApps will auto-detect the right local IP - For domain users, you can uncomment and change `RDP_DOMAIN` - On high-resolution (UHD) displays, you can set `RDP_SCALE` to the scale you would like [100|140|160|180] From 9f3a4e53d65883ba3c4ed87c5c27ee36e18e629f Mon Sep 17 00:00:00 2001 From: Hyperspeed1313 Date: Fri, 10 Nov 2023 13:34:50 -0600 Subject: [PATCH 007/187] Clarify auto-IP detection is not supported for non-KVM VMs --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index acceac6..40920fd 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ The best solution for running a VM as a subsystem for WinApps would be KVM. KVM - [Creating a Virtual Machine in KVM](docs/KVM.md) -If you already have a Virtual Machine or server you wish to use with WinApps, you will need to merge `install/RDPApps.reg` into the VM's Windows Registry. If this VM is in KVM and you want to use auto-IP detection, you will need to name the machine `RDPWindows`. Directions for both of these can be found in the guide linked above. +If you already have a Virtual Machine or server you wish to use with WinApps, you will need to merge `install/RDPApps.reg` into the VM's Windows Registry. If this VM is in KVM and you want to use auto-IP detection, you will need to name the machine `RDPWindows` (auto-IP detection not supported for non-KVM VMs). Directions for both of these can be found in the guide linked above. ### Step 2: Download the repo and prerequisites To get things going, use: From dac09eedf4ed6b3564d243b4c9debdab31726f25 Mon Sep 17 00:00:00 2001 From: matt-m-3 Date: Thu, 7 Dec 2023 09:13:59 -0600 Subject: [PATCH 008/187] correcting waConfigureDetectedApps function --- installer.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/installer.sh b/installer.sh index e692b3d..464980b 100755 --- a/installer.sh +++ b/installer.sh @@ -189,8 +189,8 @@ CATEGORIES=\"WinApps\" # GNOME mimetypes MIME_TYPES=\"\" -" > "${SYS_PATH}/apps/${EXE}/info" - echo "${ICONS[$I]}" | base64 -d > "${SYS_PATH}/apps/${EXE}/icon.ico" +" | sudo tee "${SYS_PATH}/apps/${EXE}/info" > /dev/null + echo "${ICONS[$I]}" | base64 -d | sudo tee "${SYS_PATH}/apps/${EXE}/icon.ico" > /dev/null waConfigureApp "${EXE}" ico COUNT=$((COUNT + 1)) fi From 152a92412badea5e366c918be1cebd142624e377 Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Mon, 22 Jan 2024 19:21:41 +0000 Subject: [PATCH 009/187] feat: mention freerdp3 links in readme, see e.g. #72 --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 40920fd..7c05420 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,11 @@ sudo apt install -y freerdp2-x11 git clone https://github.com/winapps-org/winapps.git cd winapps ``` + +> [!note] +> Ideally grab freerdp 3.0.0 or later, especially if you're having issues. +> You can find nightly builds here: https://github.com/FreeRDP/FreeRDP/wiki/Prebuilds + ### Step 3: Creating your WinApps configuration file You will need to create a `~/.config/winapps/winapps.conf` configuration file with the following information in it: ``` bash From 93c450b332da29dc6c3584651c280eb67a9687f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastien=20B=C3=BCrky?= Date: Sat, 20 Apr 2024 22:26:22 +0200 Subject: [PATCH 010/187] Fixes for freerdp3, and for arch linux, also add convenience function to install all officially supported apps in one go, also fix a typo --- README.md | 49 +++++++++++---- apps/iexplorer/info | 2 +- bin/winapps | 40 +++++++----- installer.sh | 150 ++++++++++++++++++++++++++++++-------------- 4 files changed, 164 insertions(+), 77 deletions(-) diff --git a/README.md b/README.md index 7c05420..8269b0e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # winapps -The winapps main project + +The winapps main project Originally created by fmstrat https://github.com/Fmstrat/winapps/ Run Windows apps such as Microsoft Office/Adobe in Linux (Ubuntu/Fedora) and GNOME/KDE as if they were a part of the native OS, including Nautilus integration for right clicking on files of specific mime types to open them. @@ -7,7 +8,9 @@ Run Windows apps such as Microsoft Office/Adobe in Linux (Ubuntu/Fedora) and GNO ## How it works + WinApps was created as an easy, one command way to include apps running inside a VM (or on any RDP server) directly into GNOME as if they were native applications. WinApps works by: + - Running a Windows RDP server in a background VM container - Checking the RDP server for installed applications such as Microsoft Office - If those programs are installed, it creates shortcuts leveraging FreeRDP for both the CLI and the GNOME tray @@ -15,9 +18,11 @@ WinApps was created as an easy, one command way to include apps running inside a - You can right click on any files in your home directory to open with an application, too ## Currently supported applications -### WinApps supports ***ANY*** installed application on your system. + +### WinApps supports **_ANY_** installed application on your system. It does this by: + 1. Scanning your system for offically configured applications (below) 2. Scanning your system for any other EXE files with install records in the Windows Registry @@ -75,6 +80,7 @@ Note: The officially configured application list below is fueled by the communit ## Installation ### Step 1: Set up a Windows Virtual Machine + The best solution for running a VM as a subsystem for WinApps would be KVM. KVM is a CPU and memory-efficient virtualization engine bundled with most major Linux distributions. To set up the VM for WinApps, follow this guide: - [Creating a Virtual Machine in KVM](docs/KVM.md) @@ -82,8 +88,10 @@ The best solution for running a VM as a subsystem for WinApps would be KVM. KVM If you already have a Virtual Machine or server you wish to use with WinApps, you will need to merge `install/RDPApps.reg` into the VM's Windows Registry. If this VM is in KVM and you want to use auto-IP detection, you will need to name the machine `RDPWindows` (auto-IP detection not supported for non-KVM VMs). Directions for both of these can be found in the guide linked above. ### Step 2: Download the repo and prerequisites + To get things going, use: -``` bash + +```bash sudo apt install -y freerdp2-x11 git clone https://github.com/winapps-org/winapps.git cd winapps @@ -94,8 +102,10 @@ cd winapps > You can find nightly builds here: https://github.com/FreeRDP/FreeRDP/wiki/Prebuilds ### Step 3: Creating your WinApps configuration file + You will need to create a `~/.config/winapps/winapps.conf` configuration file with the following information in it: -``` bash + +```bash RDP_USER="MyWindowsUser" RDP_PASS="MyWindowsPassword" #RDP_DOMAIN="MYDOMAIN" @@ -104,10 +114,13 @@ RDP_PASS="MyWindowsPassword" #RDP_FLAGS="" #MULTIMON="true" #DEBUG="true" +#FREERDP_COMMAND="xfreerdp" ``` + The username and password should be a full user account and password, such as the one created when setting up Windows or a domain user. It cannot be a user/PIN combination as those are not valid for RDP access. Options: + - When using a pre-existing non-KVM RDP server, you must use the `RDP_IP` to specify it's location - If you are running a VM in KVM with NAT enabled, leave `RDP_IP` commented out and WinApps will auto-detect the right local IP - For domain users, you can uncomment and change `RDP_DOMAIN` @@ -115,15 +128,20 @@ Options: - To add flags to the FreeRDP call, such as `/audio-mode:1` to pass in a mic, use the `RDP_FLAGS` configuration option - For multi-monitor setups, you can try enabling `MULTIMON`, however if you get a black screen (FreeRDP bug) you will need to revert back - If you enable `DEBUG`, a log will be created on each application start in `~/.local/share/winapps/winapps.log` +- If you are on a system, where the command for freeredp is not xfreerdp, change `FREERDP_COMMAND` to it. ### Step 4: Run the WinApps installer + Lastly, check that FreeRDP can connect with: + ``` bin/winapps check ``` + You will see output from FreeRDP, as well as potentially have to accept the initial certificate. After that, a Windows Explorer window should pop up. You can close this window and press `Ctrl-C` to cancel out of FreeRDP. If this step fails, try restarting the VM, or your problem could be related to: + - You need to accept the security cert the first time you connect (with 'check') - Not enabling RDP in the Windows VM - Not being able to connect to the IP of the VM @@ -131,16 +149,19 @@ If this step fails, try restarting the VM, or your problem could be related to: - Not merging `install/RDPApps.reg` into the VM Then the final step is to run the installer which will prompt you for a system or user install: -``` bash + +```bash ./installer.sh ``` + This will take you through the following process: - ## Adding pre-defined applications + Adding applications with custom icons and mime types to the installer is easy. Simply copy one of the application configurations in the `apps` folder, and: + - Edit the variables for the application - Replace the `icon.svg` with an SVG for the application (appropriately licensed) - Re-run the installer @@ -149,21 +170,27 @@ Adding applications with custom icons and mime types to the installer is easy. S When running the installer, it will check for if any configured apps are installed, and if they are it will create the appropriate shortcuts on the host OS. ## Running applications manually + WinApps offers a manual mode for running applications that are not configured. This is completed with the `manual` flag. Executables that are in the path do not require full path definition. -``` bash + +```bash ./bin/winapps manual "C:\my\directory\executableNotInPath.exe" ./bin/winapps manual executableInPath.exe ``` ## Checking for new application support + The installer can be run multiple times, so simply run the below again and it will remove any current installations and update for the latest applications. -``` bash + +```bash ./installer.sh ``` ## Optional installer command line arguments + The following optional commands can be used to manage your application configurations without prompts: -``` bash + +```bash ./installer.sh --user # Configure applications for the current user ./installer.sh --system # Configure applications for the entire system ./installer.sh --user --uninstall # Remove all configured applications for the current user @@ -171,9 +198,9 @@ The following optional commands can be used to manage your application configura ``` ## Shout outs + - Some icons pulled from - - Fluent UI React - Icons under [MIT License](https://github.com/Fmstrat/fluent-ui-react/blob/master/LICENSE.md) + - Fluent UI React - Icons under [MIT License](https://github.com/Fmstrat/fluent-ui-react/blob/master/LICENSE.md) - Fluent UI - Icons under [MIT License](https://github.com/Fmstrat/fluentui/blob/master/LICENSE) with [restricted use](https://static2.sharepointonline.com/files/fabric/assets/microsoft_fabric_assets_license_agreement_nov_2019.pdf) - PKief's VSCode Material Icon Theme - Icons under [MIT License](https://github.com/Fmstrat/vscode-material-icon-theme/blob/master/LICENSE.md) - DiemenDesign's LibreICONS - Icons under [MIT License](https://github.com/Fmstrat/LibreICONS/blob/master/LICENSE) - diff --git a/apps/iexplorer/info b/apps/iexplorer/info index 7de8b24..2da385e 100644 --- a/apps/iexplorer/info +++ b/apps/iexplorer/info @@ -8,7 +8,7 @@ FULL_NAME="Internet Explorer" WIN_EXECUTABLE="C:\Program Files\Internet Explorer\iexplore.exe" # GNOME categories -CATEGORIES="WinApps;Office" +CATEGORIES="WinApps;Network;WebBrowser;" # GNOME mimetypes MIME_TYPES="text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;video/webm;application/x-xpinstall;" diff --git a/bin/winapps b/bin/winapps index cecb079..0f24c86 100755 --- a/bin/winapps +++ b/bin/winapps @@ -4,7 +4,6 @@ if [ ! -f "${HOME}/.config/winapps/winapps.conf" ] && [ ! -f "${HOME}/.winapps" echo "You need to create a ~/.config/winapps/winapps.conf configuration. Exiting..." exit fi - DIR="$(dirname "$(readlink -f "$0")")" RUN="$(date)-${RANDOM}" @@ -22,7 +21,7 @@ fi function dprint() { if [ "${DEBUG}" = "true" ]; then - echo "[${RUN}] ${1}" >> "${HOME}/.local/share/winapps/winapps.log" + echo "[${RUN}] ${1}" >>"${HOME}/.local/share/winapps/winapps.log" fi } @@ -34,52 +33,59 @@ if [ -f "${HOME}/.local/share/winapps/run" ]; then touch "${HOME}/.local/share/winapps/run" THIS_RUN=$(stat -t -c %Y "${HOME}/.local/share/winapps/run") dprint "THIS_RUN:${THIS_RUN}" - if (( $THIS_RUN - $LAST_RAN < 2 )); then + if (($THIS_RUN - $LAST_RAN < 2)); then exit fi else touch "${HOME}/.local/share/winapps/run" fi -if [ -z "$(which xfreerdp)" ]; then - echo "You need xfreerdp!" - echo " sudo apt-get install -y freerdp2-x11" - exit +if [ -z "${FREERDP_COMMAND}" ]; then + if command -v xfreerdp &> /dev/null + then + FREERDP_COMMAND="xfreerdp" + elif command -v xfreerdp3 &> /dev/null + then + FREERDP_COMMAND="xfreerdp3" + fi +else + dprint "Using custom freerdp command ${FREERDP_COMMAND}" fi if [ -z "${RDP_IP}" ]; then - if [ -z "$(groups |grep libvirt)" ]; then + if [ -z "$(groups | grep libvirt)" ]; then echo "You are not a member of the libvirt group. Run the below then reboot." echo ' sudo usermod -a -G libvirt $(whoami)' echo ' sudo usermod -a -G kvm $(whoami)' exit fi - if [ -z "$(virsh list |grep RDPWindows)" ]; then + if [ -z "$(virsh list | grep RDPWindows)" ]; then echo "RDPWindows is not running, run:" echo " virsh start RDPWindows" exit fi - RDP_IP=$(virsh net-dhcp-leases default |grep RDPWindows |awk '{print $5}') + RDP_IP=$(virsh net-dhcp-leases default | grep RDPWindows | awk '{print $5}') RDP_IP=${RDP_IP%%\/*} + fi dprint "1:${1}" dprint "2:${2}" dprint "@:${@}" -MULTI_FLAG="span" +MULTI_FLAG="+span" if [ "${MULTIMON}" = "true" ]; then - MULTI_FLAG="multimon" + MULTI_FLAG="/multimon" fi if [ "${1}" = "windows" ]; then - xfreerdp ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} /scale:${RDP_SCALE} /dynamic-resolution +auto-reconnect +home-drive /wm-class:"Microsoft Windows" 1> /dev/null 2>&1 & + $FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +dynamic-resolution +auto-reconnect +home-drive /wm-class:"Microsoft Windows" /v:${RDP_IP} 1>/dev/null 2>&1 & elif [ "${1}" = "check" ]; then dprint "CHECK" - xfreerdp ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +home-drive -wallpaper /scale:${RDP_SCALE} /dynamic-resolution /${MULTI_FLAG} /app:"explorer.exe" + $FREERDP_COMMAND ${RDP_FLAGS} /d:${RDP_DOMAIN} /u:${RDP_USER} /p:${RDP_PASS} /scale:${RDP_SCALE} +auto-reconnect +home-drive -wallpaper +dynamic-resolution ${MULTI_FLAG} /app:program:"explorer.exe" /v:${RDP_IP} elif [ "${1}" = "manual" ]; then dprint "MANUAL:${2}" - xfreerdp ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +home-drive -wallpaper /scale:${RDP_SCALE} /dynamic-resolution /${MULTI_FLAG} /app:"${2}" 1> /dev/null 2>&1 & + $FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +auto-reconnect +home-drive +dynamic-resolution ${MULTI_FLAG} /app:programm:"${2}" /v:${RDP_IP} 1>/dev/null 2>&1 & elif [ "${1}" != "install" ]; then dprint "DIR:${DIR}" if [ -e "${DIR}/../apps/${1}/info" ]; then @@ -99,9 +105,9 @@ elif [ "${1}" != "install" ]; then dprint "HOME:${HOME}" FILE=$(echo "${2}" | sed 's|'"${HOME}"'|\\\\tsclient\\home|;s|/|\\|g;s|\\|\\\\|g') dprint "FILE:${FILE}" - xfreerdp ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +clipboard +home-drive -wallpaper /scale:${RDP_SCALE} /dynamic-resolution /${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:"${WIN_EXECUTABLE}" /app-icon:"${ICON}" /app-cmd:"\"${FILE}\"" 1> /dev/null 2>&1 & + $FREERDP_COMMAND ${RDP_FLAGS} /d:${RDP_DOMAIN} /u:${RDP_USER} /p:${RDP_PASS} /scale:${RDP_SCALE} +auto-reconnect +clipboard +home-drive -wallpaper +dynamic-resolution ${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:program:"${WIN_EXECUTABLE}",icon:"${ICON}",name:"${FULL_NAME}",cmd:"\"$FILE\"" /v:${RDP_IP} 1>/dev/null 2>&1 & else - xfreerdp ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +clipboard +home-drive -wallpaper /scale:${RDP_SCALE} /dynamic-resolution /${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:"${WIN_EXECUTABLE}" /app-icon:"${ICON}" 1> /dev/null 2>&1 & + $FREERDP_COMMAND ${RDP_FLAGS} /d:${RDP_DOMAIN} /u:${RDP_USER} /p:${RDP_PASS} /scale:${RDP_SCALE} +auto-reconnect +clipboard +home-drive -wallpaper +dynamic-resolution ${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:program:"${WIN_EXECUTABLE}",icon:"${ICON}",name:"${FULL_NAME}" /v:${RDP_IP} 1>/dev/null 2>&1 & fi fi diff --git a/installer.sh b/installer.sh index 464980b..2072d2d 100755 --- a/installer.sh +++ b/installer.sh @@ -1,6 +1,12 @@ #!/usr/bin/env bash -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +if ! command -v bc &> /dev/null +then + echo "You need bc!" + exit +fi + +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" MAKEDEMO=0 USEDEMO=0 @@ -37,16 +43,16 @@ function waFindInstalled() { cp "${DIR}/install/ExtractPrograms.ps1" ${HOME}/.local/share/winapps/ExtractPrograms.ps1 for F in $(ls "${DIR}/apps"); do . "${DIR}/apps/${F}/info" - echo "IF EXIST \"${WIN_EXECUTABLE}\" ECHO ${F} >> \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp" >> ${HOME}/.local/share/winapps/installed.bat - done; - echo "powershell.exe -ExecutionPolicy Bypass -File \\\\tsclient\\home\\.local\\share\\winapps\\ExtractPrograms.ps1 > \\\\tsclient\home\\.local\\share\\winapps\\detected" >> ${HOME}/.local/share/winapps/installed.bat - echo "RENAME \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp installed" >> ${HOME}/.local/share/winapps/installed.bat - xfreerdp /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /v:${RDP_IP} +auto-reconnect +home-drive -wallpaper /span /wm-class:"RDPInstaller" /app:"C:\Windows\System32\cmd.exe" /app-icon:"${DIR}/../icons/windows.svg" /app-cmd:"/C \\\\tsclient\\home\\.local\\share\\winapps\\installed.bat" 1> /dev/null 2>&1 & + echo "IF EXIST \"${WIN_EXECUTABLE}\" ECHO ${F} >> \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp" >>${HOME}/.local/share/winapps/installed.bat + done + echo "powershell.exe -ExecutionPolicy Bypass -File \\\\tsclient\\home\\.local\\share\\winapps\\ExtractPrograms.ps1 > \\\\tsclient\home\\.local\\share\\winapps\\detected" >>${HOME}/.local/share/winapps/installed.bat + echo "RENAME \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp installed" >>${HOME}/.local/share/winapps/installed.bat + $FREERDP_COMMAND /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" +auto-reconnect +home-drive -wallpaper +span /app:program:"C:\Windows\System32\cmd.exe",cmd:"/C \\\\tsclient\\home\\.local\\share\\winapps\\installed.bat" /v:${RDP_IP} 1>/dev/null 2>&1 & COUNT=0 while [ ! -f "${HOME}/.local/share/winapps/installed" ]; do sleep 5 COUNT=$((COUNT + 1)) - if (( COUNT == 15 )); then + if ((COUNT == 15)); then echo " Finished." echo "" echo "The RDP connection failed to connect or run. Please confirm FreeRDP can connect with:" @@ -75,11 +81,11 @@ function waFindInstalled() { } function waConfigureApp() { - . "${SYS_PATH}/apps/${1}/info" - echo -n " Configuring ${NAME}..." - if [ ${USEDEMO} != 1 ]; then - ${SUDO} rm -f "${APP_PATH}/${1}.desktop" - echo "[Desktop Entry] + . "${SYS_PATH}/apps/${1}/info" + echo -n " Configuring ${NAME}..." + if [ ${USEDEMO} != 1 ]; then + ${SUDO} rm -f "${APP_PATH}/${1}.desktop" + echo "[Desktop Entry] Name=${NAME} Exec=${BIN_PATH}/winapps ${1} %F Terminal=false @@ -89,40 +95,45 @@ StartupWMClass=${FULL_NAME} Comment=${FULL_NAME} Categories=${CATEGORIES} MimeType=${MIME_TYPES} -" |${SUDO} tee "${APP_PATH}/${1}.desktop" > /dev/null - ${SUDO} rm -f "${BIN_PATH}/${1}" - echo "#!/usr/bin/env bash +" | ${SUDO} tee "${APP_PATH}/${1}.desktop" >/dev/null + ${SUDO} rm -f "${BIN_PATH}/${1}" + echo "#!/usr/bin/env bash ${BIN_PATH}/winapps ${1} $@ -" |${SUDO} tee "${BIN_PATH}/${1}" > /dev/null - ${SUDO} chmod a+x "${BIN_PATH}/${1}" - fi - echo " Finished." +" | ${SUDO} tee "${BIN_PATH}/${1}" >/dev/null + ${SUDO} chmod a+x "${BIN_PATH}/${1}" + fi + echo " Finished." } function waConfigureApps() { APPS=() - for F in $(cat "${HOME}/.local/share/winapps/installed" |sed 's/\r/\n/g'); do + for F in $(cat "${HOME}/.local/share/winapps/installed" | sed 's/\r/\n/g'); do . "${DIR}/apps/${F}/info" APPS+=("${FULL_NAME} (${F})") - INSTALLED_EXES+=("$(echo "${WIN_EXECUTABLE##*\\}" |tr '[:upper:]' '[:lower:]')") + INSTALLED_EXES+=("$(echo "${WIN_EXECUTABLE##*\\}" | tr '[:upper:]' '[:lower:]')") done IFS=$'\n' APPS=($(sort <<<"${APPS[*]}")) unset IFS OPTIONS=("Set up all detected pre-configured applications" "Select which pre-configured applications to set up" "Do not set up any pre-configured applications") - menuFromArr APP_INSTALL "How would you like to handle WinApps pre-configured applications?" "${OPTIONS[@]}" + + if [ "${INSTALL_TYPE}" != 'User' ]; then + menuFromArr APP_INSTALL "How would you like to handle WinApps pre-configured applications?" "${OPTIONS[@]}" + else"grep -l -d skip" + menuFromArr APP_INSTALL "How would you like to handle WinApps pre-configured applications? If any web browser is set-up, may be configured as default browser." "${OPTIONS[@]}" + fi if [ "${APP_INSTALL}" = "Select which pre-configured applications to set up" ]; then checkbox_input "Which pre-configured apps would you like to set up?" APPS SELECTED_APPS - echo "" > "${HOME}/.local/share/winapps/installed" + echo "" >"${HOME}/.local/share/winapps/installed" for F in "${SELECTED_APPS[@]}"; do APP="${F##*(}" APP="${APP%%)}" - echo "${APP}" >> "${HOME}/.local/share/winapps/installed" + echo "${APP}" >>"${HOME}/.local/share/winapps/installed" done - fi + fi ${SUDO} cp "${DIR}/bin/winapps" "${BIN_PATH}/winapps" COUNT=0 if [ "${APP_INSTALL}" != "Do not set up any pre-configured applications" ]; then - for F in $(cat "${HOME}/.local/share/winapps/installed" |sed 's/\r/\n/g'); do + for F in $(cat "${HOME}/.local/share/winapps/installed" | sed 's/\r/\n/g'); do COUNT=$((COUNT + 1)) ${SUDO} cp -r "apps/${F}" "${SYS_PATH}/apps" waConfigureApp "${F}" svg @@ -130,7 +141,22 @@ function waConfigureApps() { fi rm -f "${HOME}/.local/share/winapps/installed" rm -f "${HOME}/.local/share/winapps/installed.bat" - if (( $COUNT == 0 )); then + if (($COUNT == 0)); then + echo " No configured applications." + fi +} + +function waConfigureAppsAllOfficiallySupported(){ + ${SUDO} cp "${DIR}/bin/winapps" "${BIN_PATH}/winapps" + COUNT=0 + for F in $(cat "${HOME}/.local/share/winapps/installed" | sed 's/\r/\n/g'); do + COUNT=$((COUNT + 1)) + ${SUDO} cp -r "apps/${F}" "${SYS_PATH}/apps" + waConfigureApp "${F}" svg + done + rm -f "${HOME}/.local/share/winapps/installed" + rm -f "${HOME}/.local/share/winapps/installed.bat" + if (($COUNT == 0)); then echo " No configured applications." fi } @@ -142,8 +168,12 @@ function waConfigureDetectedApps() { APPS=() for I in "${!NAMES[@]}"; do EXE=${EXES[$I]##*\\} - EXE_LOWER=$(echo "${EXE}" |tr '[:upper:]' '[:lower:]') - if ( dlm=$'\x1F' ; IFS="$dlm" ; [[ "$dlm${INSTALLED_EXES[*]}$dlm" != *"$dlm${EXE_LOWER}$dlm"* ]] ) ; then + EXE_LOWER=$(echo "${EXE}" | tr '[:upper:]' '[:lower:]') + if ( + dlm=$'\x1F' + IFS="$dlm" + [[ "$dlm${INSTALLED_EXES[*]}$dlm" != *"$dlm${EXE_LOWER}$dlm"* ]] + ); then APPS+=("${NAMES[$I]} (${EXE})") fi done @@ -153,17 +183,17 @@ function waConfigureDetectedApps() { menuFromArr APP_INSTALL "How would you like to handle other detected applications?" "${OPTIONS[@]}" if [ "${APP_INSTALL}" = "Select which applications to set up" ]; then checkbox_input "Which other apps would you like to set up?" APPS SELECTED_APPS - echo "" > "${HOME}/.local/share/winapps/installed" + echo "" >"${HOME}/.local/share/winapps/installed" for F in "${SELECTED_APPS[@]}"; do EXE="${F##*(}" EXE="${EXE%%)}" APP="${F% (*}" - echo "${EXE}|${APP}" >> "${HOME}/.local/share/winapps/installed" + echo "${EXE}|${APP}" >>"${HOME}/.local/share/winapps/installed" done elif [ "${APP_INSTALL}" = "Set up all detected applications" ]; then for I in "${!EXES[@]}"; do EXE=${EXES[$I]##*\\} - echo "${EXE}|${NAMES[$I]}" >> "${HOME}/.local/share/winapps/installed" + echo "${EXE}|${NAMES[$I]}" >>"${HOME}/.local/share/winapps/installed" done fi COUNT=0 @@ -173,7 +203,7 @@ function waConfigureDetectedApps() { NAME="${LINE#*|}" for I in "${!NAMES[@]}"; do if [ "${NAME}" = "${NAMES[$I]}" ] && [[ "${EXES[$I]}" == *"\\${EXE}" ]]; then - EXE=$(echo "${EXE}" |tr '[:upper:]' '[:lower:]') + EXE=$(echo "${EXE}" | tr '[:upper:]' '[:lower:]') ${SUDO} mkdir -p "${SYS_PATH}/apps/${EXE}" echo "# GNOME shortcut name NAME=\"${NAME}\" @@ -189,23 +219,22 @@ CATEGORIES=\"WinApps\" # GNOME mimetypes MIME_TYPES=\"\" -" | sudo tee "${SYS_PATH}/apps/${EXE}/info" > /dev/null - echo "${ICONS[$I]}" | base64 -d | sudo tee "${SYS_PATH}/apps/${EXE}/icon.ico" > /dev/null +" | sudo tee "${SYS_PATH}/apps/${EXE}/info" >/dev/null + echo "${ICONS[$I]}" | base64 -d | sudo tee "${SYS_PATH}/apps/${EXE}/icon.ico" >/dev/null waConfigureApp "${EXE}" ico COUNT=$((COUNT + 1)) fi done - done < "${HOME}/.local/share/winapps/installed" + done <"${HOME}/.local/share/winapps/installed" rm -f "${HOME}/.local/share/winapps/installed" fi rm -f "${HOME}/.local/share/winapps/installed.bat" - if (( $COUNT == 0 )); then + if (($COUNT == 0)); then echo " No configured applications." fi fi } - function waConfigureWindows() { echo -n " Configuring Windows..." if [ ${USEDEMO} != 1 ]; then @@ -218,14 +247,14 @@ Exec=${BIN_PATH}/winapps windows %F Terminal=false Type=Application Icon=${SYS_PATH}/icons/windows.svg -StartupWMClass=Micorosoft Windows -Comment=Micorosoft Windows +StartupWMClass=Microsoft Windows +Comment=Microsoft Windows Categories=Windows -" |${SUDO} tee "${APP_PATH}/windows.desktop" > /dev/null +" | ${SUDO} tee "${APP_PATH}/windows.desktop" >/dev/null ${SUDO} rm -f "${BIN_PATH}/windows" echo "#!/usr/bin/env bash ${BIN_PATH}/winapps windows -" |${SUDO} tee "/${BIN_PATH}/windows" > /dev/null +" | ${SUDO} tee "/${BIN_PATH}/windows" >/dev/null ${SUDO} chmod a+x "${BIN_PATH}/windows" fi echo " Finished." @@ -234,12 +263,12 @@ ${BIN_PATH}/winapps windows function waUninstallUser() { rm -f "${HOME}/.local/bin/winapps" rm -rf "${HOME}/.local/share/winapps" - for F in $(grep -l -d skip "bin/winapps" "${HOME}/.local/share/applications/"*); do + for F in $(grep -l -d skip "bin/winapps" "${HOME}/.local/share/applications/"* -s); do echo -n " Removing ${F}..." ${SUDO} rm ${F} echo " Finished." done - for F in $(grep -l -d skip "bin/winapps" "${HOME}/.local/bin/"*); do + for F in $(grep -l -d skip "bin/winapps" "${HOME}/.local/bin/"* -s); do echo -n " Removing ${F}..." ${SUDO} rm ${F} echo " Finished." @@ -249,7 +278,7 @@ function waUninstallUser() { function waUninstallSystem() { ${SUDO} rm -f "/usr/local/bin/winapps" ${SUDO} rm -rf "/usr/local/share/winapps" - for F in $(grep -l -d skip "bin/winapps" "/usr/share/applications/"*); do + for F in $(grep -l -d skip "bin/winapps" "/usr/share/applications/"* -s); do if [ -z "${SUDO}" ]; then waNoSudo fi @@ -257,7 +286,7 @@ function waUninstallSystem() { ${SUDO} rm ${F} echo " Finished." done - for F in $(grep -l -d skip "bin/winapps" "/usr/local/bin/"*); do + for F in $(grep -l -d skip "bin/winapps" "/usr/local/bin/"* -s); do if [ -z "${SUDO}" ]; then waNoSudo fi @@ -283,19 +312,32 @@ if [ "${INSTALL_TYPE}" = 'User' ]; then BIN_PATH="${HOME}/.local/bin" APP_PATH="${HOME}/.local/share/applications" SYS_PATH="${HOME}/.local/share/winapps" + mkdir -p $BIN_PATH + mkdir -p $APP_PATH + mkdir -p $SYS_PATH if [ -n "${2}" ]; then if [ "${2}" = '--uninstall' ]; then # Uninstall echo "Uninstalling..." waUninstallUser exit + elif [ "${2}" = '--setupAllOfficiallySupportedApps' ]; then + echo "Setting up All Officially Supported Apps " + echo "Removing any old configurations..." + waUninstallUser + waUninstallSystem + waInstall + waFindInstalled + waConfigureWindows + waConfigureAppsAllOfficiallySupported + exit else usage fi fi elif [ "${INSTALL_TYPE}" = 'System' ]; then SUDO="sudo" - sudo ls > /dev/null + sudo ls >/dev/null BIN_PATH="/usr/local/bin" APP_PATH="/usr/share/applications" SYS_PATH="/usr/local/share/winapps" @@ -305,6 +347,18 @@ elif [ "${INSTALL_TYPE}" = 'System' ]; then echo "Uninstalling..." waUninstallSystem exit + elif [ "${2}" = '--setupAllOfficiallySupportedApps' ]; then + echo "Setting up All Officially Supported Apps " + echo "Removing any old configurations..." + waUninstallUser + waUninstallSystem + + echo "Installing..." + waInstall + waFindInstalled + waConfigureWindows + waConfigureAppsAllOfficiallySupported + exit else usage fi @@ -330,4 +384,4 @@ waConfigureWindows waConfigureApps waConfigureDetectedApps -echo "Installation complete." \ No newline at end of file +echo "Installation complete." From 8cfebfd00a6c47c7fed545a9e6fa53ab13e1c4c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastien=20B=C3=BCrky?= Date: Sat, 20 Apr 2024 22:45:32 +0200 Subject: [PATCH 011/187] Readme Fix --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 8269b0e..c16d4a4 100644 --- a/README.md +++ b/README.md @@ -196,6 +196,9 @@ The following optional commands can be used to manage your application configura ./installer.sh --user --uninstall # Remove all configured applications for the current user ./installer.sh --system --uninstall # Remove all configured applications for the entire system ``` +./installer.sh --user --setupAllOfficiallySupportedApps # Configures all officially support applications for the current user +./installer.sh --system --setupAllOfficiallySupportedApps # Configures all officially support applications for the entire system +``` ## Shout outs From a21cc6cc36649ec1dd284c926251cd9974d5185b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastien=20B=C3=BCrky?= Date: Sat, 20 Apr 2024 22:46:25 +0200 Subject: [PATCH 012/187] Fix self introduced Typo --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c16d4a4..2924c69 100644 --- a/README.md +++ b/README.md @@ -196,8 +196,8 @@ The following optional commands can be used to manage your application configura ./installer.sh --user --uninstall # Remove all configured applications for the current user ./installer.sh --system --uninstall # Remove all configured applications for the entire system ``` -./installer.sh --user --setupAllOfficiallySupportedApps # Configures all officially support applications for the current user -./installer.sh --system --setupAllOfficiallySupportedApps # Configures all officially support applications for the entire system +./installer.sh --user --setupAllOfficiallySupportedApps # Configures all officially supported applications for the current user +./installer.sh --system --setupAllOfficiallySupportedApps # Configures all officially supported applications for the entire system ``` ## Shout outs From f240fc3e952b20874e928945c914cca54fce86b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastien=20B=C3=BCrky?= Date: Sat, 20 Apr 2024 23:17:37 +0200 Subject: [PATCH 013/187] another typo fix --- installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer.sh b/installer.sh index 2072d2d..696283d 100755 --- a/installer.sh +++ b/installer.sh @@ -118,7 +118,7 @@ function waConfigureApps() { if [ "${INSTALL_TYPE}" != 'User' ]; then menuFromArr APP_INSTALL "How would you like to handle WinApps pre-configured applications?" "${OPTIONS[@]}" - else"grep -l -d skip" + else "grep -l -d skip" menuFromArr APP_INSTALL "How would you like to handle WinApps pre-configured applications? If any web browser is set-up, may be configured as default browser." "${OPTIONS[@]}" fi if [ "${APP_INSTALL}" = "Select which pre-configured applications to set up" ]; then From 84bf580d11f82bee8af9c7807beaeb5062ed82b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastien=20B=C3=BCrky?= Date: Sat, 20 Apr 2024 23:19:35 +0200 Subject: [PATCH 014/187] Prefer to use os icons --- apps/adobe-cc/info | 3 +++ apps/aftereffects-cc/info | 3 +++ apps/audition-cc/info | 3 +++ apps/bridge-cc/info | 3 +++ apps/bridge-cs6-x86/info | 3 +++ apps/bridge-cs6/info | 3 +++ apps/cmd/info | 3 +++ apps/excel-o365-x86/info | 3 +++ apps/excel-o365/info | 3 +++ apps/excel-x86/info | 3 +++ apps/excel/info | 3 +++ apps/illustrator-cc/info | 3 +++ apps/indesign-cc/info | 3 +++ apps/lightroom-cc/info | 3 +++ apps/onenote-o365-x86/info | 3 +++ apps/onenote-o365/info | 3 +++ apps/onenote-x86/info | 3 +++ apps/onenote/info | 3 +++ apps/outlook-o365-x86/info | 3 +++ apps/outlook-o365/info | 3 +++ apps/outlook-x86/info | 3 +++ apps/outlook/info | 3 +++ apps/photoshop-cc/info | 3 +++ apps/photoshop-cs6-x86/info | 3 +++ apps/photoshop-cs6/info | 3 +++ apps/powerpoint-o365-x86/info | 3 +++ apps/powerpoint-o365/info | 3 +++ apps/powerpoint-x86/info | 3 +++ apps/powerpoint/info | 3 +++ apps/word-o365-x86/info | 3 +++ apps/word-o365/info | 3 +++ apps/word-x86/info | 3 +++ apps/word/info | 3 +++ installer.sh | 26 +++++++++++++++----------- 34 files changed, 114 insertions(+), 11 deletions(-) diff --git a/apps/adobe-cc/info b/apps/adobe-cc/info index a1a0e9f..c8a0051 100644 --- a/apps/adobe-cc/info +++ b/apps/adobe-cc/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Adobe" # GNOME mimetypes MIME_TYPES="" + +# System Icon +ICON="AdobeUpdate" \ No newline at end of file diff --git a/apps/aftereffects-cc/info b/apps/aftereffects-cc/info index f40e513..76a96be 100644 --- a/apps/aftereffects-cc/info +++ b/apps/aftereffects-cc/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Adobe" # GNOME mimetypes MIME_TYPES="application/vnd.adobe.aftereffects.project;application/vnd.adobe.aftereffects.template;" + +# System Icon +ICON="AdobeAfterEffect" \ No newline at end of file diff --git a/apps/audition-cc/info b/apps/audition-cc/info index 8551913..934abc3 100644 --- a/apps/audition-cc/info +++ b/apps/audition-cc/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Adobe" # GNOME mimetypes MIME_TYPES="" + +# System Icon +ICON="AdobeAudition" \ No newline at end of file diff --git a/apps/bridge-cc/info b/apps/bridge-cc/info index 48379a0..02edf53 100644 --- a/apps/bridge-cc/info +++ b/apps/bridge-cc/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Adobe" # GNOME mimetypes MIME_TYPES="image/vnd.adobe.photoshop;" + +# System Icon +ICON="AdobeBridge" \ No newline at end of file diff --git a/apps/bridge-cs6-x86/info b/apps/bridge-cs6-x86/info index 5f72104..eaaa69a 100644 --- a/apps/bridge-cs6-x86/info +++ b/apps/bridge-cs6-x86/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Adobe" # GNOME mimetypes MIME_TYPES="image/vnd.adobe.photoshop;" + +# System Icon +ICON="AdobeBridge" \ No newline at end of file diff --git a/apps/bridge-cs6/info b/apps/bridge-cs6/info index 17009f0..66b29fc 100644 --- a/apps/bridge-cs6/info +++ b/apps/bridge-cs6/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Adobe" # GNOME mimetypes MIME_TYPES="image/vnd.adobe.photoshop;" + +# System Icon +ICON="AdobeBridge" \ No newline at end of file diff --git a/apps/cmd/info b/apps/cmd/info index eda4064..af457af 100644 --- a/apps/cmd/info +++ b/apps/cmd/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Windows" # GNOME mimetypes MIME_TYPES="" + +# System Icon +ICON="Terminal" \ No newline at end of file diff --git a/apps/excel-o365-x86/info b/apps/excel-o365-x86/info index a913aa0..e50b961 100644 --- a/apps/excel-o365-x86/info +++ b/apps/excel-o365-x86/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Office" # GNOME mimetypes MIME_TYPES="application/vnd.ms-excel;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;application/vnd.openxmlformats-officedocument.spreadsheetml.template;application/vnd.ms-excel.sheet.macroEnabled.12;application/vnd.ms-excel.template.macroEnabled.12;application/vnd.ms-excel.addin.macroEnabled.12;application/vnd.ms-excel.sheet.binary.macroEnabled.12;" + +# System Icon +ICON="ms-excel"s \ No newline at end of file diff --git a/apps/excel-o365/info b/apps/excel-o365/info index de6b82b..9671c74 100644 --- a/apps/excel-o365/info +++ b/apps/excel-o365/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Office" # GNOME mimetypes MIME_TYPES="application/vnd.ms-excel;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;application/vnd.openxmlformats-officedocument.spreadsheetml.template;application/vnd.ms-excel.sheet.macroEnabled.12;application/vnd.ms-excel.template.macroEnabled.12;application/vnd.ms-excel.addin.macroEnabled.12;application/vnd.ms-excel.sheet.binary.macroEnabled.12;" + +# System Icon +ICON="ms-excel" \ No newline at end of file diff --git a/apps/excel-x86/info b/apps/excel-x86/info index ceb3b6c..5a71f70 100644 --- a/apps/excel-x86/info +++ b/apps/excel-x86/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Office" # GNOME mimetypes MIME_TYPES="application/vnd.ms-excel;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;application/vnd.openxmlformats-officedocument.spreadsheetml.template;application/vnd.ms-excel.sheet.macroEnabled.12;application/vnd.ms-excel.template.macroEnabled.12;application/vnd.ms-excel.addin.macroEnabled.12;application/vnd.ms-excel.sheet.binary.macroEnabled.12;" + +# System Icon +ICON="ms-excel" \ No newline at end of file diff --git a/apps/excel/info b/apps/excel/info index f397b76..ad891ff 100644 --- a/apps/excel/info +++ b/apps/excel/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Office" # GNOME mimetypes MIME_TYPES="application/vnd.ms-excel;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;application/vnd.openxmlformats-officedocument.spreadsheetml.template;application/vnd.ms-excel.sheet.macroEnabled.12;application/vnd.ms-excel.template.macroEnabled.12;application/vnd.ms-excel.addin.macroEnabled.12;application/vnd.ms-excel.sheet.binary.macroEnabled.12;" + +# System Icon +ICON="ms-excel" \ No newline at end of file diff --git a/apps/illustrator-cc/info b/apps/illustrator-cc/info index 701ab29..c8ba5da 100644 --- a/apps/illustrator-cc/info +++ b/apps/illustrator-cc/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Adobe" # GNOME mimetypes MIME_TYPES="application/illustrator;" + +# System Icon +ICON="AdobeIllustrator" \ No newline at end of file diff --git a/apps/indesign-cc/info b/apps/indesign-cc/info index 7829791..b60a80e 100644 --- a/apps/indesign-cc/info +++ b/apps/indesign-cc/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Adobe" # GNOME mimetypes MIME_TYPES="application/x-adobe-indesign-interchange;application/x-adobe-indesign;" + +# System Icon +ICON="AdobeIndesign" \ No newline at end of file diff --git a/apps/lightroom-cc/info b/apps/lightroom-cc/info index d4f19f3..23ef96b 100644 --- a/apps/lightroom-cc/info +++ b/apps/lightroom-cc/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Adobe" # GNOME mimetypes MIME_TYPES="" + +# System Icon +ICON="AdobeLightroom" \ No newline at end of file diff --git a/apps/onenote-o365-x86/info b/apps/onenote-o365-x86/info index 7a2553d..1ce4872 100644 --- a/apps/onenote-o365-x86/info +++ b/apps/onenote-o365-x86/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Office" # GNOME mimetypes MIME_TYPES="application/msonenote;" + +# System Icon +ICON="ms-outlook" \ No newline at end of file diff --git a/apps/onenote-o365/info b/apps/onenote-o365/info index 3003121..248fea3 100644 --- a/apps/onenote-o365/info +++ b/apps/onenote-o365/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Office" # GNOME mimetypes MIME_TYPES="application/msonenote;" + +# System Icon +ICON="ms-outlook" \ No newline at end of file diff --git a/apps/onenote-x86/info b/apps/onenote-x86/info index fde6517..cf68779 100644 --- a/apps/onenote-x86/info +++ b/apps/onenote-x86/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Office" # GNOME mimetypes MIME_TYPES="application/msonenote;" + +# System Icon +ICON="ms-onenote" \ No newline at end of file diff --git a/apps/onenote/info b/apps/onenote/info index 1165128..d6e6636 100644 --- a/apps/onenote/info +++ b/apps/onenote/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Office" # GNOME mimetypes MIME_TYPES="application/msonenote;" + +# System Icon +ICON="ms-outlook" \ No newline at end of file diff --git a/apps/outlook-o365-x86/info b/apps/outlook-o365-x86/info index 14422af..31f5746 100644 --- a/apps/outlook-o365-x86/info +++ b/apps/outlook-o365-x86/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Office" # GNOME mimetypes MIME_TYPES="application/vnd.ms-outlook;application/octet-stream;" + +# System Icon +ICON="ms-outlook" \ No newline at end of file diff --git a/apps/outlook-o365/info b/apps/outlook-o365/info index 9893d42..f248cab 100644 --- a/apps/outlook-o365/info +++ b/apps/outlook-o365/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Office" # GNOME mimetypes MIME_TYPES="application/vnd.ms-outlook;application/octet-stream;" + +# System Icon +ICON="ms-outlook" \ No newline at end of file diff --git a/apps/outlook-x86/info b/apps/outlook-x86/info index 1431add..9f68b8e 100644 --- a/apps/outlook-x86/info +++ b/apps/outlook-x86/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Office" # GNOME mimetypes MIME_TYPES="application/vnd.ms-outlook;application/octet-stream;" + +# System Icon +ICON="ms-outlook" \ No newline at end of file diff --git a/apps/outlook/info b/apps/outlook/info index f3a4f43..d990949 100644 --- a/apps/outlook/info +++ b/apps/outlook/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Office" # GNOME mimetypes MIME_TYPES="application/vnd.ms-outlook;application/octet-stream;" + +# System Icon +ICON="ms-outlook" \ No newline at end of file diff --git a/apps/photoshop-cc/info b/apps/photoshop-cc/info index 45fc878..8f8a220 100644 --- a/apps/photoshop-cc/info +++ b/apps/photoshop-cc/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Adobe" # GNOME mimetypes MIME_TYPES="image/vnd.adobe.photoshop;" + +# System Icon +ICON="AdobePhotoshop" \ No newline at end of file diff --git a/apps/photoshop-cs6-x86/info b/apps/photoshop-cs6-x86/info index d4fd734..2a23552 100644 --- a/apps/photoshop-cs6-x86/info +++ b/apps/photoshop-cs6-x86/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Adobe" # GNOME mimetypes MIME_TYPES="image/vnd.adobe.photoshop;" + +# System Icon +ICON="AdobePhotoshop" \ No newline at end of file diff --git a/apps/photoshop-cs6/info b/apps/photoshop-cs6/info index a1ae9e6..bc1d939 100644 --- a/apps/photoshop-cs6/info +++ b/apps/photoshop-cs6/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Adobe" # GNOME mimetypes MIME_TYPES="image/vnd.adobe.photoshop;" + +# System Icon +ICON="AdobePhotoshop" \ No newline at end of file diff --git a/apps/powerpoint-o365-x86/info b/apps/powerpoint-o365-x86/info index 8496695..9c89d89 100644 --- a/apps/powerpoint-o365-x86/info +++ b/apps/powerpoint-o365-x86/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Office" # GNOME mimetypes MIME_TYPES="application/vnd.ms-powerpoint;application/vnd.openxmlformats-officedocument.presentationml.presentation;application/vnd.openxmlformats-officedocument.presentationml.template;application/vnd.openxmlformats-officedocument.presentationml.slideshow;application/vnd.ms-powerpoint.addin.macroEnabled.12;application/vnd.ms-powerpoint.presentation.macroEnabled.12;application/vnd.ms-powerpoint.template.macroEnabled.12;application/vnd.ms-powerpoint.slideshow.macroEnabled.12;" + +# System Icon +ICON="ms-powerpoint" \ No newline at end of file diff --git a/apps/powerpoint-o365/info b/apps/powerpoint-o365/info index 45b7916..ce16e08 100644 --- a/apps/powerpoint-o365/info +++ b/apps/powerpoint-o365/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Office" # GNOME mimetypes MIME_TYPES="application/vnd.ms-powerpoint;application/vnd.openxmlformats-officedocument.presentationml.presentation;application/vnd.openxmlformats-officedocument.presentationml.template;application/vnd.openxmlformats-officedocument.presentationml.slideshow;application/vnd.ms-powerpoint.addin.macroEnabled.12;application/vnd.ms-powerpoint.presentation.macroEnabled.12;application/vnd.ms-powerpoint.template.macroEnabled.12;application/vnd.ms-powerpoint.slideshow.macroEnabled.12;" + +# System Icon +ICON="ms-powerpoint" \ No newline at end of file diff --git a/apps/powerpoint-x86/info b/apps/powerpoint-x86/info index 1170358..409318f 100644 --- a/apps/powerpoint-x86/info +++ b/apps/powerpoint-x86/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Office" # GNOME mimetypes MIME_TYPES="application/vnd.ms-powerpoint;application/vnd.openxmlformats-officedocument.presentationml.presentation;application/vnd.openxmlformats-officedocument.presentationml.template;application/vnd.openxmlformats-officedocument.presentationml.slideshow;application/vnd.ms-powerpoint.addin.macroEnabled.12;application/vnd.ms-powerpoint.presentation.macroEnabled.12;application/vnd.ms-powerpoint.template.macroEnabled.12;application/vnd.ms-powerpoint.slideshow.macroEnabled.12;" + +# System Icon +ICON="ms-powerpoint" \ No newline at end of file diff --git a/apps/powerpoint/info b/apps/powerpoint/info index 17f1cba..e08c80d 100644 --- a/apps/powerpoint/info +++ b/apps/powerpoint/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Office" # GNOME mimetypes MIME_TYPES="application/vnd.ms-powerpoint;application/vnd.openxmlformats-officedocument.presentationml.presentation;application/vnd.openxmlformats-officedocument.presentationml.template;application/vnd.openxmlformats-officedocument.presentationml.slideshow;application/vnd.ms-powerpoint.addin.macroEnabled.12;application/vnd.ms-powerpoint.presentation.macroEnabled.12;application/vnd.ms-powerpoint.template.macroEnabled.12;application/vnd.ms-powerpoint.slideshow.macroEnabled.12;" + +# System Icon +ICON="ms-powerpoint" \ No newline at end of file diff --git a/apps/word-o365-x86/info b/apps/word-o365-x86/info index b6a001e..8a3011a 100644 --- a/apps/word-o365-x86/info +++ b/apps/word-o365-x86/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Office" # GNOME mimetypes MIME_TYPES="application/msword;application/vnd.openxmlformats-officedocument.wordprocessingml.document;application/vnd.openxmlformats-officedocument.wordprocessingml.template;application/vnd.ms-word.document.macroEnabled.12;application/vnd.ms-word.template.macroEnabled.12;" + +# System Icon +ICON="ms-word" \ No newline at end of file diff --git a/apps/word-o365/info b/apps/word-o365/info index 2e1a365..4223a4d 100644 --- a/apps/word-o365/info +++ b/apps/word-o365/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Office" # GNOME mimetypes MIME_TYPES="application/msword;application/vnd.openxmlformats-officedocument.wordprocessingml.document;application/vnd.openxmlformats-officedocument.wordprocessingml.template;application/vnd.ms-word.document.macroEnabled.12;application/vnd.ms-word.template.macroEnabled.12;" + +# System Icon +ICON="ms-word" \ No newline at end of file diff --git a/apps/word-x86/info b/apps/word-x86/info index a4b9c45..ffe7a81 100644 --- a/apps/word-x86/info +++ b/apps/word-x86/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Office" # GNOME mimetypes MIME_TYPES="application/msword;application/vnd.openxmlformats-officedocument.wordprocessingml.document;application/vnd.openxmlformats-officedocument.wordprocessingml.template;application/vnd.ms-word.document.macroEnabled.12;application/vnd.ms-word.template.macroEnabled.12;" + +# System Icon +ICON="ms-word" \ No newline at end of file diff --git a/apps/word/info b/apps/word/info index 4236346..62b6774 100644 --- a/apps/word/info +++ b/apps/word/info @@ -12,3 +12,6 @@ CATEGORIES="WinApps;Office" # GNOME mimetypes MIME_TYPES="application/msword;application/vnd.openxmlformats-officedocument.wordprocessingml.document;application/vnd.openxmlformats-officedocument.wordprocessingml.template;application/vnd.ms-word.document.macroEnabled.12;application/vnd.ms-word.template.macroEnabled.12;" + +# System Icon +ICON="ms-word" \ No newline at end of file diff --git a/installer.sh b/installer.sh index 464980b..d556053 100755 --- a/installer.sh +++ b/installer.sh @@ -75,16 +75,19 @@ function waFindInstalled() { } function waConfigureApp() { - . "${SYS_PATH}/apps/${1}/info" - echo -n " Configuring ${NAME}..." - if [ ${USEDEMO} != 1 ]; then - ${SUDO} rm -f "${APP_PATH}/${1}.desktop" - echo "[Desktop Entry] + if [ -z "${ICON}" ]; then + ICON=${SYS_PATH}/apps/${1}/icon.${2} + fi + . "${SYS_PATH}/apps/${1}/info" + echo -n " Configuring ${NAME}..." + if [ ${USEDEMO} != 1 ]; then + ${SUDO} rm -f "${APP_PATH}/${1}.desktop" + echo "[Desktop Entry] Name=${NAME} Exec=${BIN_PATH}/winapps ${1} %F Terminal=false Type=Application -Icon=${SYS_PATH}/apps/${1}/icon.${2} +Icon=$ICON StartupWMClass=${FULL_NAME} Comment=${FULL_NAME} Categories=${CATEGORIES} @@ -93,10 +96,11 @@ MimeType=${MIME_TYPES} ${SUDO} rm -f "${BIN_PATH}/${1}" echo "#!/usr/bin/env bash ${BIN_PATH}/winapps ${1} $@ -" |${SUDO} tee "${BIN_PATH}/${1}" > /dev/null - ${SUDO} chmod a+x "${BIN_PATH}/${1}" - fi - echo " Finished." +" | ${SUDO} tee "${BIN_PATH}/${1}" >/dev/null + ${SUDO} chmod a+x "${BIN_PATH}/${1}" + fi + echo " Finished." + ICON="" } function waConfigureApps() { @@ -217,7 +221,7 @@ Name=Windows Exec=${BIN_PATH}/winapps windows %F Terminal=false Type=Application -Icon=${SYS_PATH}/icons/windows.svg +Icon=distributor-logo-windows StartupWMClass=Micorosoft Windows Comment=Micorosoft Windows Categories=Windows From 0225a9cf017c56c319fa859dbc4983f44c2b65e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastien=20B=C3=BCrky?= Date: Sun, 5 May 2024 14:56:57 +0200 Subject: [PATCH 015/187] Fix readme and check if the custom freeRDP Command is actually existing --- README.md | 1 - bin/winapps | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2924c69..a798dd9 100644 --- a/README.md +++ b/README.md @@ -195,7 +195,6 @@ The following optional commands can be used to manage your application configura ./installer.sh --system # Configure applications for the entire system ./installer.sh --user --uninstall # Remove all configured applications for the current user ./installer.sh --system --uninstall # Remove all configured applications for the entire system -``` ./installer.sh --user --setupAllOfficiallySupportedApps # Configures all officially supported applications for the current user ./installer.sh --system --setupAllOfficiallySupportedApps # Configures all officially supported applications for the entire system ``` diff --git a/bin/winapps b/bin/winapps index 0f24c86..cf4a52b 100755 --- a/bin/winapps +++ b/bin/winapps @@ -49,7 +49,11 @@ if [ -z "${FREERDP_COMMAND}" ]; then FREERDP_COMMAND="xfreerdp3" fi else - dprint "Using custom freerdp command ${FREERDP_COMMAND}" + if command -v $FREERDP_COMMAND &> /dev/null + dprint "Using custom freerdp command ${FREERDP_COMMAND}" + else + echo "You have supplied a custom FreeRDP command, but the command is not available." + fi fi if [ -z "${RDP_IP}" ]; then From 1e2ee830a7f5b5f0eead48d8dbcf5ddb9ad8eb47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastien=20B=C3=BCrky?= Date: Sun, 5 May 2024 15:34:59 +0200 Subject: [PATCH 016/187] we probably should actually stop trying to execute this if the command is not found --- bin/winapps | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/winapps b/bin/winapps index cf4a52b..0500cff 100755 --- a/bin/winapps +++ b/bin/winapps @@ -53,6 +53,7 @@ else dprint "Using custom freerdp command ${FREERDP_COMMAND}" else echo "You have supplied a custom FreeRDP command, but the command is not available." + exit fi fi From c526adde04023db366b17b9c98cd0d528a7b5642 Mon Sep 17 00:00:00 2001 From: LDprg <71488985+LDprg@users.noreply.github.com> Date: Tue, 14 May 2024 11:37:53 +0200 Subject: [PATCH 017/187] Create docker.md --- docs/docker.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/docker.md diff --git a/docs/docker.md b/docs/docker.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/docs/docker.md @@ -0,0 +1 @@ + From aa2c1d886312e72e524e734b6527a67b63b0292d Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Tue, 14 May 2024 19:32:21 +0200 Subject: [PATCH 018/187] fix: invalid syntax --- bin/winapps | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/bin/winapps b/bin/winapps index 0500cff..573be81 100755 --- a/bin/winapps +++ b/bin/winapps @@ -48,13 +48,12 @@ if [ -z "${FREERDP_COMMAND}" ]; then then FREERDP_COMMAND="xfreerdp3" fi -else - if command -v $FREERDP_COMMAND &> /dev/null +elif command -v $FREERDP_COMMAND &> /dev/null +then dprint "Using custom freerdp command ${FREERDP_COMMAND}" - else - echo "You have supplied a custom FreeRDP command, but the command is not available." - exit - fi +else + echo "You have supplied a custom FreeRDP command, but the command is not available." + exit fi if [ -z "${RDP_IP}" ]; then From c9a94b2bce894edd82ac558d98b37299bf7a7681 Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Tue, 14 May 2024 19:56:39 +0200 Subject: [PATCH 019/187] fix: properly quote some variables --- bin/winapps | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/bin/winapps b/bin/winapps index 573be81..03bd9e7 100755 --- a/bin/winapps +++ b/bin/winapps @@ -33,7 +33,7 @@ if [ -f "${HOME}/.local/share/winapps/run" ]; then touch "${HOME}/.local/share/winapps/run" THIS_RUN=$(stat -t -c %Y "${HOME}/.local/share/winapps/run") dprint "THIS_RUN:${THIS_RUN}" - if (($THIS_RUN - $LAST_RAN < 2)); then + if ((THIS_RUN - LAST_RAN < 2)); then exit fi else @@ -57,13 +57,13 @@ else fi if [ -z "${RDP_IP}" ]; then - if [ -z "$(groups | grep libvirt)" ]; then + if [ ! "$(groups | grep -v libvirt)" ]; then echo "You are not a member of the libvirt group. Run the below then reboot." echo ' sudo usermod -a -G libvirt $(whoami)' echo ' sudo usermod -a -G kvm $(whoami)' exit fi - if [ -z "$(virsh list | grep RDPWindows)" ]; then + if [ ! "$(virsh list | grep -v RDPWindows)" ]; then echo "RDPWindows is not running, run:" echo " virsh start RDPWindows" exit @@ -75,6 +75,8 @@ fi dprint "1:${1}" dprint "2:${2}" +# this is just for debug logging anyways +# shellcheck disable=SC2145 dprint "@:${@}" MULTI_FLAG="+span" @@ -86,32 +88,35 @@ if [ "${1}" = "windows" ]; then $FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +dynamic-resolution +auto-reconnect +home-drive /wm-class:"Microsoft Windows" /v:${RDP_IP} 1>/dev/null 2>&1 & elif [ "${1}" = "check" ]; then dprint "CHECK" - $FREERDP_COMMAND ${RDP_FLAGS} /d:${RDP_DOMAIN} /u:${RDP_USER} /p:${RDP_PASS} /scale:${RDP_SCALE} +auto-reconnect +home-drive -wallpaper +dynamic-resolution ${MULTI_FLAG} /app:program:"explorer.exe" /v:${RDP_IP} + $FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +auto-reconnect +home-drive -wallpaper +dynamic-resolution ${MULTI_FLAG} /app:program:"explorer.exe" /v:${RDP_IP} elif [ "${1}" = "manual" ]; then dprint "MANUAL:${2}" - $FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +auto-reconnect +home-drive +dynamic-resolution ${MULTI_FLAG} /app:programm:"${2}" /v:${RDP_IP} 1>/dev/null 2>&1 & + $FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +auto-reconnect +home-drive +dynamic-resolution ${MULTI_FLAG} /app:program:"${2}" /v:"${RDP_IP}" 1>/dev/null 2>&1 & elif [ "${1}" != "install" ]; then dprint "DIR:${DIR}" if [ -e "${DIR}/../apps/${1}/info" ]; then + # shellcheck disable=SC1090 . "${DIR}/../apps/${1}/info" ICON="${DIR}/../apps/${1}/icon.svg" elif [ -e "${HOME}/.local/share/winapps/apps/${1}/info" ]; then + # shellcheck disable=SC1090 . "${HOME}/.local/share/winapps/apps/${1}/info" ICON="${HOME}/.local/share/winapps/apps/${1}/icon.svg" elif [ -e "/usr/local/share/winapps/apps/${1}/info" ]; then + # shellcheck disable=SC1090 . "/usr/local/share/winapps/apps/${1}/info" ICON="/usr/local/share/winapps/apps/${1}/icon.svg" else - echo "You need to run 'install.sh' first." + echo "You need to run 'installer.sh' first." exit 1 fi if [ -n "${2}" ]; then dprint "HOME:${HOME}" FILE=$(echo "${2}" | sed 's|'"${HOME}"'|\\\\tsclient\\home|;s|/|\\|g;s|\\|\\\\|g') dprint "FILE:${FILE}" - $FREERDP_COMMAND ${RDP_FLAGS} /d:${RDP_DOMAIN} /u:${RDP_USER} /p:${RDP_PASS} /scale:${RDP_SCALE} +auto-reconnect +clipboard +home-drive -wallpaper +dynamic-resolution ${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:program:"${WIN_EXECUTABLE}",icon:"${ICON}",name:"${FULL_NAME}",cmd:"\"$FILE\"" /v:${RDP_IP} 1>/dev/null 2>&1 & + $FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +auto-reconnect +clipboard +home-drive -wallpaper +dynamic-resolution ${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:program:"${WIN_EXECUTABLE}",icon:"${ICON}",name:"${FULL_NAME}",cmd:"\"$FILE\"" /v:"${RDP_IP}" 1>/dev/null 2>&1 & else - $FREERDP_COMMAND ${RDP_FLAGS} /d:${RDP_DOMAIN} /u:${RDP_USER} /p:${RDP_PASS} /scale:${RDP_SCALE} +auto-reconnect +clipboard +home-drive -wallpaper +dynamic-resolution ${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:program:"${WIN_EXECUTABLE}",icon:"${ICON}",name:"${FULL_NAME}" /v:${RDP_IP} 1>/dev/null 2>&1 & + $FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +auto-reconnect +clipboard +home-drive -wallpaper +dynamic-resolution ${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:program:"${WIN_EXECUTABLE}",icon:"${ICON}",name:"${FULL_NAME}" /v:"${RDP_IP}" 1>/dev/null 2>&1 & fi fi From 1fb7ee78188e3291e92a94254355d4e31b5a0b15 Mon Sep 17 00:00:00 2001 From: LDprg <71488985+LDprg@users.noreply.github.com> Date: Wed, 15 May 2024 06:17:39 +0200 Subject: [PATCH 020/187] Add gerneral info about docker --- docs/docker.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/docker.md b/docs/docker.md index 8b13789..0230800 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -1 +1,13 @@ +# Docker +## Why docker? + +While working with virsh is completely fine for winapps you have to setup and optimise you vm manually. Docker on the other hand setups most of the stuff automatically and makes the vm highly portable between linux distros. + +# Requirements + +Since docker manages the dependencies of the container automatically you only need to install docker or podman itself. (Podman is recommended because of the faster container startup times) + +Note: This will only work on linux systems since some kernel interfaces (like kvm) are needed by the vm. Because of this performance can vary in kernel versions (newer will likely perform better). + +# Setup docker container \ No newline at end of file From 6b580be6a69e22e607caa5b7f58b6b2ddd6c86a2 Mon Sep 17 00:00:00 2001 From: LDprg <71488985+LDprg@users.noreply.github.com> Date: Wed, 15 May 2024 06:24:47 +0200 Subject: [PATCH 021/187] add docker compose docs --- docs/docker.md | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/docs/docker.md b/docs/docker.md index 0230800..f5e6789 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -6,8 +6,39 @@ While working with virsh is completely fine for winapps you have to setup and op # Requirements -Since docker manages the dependencies of the container automatically you only need to install docker or podman itself. (Podman is recommended because of the faster container startup times) +Since docker manages the dependencies of the container automatically you only need to install docker or podman itself. (Podman is recommended because of the faster container startup times. Note that podman and docker are interchangeable so no instructions will change depending on which one you use) Note: This will only work on linux systems since some kernel interfaces (like kvm) are needed by the vm. Because of this performance can vary in kernel versions (newer will likely perform better). -# Setup docker container \ No newline at end of file +# Setup docker container + +The easiest way to setup a windows vm is by using docker compose. Just create a `docker-compose.yml` with following content: + +```yaml +name: "winapps" + +volumes: + data: + +services: + windows: + image: dockurr/windows + container_name: windows + environment: + VERSION: "win11" + RAM_SIZE: "8G" + CPU_CORES: "4" + privileged: true + ports: + - 8006:8006 + - 3389:3389/tcp + - 3389:3389/udp + stop_grace_period: 2m + restart: on-failure + volumes: + - data:/storage +``` + +Now you can tune the ram/usage by changing RAM_SIZE/CPU_CORES. You can also specify the windows versions you want to use. + +Note: Older versions than Windows 10 are not officially supported. However they might still work with some additional tuning. \ No newline at end of file From 7151a3b756167dbbdc29eed2e51e9098d1bd1fb3 Mon Sep 17 00:00:00 2001 From: LDprg <71488985+LDprg@users.noreply.github.com> Date: Wed, 15 May 2024 06:46:34 +0200 Subject: [PATCH 022/187] Aktualisieren von README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7c05420..c0f490a 100644 --- a/README.md +++ b/README.md @@ -75,9 +75,10 @@ Note: The officially configured application list below is fueled by the communit ## Installation ### Step 1: Set up a Windows Virtual Machine -The best solution for running a VM as a subsystem for WinApps would be KVM. KVM is a CPU and memory-efficient virtualization engine bundled with most major Linux distributions. To set up the VM for WinApps, follow this guide: +The best solution for running a VM as a subsystem for WinApps would be docker. Docker allows to automise the install process and still uses kvm/qemu under the hood. We still provide the outdated KVM install instructions. -- [Creating a Virtual Machine in KVM](docs/KVM.md) +- [Creating a Virtual Machine with docker](docs/docker.md) +- [Creating a Virtual Machine in KVM (outdated)](docs/KVM.md) If you already have a Virtual Machine or server you wish to use with WinApps, you will need to merge `install/RDPApps.reg` into the VM's Windows Registry. If this VM is in KVM and you want to use auto-IP detection, you will need to name the machine `RDPWindows` (auto-IP detection not supported for non-KVM VMs). Directions for both of these can be found in the guide linked above. From 90f32e28f108328da860cd9a1034909896318a65 Mon Sep 17 00:00:00 2001 From: LDprg <71488985+LDprg@users.noreply.github.com> Date: Wed, 15 May 2024 06:55:25 +0200 Subject: [PATCH 023/187] Add Windows install instructions --- docs/docker.md | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/docs/docker.md b/docs/docker.md index f5e6789..5db0ab6 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -2,7 +2,7 @@ ## Why docker? -While working with virsh is completely fine for winapps you have to setup and optimise you vm manually. Docker on the other hand setups most of the stuff automatically and makes the vm highly portable between linux distros. +While working with virsh is completely fine for winapps, however you have to setup and optimise you vm manually. Docker on the other hand setups most of the stuff automatically and also makes the vm highly portable between linux distros. # Requirements @@ -41,4 +41,25 @@ services: Now you can tune the ram/usage by changing RAM_SIZE/CPU_CORES. You can also specify the windows versions you want to use. -Note: Older versions than Windows 10 are not officially supported. However they might still work with some additional tuning. \ No newline at end of file +Note: Older versions than Windows 10 are not officially supported. However they might still work with some additional tuning. + +You can now just run: +```shell +docker compose up +``` + +After this just open http://127.0.0.1:8006 in your webbrowser and finish you windows installation as usual. + +Note: RDP will be automatically enabled, however you still need to load the reg files into you vm. You VM IP is your localhost since all ports specified will be passed through. + +Now you should be ready to go and try to connect to your vm with winapps. + +For stopping the vm just use: +```shell +docker compose stop +``` + +For starting again afterwards use: +```shell +docker compose start +``` \ No newline at end of file From ccd524b37611c2eab4e8bbcdb51102475b3b8906 Mon Sep 17 00:00:00 2001 From: LDprg <71488985+LDprg@users.noreply.github.com> Date: Thu, 23 May 2024 17:09:42 +0200 Subject: [PATCH 024/187] Aktualisieren von docker.md --- docs/docker.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/docker.md b/docs/docker.md index 5db0ab6..c7b36af 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -50,7 +50,9 @@ docker compose up After this just open http://127.0.0.1:8006 in your webbrowser and finish you windows installation as usual. -Note: RDP will be automatically enabled, however you still need to load the reg files into you vm. You VM IP is your localhost since all ports specified will be passed through. +Change the RDP_IP config to localhost or "127.0.0.1. + +Note: RDP will be automatically enabled, however you still need to load the reg files into you vm. Now you should be ready to go and try to connect to your vm with winapps. From 78da7e128064d42fe9249c0c0299098095e830b6 Mon Sep 17 00:00:00 2001 From: LDprg Date: Thu, 23 May 2024 18:28:12 +0200 Subject: [PATCH 025/187] Add precommit repos --- .pre-commit-config.yaml | 52 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3cd863f..5a1df09 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,54 @@ ci: autoupdate_branch: "rewrite" -repos: [] +repos: + - repo: https://github.com/Lucas-C/pre-commit-hooks + rev: v1.5.5 + hooks: + - id: chmod + args: ["777"] + files: (\.sh|winapps)$ + - id: forbid-crlf + - id: remove-crlf + - id: forbid-tabs + - id: remove-tabs + args: [--whitespaces-count, "2"] + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: check-added-large-files + - id: check-case-conflict + - id: check-executables-have-shebangs + - id: check-json + - id: check-merge-conflict + - id: check-shebang-scripts-are-executable + - id: check-symlinks + - id: check-toml + - id: check-vcs-permalinks + - id: check-xml + - id: check-yaml + - id: destroyed-symlinks + - id: detect-private-key + - id: end-of-file-fixer + - id: fix-byte-order-marker + - id: forbid-new-submodules + - id: forbid-submodules + - id: mixed-line-ending + - id: pretty-format-json + args: ["--autofix", "--no-sort-keys"] + - id: sort-simple-yaml + - id: trailing-whitespace + + - repo: https://github.com/lovesegfault/beautysh + rev: v6.2.1 + hooks: + - id: beautysh + fail_fast: true + additional_dependencies: + - setuptools + + # - repo: https://github.com/shellcheck-py/shellcheck-py + # rev: v0.10.0.1 + # hooks: + # - id: shellcheck From d9a08384d951e648beb94a404049998bc1fe5d6b Mon Sep 17 00:00:00 2001 From: LDprg Date: Thu, 23 May 2024 18:30:03 +0200 Subject: [PATCH 026/187] add many fixes based on precommit --- README.md | 4 +- apps/acrobat-x-pro/icon.svg | 0 apps/adobe-cc/icon.svg | 2 +- apps/adobe-cc/info | 2 +- apps/aftereffects-cc/icon.svg | 2 +- apps/aftereffects-cc/info | 2 +- apps/audition-cc/icon.svg | 2 +- apps/audition-cc/info | 2 +- apps/bridge-cc/icon.svg | 2 +- apps/bridge-cc/info | 2 +- apps/bridge-cs6-x86/icon.svg | 2 +- apps/bridge-cs6-x86/info | 2 +- apps/bridge-cs6/icon.svg | 2 +- apps/bridge-cs6/info | 2 +- apps/cmd/info | 2 +- apps/excel-o365-x86/info | 2 +- apps/excel-o365/info | 2 +- apps/excel-x86/info | 2 +- apps/excel/info | 2 +- apps/illustrator-cc/icon.svg | 2 +- apps/illustrator-cc/info | 2 +- apps/indesign-cc/icon.svg | 2 +- apps/indesign-cc/info | 2 +- apps/lightroom-cc/icon.svg | 2 +- apps/lightroom-cc/info | 2 +- apps/onenote-o365-x86/icon.svg | 2 +- apps/onenote-o365-x86/info | 2 +- apps/onenote-o365/icon.svg | 2 +- apps/onenote-o365/info | 2 +- apps/onenote-x86/icon.svg | 2 +- apps/onenote-x86/info | 2 +- apps/onenote/icon.svg | 2 +- apps/onenote/info | 2 +- apps/outlook-o365-x86/info | 2 +- apps/outlook-o365/info | 2 +- apps/outlook-x86/info | 2 +- apps/outlook/info | 2 +- apps/photoshop-cc/icon.svg | 2 +- apps/photoshop-cc/info | 2 +- apps/photoshop-cs6-x86/icon.svg | 2 +- apps/photoshop-cs6-x86/info | 2 +- apps/photoshop-cs6/icon.svg | 2 +- apps/photoshop-cs6/info | 2 +- apps/powerpoint-o365-x86/info | 2 +- apps/powerpoint-o365/info | 2 +- apps/powerpoint-x86/info | 2 +- apps/powerpoint/info | 2 +- apps/publisher-o365-x86/icon.svg | 2 +- apps/publisher-o365/icon.svg | 2 +- apps/publisher-x86/icon.svg | 2 +- apps/publisher/icon.svg | 2 +- apps/word-o365-x86/info | 2 +- apps/word-o365/info | 2 +- apps/word-x86/info | 2 +- apps/word/info | 2 +- bin/winapps | 142 ++-- docs/KVM.md | 3 - icons/windows.svg | 6 +- install/ExtractPrograms.ps1 | 17 +- install/inquirer.sh | 1186 +++++++++++++++--------------- installer.sh | 560 +++++++------- kvm/RDPWindows.xml | 1 - 62 files changed, 1010 insertions(+), 1015 deletions(-) mode change 100755 => 100644 apps/acrobat-x-pro/icon.svg mode change 100755 => 100644 apps/adobe-cc/icon.svg mode change 100755 => 100644 apps/aftereffects-cc/icon.svg mode change 100755 => 100644 apps/audition-cc/icon.svg mode change 100755 => 100644 apps/bridge-cc/icon.svg mode change 100755 => 100644 apps/bridge-cs6-x86/icon.svg mode change 100755 => 100644 apps/bridge-cs6/icon.svg mode change 100755 => 100644 apps/illustrator-cc/icon.svg mode change 100755 => 100644 apps/indesign-cc/icon.svg mode change 100755 => 100644 apps/lightroom-cc/icon.svg diff --git a/README.md b/README.md index a798dd9..493dcce 100644 --- a/README.md +++ b/README.md @@ -97,8 +97,8 @@ git clone https://github.com/winapps-org/winapps.git cd winapps ``` -> [!note] -> Ideally grab freerdp 3.0.0 or later, especially if you're having issues. +> [!note] +> Ideally grab freerdp 3.0.0 or later, especially if you're having issues. > You can find nightly builds here: https://github.com/FreeRDP/FreeRDP/wiki/Prebuilds ### Step 3: Creating your WinApps configuration file diff --git a/apps/acrobat-x-pro/icon.svg b/apps/acrobat-x-pro/icon.svg old mode 100755 new mode 100644 diff --git a/apps/adobe-cc/icon.svg b/apps/adobe-cc/icon.svg old mode 100755 new mode 100644 index 9272652..6c124a4 --- a/apps/adobe-cc/icon.svg +++ b/apps/adobe-cc/icon.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/apps/adobe-cc/info b/apps/adobe-cc/info index c8a0051..42a62ba 100644 --- a/apps/adobe-cc/info +++ b/apps/adobe-cc/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Adobe" MIME_TYPES="" # System Icon -ICON="AdobeUpdate" \ No newline at end of file +ICON="AdobeUpdate" diff --git a/apps/aftereffects-cc/icon.svg b/apps/aftereffects-cc/icon.svg old mode 100755 new mode 100644 index 6b42dd7..677803b --- a/apps/aftereffects-cc/icon.svg +++ b/apps/aftereffects-cc/icon.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/apps/aftereffects-cc/info b/apps/aftereffects-cc/info index 76a96be..7181324 100644 --- a/apps/aftereffects-cc/info +++ b/apps/aftereffects-cc/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Adobe" MIME_TYPES="application/vnd.adobe.aftereffects.project;application/vnd.adobe.aftereffects.template;" # System Icon -ICON="AdobeAfterEffect" \ No newline at end of file +ICON="AdobeAfterEffect" diff --git a/apps/audition-cc/icon.svg b/apps/audition-cc/icon.svg old mode 100755 new mode 100644 index 01c32a6..af88949 --- a/apps/audition-cc/icon.svg +++ b/apps/audition-cc/icon.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/apps/audition-cc/info b/apps/audition-cc/info index 934abc3..b3bdde4 100644 --- a/apps/audition-cc/info +++ b/apps/audition-cc/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Adobe" MIME_TYPES="" # System Icon -ICON="AdobeAudition" \ No newline at end of file +ICON="AdobeAudition" diff --git a/apps/bridge-cc/icon.svg b/apps/bridge-cc/icon.svg old mode 100755 new mode 100644 index 6a84294..6fd0faa --- a/apps/bridge-cc/icon.svg +++ b/apps/bridge-cc/icon.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/apps/bridge-cc/info b/apps/bridge-cc/info index 02edf53..b4a8f09 100644 --- a/apps/bridge-cc/info +++ b/apps/bridge-cc/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Adobe" MIME_TYPES="image/vnd.adobe.photoshop;" # System Icon -ICON="AdobeBridge" \ No newline at end of file +ICON="AdobeBridge" diff --git a/apps/bridge-cs6-x86/icon.svg b/apps/bridge-cs6-x86/icon.svg old mode 100755 new mode 100644 index 6a84294..6fd0faa --- a/apps/bridge-cs6-x86/icon.svg +++ b/apps/bridge-cs6-x86/icon.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/apps/bridge-cs6-x86/info b/apps/bridge-cs6-x86/info index eaaa69a..1d8cf59 100644 --- a/apps/bridge-cs6-x86/info +++ b/apps/bridge-cs6-x86/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Adobe" MIME_TYPES="image/vnd.adobe.photoshop;" # System Icon -ICON="AdobeBridge" \ No newline at end of file +ICON="AdobeBridge" diff --git a/apps/bridge-cs6/icon.svg b/apps/bridge-cs6/icon.svg old mode 100755 new mode 100644 index 6a84294..6fd0faa --- a/apps/bridge-cs6/icon.svg +++ b/apps/bridge-cs6/icon.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/apps/bridge-cs6/info b/apps/bridge-cs6/info index 66b29fc..3fa52e8 100644 --- a/apps/bridge-cs6/info +++ b/apps/bridge-cs6/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Adobe" MIME_TYPES="image/vnd.adobe.photoshop;" # System Icon -ICON="AdobeBridge" \ No newline at end of file +ICON="AdobeBridge" diff --git a/apps/cmd/info b/apps/cmd/info index af457af..08e2e87 100644 --- a/apps/cmd/info +++ b/apps/cmd/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Windows" MIME_TYPES="" # System Icon -ICON="Terminal" \ No newline at end of file +ICON="Terminal" diff --git a/apps/excel-o365-x86/info b/apps/excel-o365-x86/info index e50b961..94b8372 100644 --- a/apps/excel-o365-x86/info +++ b/apps/excel-o365-x86/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Office" MIME_TYPES="application/vnd.ms-excel;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;application/vnd.openxmlformats-officedocument.spreadsheetml.template;application/vnd.ms-excel.sheet.macroEnabled.12;application/vnd.ms-excel.template.macroEnabled.12;application/vnd.ms-excel.addin.macroEnabled.12;application/vnd.ms-excel.sheet.binary.macroEnabled.12;" # System Icon -ICON="ms-excel"s \ No newline at end of file +ICON="ms-excel"s diff --git a/apps/excel-o365/info b/apps/excel-o365/info index 9671c74..e0e67e5 100644 --- a/apps/excel-o365/info +++ b/apps/excel-o365/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Office" MIME_TYPES="application/vnd.ms-excel;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;application/vnd.openxmlformats-officedocument.spreadsheetml.template;application/vnd.ms-excel.sheet.macroEnabled.12;application/vnd.ms-excel.template.macroEnabled.12;application/vnd.ms-excel.addin.macroEnabled.12;application/vnd.ms-excel.sheet.binary.macroEnabled.12;" # System Icon -ICON="ms-excel" \ No newline at end of file +ICON="ms-excel" diff --git a/apps/excel-x86/info b/apps/excel-x86/info index 5a71f70..bfdb56a 100644 --- a/apps/excel-x86/info +++ b/apps/excel-x86/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Office" MIME_TYPES="application/vnd.ms-excel;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;application/vnd.openxmlformats-officedocument.spreadsheetml.template;application/vnd.ms-excel.sheet.macroEnabled.12;application/vnd.ms-excel.template.macroEnabled.12;application/vnd.ms-excel.addin.macroEnabled.12;application/vnd.ms-excel.sheet.binary.macroEnabled.12;" # System Icon -ICON="ms-excel" \ No newline at end of file +ICON="ms-excel" diff --git a/apps/excel/info b/apps/excel/info index ad891ff..9ef5cb4 100644 --- a/apps/excel/info +++ b/apps/excel/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Office" MIME_TYPES="application/vnd.ms-excel;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;application/vnd.openxmlformats-officedocument.spreadsheetml.template;application/vnd.ms-excel.sheet.macroEnabled.12;application/vnd.ms-excel.template.macroEnabled.12;application/vnd.ms-excel.addin.macroEnabled.12;application/vnd.ms-excel.sheet.binary.macroEnabled.12;" # System Icon -ICON="ms-excel" \ No newline at end of file +ICON="ms-excel" diff --git a/apps/illustrator-cc/icon.svg b/apps/illustrator-cc/icon.svg old mode 100755 new mode 100644 index 7ea299b..21d31b3 --- a/apps/illustrator-cc/icon.svg +++ b/apps/illustrator-cc/icon.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/apps/illustrator-cc/info b/apps/illustrator-cc/info index c8ba5da..58af241 100644 --- a/apps/illustrator-cc/info +++ b/apps/illustrator-cc/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Adobe" MIME_TYPES="application/illustrator;" # System Icon -ICON="AdobeIllustrator" \ No newline at end of file +ICON="AdobeIllustrator" diff --git a/apps/indesign-cc/icon.svg b/apps/indesign-cc/icon.svg old mode 100755 new mode 100644 index f26dead..ceaa431 --- a/apps/indesign-cc/icon.svg +++ b/apps/indesign-cc/icon.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/apps/indesign-cc/info b/apps/indesign-cc/info index b60a80e..481b2dc 100644 --- a/apps/indesign-cc/info +++ b/apps/indesign-cc/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Adobe" MIME_TYPES="application/x-adobe-indesign-interchange;application/x-adobe-indesign;" # System Icon -ICON="AdobeIndesign" \ No newline at end of file +ICON="AdobeIndesign" diff --git a/apps/lightroom-cc/icon.svg b/apps/lightroom-cc/icon.svg old mode 100755 new mode 100644 index 9a02e00..6d10ba7 --- a/apps/lightroom-cc/icon.svg +++ b/apps/lightroom-cc/icon.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/apps/lightroom-cc/info b/apps/lightroom-cc/info index 23ef96b..a2cdb25 100644 --- a/apps/lightroom-cc/info +++ b/apps/lightroom-cc/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Adobe" MIME_TYPES="" # System Icon -ICON="AdobeLightroom" \ No newline at end of file +ICON="AdobeLightroom" diff --git a/apps/onenote-o365-x86/icon.svg b/apps/onenote-o365-x86/icon.svg index b76f325..cf85277 100644 --- a/apps/onenote-o365-x86/icon.svg +++ b/apps/onenote-o365-x86/icon.svg @@ -1,3 +1,3 @@ - \ No newline at end of file + diff --git a/apps/onenote-o365-x86/info b/apps/onenote-o365-x86/info index 1ce4872..335e780 100644 --- a/apps/onenote-o365-x86/info +++ b/apps/onenote-o365-x86/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Office" MIME_TYPES="application/msonenote;" # System Icon -ICON="ms-outlook" \ No newline at end of file +ICON="ms-outlook" diff --git a/apps/onenote-o365/icon.svg b/apps/onenote-o365/icon.svg index b76f325..cf85277 100644 --- a/apps/onenote-o365/icon.svg +++ b/apps/onenote-o365/icon.svg @@ -1,3 +1,3 @@ - \ No newline at end of file + diff --git a/apps/onenote-o365/info b/apps/onenote-o365/info index 248fea3..6626816 100644 --- a/apps/onenote-o365/info +++ b/apps/onenote-o365/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Office" MIME_TYPES="application/msonenote;" # System Icon -ICON="ms-outlook" \ No newline at end of file +ICON="ms-outlook" diff --git a/apps/onenote-x86/icon.svg b/apps/onenote-x86/icon.svg index b76f325..cf85277 100644 --- a/apps/onenote-x86/icon.svg +++ b/apps/onenote-x86/icon.svg @@ -1,3 +1,3 @@ - \ No newline at end of file + diff --git a/apps/onenote-x86/info b/apps/onenote-x86/info index cf68779..e535123 100644 --- a/apps/onenote-x86/info +++ b/apps/onenote-x86/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Office" MIME_TYPES="application/msonenote;" # System Icon -ICON="ms-onenote" \ No newline at end of file +ICON="ms-onenote" diff --git a/apps/onenote/icon.svg b/apps/onenote/icon.svg index b76f325..cf85277 100644 --- a/apps/onenote/icon.svg +++ b/apps/onenote/icon.svg @@ -1,3 +1,3 @@ - \ No newline at end of file + diff --git a/apps/onenote/info b/apps/onenote/info index d6e6636..908f58e 100644 --- a/apps/onenote/info +++ b/apps/onenote/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Office" MIME_TYPES="application/msonenote;" # System Icon -ICON="ms-outlook" \ No newline at end of file +ICON="ms-outlook" diff --git a/apps/outlook-o365-x86/info b/apps/outlook-o365-x86/info index 31f5746..9a528f4 100644 --- a/apps/outlook-o365-x86/info +++ b/apps/outlook-o365-x86/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Office" MIME_TYPES="application/vnd.ms-outlook;application/octet-stream;" # System Icon -ICON="ms-outlook" \ No newline at end of file +ICON="ms-outlook" diff --git a/apps/outlook-o365/info b/apps/outlook-o365/info index f248cab..4763b83 100644 --- a/apps/outlook-o365/info +++ b/apps/outlook-o365/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Office" MIME_TYPES="application/vnd.ms-outlook;application/octet-stream;" # System Icon -ICON="ms-outlook" \ No newline at end of file +ICON="ms-outlook" diff --git a/apps/outlook-x86/info b/apps/outlook-x86/info index 9f68b8e..4874db3 100644 --- a/apps/outlook-x86/info +++ b/apps/outlook-x86/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Office" MIME_TYPES="application/vnd.ms-outlook;application/octet-stream;" # System Icon -ICON="ms-outlook" \ No newline at end of file +ICON="ms-outlook" diff --git a/apps/outlook/info b/apps/outlook/info index d990949..43453c6 100644 --- a/apps/outlook/info +++ b/apps/outlook/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Office" MIME_TYPES="application/vnd.ms-outlook;application/octet-stream;" # System Icon -ICON="ms-outlook" \ No newline at end of file +ICON="ms-outlook" diff --git a/apps/photoshop-cc/icon.svg b/apps/photoshop-cc/icon.svg index a9d19f7..9565f6d 100644 --- a/apps/photoshop-cc/icon.svg +++ b/apps/photoshop-cc/icon.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/apps/photoshop-cc/info b/apps/photoshop-cc/info index 8f8a220..a7413d6 100644 --- a/apps/photoshop-cc/info +++ b/apps/photoshop-cc/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Adobe" MIME_TYPES="image/vnd.adobe.photoshop;" # System Icon -ICON="AdobePhotoshop" \ No newline at end of file +ICON="AdobePhotoshop" diff --git a/apps/photoshop-cs6-x86/icon.svg b/apps/photoshop-cs6-x86/icon.svg index a9d19f7..9565f6d 100644 --- a/apps/photoshop-cs6-x86/icon.svg +++ b/apps/photoshop-cs6-x86/icon.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/apps/photoshop-cs6-x86/info b/apps/photoshop-cs6-x86/info index 2a23552..16d8911 100644 --- a/apps/photoshop-cs6-x86/info +++ b/apps/photoshop-cs6-x86/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Adobe" MIME_TYPES="image/vnd.adobe.photoshop;" # System Icon -ICON="AdobePhotoshop" \ No newline at end of file +ICON="AdobePhotoshop" diff --git a/apps/photoshop-cs6/icon.svg b/apps/photoshop-cs6/icon.svg index a9d19f7..9565f6d 100644 --- a/apps/photoshop-cs6/icon.svg +++ b/apps/photoshop-cs6/icon.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/apps/photoshop-cs6/info b/apps/photoshop-cs6/info index bc1d939..24cb454 100644 --- a/apps/photoshop-cs6/info +++ b/apps/photoshop-cs6/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Adobe" MIME_TYPES="image/vnd.adobe.photoshop;" # System Icon -ICON="AdobePhotoshop" \ No newline at end of file +ICON="AdobePhotoshop" diff --git a/apps/powerpoint-o365-x86/info b/apps/powerpoint-o365-x86/info index 9c89d89..755acc6 100644 --- a/apps/powerpoint-o365-x86/info +++ b/apps/powerpoint-o365-x86/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Office" MIME_TYPES="application/vnd.ms-powerpoint;application/vnd.openxmlformats-officedocument.presentationml.presentation;application/vnd.openxmlformats-officedocument.presentationml.template;application/vnd.openxmlformats-officedocument.presentationml.slideshow;application/vnd.ms-powerpoint.addin.macroEnabled.12;application/vnd.ms-powerpoint.presentation.macroEnabled.12;application/vnd.ms-powerpoint.template.macroEnabled.12;application/vnd.ms-powerpoint.slideshow.macroEnabled.12;" # System Icon -ICON="ms-powerpoint" \ No newline at end of file +ICON="ms-powerpoint" diff --git a/apps/powerpoint-o365/info b/apps/powerpoint-o365/info index ce16e08..a0d25d2 100644 --- a/apps/powerpoint-o365/info +++ b/apps/powerpoint-o365/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Office" MIME_TYPES="application/vnd.ms-powerpoint;application/vnd.openxmlformats-officedocument.presentationml.presentation;application/vnd.openxmlformats-officedocument.presentationml.template;application/vnd.openxmlformats-officedocument.presentationml.slideshow;application/vnd.ms-powerpoint.addin.macroEnabled.12;application/vnd.ms-powerpoint.presentation.macroEnabled.12;application/vnd.ms-powerpoint.template.macroEnabled.12;application/vnd.ms-powerpoint.slideshow.macroEnabled.12;" # System Icon -ICON="ms-powerpoint" \ No newline at end of file +ICON="ms-powerpoint" diff --git a/apps/powerpoint-x86/info b/apps/powerpoint-x86/info index 409318f..21ba721 100644 --- a/apps/powerpoint-x86/info +++ b/apps/powerpoint-x86/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Office" MIME_TYPES="application/vnd.ms-powerpoint;application/vnd.openxmlformats-officedocument.presentationml.presentation;application/vnd.openxmlformats-officedocument.presentationml.template;application/vnd.openxmlformats-officedocument.presentationml.slideshow;application/vnd.ms-powerpoint.addin.macroEnabled.12;application/vnd.ms-powerpoint.presentation.macroEnabled.12;application/vnd.ms-powerpoint.template.macroEnabled.12;application/vnd.ms-powerpoint.slideshow.macroEnabled.12;" # System Icon -ICON="ms-powerpoint" \ No newline at end of file +ICON="ms-powerpoint" diff --git a/apps/powerpoint/info b/apps/powerpoint/info index e08c80d..6910809 100644 --- a/apps/powerpoint/info +++ b/apps/powerpoint/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Office" MIME_TYPES="application/vnd.ms-powerpoint;application/vnd.openxmlformats-officedocument.presentationml.presentation;application/vnd.openxmlformats-officedocument.presentationml.template;application/vnd.openxmlformats-officedocument.presentationml.slideshow;application/vnd.ms-powerpoint.addin.macroEnabled.12;application/vnd.ms-powerpoint.presentation.macroEnabled.12;application/vnd.ms-powerpoint.template.macroEnabled.12;application/vnd.ms-powerpoint.slideshow.macroEnabled.12;" # System Icon -ICON="ms-powerpoint" \ No newline at end of file +ICON="ms-powerpoint" diff --git a/apps/publisher-o365-x86/icon.svg b/apps/publisher-o365-x86/icon.svg index 6706891..82b310e 100644 --- a/apps/publisher-o365-x86/icon.svg +++ b/apps/publisher-o365-x86/icon.svg @@ -1,3 +1,3 @@ - + diff --git a/apps/publisher-o365/icon.svg b/apps/publisher-o365/icon.svg index 6706891..82b310e 100644 --- a/apps/publisher-o365/icon.svg +++ b/apps/publisher-o365/icon.svg @@ -1,3 +1,3 @@ - + diff --git a/apps/publisher-x86/icon.svg b/apps/publisher-x86/icon.svg index 6706891..82b310e 100644 --- a/apps/publisher-x86/icon.svg +++ b/apps/publisher-x86/icon.svg @@ -1,3 +1,3 @@ - + diff --git a/apps/publisher/icon.svg b/apps/publisher/icon.svg index 6706891..82b310e 100644 --- a/apps/publisher/icon.svg +++ b/apps/publisher/icon.svg @@ -1,3 +1,3 @@ - + diff --git a/apps/word-o365-x86/info b/apps/word-o365-x86/info index 8a3011a..b2d853d 100644 --- a/apps/word-o365-x86/info +++ b/apps/word-o365-x86/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Office" MIME_TYPES="application/msword;application/vnd.openxmlformats-officedocument.wordprocessingml.document;application/vnd.openxmlformats-officedocument.wordprocessingml.template;application/vnd.ms-word.document.macroEnabled.12;application/vnd.ms-word.template.macroEnabled.12;" # System Icon -ICON="ms-word" \ No newline at end of file +ICON="ms-word" diff --git a/apps/word-o365/info b/apps/word-o365/info index 4223a4d..0632b79 100644 --- a/apps/word-o365/info +++ b/apps/word-o365/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Office" MIME_TYPES="application/msword;application/vnd.openxmlformats-officedocument.wordprocessingml.document;application/vnd.openxmlformats-officedocument.wordprocessingml.template;application/vnd.ms-word.document.macroEnabled.12;application/vnd.ms-word.template.macroEnabled.12;" # System Icon -ICON="ms-word" \ No newline at end of file +ICON="ms-word" diff --git a/apps/word-x86/info b/apps/word-x86/info index ffe7a81..b35c54e 100644 --- a/apps/word-x86/info +++ b/apps/word-x86/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Office" MIME_TYPES="application/msword;application/vnd.openxmlformats-officedocument.wordprocessingml.document;application/vnd.openxmlformats-officedocument.wordprocessingml.template;application/vnd.ms-word.document.macroEnabled.12;application/vnd.ms-word.template.macroEnabled.12;" # System Icon -ICON="ms-word" \ No newline at end of file +ICON="ms-word" diff --git a/apps/word/info b/apps/word/info index 62b6774..a1dfd71 100644 --- a/apps/word/info +++ b/apps/word/info @@ -14,4 +14,4 @@ CATEGORIES="WinApps;Office" MIME_TYPES="application/msword;application/vnd.openxmlformats-officedocument.wordprocessingml.document;application/vnd.openxmlformats-officedocument.wordprocessingml.template;application/vnd.ms-word.document.macroEnabled.12;application/vnd.ms-word.template.macroEnabled.12;" # System Icon -ICON="ms-word" \ No newline at end of file +ICON="ms-word" diff --git a/bin/winapps b/bin/winapps index 03bd9e7..3fec6fb 100755 --- a/bin/winapps +++ b/bin/winapps @@ -1,75 +1,75 @@ #!/usr/bin/env bash if [ ! -f "${HOME}/.config/winapps/winapps.conf" ] && [ ! -f "${HOME}/.winapps" ]; then - echo "You need to create a ~/.config/winapps/winapps.conf configuration. Exiting..." - exit + echo "You need to create a ~/.config/winapps/winapps.conf configuration. Exiting..." + exit fi DIR="$(dirname "$(readlink -f "$0")")" RUN="$(date)-${RANDOM}" if [ ! -d "${HOME}/.local/share/winapps" ]; then - mkdir -p "${HOME}/.local/share/winapps" + mkdir -p "${HOME}/.local/share/winapps" fi RDP_SCALE=100 if [ -f "${HOME}/.config/winapps/winapps.conf" ]; then - . "${HOME}/.config/winapps/winapps.conf" + . "${HOME}/.config/winapps/winapps.conf" else - . "${HOME}/.winapps" + . "${HOME}/.winapps" fi function dprint() { - if [ "${DEBUG}" = "true" ]; then - echo "[${RUN}] ${1}" >>"${HOME}/.local/share/winapps/winapps.log" - fi + if [ "${DEBUG}" = "true" ]; then + echo "[${RUN}] ${1}" >>"${HOME}/.local/share/winapps/winapps.log" + fi } dprint "START" if [ -f "${HOME}/.local/share/winapps/run" ]; then - LAST_RAN=$(stat -t -c %Y "${HOME}/.local/share/winapps/run") - dprint "LAST_RAN:${LAST_RAN}" - touch "${HOME}/.local/share/winapps/run" - THIS_RUN=$(stat -t -c %Y "${HOME}/.local/share/winapps/run") - dprint "THIS_RUN:${THIS_RUN}" - if ((THIS_RUN - LAST_RAN < 2)); then - exit - fi + LAST_RAN=$(stat -t -c %Y "${HOME}/.local/share/winapps/run") + dprint "LAST_RAN:${LAST_RAN}" + touch "${HOME}/.local/share/winapps/run" + THIS_RUN=$(stat -t -c %Y "${HOME}/.local/share/winapps/run") + dprint "THIS_RUN:${THIS_RUN}" + if ((THIS_RUN - LAST_RAN < 2)); then + exit + fi else - touch "${HOME}/.local/share/winapps/run" + touch "${HOME}/.local/share/winapps/run" fi if [ -z "${FREERDP_COMMAND}" ]; then - if command -v xfreerdp &> /dev/null - then - FREERDP_COMMAND="xfreerdp" - elif command -v xfreerdp3 &> /dev/null - then - FREERDP_COMMAND="xfreerdp3" - fi + if command -v xfreerdp &> /dev/null + then + FREERDP_COMMAND="xfreerdp" + elif command -v xfreerdp3 &> /dev/null + then + FREERDP_COMMAND="xfreerdp3" + fi elif command -v $FREERDP_COMMAND &> /dev/null then - dprint "Using custom freerdp command ${FREERDP_COMMAND}" + dprint "Using custom freerdp command ${FREERDP_COMMAND}" else - echo "You have supplied a custom FreeRDP command, but the command is not available." - exit + echo "You have supplied a custom FreeRDP command, but the command is not available." + exit fi if [ -z "${RDP_IP}" ]; then - if [ ! "$(groups | grep -v libvirt)" ]; then - echo "You are not a member of the libvirt group. Run the below then reboot." - echo ' sudo usermod -a -G libvirt $(whoami)' - echo ' sudo usermod -a -G kvm $(whoami)' - exit - fi - if [ ! "$(virsh list | grep -v RDPWindows)" ]; then - echo "RDPWindows is not running, run:" - echo " virsh start RDPWindows" - exit - fi - RDP_IP=$(virsh net-dhcp-leases default | grep RDPWindows | awk '{print $5}') - RDP_IP=${RDP_IP%%\/*} + if [ ! "$(groups | grep -v libvirt)" ]; then + echo "You are not a member of the libvirt group. Run the below then reboot." + echo ' sudo usermod -a -G libvirt $(whoami)' + echo ' sudo usermod -a -G kvm $(whoami)' + exit + fi + if [ ! "$(virsh list | grep -v RDPWindows)" ]; then + echo "RDPWindows is not running, run:" + echo " virsh start RDPWindows" + exit + fi + RDP_IP=$(virsh net-dhcp-leases default | grep RDPWindows | awk '{print $5}') + RDP_IP=${RDP_IP%%\/*} fi @@ -81,43 +81,43 @@ dprint "@:${@}" MULTI_FLAG="+span" if [ "${MULTIMON}" = "true" ]; then - MULTI_FLAG="/multimon" + MULTI_FLAG="/multimon" fi if [ "${1}" = "windows" ]; then - $FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +dynamic-resolution +auto-reconnect +home-drive /wm-class:"Microsoft Windows" /v:${RDP_IP} 1>/dev/null 2>&1 & + $FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +dynamic-resolution +auto-reconnect +home-drive /wm-class:"Microsoft Windows" /v:${RDP_IP} 1>/dev/null 2>&1 & elif [ "${1}" = "check" ]; then - dprint "CHECK" - $FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +auto-reconnect +home-drive -wallpaper +dynamic-resolution ${MULTI_FLAG} /app:program:"explorer.exe" /v:${RDP_IP} + dprint "CHECK" + $FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +auto-reconnect +home-drive -wallpaper +dynamic-resolution ${MULTI_FLAG} /app:program:"explorer.exe" /v:${RDP_IP} elif [ "${1}" = "manual" ]; then - dprint "MANUAL:${2}" - $FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +auto-reconnect +home-drive +dynamic-resolution ${MULTI_FLAG} /app:program:"${2}" /v:"${RDP_IP}" 1>/dev/null 2>&1 & + dprint "MANUAL:${2}" + $FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +auto-reconnect +home-drive +dynamic-resolution ${MULTI_FLAG} /app:program:"${2}" /v:"${RDP_IP}" 1>/dev/null 2>&1 & elif [ "${1}" != "install" ]; then - dprint "DIR:${DIR}" - if [ -e "${DIR}/../apps/${1}/info" ]; then - # shellcheck disable=SC1090 - . "${DIR}/../apps/${1}/info" - ICON="${DIR}/../apps/${1}/icon.svg" - elif [ -e "${HOME}/.local/share/winapps/apps/${1}/info" ]; then - # shellcheck disable=SC1090 - . "${HOME}/.local/share/winapps/apps/${1}/info" - ICON="${HOME}/.local/share/winapps/apps/${1}/icon.svg" - elif [ -e "/usr/local/share/winapps/apps/${1}/info" ]; then - # shellcheck disable=SC1090 - . "/usr/local/share/winapps/apps/${1}/info" - ICON="/usr/local/share/winapps/apps/${1}/icon.svg" - else - echo "You need to run 'installer.sh' first." - exit 1 - fi - if [ -n "${2}" ]; then - dprint "HOME:${HOME}" - FILE=$(echo "${2}" | sed 's|'"${HOME}"'|\\\\tsclient\\home|;s|/|\\|g;s|\\|\\\\|g') - dprint "FILE:${FILE}" - $FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +auto-reconnect +clipboard +home-drive -wallpaper +dynamic-resolution ${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:program:"${WIN_EXECUTABLE}",icon:"${ICON}",name:"${FULL_NAME}",cmd:"\"$FILE\"" /v:"${RDP_IP}" 1>/dev/null 2>&1 & - else - $FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +auto-reconnect +clipboard +home-drive -wallpaper +dynamic-resolution ${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:program:"${WIN_EXECUTABLE}",icon:"${ICON}",name:"${FULL_NAME}" /v:"${RDP_IP}" 1>/dev/null 2>&1 & - fi + dprint "DIR:${DIR}" + if [ -e "${DIR}/../apps/${1}/info" ]; then + # shellcheck disable=SC1090 + . "${DIR}/../apps/${1}/info" + ICON="${DIR}/../apps/${1}/icon.svg" + elif [ -e "${HOME}/.local/share/winapps/apps/${1}/info" ]; then + # shellcheck disable=SC1090 + . "${HOME}/.local/share/winapps/apps/${1}/info" + ICON="${HOME}/.local/share/winapps/apps/${1}/icon.svg" + elif [ -e "/usr/local/share/winapps/apps/${1}/info" ]; then + # shellcheck disable=SC1090 + . "/usr/local/share/winapps/apps/${1}/info" + ICON="/usr/local/share/winapps/apps/${1}/icon.svg" + else + echo "You need to run 'installer.sh' first." + exit 1 + fi + if [ -n "${2}" ]; then + dprint "HOME:${HOME}" + FILE=$(echo "${2}" | sed 's|'"${HOME}"'|\\\\tsclient\\home|;s|/|\\|g;s|\\|\\\\|g') + dprint "FILE:${FILE}" + $FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +auto-reconnect +clipboard +home-drive -wallpaper +dynamic-resolution ${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:program:"${WIN_EXECUTABLE}",icon:"${ICON}",name:"${FULL_NAME}",cmd:"\"$FILE\"" /v:"${RDP_IP}" 1>/dev/null 2>&1 & + else + $FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +auto-reconnect +clipboard +home-drive -wallpaper +dynamic-resolution ${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:program:"${WIN_EXECUTABLE}",icon:"${ICON}",name:"${FULL_NAME}" /v:"${RDP_IP}" 1>/dev/null 2>&1 & + fi fi dprint "END" diff --git a/docs/KVM.md b/docs/KVM.md index dea6e93..ea65b27 100644 --- a/docs/KVM.md +++ b/docs/KVM.md @@ -198,6 +198,3 @@ sudo systemctl restart libvirtd sudo ln -s /etc/apparmor.d/usr.sbin.libvirtd /etc/apparmor.d/disable/ ``` You will likely need to reboot to ensure your current shell is added to the group. - - - diff --git a/icons/windows.svg b/icons/windows.svg index aff2730..6296a2a 100644 --- a/icons/windows.svg +++ b/icons/windows.svg @@ -1,3 +1,3 @@ - - - + + + diff --git a/install/ExtractPrograms.ps1 b/install/ExtractPrograms.ps1 index 0111190..eff0a08 100644 --- a/install/ExtractPrograms.ps1 +++ b/install/ExtractPrograms.ps1 @@ -63,7 +63,7 @@ Function Get-Icon { .EXAMPLE Get-Icon -Path 'C:\windows\system32\WindowsPowerShell\v1.0\PowerShell.exe' -ToBitmap - Tag : + Tag : PhysicalDimension : {Width=32, Height=32} Size : {Width=32, Height=32} Width : 32 @@ -173,25 +173,25 @@ Function Get-Icon { $Path = Convert-Path -Path $Path Write-Debug $Path If (Test-Path -Path $Path) { - #$Icon = [System.Drawing.Icon]::ExtractAssociatedIcon($Path)| - $Icon = [System.Drawing.Icon]::ExtractAssociatedIcon($Path)| + #$Icon = [System.Drawing.Icon]::ExtractAssociatedIcon($Path)| + $Icon = [System.Drawing.Icon]::ExtractAssociatedIcon($Path)| Add-Member -MemberType NoteProperty -Name FullName -Value $Path -PassThru If ($PSBoundParameters.ContainsKey('ToBytes')) { Write-Verbose "Retrieving bytes" $MemoryStream = New-Object System.IO.MemoryStream $Icon.save($MemoryStream) Write-Debug ($MemoryStream | Out-String) - $MemoryStream.ToArray() - $MemoryStream.Flush() - $MemoryStream.Dispose() + $MemoryStream.ToArray() + $MemoryStream.Flush() + $MemoryStream.Dispose() } ElseIf ($PSBoundParameters.ContainsKey('ToBitmap')) { $Icon.ToBitMap() } ElseIf ($PSBoundParameters.ContainsKey('ToBase64')) { $MemoryStream = New-Object System.IO.MemoryStream $Icon.save($MemoryStream) Write-Debug ($MemoryStream | Out-String) - $Bytes = $MemoryStream.ToArray() - $MemoryStream.Flush() + $Bytes = $MemoryStream.ToArray() + $MemoryStream.Flush() $MemoryStream.Dispose() [convert]::ToBase64String($Bytes) } Else { @@ -219,4 +219,3 @@ Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\*" | "EXES+=(""$Exe"")" "ICONS+=(""$Icon"")" } - diff --git a/install/inquirer.sh b/install/inquirer.sh index 00194a8..917e928 100755 --- a/install/inquirer.sh +++ b/install/inquirer.sh @@ -49,785 +49,785 @@ normal="$(tput sgr0)" dim=$'\e[2m' print() { - echo "$1" - tput el + echo "$1" + tput el } join() { - local IFS=$'\n' - local _join_list - eval _join_list=( '"${'${1}'[@]}"' ) - local first=true - for item in ${_join_list[@]}; do - if [ "$first" = true ]; then - printf "%s" "$item" - first=false - else - printf "${2-, }%s" "$item" - fi - done + local IFS=$'\n' + local _join_list + eval _join_list=( '"${'${1}'[@]}"' ) + local first=true + for item in ${_join_list[@]}; do + if [ "$first" = true ]; then + printf "%s" "$item" + first=false + else + printf "${2-, }%s" "$item" + fi + done } function gen_env_from_options() { - local IFS=$'\n' - local _indices - local _env_names - local _checkbox_selected - eval _indices=( '"${'${1}'[@]}"' ) - eval _env_names=( '"${'${2}'[@]}"' ) + local IFS=$'\n' + local _indices + local _env_names + local _checkbox_selected + eval _indices=( '"${'${1}'[@]}"' ) + eval _env_names=( '"${'${2}'[@]}"' ) - for i in $(gen_index ${#_env_names[@]}); do - _checkbox_selected[$i]=false - done + for i in $(gen_index ${#_env_names[@]}); do + _checkbox_selected[$i]=false + done - for i in ${_indices[@]}; do - _checkbox_selected[$i]=true - done + for i in ${_indices[@]}; do + _checkbox_selected[$i]=true + done - for i in $(gen_index ${#_env_names[@]}); do - printf "%s=%s\n" "${_env_names[$i]}" "${_checkbox_selected[$i]}" - done + for i in $(gen_index ${#_env_names[@]}); do + printf "%s=%s\n" "${_env_names[$i]}" "${_checkbox_selected[$i]}" + done } on_default() { - true; + true; } on_keypress() { - local OLD_IFS - local IFS - local key - OLD_IFS=$IFS - local on_up=${1:-on_default} - local on_down=${2:-on_default} - local on_space=${3:-on_default} - local on_enter=${4:-on_default} - local on_left=${5:-on_default} - local on_right=${6:-on_default} - local on_ascii=${7:-on_default} - local on_backspace=${8:-on_default} - _break_keypress=false - while IFS="" read -rsn1 key; do - case "$key" in - $'\x1b') - read -rsn1 key - if [[ "$key" == "[" ]]; then - read -rsn1 key - case "$key" in - 'A') eval $on_up;; - 'B') eval $on_down;; - 'D') eval $on_left;; - 'C') eval $on_right;; - esac - fi - ;; - ' ') eval $on_space ' ';; - [a-z0-9A-Z\!\#\$\&\+\,\-\.\/\;\=\?\@\[\]\^\_\{\}\~]) eval $on_ascii $key;; - $'\x7f') eval $on_backspace $key;; - '') eval $on_enter $key;; - esac - if [ $_break_keypress = true ]; then - break - fi - done - IFS=$OLD_IFS + local OLD_IFS + local IFS + local key + OLD_IFS=$IFS + local on_up=${1:-on_default} + local on_down=${2:-on_default} + local on_space=${3:-on_default} + local on_enter=${4:-on_default} + local on_left=${5:-on_default} + local on_right=${6:-on_default} + local on_ascii=${7:-on_default} + local on_backspace=${8:-on_default} + _break_keypress=false + while IFS="" read -rsn1 key; do + case "$key" in + $'\x1b') + read -rsn1 key + if [[ "$key" == "[" ]]; then + read -rsn1 key + case "$key" in + 'A') eval $on_up ;; + 'B') eval $on_down ;; + 'D') eval $on_left ;; + 'C') eval $on_right ;; + esac + fi + ;; + ' ') eval $on_space ' ' ;; + [a-z0-9A-Z\!\#\$\&\+\,\-\.\/\;\=\?\@\[\]\^\_\{\}\~]) eval $on_ascii $key ;; + $'\x7f') eval $on_backspace $key ;; + '') eval $on_enter $key ;; + esac + if [ $_break_keypress = true ]; then + break + fi + done + IFS=$OLD_IFS } gen_index() { - local k=$1 - local l=0 - if [ $k -gt 0 ]; then - for l in $(seq $k) - do - echo "$l-1" | bc - done - fi + local k=$1 + local l=0 + if [ $k -gt 0 ]; then + for l in $(seq $k) + do + echo "$l-1" | bc + done + fi } cleanup() { - # Reset character attributes, make cursor visible, and restore - # previous screen contents (if possible). - tput sgr0 - tput cnorm - stty echo + # Reset character attributes, make cursor visible, and restore + # previous screen contents (if possible). + tput sgr0 + tput cnorm + stty echo - # Restore `set e` option to its orignal value - if [[ $OLD_SET =~ e ]] - then set -e - else set +e - fi + # Restore `set e` option to its orignal value + if [[ $OLD_SET =~ e ]] + then set -e + else set +e + fi } control_c() { - cleanup - exit $? + cleanup + exit $? } select_indices() { - local _select_list - local _select_indices - local _select_selected=() - eval _select_list=( '"${'${1}'[@]}"' ) - eval _select_indices=( '"${'${2}'[@]}"' ) - local _select_var_name=$3 - eval $_select_var_name\=\(\) - for i in $(gen_index ${#_select_indices[@]}); do - eval $_select_var_name\+\=\(\""${_select_list[${_select_indices[$i]}]}"\"\) - done + local _select_list + local _select_indices + local _select_selected=() + eval _select_list=( '"${'${1}'[@]}"' ) + eval _select_indices=( '"${'${2}'[@]}"' ) + local _select_var_name=$3 + eval $_select_var_name\=\(\) + for i in $(gen_index ${#_select_indices[@]}); do + eval $_select_var_name\+\=\(\""${_select_list[${_select_indices[$i]}]}"\"\) + done } print_checkbox_line_arrow() { - if [ "${_checkbox_selected[$1]}" = true ]; then - printf "${cyan}${arrow}${green}${checked}${normal} ${_checkbox_list[$1]} ${normal}" - else - printf "${cyan}${arrow}${normal}${unchecked} ${_checkbox_list[$1]} ${normal}" - fi + if [ "${_checkbox_selected[$1]}" = true ]; then + printf "${cyan}${arrow}${green}${checked}${normal} ${_checkbox_list[$1]} ${normal}" + else + printf "${cyan}${arrow}${normal}${unchecked} ${_checkbox_list[$1]} ${normal}" + fi } print_checkbox_line() { - if [ "${_checkbox_selected[$1]}" = true ]; then - printf " ${green}${checked}${normal} ${_checkbox_list[$1]} ${normal}" - else - printf " ${normal}${unchecked} ${_checkbox_list[$1]} ${normal}" - fi + if [ "${_checkbox_selected[$1]}" = true ]; then + printf " ${green}${checked}${normal} ${_checkbox_list[$1]} ${normal}" + else + printf " ${normal}${unchecked} ${_checkbox_list[$1]} ${normal}" + fi } # https://www.gnu.org/software/termutils/manual/termutils-2.0/html_chapter/tput_1.html # http://linuxcommand.org/lc3_adv_tput.php on_checkbox_input_up2() { - #remove_checkbox_instructions - tput cub "$(tput cols)" - - if [ "${_checkbox_selected[$_current_index]}" = true ]; then - printf " ${green}${checked}${normal} ${_checkbox_list[$_current_index]} ${normal}" - else - printf " ${unchecked} ${_checkbox_list[$_current_index]} ${normal}" - fi - tput el - - if [ $_current_index = 0 ]; then - _current_index=$((${#_checkbox_list[@]}-1)) - tput cud $((${#_checkbox_list[@]}-1)) + #remove_checkbox_instructions tput cub "$(tput cols)" - else - _current_index=$((_current_index-1)) - tput cuu1 # Up one line - tput cub "$(tput cols)" # Back to beginning (does this work?) - tput el # Clear to end of line - fi + if [ "${_checkbox_selected[$_current_index]}" = true ]; then + printf " ${green}${checked}${normal} ${_checkbox_list[$_current_index]} ${normal}" + else + printf " ${unchecked} ${_checkbox_list[$_current_index]} ${normal}" + fi + tput el - if [ "${_checkbox_selected[$_current_index]}" = true ]; then - printf "${cyan}${arrow}${green}${checked}${normal} ${_checkbox_list[$_current_index]} ${normal}" - else - printf "${cyan}${arrow}${normal}${unchecked} ${_checkbox_list[$_current_index]} ${normal}" - fi + if [ $_current_index = 0 ]; then + _current_index=$((${#_checkbox_list[@]}-1)) + tput cud $((${#_checkbox_list[@]}-1)) + tput cub "$(tput cols)" + else + _current_index=$((_current_index-1)) + + tput cuu1 # Up one line + tput cub "$(tput cols)" # Back to beginning (does this work?) + tput el # Clear to end of line + fi + + if [ "${_checkbox_selected[$_current_index]}" = true ]; then + printf "${cyan}${arrow}${green}${checked}${normal} ${_checkbox_list[$_current_index]} ${normal}" + else + printf "${cyan}${arrow}${normal}${unchecked} ${_checkbox_list[$_current_index]} ${normal}" + fi } on_checkbox_input_up() { - #remove_checkbox_instructions - tput cub "$(tput cols)" - if (( ${_current_row} > 0 )) || (( ${#_checkbox_list[@]} <= 5 )); then - print_checkbox_line $_current_index - tput el - if [ $_current_index = 0 ]; then - _current_index=$((${#_checkbox_list[@]}-1)) - _current_row=4 - tput cud $((${#_checkbox_list[@]}-1)) - tput cub "$(tput cols)" + #remove_checkbox_instructions + tput cub "$(tput cols)" + if (( ${_current_row} > 0 )) || (( ${#_checkbox_list[@]} <= 5 )); then + print_checkbox_line $_current_index + tput el + if [ $_current_index = 0 ]; then + _current_index=$((${#_checkbox_list[@]}-1)) + _current_row=4 + tput cud $((${#_checkbox_list[@]}-1)) + tput cub "$(tput cols)" + else + _current_index=$((_current_index-1)) + _current_row=$((_current_row-1)) + tput cuu1 + tput cub "$(tput cols)" + tput el + fi + print_checkbox_line_arrow $_current_index else - _current_index=$((_current_index-1)) - _current_row=$((_current_row-1)) - tput cuu1 - tput cub "$(tput cols)" - tput el + if [ $_current_index = 0 ]; then + _current_index=$((${#_checkbox_list[@]}-1)) + _current_row=4 + tput cuu 1 + tput cub "$(tput cols)" + tput el + printf " ${cyan}${up_arrow}${normal}" + for I in 4 3 2 1; do + tput cud1 + tput cub "$(tput cols)" + tput el + print_checkbox_line $((_current_index-I)) + done + tput cud1 + tput cub "$(tput cols)" + tput el + print_checkbox_line_arrow $((_current_index)) + tput cud1 + tput cub "$(tput cols)" + tput el + printf " ${dim}${down_arrow}${normal}" + tput cuu 1 + else + _current_index=$((_current_index-1)) + tput cud 5 + tput cub "$(tput cols)" + tput el + printf " ${cyan}${down_arrow}${normal}" + for I in 4 3 2 1; do + tput cuu1 + tput cub "$(tput cols)" + tput el + print_checkbox_line $((_current_index+I)) + done + tput cuu1 + tput cub "$(tput cols)" + tput el + print_checkbox_line_arrow $((_current_index)) + if [ $_current_index = 0 ]; then + tput cuu1 + tput cub "$(tput cols)" + tput el + printf " ${dim}${up_arrow}${normal}" + tput cud1 + fi + fi fi - print_checkbox_line_arrow $_current_index - else - if [ $_current_index = 0 ]; then - _current_index=$((${#_checkbox_list[@]}-1)) - _current_row=4 - tput cuu 1 - tput cub "$(tput cols)" - tput el - printf " ${cyan}${up_arrow}${normal}" - for I in 4 3 2 1; do - tput cud1 - tput cub "$(tput cols)" - tput el - print_checkbox_line $((_current_index-I)) - done - tput cud1 - tput cub "$(tput cols)" - tput el - print_checkbox_line_arrow $((_current_index)) - tput cud1 - tput cub "$(tput cols)" - tput el - printf " ${dim}${down_arrow}${normal}" - tput cuu 1 - else - _current_index=$((_current_index-1)) - tput cud 5 - tput cub "$(tput cols)" - tput el - printf " ${cyan}${down_arrow}${normal}" - for I in 4 3 2 1; do - tput cuu1 - tput cub "$(tput cols)" - tput el - print_checkbox_line $((_current_index+I)) - done - tput cuu1 - tput cub "$(tput cols)" - tput el - print_checkbox_line_arrow $((_current_index)) - if [ $_current_index = 0 ]; then - tput cuu1 - tput cub "$(tput cols)" - tput el - printf " ${dim}${up_arrow}${normal}" - tput cud1 - fi - fi - fi } on_checkbox_input_down() { - #remove_checkbox_instructions - tput cub "$(tput cols)" - if (( ${_current_row} < 4 )) || (( ${#_checkbox_list[@]} <= 5 )); then - print_checkbox_line $_current_index - tput el - if [ $_current_index = $((${#_checkbox_list[@]}-1)) ]; then - _current_index=0 - _current_row=0 - tput cuu $((${#_checkbox_list[@]}-1)) - tput cub "$(tput cols)" + #remove_checkbox_instructions + tput cub "$(tput cols)" + if (( ${_current_row} < 4 )) || (( ${#_checkbox_list[@]} <= 5 )); then + print_checkbox_line $_current_index + tput el + if [ $_current_index = $((${#_checkbox_list[@]}-1)) ]; then + _current_index=0 + _current_row=0 + tput cuu $((${#_checkbox_list[@]}-1)) + tput cub "$(tput cols)" + else + _current_index=$((_current_index+1)) + _current_row=$((_current_row+1)) + tput cud1 + tput cub "$(tput cols)" + tput el + fi + print_checkbox_line_arrow $_current_index else - _current_index=$((_current_index+1)) - _current_row=$((_current_row+1)) - tput cud1 - tput cub "$(tput cols)" - tput el + if [ $_current_index = $((${#_checkbox_list[@]}-1)) ]; then + _current_index=0 + _current_row=0 + tput cuu 5 + tput cub "$(tput cols)" + tput el + printf " ${dim}${up_arrow}${normal}" + tput cud1 + tput cub "$(tput cols)" + tput el + print_checkbox_line_arrow $((_current_index)) + for I in 1 2 3 4; do + tput cud1 + tput cub "$(tput cols)" + tput el + print_checkbox_line $((_current_index+I)) + done + tput cud1 + tput cub "$(tput cols)" + tput el + printf " ${cyan}${down_arrow}${normal}" + tput cuu 5 + else + _current_index=$((_current_index+1)) + tput cuu 5 + tput cub "$(tput cols)" + tput el + printf " ${cyan}${up_arrow}${normal}" + for I in 4 3 2 1; do + tput cud1 + tput cub "$(tput cols)" + tput el + print_checkbox_line $((_current_index-I)) + done + tput cud1 + tput cub "$(tput cols)" + tput el + print_checkbox_line_arrow $((_current_index)) + if [ $_current_index = $((${#_checkbox_list[@]}-1)) ]; then + tput cud1 + tput cub "$(tput cols)" + tput el + printf " ${dim}${down_arrow}${normal}" + tput cuu1 + fi + fi fi - print_checkbox_line_arrow $_current_index - else - if [ $_current_index = $((${#_checkbox_list[@]}-1)) ]; then - _current_index=0 - _current_row=0 - tput cuu 5 - tput cub "$(tput cols)" - tput el - printf " ${dim}${up_arrow}${normal}" - tput cud1 - tput cub "$(tput cols)" - tput el - print_checkbox_line_arrow $((_current_index)) - for I in 1 2 3 4; do - tput cud1 - tput cub "$(tput cols)" - tput el - print_checkbox_line $((_current_index+I)) - done - tput cud1 - tput cub "$(tput cols)" - tput el - printf " ${cyan}${down_arrow}${normal}" - tput cuu 5 - else - _current_index=$((_current_index+1)) - tput cuu 5 - tput cub "$(tput cols)" - tput el - printf " ${cyan}${up_arrow}${normal}" - for I in 4 3 2 1; do - tput cud1 - tput cub "$(tput cols)" - tput el - print_checkbox_line $((_current_index-I)) - done - tput cud1 - tput cub "$(tput cols)" - tput el - print_checkbox_line_arrow $((_current_index)) - if [ $_current_index = $((${#_checkbox_list[@]}-1)) ]; then - tput cud1 - tput cub "$(tput cols)" - tput el - printf " ${dim}${down_arrow}${normal}" - tput cuu1 - fi - fi - fi } on_checkbox_input_enter() { - remove_checkbox_instructions - local OLD_IFS - OLD_IFS=$IFS - _checkbox_selected_indices=() - _checkbox_selected_options=() - IFS=$'\n' + remove_checkbox_instructions + local OLD_IFS + OLD_IFS=$IFS + _checkbox_selected_indices=() + _checkbox_selected_options=() + IFS=$'\n' - for i in $(gen_index ${#_checkbox_list[@]}); do - if [ "${_checkbox_selected[$i]}" = true ]; then - _checkbox_selected_indices+=($i) - _checkbox_selected_options+=("${_checkbox_list[$i]}") + for i in $(gen_index ${#_checkbox_list[@]}); do + if [ "${_checkbox_selected[$i]}" = true ]; then + _checkbox_selected_indices+=($i) + _checkbox_selected_options+=("${_checkbox_list[$i]}") + fi + done + + if (( ${#_checkbox_list[@]} <= 5 )); then + tput cud $((${#_checkbox_list[@]}-${_current_index})) + tput cub "$(tput cols)" + for i in $(seq $((${#_checkbox_list[@]}+1))); do + tput el1 + tput el + tput cuu1 + done + else + tput cud $((6-${_current_row})) + tput cub "$(tput cols)" + for i in $(seq 8); do + tput el1 + tput el + tput cuu1 + done fi - done - - if (( ${#_checkbox_list[@]} <= 5 )); then - tput cud $((${#_checkbox_list[@]}-${_current_index})) tput cub "$(tput cols)" - for i in $(seq $((${#_checkbox_list[@]}+1))); do - tput el1 - tput el - tput cuu1 - done - else - tput cud $((6-${_current_row})) + + tput cuf $((${#prompt}+3)) + printf "${cyan}$(join _checkbox_selected_options)${normal}" + tput el + + tput cud1 tput cub "$(tput cols)" - for i in $(seq 8); do - tput el1 - tput el - tput cuu1 - done - fi - tput cub "$(tput cols)" + tput el - tput cuf $((${#prompt}+3)) - printf "${cyan}$(join _checkbox_selected_options)${normal}" - tput el - - tput cud1 - tput cub "$(tput cols)" - tput el - - _break_keypress=true - IFS=$OLD_IFS + _break_keypress=true + IFS=$OLD_IFS } on_checkbox_input_space() { - #remove_checkbox_instructions - tput cub "$(tput cols)" - tput el - if [ "${_checkbox_selected[$_current_index]}" = true ]; then - _checkbox_selected[$_current_index]=false - else - _checkbox_selected[$_current_index]=true - fi + #remove_checkbox_instructions + tput cub "$(tput cols)" + tput el + if [ "${_checkbox_selected[$_current_index]}" = true ]; then + _checkbox_selected[$_current_index]=false + else + _checkbox_selected[$_current_index]=true + fi - print_checkbox_line_arrow $_current_index + print_checkbox_line_arrow $_current_index } remove_checkbox_instructions() { - if [ $_first_keystroke = true ]; then - tput cuu $((${_current_index}+1)) - tput cub "$(tput cols)" - tput cuf $((${#prompt}+3)) - tput el - tput cud $((${_current_index}+1)) - _first_keystroke=false - fi + if [ $_first_keystroke = true ]; then + tput cuu $((${_current_index}+1)) + tput cub "$(tput cols)" + tput cuf $((${#prompt}+3)) + tput el + tput cud $((${_current_index}+1)) + _first_keystroke=false + fi } # for vim movements on_checkbox_input_ascii() { - local key=$1 - case $key in - "j" ) on_checkbox_input_down;; - "k" ) on_checkbox_input_up;; - esac + local key=$1 + case $key in + "j" ) on_checkbox_input_down ;; + "k" ) on_checkbox_input_up ;; + esac } _checkbox_input() { - local i - local j - prompt=$1 - eval _checkbox_list=( '"${'${2}'[@]}"' ) - _current_index=0 - _current_row=0 - _first_keystroke=true + local i + local j + prompt=$1 + eval _checkbox_list=( '"${'${2}'[@]}"' ) + _current_index=0 + _current_row=0 + _first_keystroke=true - trap control_c SIGINT EXIT + trap control_c SIGINT EXIT - stty -echo - tput civis + stty -echo + tput civis - print "${normal}${green}?${normal} ${bold}${prompt}${normal} ${dim}(Press to select, to finalize)${normal}" + print "${normal}${green}?${normal} ${bold}${prompt}${normal} ${dim}(Press to select, to finalize)${normal}" - for i in $(gen_index ${#_checkbox_list[@]}); do - _checkbox_selected[$i]=false - done - - if [ -n "$3" ]; then - eval _selected_indices=( '"${'${3}'[@]}"' ) - for i in ${_selected_indices[@]}; do - _checkbox_selected[$i]=true + for i in $(gen_index ${#_checkbox_list[@]}); do + _checkbox_selected[$i]=false done - fi - if (( ${#_checkbox_list[@]} > 5 )); then - tput cub "$(tput cols)" - print " ${dim}${up_arrow}${normal}" - fi - - for i in $(gen_index ${#_checkbox_list[@]}); do - tput cub "$(tput cols)" - if [ $i = 0 ]; then - print_checkbox_line_arrow $i - else - print_checkbox_line $i + if [ -n "$3" ]; then + eval _selected_indices=( '"${'${3}'[@]}"' ) + for i in ${_selected_indices[@]}; do + _checkbox_selected[$i]=true + done fi - print "" - tput el - if (( $i > 3 )) && (( ${#_checkbox_list[@]} > 5 )); then - print " ${cyan}${down_arrow}${normal}" - break - fi - done - for j in $(gen_index ${#_checkbox_list[@]}); do - tput cuu1 - if (( $j > 4 )); then - break + if (( ${#_checkbox_list[@]} > 5 )); then + tput cub "$(tput cols)" + print " ${dim}${up_arrow}${normal}" fi - done - on_keypress on_checkbox_input_up on_checkbox_input_down on_checkbox_input_space on_checkbox_input_enter on_default on_default on_checkbox_input_ascii + for i in $(gen_index ${#_checkbox_list[@]}); do + tput cub "$(tput cols)" + if [ $i = 0 ]; then + print_checkbox_line_arrow $i + else + print_checkbox_line $i + fi + print "" + tput el + if (( $i > 3 )) && (( ${#_checkbox_list[@]} > 5 )); then + print " ${cyan}${down_arrow}${normal}" + break + fi + done + + for j in $(gen_index ${#_checkbox_list[@]}); do + tput cuu1 + if (( $j > 4 )); then + break + fi + done + + on_keypress on_checkbox_input_up on_checkbox_input_down on_checkbox_input_space on_checkbox_input_enter on_default on_default on_checkbox_input_ascii } checkbox_input() { - _checkbox_input "$1" "$2" - _checkbox_input_output_var_name=$3 - select_indices _checkbox_list _checkbox_selected_indices $_checkbox_input_output_var_name + _checkbox_input "$1" "$2" + _checkbox_input_output_var_name=$3 + select_indices _checkbox_list _checkbox_selected_indices $_checkbox_input_output_var_name - unset _checkbox_list - unset _break_keypress - unset _first_keystroke - unset _current_index - unset _checkbox_input_output_var_name - unset _checkbox_selected_indices - unset _checkbox_selected_options + unset _checkbox_list + unset _break_keypress + unset _first_keystroke + unset _current_index + unset _checkbox_input_output_var_name + unset _checkbox_selected_indices + unset _checkbox_selected_options - cleanup + cleanup } checkbox_input_indices() { - _checkbox_input "$1" "$2" "$3" - _checkbox_input_output_var_name=$3 + _checkbox_input "$1" "$2" "$3" + _checkbox_input_output_var_name=$3 - eval $_checkbox_input_output_var_name\=\(\) - for i in $(gen_index ${#_checkbox_selected_indices[@]}); do - eval $_checkbox_input_output_var_name\+\=\(${_checkbox_selected_indices[$i]}\) - done + eval $_checkbox_input_output_var_name\=\(\) + for i in $(gen_index ${#_checkbox_selected_indices[@]}); do + eval $_checkbox_input_output_var_name\+\=\(${_checkbox_selected_indices[$i]}\) + done - unset _checkbox_list - unset _break_keypress - unset _first_keystroke - unset _current_index - unset _checkbox_input_output_var_name - unset _checkbox_selected_indices - unset _checkbox_selected_options + unset _checkbox_list + unset _break_keypress + unset _first_keystroke + unset _current_index + unset _checkbox_input_output_var_name + unset _checkbox_selected_indices + unset _checkbox_selected_options - cleanup + cleanup } on_list_input_up() { - remove_list_instructions - tput cub "$(tput cols)" - - printf " ${_list_options[$_list_selected_index]}" - tput el - - if [ $_list_selected_index = 0 ]; then - _list_selected_index=$((${#_list_options[@]}-1)) - tput cud $((${#_list_options[@]}-1)) + remove_list_instructions tput cub "$(tput cols)" - else - _list_selected_index=$((_list_selected_index-1)) - tput cuu1 - tput cub "$(tput cols)" + printf " ${_list_options[$_list_selected_index]}" tput el - fi - printf "${cyan}${arrow} %s ${normal}" "${_list_options[$_list_selected_index]}" + if [ $_list_selected_index = 0 ]; then + _list_selected_index=$((${#_list_options[@]}-1)) + tput cud $((${#_list_options[@]}-1)) + tput cub "$(tput cols)" + else + _list_selected_index=$((_list_selected_index-1)) + + tput cuu1 + tput cub "$(tput cols)" + tput el + fi + + printf "${cyan}${arrow} %s ${normal}" "${_list_options[$_list_selected_index]}" } on_list_input_down() { - remove_list_instructions - tput cub "$(tput cols)" - - printf " ${_list_options[$_list_selected_index]}" - tput el - - if [ $_list_selected_index = $((${#_list_options[@]}-1)) ]; then - _list_selected_index=0 - tput cuu $((${#_list_options[@]}-1)) - tput cub "$(tput cols)" - else - _list_selected_index=$((_list_selected_index+1)) - tput cud1 + remove_list_instructions tput cub "$(tput cols)" + + printf " ${_list_options[$_list_selected_index]}" tput el - fi - printf "${cyan}${arrow} %s ${normal}" "${_list_options[$_list_selected_index]}" + + if [ $_list_selected_index = $((${#_list_options[@]}-1)) ]; then + _list_selected_index=0 + tput cuu $((${#_list_options[@]}-1)) + tput cub "$(tput cols)" + else + _list_selected_index=$((_list_selected_index+1)) + tput cud1 + tput cub "$(tput cols)" + tput el + fi + printf "${cyan}${arrow} %s ${normal}" "${_list_options[$_list_selected_index]}" } on_list_input_enter_space() { - local OLD_IFS - OLD_IFS=$IFS - IFS=$'\n' + local OLD_IFS + OLD_IFS=$IFS + IFS=$'\n' - tput cud $((${#_list_options[@]}-${_list_selected_index})) - tput cub "$(tput cols)" + tput cud $((${#_list_options[@]}-${_list_selected_index})) + tput cub "$(tput cols)" - for i in $(seq $((${#_list_options[@]}+1))); do - tput el1 + for i in $(seq $((${#_list_options[@]}+1))); do + tput el1 + tput el + tput cuu1 + done + tput cub "$(tput cols)" + + tput cuf $((${#prompt}+3)) + printf "${cyan}${_list_options[$_list_selected_index]}${normal}" tput el - tput cuu1 - done - tput cub "$(tput cols)" - tput cuf $((${#prompt}+3)) - printf "${cyan}${_list_options[$_list_selected_index]}${normal}" - tput el + tput cud1 + tput cub "$(tput cols)" + tput el - tput cud1 - tput cub "$(tput cols)" - tput el - - _break_keypress=true - IFS=$OLD_IFS + _break_keypress=true + IFS=$OLD_IFS } remove_list_instructions() { - if [ $_first_keystroke = true ]; then - tput cuu $((${_list_selected_index}+1)) - tput cub "$(tput cols)" - tput cuf $((${#prompt}+3)) - tput el - tput cud $((${_list_selected_index}+1)) - _first_keystroke=false - fi + if [ $_first_keystroke = true ]; then + tput cuu $((${_list_selected_index}+1)) + tput cub "$(tput cols)" + tput cuf $((${#prompt}+3)) + tput el + tput cud $((${_list_selected_index}+1)) + _first_keystroke=false + fi } _list_input() { - local i - local j - prompt=$1 - eval _list_options=( '"${'${2}'[@]}"' ) + local i + local j + prompt=$1 + eval _list_options=( '"${'${2}'[@]}"' ) - _list_selected_index=0 - _first_keystroke=true + _list_selected_index=0 + _first_keystroke=true - trap control_c SIGINT EXIT + trap control_c SIGINT EXIT - stty -echo - tput civis + stty -echo + tput civis - print "${normal}${green}?${normal} ${bold}${prompt}${normal} ${dim}(Use arrow keys)${normal}" + print "${normal}${green}?${normal} ${bold}${prompt}${normal} ${dim}(Use arrow keys)${normal}" - for i in $(gen_index ${#_list_options[@]}); do - tput cub "$(tput cols)" - if [ $i = 0 ]; then - print "${cyan}${arrow} ${_list_options[$i]} ${normal}" - else - print " ${_list_options[$i]}" - fi - tput el - done + for i in $(gen_index ${#_list_options[@]}); do + tput cub "$(tput cols)" + if [ $i = 0 ]; then + print "${cyan}${arrow} ${_list_options[$i]} ${normal}" + else + print " ${_list_options[$i]}" + fi + tput el + done - for j in $(gen_index ${#_list_options[@]}); do - tput cuu1 - done + for j in $(gen_index ${#_list_options[@]}); do + tput cuu1 + done - on_keypress on_list_input_up on_list_input_down on_list_input_enter_space on_list_input_enter_space + on_keypress on_list_input_up on_list_input_down on_list_input_enter_space on_list_input_enter_space } list_input() { - _list_input "$1" "$2" - local var_name=$3 - eval $var_name=\'"${_list_options[$_list_selected_index]}"\' - unset _list_selected_index - unset _list_options - unset _break_keypress - unset _first_keystroke + _list_input "$1" "$2" + local var_name=$3 + eval $var_name=\'"${_list_options[$_list_selected_index]}"\' + unset _list_selected_index + unset _list_options + unset _break_keypress + unset _first_keystroke - cleanup + cleanup } list_input_index() { - _list_input "$1" "$2" - local var_name=$3 - eval $var_name=\'"$_list_selected_index"\' - unset _list_selected_index - unset _list_options - unset _break_keypress - unset _first_keystroke + _list_input "$1" "$2" + local var_name=$3 + eval $var_name=\'"$_list_selected_index"\' + unset _list_selected_index + unset _list_options + unset _break_keypress + unset _first_keystroke - cleanup + cleanup } on_text_input_left() { - remove_regex_failed - if [ $_current_pos -gt 0 ]; then - tput cub1 - _current_pos=$(($_current_pos-1)) - fi + remove_regex_failed + if [ $_current_pos -gt 0 ]; then + tput cub1 + _current_pos=$(($_current_pos-1)) + fi } on_text_input_right() { - remove_regex_failed - if [ $_current_pos -lt ${#_text_input} ]; then - tput cuf1 - _current_pos=$(($_current_pos+1)) - fi + remove_regex_failed + if [ $_current_pos -lt ${#_text_input} ]; then + tput cuf1 + _current_pos=$(($_current_pos+1)) + fi } on_text_input_enter() { - remove_regex_failed + remove_regex_failed - if [[ "$_text_input" =~ $_text_input_regex && "$(eval $_text_input_validator "$_text_input")" = true ]]; then - tput cub "$(tput cols)" - tput cuf $((${#_read_prompt}-19)) - printf "${cyan}${_text_input}${normal}" - tput el - tput cud1 - tput cub "$(tput cols)" - tput el - eval $var_name=\'"${_text_input}"\' - _break_keypress=true - else - _text_input_regex_failed=true - tput civis - tput cud1 - tput cub "$(tput cols)" - tput el - printf "${red}>>${normal} $_text_input_regex_failed_msg" - tput cuu1 - tput cub "$(tput cols)" - tput cuf $((${#_read_prompt}-19)) - tput el - _text_input="" - _current_pos=0 - tput cnorm - fi + if [[ "$_text_input" =~ $_text_input_regex && "$(eval $_text_input_validator "$_text_input")" = true ]]; then + tput cub "$(tput cols)" + tput cuf $((${#_read_prompt}-19)) + printf "${cyan}${_text_input}${normal}" + tput el + tput cud1 + tput cub "$(tput cols)" + tput el + eval $var_name=\'"${_text_input}"\' + _break_keypress=true + else + _text_input_regex_failed=true + tput civis + tput cud1 + tput cub "$(tput cols)" + tput el + printf "${red}>>${normal} $_text_input_regex_failed_msg" + tput cuu1 + tput cub "$(tput cols)" + tput cuf $((${#_read_prompt}-19)) + tput el + _text_input="" + _current_pos=0 + tput cnorm + fi } on_text_input_ascii() { - remove_regex_failed - local c=$1 + remove_regex_failed + local c=$1 - if [ "$c" = '' ]; then - c=' ' - fi + if [ "$c" = '' ]; then + c=' ' + fi - local rest="${_text_input:$_current_pos}" - _text_input="${_text_input:0:$_current_pos}$c$rest" - _current_pos=$(($_current_pos+1)) + local rest="${_text_input:$_current_pos}" + _text_input="${_text_input:0:$_current_pos}$c$rest" + _current_pos=$(($_current_pos+1)) - tput civis - printf "$c$rest" - tput el - if [ ${#rest} -gt 0 ]; then - tput cub ${#rest} - fi - tput cnorm + tput civis + printf "$c$rest" + tput el + if [ ${#rest} -gt 0 ]; then + tput cub ${#rest} + fi + tput cnorm } on_text_input_backspace() { - remove_regex_failed - if [ $_current_pos -gt 0 ]; then - local start="${_text_input:0:$(($_current_pos-1))}" - local rest="${_text_input:$_current_pos}" - _current_pos=$(($_current_pos-1)) - tput cub 1 - tput el - tput sc - printf "$rest" - tput rc - _text_input="$start$rest" - fi + remove_regex_failed + if [ $_current_pos -gt 0 ]; then + local start="${_text_input:0:$(($_current_pos-1))}" + local rest="${_text_input:$_current_pos}" + _current_pos=$(($_current_pos-1)) + tput cub 1 + tput el + tput sc + printf "$rest" + tput rc + _text_input="$start$rest" + fi } remove_regex_failed() { - if [ $_text_input_regex_failed = true ]; then - _text_input_regex_failed=false - tput sc - tput cud1 - tput el1 - tput el - tput rc - fi + if [ $_text_input_regex_failed = true ]; then + _text_input_regex_failed=false + tput sc + tput cud1 + tput el1 + tput el + tput rc + fi } text_input_default_validator() { - echo true; + echo true; } text_input() { - local prompt=$1 - local var_name=$2 - local _text_input_regex="${3:-"\.+"}" - local _text_input_regex_failed_msg=${4:-"Input validation failed"} - local _text_input_validator=${5:-text_input_default_validator} - local _read_prompt_start=$'\e[32m?\e[39m\e[1m' - local _read_prompt_end=$'\e[22m' - local _read_prompt="$( echo "$_read_prompt_start ${prompt} $_read_prompt_end")" - local _current_pos=0 - local _text_input_regex_failed=false - local _text_input="" - printf "$_read_prompt" + local prompt=$1 + local var_name=$2 + local _text_input_regex="${3:-"\.+"}" + local _text_input_regex_failed_msg=${4:-"Input validation failed"} + local _text_input_validator=${5:-text_input_default_validator} + local _read_prompt_start=$'\e[32m?\e[39m\e[1m' + local _read_prompt_end=$'\e[22m' + local _read_prompt="$( echo "$_read_prompt_start ${prompt} $_read_prompt_end")" + local _current_pos=0 + local _text_input_regex_failed=false + local _text_input="" + printf "$_read_prompt" - trap control_c SIGINT EXIT + trap control_c SIGINT EXIT - stty -echo - tput cnorm + stty -echo + tput cnorm - on_keypress on_default on_default on_text_input_ascii on_text_input_enter on_text_input_left on_text_input_right on_text_input_ascii on_text_input_backspace - eval $var_name=\'"${_text_input}"\' + on_keypress on_default on_default on_text_input_ascii on_text_input_enter on_text_input_left on_text_input_right on_text_input_ascii on_text_input_backspace + eval $var_name=\'"${_text_input}"\' - cleanup + cleanup } # ============================================================= function menuFromCmd() { - local mLOCALRESULT=$1 - local mRESULT='' - read -r -a ARRAY <<< $3 - list_input "$2" ARRAY mRESULT - eval $mLOCALRESULT="'$mRESULT'" + local mLOCALRESULT=$1 + local mRESULT='' + read -r -a ARRAY <<< $3 + list_input "$2" ARRAY mRESULT + eval $mLOCALRESULT="'$mRESULT'" } function menuFromArr() { - local mLOCALRESULT=$1 - shift - local PROMPT=$1 - shift - local ARRAY=("$@") - list_input "$PROMPT" ARRAY mRESULT - eval $mLOCALRESULT="'$mRESULT'" + local mLOCALRESULT=$1 + shift + local PROMPT=$1 + shift + local ARRAY=("$@") + list_input "$PROMPT" ARRAY mRESULT + eval $mLOCALRESULT="'$mRESULT'" } function multiFromArr() { - local mLOCALRESULT=$1 - shift - local PROMPT=$1 - shift - local ARRAY=("$@") - checkbox_input "$PROMPT" ARRAY mRESULT - eval $mLOCALRESULT="'$mRESULT'" + local mLOCALRESULT=$1 + shift + local PROMPT=$1 + shift + local ARRAY=("$@") + checkbox_input "$PROMPT" ARRAY mRESULT + eval $mLOCALRESULT="'$mRESULT'" } diff --git a/installer.sh b/installer.sh index 66fad71..254b205 100755 --- a/installer.sh +++ b/installer.sh @@ -1,9 +1,9 @@ #!/usr/bin/env bash -if ! command -v bc &> /dev/null +if ! command -v bc &> /dev/null then - echo "You need bc!" - exit + echo "You need bc!" + exit fi DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" @@ -16,80 +16,80 @@ USEDEMO=0 INSTALLED_EXES=() function waUsage() { - echo 'Usage: + echo 'Usage: ./installer.sh --user # Install everything in ${HOME} ./installer.sh --system # Install everything in /usr' - exit + exit } function waNoSudo() { - echo 'You are attempting to switch from a --system install to a --user install. -Please run "./installer.sh --system --uninstall" first.' - exit + echo 'You are attempting to switch from a --system install to a --user install. + Please run "./installer.sh --system --uninstall" first.' + exit } function waInstall() { - ${SUDO} mkdir -p "${SYS_PATH}/apps" - . "${DIR}/bin/winapps" install + ${SUDO} mkdir -p "${SYS_PATH}/apps" + . "${DIR}/bin/winapps" install } function waFindInstalled() { - echo -n " Checking for installed apps in RDP machine (this may take a while)..." - if [ $USEDEMO != 1 ]; then - rm -f ${HOME}/.local/share/winapps/installed.bat - rm -f ${HOME}/.local/share/winapps/installed.tmp - rm -f ${HOME}/.local/share/winapps/installed - rm -f ${HOME}/.local/share/winapps/detected - cp "${DIR}/install/ExtractPrograms.ps1" ${HOME}/.local/share/winapps/ExtractPrograms.ps1 - for F in $(ls "${DIR}/apps"); do - . "${DIR}/apps/${F}/info" - echo "IF EXIST \"${WIN_EXECUTABLE}\" ECHO ${F} >> \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp" >>${HOME}/.local/share/winapps/installed.bat - done - echo "powershell.exe -ExecutionPolicy Bypass -File \\\\tsclient\\home\\.local\\share\\winapps\\ExtractPrograms.ps1 > \\\\tsclient\home\\.local\\share\\winapps\\detected" >>${HOME}/.local/share/winapps/installed.bat - echo "RENAME \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp installed" >>${HOME}/.local/share/winapps/installed.bat - $FREERDP_COMMAND /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" +auto-reconnect +home-drive -wallpaper +span /app:program:"C:\Windows\System32\cmd.exe",cmd:"/C \\\\tsclient\\home\\.local\\share\\winapps\\installed.bat" /v:${RDP_IP} 1>/dev/null 2>&1 & - COUNT=0 - while [ ! -f "${HOME}/.local/share/winapps/installed" ]; do - sleep 5 - COUNT=$((COUNT + 1)) - if ((COUNT == 15)); then - echo " Finished." - echo "" - echo "The RDP connection failed to connect or run. Please confirm FreeRDP can connect with:" - echo " bin/winapps check" - echo "" - echo "If it cannot connect, this is most likely due to:" - echo " - You need to accept the security cert the first time you connect (with 'check')" - echo " - Not enabling RDP in the Windows VM" - echo " - Not being able to connect to the IP of the VM" - echo " - Incorrect user credentials in winapps.conf" - echo " - Not merging install/RDPApps.reg into the VM" - exit - fi - done - if [ $MAKEDEMO = 1 ]; then - rm -rf /tmp/winapps_demo - cp -a ${HOME}/.local/share/winapps /tmp/winapps_demo - exit - fi - else - rm -rf ${HOME}/.local/share/winapps - cp -a /tmp/winapps_demo ${HOME}/.local/share/winapps - #sleep 3 - fi - echo " Finished." + echo -n " Checking for installed apps in RDP machine (this may take a while)..." + if [ $USEDEMO != 1 ]; then + rm -f ${HOME}/.local/share/winapps/installed.bat + rm -f ${HOME}/.local/share/winapps/installed.tmp + rm -f ${HOME}/.local/share/winapps/installed + rm -f ${HOME}/.local/share/winapps/detected + cp "${DIR}/install/ExtractPrograms.ps1" ${HOME}/.local/share/winapps/ExtractPrograms.ps1 + for F in $(ls "${DIR}/apps"); do + . "${DIR}/apps/${F}/info" + echo "IF EXIST \"${WIN_EXECUTABLE}\" ECHO ${F} >> \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp" >>${HOME}/.local/share/winapps/installed.bat + done + echo "powershell.exe -ExecutionPolicy Bypass -File \\\\tsclient\\home\\.local\\share\\winapps\\ExtractPrograms.ps1 > \\\\tsclient\home\\.local\\share\\winapps\\detected" >>${HOME}/.local/share/winapps/installed.bat + echo "RENAME \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp installed" >>${HOME}/.local/share/winapps/installed.bat + $FREERDP_COMMAND /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" +auto-reconnect +home-drive -wallpaper +span /app:program:"C:\Windows\System32\cmd.exe",cmd:"/C \\\\tsclient\\home\\.local\\share\\winapps\\installed.bat" /v:${RDP_IP} 1>/dev/null 2>&1 & + COUNT=0 + while [ ! -f "${HOME}/.local/share/winapps/installed" ]; do + sleep 5 + COUNT=$((COUNT + 1)) + if ((COUNT == 15)); then + echo " Finished." + echo "" + echo "The RDP connection failed to connect or run. Please confirm FreeRDP can connect with:" + echo " bin/winapps check" + echo "" + echo "If it cannot connect, this is most likely due to:" + echo " - You need to accept the security cert the first time you connect (with 'check')" + echo " - Not enabling RDP in the Windows VM" + echo " - Not being able to connect to the IP of the VM" + echo " - Incorrect user credentials in winapps.conf" + echo " - Not merging install/RDPApps.reg into the VM" + exit + fi + done + if [ $MAKEDEMO = 1 ]; then + rm -rf /tmp/winapps_demo + cp -a ${HOME}/.local/share/winapps /tmp/winapps_demo + exit + fi + else + rm -rf ${HOME}/.local/share/winapps + cp -a /tmp/winapps_demo ${HOME}/.local/share/winapps + #sleep 3 + fi + echo " Finished." } function waConfigureApp() { - if [ -z "${ICON}" ]; then - ICON=${SYS_PATH}/apps/${1}/icon.${2} - fi - - . "${SYS_PATH}/apps/${1}/info" - echo -n " Configuring ${NAME}..." - if [ ${USEDEMO} != 1 ]; then - ${SUDO} rm -f "${APP_PATH}/${1}.desktop" - echo "[Desktop Entry] + if [ -z "${ICON}" ]; then + ICON=${SYS_PATH}/apps/${1}/icon.${2} + fi + + . "${SYS_PATH}/apps/${1}/info" + echo -n " Configuring ${NAME}..." + if [ ${USEDEMO} != 1 ]; then + ${SUDO} rm -f "${APP_PATH}/${1}.desktop" + echo "[Desktop Entry] Name=${NAME} Exec=${BIN_PATH}/winapps ${1} %F Terminal=false @@ -99,119 +99,119 @@ StartupWMClass=${FULL_NAME} Comment=${FULL_NAME} Categories=${CATEGORIES} MimeType=${MIME_TYPES} -" | ${SUDO} tee "${APP_PATH}/${1}.desktop" >/dev/null - ${SUDO} rm -f "${BIN_PATH}/${1}" - echo "#!/usr/bin/env bash + " | ${SUDO} tee "${APP_PATH}/${1}.desktop" >/dev/null + ${SUDO} rm -f "${BIN_PATH}/${1}" + echo "#!/usr/bin/env bash ${BIN_PATH}/winapps ${1} $@ -" | ${SUDO} tee "${BIN_PATH}/${1}" >/dev/null - ${SUDO} chmod a+x "${BIN_PATH}/${1}" - fi - echo " Finished." + " | ${SUDO} tee "${BIN_PATH}/${1}" >/dev/null + ${SUDO} chmod a+x "${BIN_PATH}/${1}" + fi + echo " Finished." - ICON="" + ICON="" } function waConfigureApps() { - APPS=() - for F in $(cat "${HOME}/.local/share/winapps/installed" | sed 's/\r/\n/g'); do - . "${DIR}/apps/${F}/info" - APPS+=("${FULL_NAME} (${F})") - INSTALLED_EXES+=("$(echo "${WIN_EXECUTABLE##*\\}" | tr '[:upper:]' '[:lower:]')") - done - IFS=$'\n' APPS=($(sort <<<"${APPS[*]}")) - unset IFS - OPTIONS=("Set up all detected pre-configured applications" "Select which pre-configured applications to set up" "Do not set up any pre-configured applications") - - if [ "${INSTALL_TYPE}" != 'User' ]; then - menuFromArr APP_INSTALL "How would you like to handle WinApps pre-configured applications?" "${OPTIONS[@]}" - else "grep -l -d skip" - menuFromArr APP_INSTALL "How would you like to handle WinApps pre-configured applications? If any web browser is set-up, may be configured as default browser." "${OPTIONS[@]}" - fi - if [ "${APP_INSTALL}" = "Select which pre-configured applications to set up" ]; then - checkbox_input "Which pre-configured apps would you like to set up?" APPS SELECTED_APPS - echo "" >"${HOME}/.local/share/winapps/installed" - for F in "${SELECTED_APPS[@]}"; do - APP="${F##*(}" - APP="${APP%%)}" - echo "${APP}" >>"${HOME}/.local/share/winapps/installed" - done - fi - ${SUDO} cp "${DIR}/bin/winapps" "${BIN_PATH}/winapps" - COUNT=0 - if [ "${APP_INSTALL}" != "Do not set up any pre-configured applications" ]; then - for F in $(cat "${HOME}/.local/share/winapps/installed" | sed 's/\r/\n/g'); do - COUNT=$((COUNT + 1)) - ${SUDO} cp -r "apps/${F}" "${SYS_PATH}/apps" - waConfigureApp "${F}" svg - done - fi - rm -f "${HOME}/.local/share/winapps/installed" - rm -f "${HOME}/.local/share/winapps/installed.bat" - if (($COUNT == 0)); then - echo " No configured applications." - fi + APPS=() + for F in $(cat "${HOME}/.local/share/winapps/installed" | sed 's/\r/\n/g'); do + . "${DIR}/apps/${F}/info" + APPS+=("${FULL_NAME} (${F})") + INSTALLED_EXES+=("$(echo "${WIN_EXECUTABLE##*\\}" | tr '[:upper:]' '[:lower:]')") + done + IFS=$'\n' APPS=($(sort <<<"${APPS[*]}")) + unset IFS + OPTIONS=("Set up all detected pre-configured applications" "Select which pre-configured applications to set up" "Do not set up any pre-configured applications") + + if [ "${INSTALL_TYPE}" != 'User' ]; then + menuFromArr APP_INSTALL "How would you like to handle WinApps pre-configured applications?" "${OPTIONS[@]}" + else "grep -l -d skip" + menuFromArr APP_INSTALL "How would you like to handle WinApps pre-configured applications? If any web browser is set-up, may be configured as default browser." "${OPTIONS[@]}" + fi + if [ "${APP_INSTALL}" = "Select which pre-configured applications to set up" ]; then + checkbox_input "Which pre-configured apps would you like to set up?" APPS SELECTED_APPS + echo "" >"${HOME}/.local/share/winapps/installed" + for F in "${SELECTED_APPS[@]}"; do + APP="${F##*(}" + APP="${APP%%)}" + echo "${APP}" >>"${HOME}/.local/share/winapps/installed" + done + fi + ${SUDO} cp "${DIR}/bin/winapps" "${BIN_PATH}/winapps" + COUNT=0 + if [ "${APP_INSTALL}" != "Do not set up any pre-configured applications" ]; then + for F in $(cat "${HOME}/.local/share/winapps/installed" | sed 's/\r/\n/g'); do + COUNT=$((COUNT + 1)) + ${SUDO} cp -r "apps/${F}" "${SYS_PATH}/apps" + waConfigureApp "${F}" svg + done + fi + rm -f "${HOME}/.local/share/winapps/installed" + rm -f "${HOME}/.local/share/winapps/installed.bat" + if (($COUNT == 0)); then + echo " No configured applications." + fi } function waConfigureAppsAllOfficiallySupported(){ - ${SUDO} cp "${DIR}/bin/winapps" "${BIN_PATH}/winapps" - COUNT=0 - for F in $(cat "${HOME}/.local/share/winapps/installed" | sed 's/\r/\n/g'); do - COUNT=$((COUNT + 1)) - ${SUDO} cp -r "apps/${F}" "${SYS_PATH}/apps" - waConfigureApp "${F}" svg - done - rm -f "${HOME}/.local/share/winapps/installed" - rm -f "${HOME}/.local/share/winapps/installed.bat" - if (($COUNT == 0)); then - echo " No configured applications." - fi + ${SUDO} cp "${DIR}/bin/winapps" "${BIN_PATH}/winapps" + COUNT=0 + for F in $(cat "${HOME}/.local/share/winapps/installed" | sed 's/\r/\n/g'); do + COUNT=$((COUNT + 1)) + ${SUDO} cp -r "apps/${F}" "${SYS_PATH}/apps" + waConfigureApp "${F}" svg + done + rm -f "${HOME}/.local/share/winapps/installed" + rm -f "${HOME}/.local/share/winapps/installed.bat" + if (($COUNT == 0)); then + echo " No configured applications." + fi } function waConfigureDetectedApps() { - if [ -f "${HOME}/.local/share/winapps/detected" ]; then - sed -i 's/\r//g' "${HOME}/.local/share/winapps/detected" - . "${HOME}/.local/share/winapps/detected" - APPS=() - for I in "${!NAMES[@]}"; do - EXE=${EXES[$I]##*\\} - EXE_LOWER=$(echo "${EXE}" | tr '[:upper:]' '[:lower:]') - if ( - dlm=$'\x1F' - IFS="$dlm" - [[ "$dlm${INSTALLED_EXES[*]}$dlm" != *"$dlm${EXE_LOWER}$dlm"* ]] - ); then - APPS+=("${NAMES[$I]} (${EXE})") - fi - done - IFS=$'\n' APPS=($(sort <<<"${APPS[*]}")) - unset IFS - OPTIONS=("Set up all detected applications" "Select which applications to set up" "Do not set up any applications") - menuFromArr APP_INSTALL "How would you like to handle other detected applications?" "${OPTIONS[@]}" - if [ "${APP_INSTALL}" = "Select which applications to set up" ]; then - checkbox_input "Which other apps would you like to set up?" APPS SELECTED_APPS - echo "" >"${HOME}/.local/share/winapps/installed" - for F in "${SELECTED_APPS[@]}"; do - EXE="${F##*(}" - EXE="${EXE%%)}" - APP="${F% (*}" - echo "${EXE}|${APP}" >>"${HOME}/.local/share/winapps/installed" - done - elif [ "${APP_INSTALL}" = "Set up all detected applications" ]; then - for I in "${!EXES[@]}"; do - EXE=${EXES[$I]##*\\} - echo "${EXE}|${NAMES[$I]}" >>"${HOME}/.local/share/winapps/installed" - done - fi - COUNT=0 - if [ -f "${HOME}/.local/share/winapps/installed" ]; then - while read LINE; do - EXE="${LINE%|*}" - NAME="${LINE#*|}" - for I in "${!NAMES[@]}"; do - if [ "${NAME}" = "${NAMES[$I]}" ] && [[ "${EXES[$I]}" == *"\\${EXE}" ]]; then - EXE=$(echo "${EXE}" | tr '[:upper:]' '[:lower:]') - ${SUDO} mkdir -p "${SYS_PATH}/apps/${EXE}" - echo "# GNOME shortcut name + if [ -f "${HOME}/.local/share/winapps/detected" ]; then + sed -i 's/\r//g' "${HOME}/.local/share/winapps/detected" + . "${HOME}/.local/share/winapps/detected" + APPS=() + for I in "${!NAMES[@]}"; do + EXE=${EXES[$I]##*\\} + EXE_LOWER=$(echo "${EXE}" | tr '[:upper:]' '[:lower:]') + if ( + dlm=$'\x1F' + IFS="$dlm" + [[ "$dlm${INSTALLED_EXES[*]}$dlm" != *"$dlm${EXE_LOWER}$dlm"* ]] + ); then + APPS+=("${NAMES[$I]} (${EXE})") + fi + done + IFS=$'\n' APPS=($(sort <<<"${APPS[*]}")) + unset IFS + OPTIONS=("Set up all detected applications" "Select which applications to set up" "Do not set up any applications") + menuFromArr APP_INSTALL "How would you like to handle other detected applications?" "${OPTIONS[@]}" + if [ "${APP_INSTALL}" = "Select which applications to set up" ]; then + checkbox_input "Which other apps would you like to set up?" APPS SELECTED_APPS + echo "" >"${HOME}/.local/share/winapps/installed" + for F in "${SELECTED_APPS[@]}"; do + EXE="${F##*(}" + EXE="${EXE%%)}" + APP="${F% (*}" + echo "${EXE}|${APP}" >>"${HOME}/.local/share/winapps/installed" + done + elif [ "${APP_INSTALL}" = "Set up all detected applications" ]; then + for I in "${!EXES[@]}"; do + EXE=${EXES[$I]##*\\} + echo "${EXE}|${NAMES[$I]}" >>"${HOME}/.local/share/winapps/installed" + done + fi + COUNT=0 + if [ -f "${HOME}/.local/share/winapps/installed" ]; then + while read LINE; do + EXE="${LINE%|*}" + NAME="${LINE#*|}" + for I in "${!NAMES[@]}"; do + if [ "${NAME}" = "${NAMES[$I]}" ] && [[ "${EXES[$I]}" == *"\\${EXE}" ]]; then + EXE=$(echo "${EXE}" | tr '[:upper:]' '[:lower:]') + ${SUDO} mkdir -p "${SYS_PATH}/apps/${EXE}" + echo "# GNOME shortcut name NAME=\"${NAME}\" # Used for descriptions and window class @@ -225,29 +225,29 @@ CATEGORIES=\"WinApps\" # GNOME mimetypes MIME_TYPES=\"\" -" | sudo tee "${SYS_PATH}/apps/${EXE}/info" >/dev/null - echo "${ICONS[$I]}" | base64 -d | sudo tee "${SYS_PATH}/apps/${EXE}/icon.ico" >/dev/null - waConfigureApp "${EXE}" ico - COUNT=$((COUNT + 1)) - fi - done - done <"${HOME}/.local/share/winapps/installed" - rm -f "${HOME}/.local/share/winapps/installed" - fi - rm -f "${HOME}/.local/share/winapps/installed.bat" - if (($COUNT == 0)); then - echo " No configured applications." - fi - fi + " | sudo tee "${SYS_PATH}/apps/${EXE}/info" >/dev/null + echo "${ICONS[$I]}" | base64 -d | sudo tee "${SYS_PATH}/apps/${EXE}/icon.ico" >/dev/null + waConfigureApp "${EXE}" ico + COUNT=$((COUNT + 1)) + fi + done + done <"${HOME}/.local/share/winapps/installed" + rm -f "${HOME}/.local/share/winapps/installed" + fi + rm -f "${HOME}/.local/share/winapps/installed.bat" + if (($COUNT == 0)); then + echo " No configured applications." + fi + fi } function waConfigureWindows() { - echo -n " Configuring Windows..." - if [ ${USEDEMO} != 1 ]; then - ${SUDO} rm -f "${APP_PATH}/windows.desktop" - ${SUDO} mkdir -p "${SYS_PATH}/icons" - ${SUDO} cp "${DIR}/icons/windows.svg" "${SYS_PATH}/icons/windows.svg" - echo "[Desktop Entry] + echo -n " Configuring Windows..." + if [ ${USEDEMO} != 1 ]; then + ${SUDO} rm -f "${APP_PATH}/windows.desktop" + ${SUDO} mkdir -p "${SYS_PATH}/icons" + ${SUDO} cp "${DIR}/icons/windows.svg" "${SYS_PATH}/icons/windows.svg" + echo "[Desktop Entry] Name=Windows Exec=${BIN_PATH}/winapps windows %F Terminal=false @@ -255,119 +255,119 @@ Type=Application Icon=${SYS_PATH}/icons/windows.svg StartupWMClass=Microsoft Windows Comment=Microsoft Windows -" | ${SUDO} tee "${APP_PATH}/windows.desktop" >/dev/null - ${SUDO} rm -f "${BIN_PATH}/windows" - echo "#!/usr/bin/env bash + " | ${SUDO} tee "${APP_PATH}/windows.desktop" >/dev/null + ${SUDO} rm -f "${BIN_PATH}/windows" + echo "#!/usr/bin/env bash ${BIN_PATH}/winapps windows -" | ${SUDO} tee "/${BIN_PATH}/windows" >/dev/null - ${SUDO} chmod a+x "${BIN_PATH}/windows" - fi - echo " Finished." + " | ${SUDO} tee "/${BIN_PATH}/windows" >/dev/null + ${SUDO} chmod a+x "${BIN_PATH}/windows" + fi + echo " Finished." } function waUninstallUser() { - rm -f "${HOME}/.local/bin/winapps" - rm -rf "${HOME}/.local/share/winapps" - for F in $(grep -l -d skip "bin/winapps" "${HOME}/.local/share/applications/"* -s); do - echo -n " Removing ${F}..." - ${SUDO} rm ${F} - echo " Finished." - done - for F in $(grep -l -d skip "bin/winapps" "${HOME}/.local/bin/"* -s); do - echo -n " Removing ${F}..." - ${SUDO} rm ${F} - echo " Finished." - done + rm -f "${HOME}/.local/bin/winapps" + rm -rf "${HOME}/.local/share/winapps" + for F in $(grep -l -d skip "bin/winapps" "${HOME}/.local/share/applications/"* -s); do + echo -n " Removing ${F}..." + ${SUDO} rm ${F} + echo " Finished." + done + for F in $(grep -l -d skip "bin/winapps" "${HOME}/.local/bin/"* -s); do + echo -n " Removing ${F}..." + ${SUDO} rm ${F} + echo " Finished." + done } function waUninstallSystem() { - ${SUDO} rm -f "/usr/local/bin/winapps" - ${SUDO} rm -rf "/usr/local/share/winapps" - for F in $(grep -l -d skip "bin/winapps" "/usr/share/applications/"* -s); do - if [ -z "${SUDO}" ]; then - waNoSudo - fi - echo -n " Removing ${F}..." - ${SUDO} rm ${F} - echo " Finished." - done - for F in $(grep -l -d skip "bin/winapps" "/usr/local/bin/"* -s); do - if [ -z "${SUDO}" ]; then - waNoSudo - fi - echo -n " Removing ${F}..." - ${SUDO} rm ${F} - echo " Finished." - done + ${SUDO} rm -f "/usr/local/bin/winapps" + ${SUDO} rm -rf "/usr/local/share/winapps" + for F in $(grep -l -d skip "bin/winapps" "/usr/share/applications/"* -s); do + if [ -z "${SUDO}" ]; then + waNoSudo + fi + echo -n " Removing ${F}..." + ${SUDO} rm ${F} + echo " Finished." + done + for F in $(grep -l -d skip "bin/winapps" "/usr/local/bin/"* -s); do + if [ -z "${SUDO}" ]; then + waNoSudo + fi + echo -n " Removing ${F}..." + ${SUDO} rm ${F} + echo " Finished." + done } if [ -z "${1}" ]; then - OPTIONS=(User System) - menuFromArr INSTALL_TYPE "Would you like to install for the current user or the whole system?" "${OPTIONS[@]}" + OPTIONS=(User System) + menuFromArr INSTALL_TYPE "Would you like to install for the current user or the whole system?" "${OPTIONS[@]}" elif [ "${1}" = '--user' ]; then - INSTALL_TYPE='User' + INSTALL_TYPE='User' elif [ "${1}" = '--system' ]; then - INSTALL_TYPE='System' + INSTALL_TYPE='System' else - waUsage + waUsage fi if [ "${INSTALL_TYPE}" = 'User' ]; then - SUDO="" - BIN_PATH="${HOME}/.local/bin" - APP_PATH="${HOME}/.local/share/applications" - SYS_PATH="${HOME}/.local/share/winapps" - mkdir -p $BIN_PATH - mkdir -p $APP_PATH - mkdir -p $SYS_PATH - if [ -n "${2}" ]; then - if [ "${2}" = '--uninstall' ]; then - # Uninstall - echo "Uninstalling..." - waUninstallUser - exit - elif [ "${2}" = '--setupAllOfficiallySupportedApps' ]; then - echo "Setting up All Officially Supported Apps " - echo "Removing any old configurations..." - waUninstallUser - waUninstallSystem - waInstall - waFindInstalled - waConfigureWindows - waConfigureAppsAllOfficiallySupported - exit - else - usage - fi - fi + SUDO="" + BIN_PATH="${HOME}/.local/bin" + APP_PATH="${HOME}/.local/share/applications" + SYS_PATH="${HOME}/.local/share/winapps" + mkdir -p $BIN_PATH + mkdir -p $APP_PATH + mkdir -p $SYS_PATH + if [ -n "${2}" ]; then + if [ "${2}" = '--uninstall' ]; then + # Uninstall + echo "Uninstalling..." + waUninstallUser + exit + elif [ "${2}" = '--setupAllOfficiallySupportedApps' ]; then + echo "Setting up All Officially Supported Apps " + echo "Removing any old configurations..." + waUninstallUser + waUninstallSystem + waInstall + waFindInstalled + waConfigureWindows + waConfigureAppsAllOfficiallySupported + exit + else + usage + fi + fi elif [ "${INSTALL_TYPE}" = 'System' ]; then - SUDO="sudo" - sudo ls >/dev/null - BIN_PATH="/usr/local/bin" - APP_PATH="/usr/share/applications" - SYS_PATH="/usr/local/share/winapps" - if [ -n "${2}" ]; then - if [ "${2}" = '--uninstall' ]; then - # Uninstall - echo "Uninstalling..." - waUninstallSystem - exit - elif [ "${2}" = '--setupAllOfficiallySupportedApps' ]; then - echo "Setting up All Officially Supported Apps " - echo "Removing any old configurations..." - waUninstallUser - waUninstallSystem + SUDO="sudo" + sudo ls >/dev/null + BIN_PATH="/usr/local/bin" + APP_PATH="/usr/share/applications" + SYS_PATH="/usr/local/share/winapps" + if [ -n "${2}" ]; then + if [ "${2}" = '--uninstall' ]; then + # Uninstall + echo "Uninstalling..." + waUninstallSystem + exit + elif [ "${2}" = '--setupAllOfficiallySupportedApps' ]; then + echo "Setting up All Officially Supported Apps " + echo "Removing any old configurations..." + waUninstallUser + waUninstallSystem - echo "Installing..." - waInstall - waFindInstalled - waConfigureWindows - waConfigureAppsAllOfficiallySupported - exit - else - usage - fi - fi + echo "Installing..." + waInstall + waFindInstalled + waConfigureWindows + waConfigureAppsAllOfficiallySupported + exit + else + usage + fi + fi fi echo "Removing any old configurations..." diff --git a/kvm/RDPWindows.xml b/kvm/RDPWindows.xml index 1523b9c..4a7e227 100644 --- a/kvm/RDPWindows.xml +++ b/kvm/RDPWindows.xml @@ -208,4 +208,3 @@ +385601105:+385600513 - From 7d8ae3ae3ec7847e6b7cd6260ae1859342e17cd4 Mon Sep 17 00:00:00 2001 From: LDprg Date: Thu, 23 May 2024 19:09:37 +0200 Subject: [PATCH 027/187] Start fixing alot of stuff --- .pre-commit-config.yaml | 1 - bin/winapps | 64 +++++------ installer.sh | 239 ++++++++++++++++++++-------------------- 3 files changed, 155 insertions(+), 149 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5a1df09..adf8aa7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -44,7 +44,6 @@ repos: rev: v6.2.1 hooks: - id: beautysh - fail_fast: true additional_dependencies: - setuptools diff --git a/bin/winapps b/bin/winapps index 3fec6fb..a188bf1 100755 --- a/bin/winapps +++ b/bin/winapps @@ -1,43 +1,45 @@ #!/usr/bin/env bash -if [ ! -f "${HOME}/.config/winapps/winapps.conf" ] && [ ! -f "${HOME}/.winapps" ]; then +if [ ! -f "$HOME/.config/winapps/winapps.conf" ] && [ ! -f "$HOME/.winapps" ]; then echo "You need to create a ~/.config/winapps/winapps.conf configuration. Exiting..." exit fi DIR="$(dirname "$(readlink -f "$0")")" -RUN="$(date)-${RANDOM}" +RUN="$(date)-$RANDOM" -if [ ! -d "${HOME}/.local/share/winapps" ]; then - mkdir -p "${HOME}/.local/share/winapps" +if [ ! -d "$HOME/.local/share/winapps" ]; then + mkdir -p "$HOME/.local/share/winapps" fi RDP_SCALE=100 -if [ -f "${HOME}/.config/winapps/winapps.conf" ]; then - . "${HOME}/.config/winapps/winapps.conf" +if [ -f "$HOME/.config/winapps/winapps.conf" ]; then + # shellcheck source=/dev/null + . "$HOME/.config/winapps/winapps.conf" else - . "${HOME}/.winapps" + # shellcheck source=/dev/null + . "$HOME/.winapps" fi function dprint() { - if [ "${DEBUG}" = "true" ]; then - echo "[${RUN}] ${1}" >>"${HOME}/.local/share/winapps/winapps.log" + if [ "$DEBUG" = "true" ]; then + echo "[$RUN] ${1}" >>"$HOME/.local/share/winapps/winapps.log" fi } dprint "START" -if [ -f "${HOME}/.local/share/winapps/run" ]; then - LAST_RAN=$(stat -t -c %Y "${HOME}/.local/share/winapps/run") +if [ -f "$HOME/.local/share/winapps/run" ]; then + LAST_RAN=$(stat -t -c %Y "$HOME/.local/share/winapps/run") dprint "LAST_RAN:${LAST_RAN}" - touch "${HOME}/.local/share/winapps/run" - THIS_RUN=$(stat -t -c %Y "${HOME}/.local/share/winapps/run") - dprint "THIS_RUN:${THIS_RUN}" + touch "$HOME/.local/share/winapps/run" + THIS_RUN=$(stat -t -c %Y "$HOME/.local/share/winapps/run") + dprint "THIS_RUN:$THIS_RUN" if ((THIS_RUN - LAST_RAN < 2)); then exit fi else - touch "${HOME}/.local/share/winapps/run" + touch "$HOME/.local/share/winapps/run" fi if [ -z "${FREERDP_COMMAND}" ]; then @@ -48,15 +50,15 @@ if [ -z "${FREERDP_COMMAND}" ]; then then FREERDP_COMMAND="xfreerdp3" fi -elif command -v $FREERDP_COMMAND &> /dev/null +elif command -v "$FREERDP_COMMAND" &> /dev/null then - dprint "Using custom freerdp command ${FREERDP_COMMAND}" + dprint "Using custom freerdp command $FREERDP_COMMAND" else echo "You have supplied a custom FreeRDP command, but the command is not available." exit fi -if [ -z "${RDP_IP}" ]; then +if [ -z "$RDP_IP" ]; then if [ ! "$(groups | grep -v libvirt)" ]; then echo "You are not a member of the libvirt group. Run the below then reboot." echo ' sudo usermod -a -G libvirt $(whoami)' @@ -74,7 +76,7 @@ if [ -z "${RDP_IP}" ]; then fi dprint "1:${1}" -dprint "2:${2}" +dprint "2:$2" # this is just for debug logging anyways # shellcheck disable=SC2145 dprint "@:${@}" @@ -85,23 +87,23 @@ if [ "${MULTIMON}" = "true" ]; then fi if [ "${1}" = "windows" ]; then - $FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +dynamic-resolution +auto-reconnect +home-drive /wm-class:"Microsoft Windows" /v:${RDP_IP} 1>/dev/null 2>&1 & + $FREERDP_COMMAND $RDP_FLAGS /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +dynamic-resolution +auto-reconnect +home-drive /wm-class:"Microsoft Windows" /v:$RDP_IP 1>/dev/null 2>&1 & elif [ "${1}" = "check" ]; then dprint "CHECK" - $FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +auto-reconnect +home-drive -wallpaper +dynamic-resolution ${MULTI_FLAG} /app:program:"explorer.exe" /v:${RDP_IP} + $FREERDP_COMMAND $RDP_FLAGS /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +auto-reconnect +home-drive -wallpaper +dynamic-resolution $MULTI_FLAG /app:program:"explorer.exe" /v:$RDP_IP elif [ "${1}" = "manual" ]; then - dprint "MANUAL:${2}" - $FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +auto-reconnect +home-drive +dynamic-resolution ${MULTI_FLAG} /app:program:"${2}" /v:"${RDP_IP}" 1>/dev/null 2>&1 & + dprint "MANUAL:$2" + $FREERDP_COMMAND $RDP_FLAGS /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +auto-reconnect +home-drive +dynamic-resolution $MULTI_FLAG /app:program:"$2" /v:"$RDP_IP" 1>/dev/null 2>&1 & elif [ "${1}" != "install" ]; then dprint "DIR:${DIR}" if [ -e "${DIR}/../apps/${1}/info" ]; then # shellcheck disable=SC1090 . "${DIR}/../apps/${1}/info" ICON="${DIR}/../apps/${1}/icon.svg" - elif [ -e "${HOME}/.local/share/winapps/apps/${1}/info" ]; then + elif [ -e "$HOME/.local/share/winapps/apps/${1}/info" ]; then # shellcheck disable=SC1090 - . "${HOME}/.local/share/winapps/apps/${1}/info" - ICON="${HOME}/.local/share/winapps/apps/${1}/icon.svg" + . "$HOME/.local/share/winapps/apps/${1}/info" + ICON="$HOME/.local/share/winapps/apps/${1}/icon.svg" elif [ -e "/usr/local/share/winapps/apps/${1}/info" ]; then # shellcheck disable=SC1090 . "/usr/local/share/winapps/apps/${1}/info" @@ -110,13 +112,13 @@ elif [ "${1}" != "install" ]; then echo "You need to run 'installer.sh' first." exit 1 fi - if [ -n "${2}" ]; then - dprint "HOME:${HOME}" - FILE=$(echo "${2}" | sed 's|'"${HOME}"'|\\\\tsclient\\home|;s|/|\\|g;s|\\|\\\\|g') + if [ -n "$2" ]; then + dprint "HOME:$HOME" + FILE=$(echo "$2" | sed 's|'"$HOME"'|\\\\tsclient\\home|;s|/|\\|g;s|\\|\\\\|g') dprint "FILE:${FILE}" - $FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +auto-reconnect +clipboard +home-drive -wallpaper +dynamic-resolution ${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:program:"${WIN_EXECUTABLE}",icon:"${ICON}",name:"${FULL_NAME}",cmd:"\"$FILE\"" /v:"${RDP_IP}" 1>/dev/null 2>&1 & + $FREERDP_COMMAND $RDP_FLAGS /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +auto-reconnect +clipboard +home-drive -wallpaper +dynamic-resolution $MULTI_FLAG /wm-class:"$FULL_NAME" /app:program:"$WIN_EXECUTABLE",icon:"$ICON",name:"$FULL_NAME",cmd:"\"$FILE\"" /v:"$RDP_IP" 1>/dev/null 2>&1 & else - $FREERDP_COMMAND ${RDP_FLAGS} /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" /scale:${RDP_SCALE} +auto-reconnect +clipboard +home-drive -wallpaper +dynamic-resolution ${MULTI_FLAG} /wm-class:"${FULL_NAME}" /app:program:"${WIN_EXECUTABLE}",icon:"${ICON}",name:"${FULL_NAME}" /v:"${RDP_IP}" 1>/dev/null 2>&1 & + $FREERDP_COMMAND $RDP_FLAGS /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +auto-reconnect +clipboard +home-drive -wallpaper +dynamic-resolution $MULTI_FLAG /wm-class:"$FULL_NAME" /app:program:"$WIN_EXECUTABLE",icon:"$ICON",name:"$FULL_NAME" /v:"$RDP_IP" 1>/dev/null 2>&1 & fi fi diff --git a/installer.sh b/installer.sh index 254b205..9ba30ff 100755 --- a/installer.sh +++ b/installer.sh @@ -11,45 +11,47 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" MAKEDEMO=0 USEDEMO=0 -. "${DIR}/install/inquirer.sh" +# shellcheck disable=SC1094 +. "$DIR/install/inquirer.sh" INSTALLED_EXES=() function waUsage() { - echo 'Usage: - ./installer.sh --user # Install everything in ${HOME} - ./installer.sh --system # Install everything in /usr' + echo "Usage: + ./installer.sh --user # Install everything in $HOME + ./installer.sh --system # Install everything in /usr" exit } function waNoSudo() { - echo 'You are attempting to switch from a --system install to a --user install. - Please run "./installer.sh --system --uninstall" first.' + echo "You are attempting to switch from a --system install to a --user install. + Please run \"./installer.sh --system --uninstall\" first." exit } function waInstall() { - ${SUDO} mkdir -p "${SYS_PATH}/apps" - . "${DIR}/bin/winapps" install + $SUDO mkdir -p "$SYS_PATH/apps" + . "$DIR/bin/winapps" install } function waFindInstalled() { echo -n " Checking for installed apps in RDP machine (this may take a while)..." if [ $USEDEMO != 1 ]; then - rm -f ${HOME}/.local/share/winapps/installed.bat - rm -f ${HOME}/.local/share/winapps/installed.tmp - rm -f ${HOME}/.local/share/winapps/installed - rm -f ${HOME}/.local/share/winapps/detected - cp "${DIR}/install/ExtractPrograms.ps1" ${HOME}/.local/share/winapps/ExtractPrograms.ps1 - for F in $(ls "${DIR}/apps"); do - . "${DIR}/apps/${F}/info" - echo "IF EXIST \"${WIN_EXECUTABLE}\" ECHO ${F} >> \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp" >>${HOME}/.local/share/winapps/installed.bat + rm -f "$HOME/.local/share/winapps/installed.bat" + rm -f "$HOME/.local/share/winapps/installed.tmp" + rm -f "$HOME/.local/share/winapps/installed" + rm -f "$HOME/.local/share/winapps/detected" + cp "$DIR/install/ExtractPrograms.ps1" "$HOME/.local/share/winapps/ExtractPrograms.ps1" + for F in "$DIR/apps"; do + [[ -e "$F" ]] || break + . "$DIR/apps/${F}/info" + echo "IF EXIST \"${WIN_EXECUTABLE}\" ECHO ${F} >> \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp" >>"$HOME/.local/share/winapps/installed.bat" done - echo "powershell.exe -ExecutionPolicy Bypass -File \\\\tsclient\\home\\.local\\share\\winapps\\ExtractPrograms.ps1 > \\\\tsclient\home\\.local\\share\\winapps\\detected" >>${HOME}/.local/share/winapps/installed.bat - echo "RENAME \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp installed" >>${HOME}/.local/share/winapps/installed.bat + echo "powershell.exe -ExecutionPolicy Bypass -File \\\\tsclient\\home\\.local\\share\\winapps\\ExtractPrograms.ps1 > \\\\tsclient\home\\.local\\share\\winapps\\detected" >>"$HOME/.local/share/winapps/installed.bat" + echo "RENAME \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp installed" >>"$HOME/.local/share/winapps/installed.bat" $FREERDP_COMMAND /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" +auto-reconnect +home-drive -wallpaper +span /app:program:"C:\Windows\System32\cmd.exe",cmd:"/C \\\\tsclient\\home\\.local\\share\\winapps\\installed.bat" /v:${RDP_IP} 1>/dev/null 2>&1 & COUNT=0 - while [ ! -f "${HOME}/.local/share/winapps/installed" ]; do + while [ ! -f "$HOME/.local/share/winapps/installed" ]; do sleep 5 COUNT=$((COUNT + 1)) if ((COUNT == 15)); then @@ -69,12 +71,12 @@ function waFindInstalled() { done if [ $MAKEDEMO = 1 ]; then rm -rf /tmp/winapps_demo - cp -a ${HOME}/.local/share/winapps /tmp/winapps_demo + cp -a "$HOME/.local/share/winapps /tmp/winapps_demo" exit fi else - rm -rf ${HOME}/.local/share/winapps - cp -a /tmp/winapps_demo ${HOME}/.local/share/winapps + rm -rf "$HOME/.local/share/winapps" + cp -a /tmp/winapps_demo "$HOME/.local/share/winapps" #sleep 3 fi echo " Finished." @@ -82,16 +84,16 @@ function waFindInstalled() { function waConfigureApp() { if [ -z "${ICON}" ]; then - ICON=${SYS_PATH}/apps/${1}/icon.${2} + ICON=$SYS_PATH/apps/${1}/icon.${2} fi - . "${SYS_PATH}/apps/${1}/info" - echo -n " Configuring ${NAME}..." - if [ ${USEDEMO} != 1 ]; then - ${SUDO} rm -f "${APP_PATH}/${1}.desktop" + . "$SYS_PATH/apps/${1}/info" + echo -n " Configuring $NAME..." + if [ $USEDEMO != 1 ]; then + $SUDO rm -f "$APP_PATH/${1}.desktop" echo "[Desktop Entry] -Name=${NAME} -Exec=${BIN_PATH}/winapps ${1} %F +Name=$NAME +Exec=$BIN_PATH/winapps ${1} %F Terminal=false Type=Application Icon=$ICON @@ -99,12 +101,11 @@ StartupWMClass=${FULL_NAME} Comment=${FULL_NAME} Categories=${CATEGORIES} MimeType=${MIME_TYPES} - " | ${SUDO} tee "${APP_PATH}/${1}.desktop" >/dev/null - ${SUDO} rm -f "${BIN_PATH}/${1}" - echo "#!/usr/bin/env bash -${BIN_PATH}/winapps ${1} $@ - " | ${SUDO} tee "${BIN_PATH}/${1}" >/dev/null - ${SUDO} chmod a+x "${BIN_PATH}/${1}" + " | $SUDO tee "$APP_PATH/${1}.desktop" >/dev/null + $SUDO rm -f "$BIN_PATH/${1}" + echo "#!/usr/bin/env bash $BIN_PATH/winapps ${1} $* + " | $SUDO tee "$BIN_PATH/${1}" >/dev/null + $SUDO chmod a+x "$BIN_PATH/${1}" fi echo " Finished." @@ -113,8 +114,8 @@ ${BIN_PATH}/winapps ${1} $@ function waConfigureApps() { APPS=() - for F in $(cat "${HOME}/.local/share/winapps/installed" | sed 's/\r/\n/g'); do - . "${DIR}/apps/${F}/info" + for F in $(cat "$HOME/.local/share/winapps/installed" | sed 's/\r/\n/g'); do + . "$DIR/apps/${F}/info" APPS+=("${FULL_NAME} (${F})") INSTALLED_EXES+=("$(echo "${WIN_EXECUTABLE##*\\}" | tr '[:upper:]' '[:lower:]')") done @@ -129,93 +130,93 @@ function waConfigureApps() { fi if [ "${APP_INSTALL}" = "Select which pre-configured applications to set up" ]; then checkbox_input "Which pre-configured apps would you like to set up?" APPS SELECTED_APPS - echo "" >"${HOME}/.local/share/winapps/installed" + echo "" >"$HOME/.local/share/winapps/installed" for F in "${SELECTED_APPS[@]}"; do APP="${F##*(}" APP="${APP%%)}" - echo "${APP}" >>"${HOME}/.local/share/winapps/installed" + echo "${APP}" >>"$HOME/.local/share/winapps/installed" done fi - ${SUDO} cp "${DIR}/bin/winapps" "${BIN_PATH}/winapps" + $SUDO cp "$DIR/bin/winapps" "$BIN_PATH/winapps" COUNT=0 if [ "${APP_INSTALL}" != "Do not set up any pre-configured applications" ]; then - for F in $(cat "${HOME}/.local/share/winapps/installed" | sed 's/\r/\n/g'); do + for F in $(cat "$HOME/.local/share/winapps/installed" | sed 's/\r/\n/g'); do COUNT=$((COUNT + 1)) - ${SUDO} cp -r "apps/${F}" "${SYS_PATH}/apps" + $SUDO cp -r "apps/${F}" "$SYS_PATH/apps" waConfigureApp "${F}" svg done fi - rm -f "${HOME}/.local/share/winapps/installed" - rm -f "${HOME}/.local/share/winapps/installed.bat" + rm -f "$HOME/.local/share/winapps/installed" + rm -f "$HOME/.local/share/winapps/installed.bat" if (($COUNT == 0)); then echo " No configured applications." fi } function waConfigureAppsAllOfficiallySupported(){ - ${SUDO} cp "${DIR}/bin/winapps" "${BIN_PATH}/winapps" + $SUDO cp "$DIR/bin/winapps" "$BIN_PATH/winapps" COUNT=0 - for F in $(cat "${HOME}/.local/share/winapps/installed" | sed 's/\r/\n/g'); do + for F in $(cat "$HOME/.local/share/winapps/installed" | sed 's/\r/\n/g'); do COUNT=$((COUNT + 1)) - ${SUDO} cp -r "apps/${F}" "${SYS_PATH}/apps" + $SUDO cp -r "apps/${F}" "$SYS_PATH/apps" waConfigureApp "${F}" svg done - rm -f "${HOME}/.local/share/winapps/installed" - rm -f "${HOME}/.local/share/winapps/installed.bat" + rm -f "$HOME/.local/share/winapps/installed" + rm -f "$HOME/.local/share/winapps/installed.bat" if (($COUNT == 0)); then echo " No configured applications." fi } function waConfigureDetectedApps() { - if [ -f "${HOME}/.local/share/winapps/detected" ]; then - sed -i 's/\r//g' "${HOME}/.local/share/winapps/detected" - . "${HOME}/.local/share/winapps/detected" + if [ -f "$HOME/.local/share/winapps/detected" ]; then + sed -i 's/\r//g' "$HOME/.local/share/winapps/detected" + . "$HOME/.local/share/winapps/detected" APPS=() for I in "${!NAMES[@]}"; do EXE=${EXES[$I]##*\\} - EXE_LOWER=$(echo "${EXE}" | tr '[:upper:]' '[:lower:]') + EXE_LOWER=$(echo "$EXE" | tr '[:upper:]' '[:lower:]') if ( dlm=$'\x1F' IFS="$dlm" [[ "$dlm${INSTALLED_EXES[*]}$dlm" != *"$dlm${EXE_LOWER}$dlm"* ]] ); then - APPS+=("${NAMES[$I]} (${EXE})") + APPS+=("${NAMES[$I]} ($EXE)") fi done - IFS=$'\n' APPS=($(sort <<<"${APPS[*]}")) + IFS=$'\n' APPS=("$(sort <<<"${APPS[*]}")") unset IFS OPTIONS=("Set up all detected applications" "Select which applications to set up" "Do not set up any applications") menuFromArr APP_INSTALL "How would you like to handle other detected applications?" "${OPTIONS[@]}" if [ "${APP_INSTALL}" = "Select which applications to set up" ]; then checkbox_input "Which other apps would you like to set up?" APPS SELECTED_APPS - echo "" >"${HOME}/.local/share/winapps/installed" + echo "" >"$HOME/.local/share/winapps/installed" for F in "${SELECTED_APPS[@]}"; do EXE="${F##*(}" EXE="${EXE%%)}" APP="${F% (*}" - echo "${EXE}|${APP}" >>"${HOME}/.local/share/winapps/installed" + echo "$EXE|${APP}" >>"$HOME/.local/share/winapps/installed" done elif [ "${APP_INSTALL}" = "Set up all detected applications" ]; then for I in "${!EXES[@]}"; do EXE=${EXES[$I]##*\\} - echo "${EXE}|${NAMES[$I]}" >>"${HOME}/.local/share/winapps/installed" + echo "$EXE|${NAMES[$I]}" >>"$HOME/.local/share/winapps/installed" done fi COUNT=0 - if [ -f "${HOME}/.local/share/winapps/installed" ]; then - while read LINE; do + if [ -f "$HOME/.local/share/winapps/installed" ]; then + while read -r LINE; do EXE="${LINE%|*}" NAME="${LINE#*|}" for I in "${!NAMES[@]}"; do - if [ "${NAME}" = "${NAMES[$I]}" ] && [[ "${EXES[$I]}" == *"\\${EXE}" ]]; then - EXE=$(echo "${EXE}" | tr '[:upper:]' '[:lower:]') - ${SUDO} mkdir -p "${SYS_PATH}/apps/${EXE}" + if [ "$NAME" = "${NAMES[$I]}" ] && [[ "${EXES[$I]}" == *"\\$EXE" ]]; then + EXE=$(echo "$EXE" | tr '[:upper:]' '[:lower:]') + $SUDO mkdir -p "$SYS_PATH/apps/$EXE" echo "# GNOME shortcut name -NAME=\"${NAME}\" +NAME=\"$NAME\" # Used for descriptions and window class -FULL_NAME=\"${NAME}\" +FULL_NAME=\"$NAME\" # The executable inside windows WIN_EXECUTABLE=\"${EXES[$I]}\" @@ -225,17 +226,17 @@ CATEGORIES=\"WinApps\" # GNOME mimetypes MIME_TYPES=\"\" - " | sudo tee "${SYS_PATH}/apps/${EXE}/info" >/dev/null - echo "${ICONS[$I]}" | base64 -d | sudo tee "${SYS_PATH}/apps/${EXE}/icon.ico" >/dev/null - waConfigureApp "${EXE}" ico + " | sudo tee "$SYS_PATH/apps/$EXE/info" >/dev/null + echo "${ICONS[$I]}" | base64 -d | sudo tee "$SYS_PATH/apps/$EXE/icon.ico" >/dev/null + waConfigureApp "$EXE" ico COUNT=$((COUNT + 1)) fi done - done <"${HOME}/.local/share/winapps/installed" - rm -f "${HOME}/.local/share/winapps/installed" + done <"$HOME/.local/share/winapps/installed" + rm -f "$HOME/.local/share/winapps/installed" fi - rm -f "${HOME}/.local/share/winapps/installed.bat" - if (($COUNT == 0)); then + rm -f "$HOME/.local/share/winapps/installed.bat" + if ((COUNT == 0)); then echo " No configured applications." fi fi @@ -243,60 +244,64 @@ MIME_TYPES=\"\" function waConfigureWindows() { echo -n " Configuring Windows..." - if [ ${USEDEMO} != 1 ]; then - ${SUDO} rm -f "${APP_PATH}/windows.desktop" - ${SUDO} mkdir -p "${SYS_PATH}/icons" - ${SUDO} cp "${DIR}/icons/windows.svg" "${SYS_PATH}/icons/windows.svg" + if [ $USEDEMO != 1 ]; then + $SUDO rm -f "$APP_PATH/windows.desktop" + $SUDO mkdir -p "$SYS_PATH/icons" + $SUDO cp "$DIR/icons/windows.svg" "$SYS_PATH/icons/windows.svg" echo "[Desktop Entry] Name=Windows -Exec=${BIN_PATH}/winapps windows %F +Exec=$BIN_PATH/winapps windows %F Terminal=false Type=Application -Icon=${SYS_PATH}/icons/windows.svg +Icon=$SYS_PATH/icons/windows.svg StartupWMClass=Microsoft Windows Comment=Microsoft Windows - " | ${SUDO} tee "${APP_PATH}/windows.desktop" >/dev/null - ${SUDO} rm -f "${BIN_PATH}/windows" + " | $SUDO tee "$APP_PATH/windows.desktop" >/dev/null + $SUDO rm -f "$BIN_PATH/windows" echo "#!/usr/bin/env bash -${BIN_PATH}/winapps windows - " | ${SUDO} tee "/${BIN_PATH}/windows" >/dev/null - ${SUDO} chmod a+x "${BIN_PATH}/windows" +$BIN_PATH/winapps windows + " | $SUDO tee "/$BIN_PATH/windows" >/dev/null + $SUDO chmod a+x "$BIN_PATH/windows" fi echo " Finished." } function waUninstallUser() { - rm -f "${HOME}/.local/bin/winapps" - rm -rf "${HOME}/.local/share/winapps" - for F in $(grep -l -d skip "bin/winapps" "${HOME}/.local/share/applications/"* -s); do - echo -n " Removing ${F}..." - ${SUDO} rm ${F} + rm -f "$HOME/.local/bin/winapps" + rm -rf "$HOME/.local/share/winapps" + grep -l -d skip "bin/winapps" "$HOME/.local/share/applications/"* -s | while IFS= read -r F + do + echo -n " Removing $F..." + "$SUDO" rm "$F" echo " Finished." done - for F in $(grep -l -d skip "bin/winapps" "${HOME}/.local/bin/"* -s); do - echo -n " Removing ${F}..." - ${SUDO} rm ${F} + grep -l -d skip "bin/winapps" "$HOME/.local/bin/"* -s | while IFS= read -r F + do + echo -n " Removing $F..." + "$SUDO" rm "$F" echo " Finished." done } function waUninstallSystem() { - ${SUDO} rm -f "/usr/local/bin/winapps" - ${SUDO} rm -rf "/usr/local/share/winapps" - for F in $(grep -l -d skip "bin/winapps" "/usr/share/applications/"* -s); do - if [ -z "${SUDO}" ]; then + "$SUDO" rm -f "/usr/local/bin/winapps" + "$SUDO" rm -rf "/usr/local/share/winapps" + grep -l -d skip "bin/winapps" "/usr/share/applications/"* -s | while IFS= read -r F + do + if [ -z "$SUDO" ]; then waNoSudo fi - echo -n " Removing ${F}..." - ${SUDO} rm ${F} + echo -n " Removing $F..." + "$SUDO" rm "$F" echo " Finished." done - for F in $(grep -l -d skip "bin/winapps" "/usr/local/bin/"* -s); do - if [ -z "${SUDO}" ]; then + grep -l -d skip "bin/winapps" "/usr/local/bin/"* -s | while IFS= read -r F + do + if [ -z "$SUDO" ]; then waNoSudo fi - echo -n " Removing ${F}..." - ${SUDO} rm ${F} + echo -n " Removing $F..." + "$SUDO" rm "$F" echo " Finished." done } @@ -304,29 +309,29 @@ function waUninstallSystem() { if [ -z "${1}" ]; then OPTIONS=(User System) menuFromArr INSTALL_TYPE "Would you like to install for the current user or the whole system?" "${OPTIONS[@]}" -elif [ "${1}" = '--user' ]; then +elif [ "$1" = '--user' ]; then INSTALL_TYPE='User' -elif [ "${1}" = '--system' ]; then +elif [ "$1" = '--system' ]; then INSTALL_TYPE='System' else waUsage fi -if [ "${INSTALL_TYPE}" = 'User' ]; then +if [ "$INSTALL_TYPE" = 'User' ]; then SUDO="" - BIN_PATH="${HOME}/.local/bin" - APP_PATH="${HOME}/.local/share/applications" - SYS_PATH="${HOME}/.local/share/winapps" - mkdir -p $BIN_PATH - mkdir -p $APP_PATH - mkdir -p $SYS_PATH - if [ -n "${2}" ]; then - if [ "${2}" = '--uninstall' ]; then + BIN_PATH="$HOME/.local/bin" + APP_PATH="$HOME/.local/share/applications" + SYS_PATH="$HOME/.local/share/winapps" + mkdir -p "$BIN_PATH" + mkdir -p "$APP_PATH" + mkdir -p "$SYS_PATH" + if [ -n "$2" ]; then + if [ "$2" = '--uninstall' ]; then # Uninstall echo "Uninstalling..." waUninstallUser exit - elif [ "${2}" = '--setupAllOfficiallySupportedApps' ]; then + elif [ "$2" = '--setupAllOfficiallySupportedApps' ]; then echo "Setting up All Officially Supported Apps " echo "Removing any old configurations..." waUninstallUser @@ -340,19 +345,19 @@ if [ "${INSTALL_TYPE}" = 'User' ]; then usage fi fi -elif [ "${INSTALL_TYPE}" = 'System' ]; then +elif [ "$INSTALL_TYPE" = 'System' ]; then SUDO="sudo" sudo ls >/dev/null BIN_PATH="/usr/local/bin" APP_PATH="/usr/share/applications" SYS_PATH="/usr/local/share/winapps" - if [ -n "${2}" ]; then - if [ "${2}" = '--uninstall' ]; then + if [ -n "$2" ]; then + if [ "$2" = '--uninstall' ]; then # Uninstall echo "Uninstalling..." waUninstallSystem exit - elif [ "${2}" = '--setupAllOfficiallySupportedApps' ]; then + elif [ "$2" = '--setupAllOfficiallySupportedApps' ]; then echo "Setting up All Officially Supported Apps " echo "Removing any old configurations..." waUninstallUser From 3d8ff78e91ef1a7c3be1ed158d05d2044262d8d5 Mon Sep 17 00:00:00 2001 From: LDprg <71488985+LDprg@users.noreply.github.com> Date: Fri, 24 May 2024 06:14:54 +0200 Subject: [PATCH 028/187] Small refinements --- docs/docker.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/docker.md b/docs/docker.md index c7b36af..e682051 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -39,7 +39,7 @@ services: - data:/storage ``` -Now you can tune the ram/usage by changing RAM_SIZE/CPU_CORES. You can also specify the windows versions you want to use. +Now you can tune the ram/usage by changing RAM_SIZE/CPU_CORES. You can also specify the windows versions you want to use. You might also want to take a look at the [docker image repo](https://github.com/dockur/windows). Note: Older versions than Windows 10 are not officially supported. However they might still work with some additional tuning. @@ -50,9 +50,9 @@ docker compose up After this just open http://127.0.0.1:8006 in your webbrowser and finish you windows installation as usual. -Change the RDP_IP config to localhost or "127.0.0.1. +Change the RDP_IP in your winapps config to localhost or "127.0.0.1". -Note: RDP will be automatically enabled, however you still need to load the reg files into you vm. +RDP will be automatically enabled, however you still need to load the reg files into you vm. Now you should be ready to go and try to connect to your vm with winapps. From 07886014091158ccdd7d2525598c58102c0bdd36 Mon Sep 17 00:00:00 2001 From: LDprg <71488985+LDprg@users.noreply.github.com> Date: Fri, 24 May 2024 11:30:32 +0200 Subject: [PATCH 029/187] Fix unclear sections of docker.md --- docs/docker.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/docker.md b/docs/docker.md index e682051..0fb6b34 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -8,11 +8,17 @@ While working with virsh is completely fine for winapps, however you have to set Since docker manages the dependencies of the container automatically you only need to install docker or podman itself. (Podman is recommended because of the faster container startup times. Note that podman and docker are interchangeable so no instructions will change depending on which one you use) -Note: This will only work on linux systems since some kernel interfaces (like kvm) are needed by the vm. Because of this performance can vary in kernel versions (newer will likely perform better). +When using podman you want to make sure podman socket is enabled with: +```shell +sudo systemctl enable --now podman.socket +``` + +> [!NOTE] +> This will only work on linux systems since some kernel interfaces (like kvm) are needed by the vm. Because of this performance can vary in kernel versions (newer will likely perform better). # Setup docker container -The easiest way to setup a windows vm is by using docker compose. Just create a `docker-compose.yml` with following content: +The easiest way to setup a windows vm is by using docker compose. Just create a `compose.yml` with following content: ```yaml name: "winapps" @@ -25,8 +31,8 @@ services: image: dockurr/windows container_name: windows environment: - VERSION: "win11" - RAM_SIZE: "8G" + VERSION: "tiny11" + RAM_SIZE: "4G" CPU_CORES: "4" privileged: true ports: @@ -41,7 +47,8 @@ services: Now you can tune the ram/usage by changing RAM_SIZE/CPU_CORES. You can also specify the windows versions you want to use. You might also want to take a look at the [docker image repo](https://github.com/dockur/windows). -Note: Older versions than Windows 10 are not officially supported. However they might still work with some additional tuning. +> [!NOTE] +> Older versions than Windows 10 are not officially supported. However they might still work with some additional tuning. You can now just run: ```shell From e7b9ae0fa77e31c4bd23a7eabc789b519b1d3d80 Mon Sep 17 00:00:00 2001 From: LDprg <71488985+LDprg@users.noreply.github.com> Date: Fri, 24 May 2024 11:34:38 +0200 Subject: [PATCH 030/187] Add docker and podman doc ref --- docs/docker.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/docker.md b/docs/docker.md index 0fb6b34..9afba83 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -8,6 +8,10 @@ While working with virsh is completely fine for winapps, however you have to set Since docker manages the dependencies of the container automatically you only need to install docker or podman itself. (Podman is recommended because of the faster container startup times. Note that podman and docker are interchangeable so no instructions will change depending on which one you use) +You might also want to take a look in the docs: +- [podman docs](https://docs.podman.io/) +- [docker docs](https://docs.docker.com/) + When using podman you want to make sure podman socket is enabled with: ```shell sudo systemctl enable --now podman.socket From 8f259464a5561af7ae332df7b809a486188d511f Mon Sep 17 00:00:00 2001 From: LDprg Date: Fri, 24 May 2024 18:14:03 +0200 Subject: [PATCH 031/187] finish adding spellcheck --- .pre-commit-config.yaml | 8 ++-- bin/winapps | 51 +++++++++++----------- install/inquirer.sh | 2 + installer.sh | 94 +++++++++++++++++++++++------------------ 4 files changed, 84 insertions(+), 71 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index adf8aa7..199bc64 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -47,7 +47,7 @@ repos: additional_dependencies: - setuptools - # - repo: https://github.com/shellcheck-py/shellcheck-py - # rev: v0.10.0.1 - # hooks: - # - id: shellcheck + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.10.0.1 + hooks: + - id: shellcheck diff --git a/bin/winapps b/bin/winapps index a188bf1..4ffe221 100755 --- a/bin/winapps +++ b/bin/winapps @@ -23,7 +23,7 @@ fi function dprint() { if [ "$DEBUG" = "true" ]; then - echo "[$RUN] ${1}" >>"$HOME/.local/share/winapps/winapps.log" + echo "[$RUN] $1" >>"$HOME/.local/share/winapps/winapps.log" fi } @@ -59,13 +59,13 @@ else fi if [ -z "$RDP_IP" ]; then - if [ ! "$(groups | grep -v libvirt)" ]; then + if groups | grep -vq libvirt; then echo "You are not a member of the libvirt group. Run the below then reboot." - echo ' sudo usermod -a -G libvirt $(whoami)' - echo ' sudo usermod -a -G kvm $(whoami)' + echo " sudo usermod -a -G libvirt $(whoami)" + echo " sudo usermod -a -G kvm $(whoami)" exit fi - if [ ! "$(virsh list | grep -v RDPWindows)" ]; then + if virsh list | grep -vq RDPWindows; then echo "RDPWindows is not running, run:" echo " virsh start RDPWindows" exit @@ -75,39 +75,39 @@ if [ -z "$RDP_IP" ]; then fi -dprint "1:${1}" +dprint "1:$1" dprint "2:$2" # this is just for debug logging anyways # shellcheck disable=SC2145 dprint "@:${@}" MULTI_FLAG="+span" -if [ "${MULTIMON}" = "true" ]; then +if [ "$MULTIMON" = "true" ]; then MULTI_FLAG="/multimon" fi -if [ "${1}" = "windows" ]; then - $FREERDP_COMMAND $RDP_FLAGS /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +dynamic-resolution +auto-reconnect +home-drive /wm-class:"Microsoft Windows" /v:$RDP_IP 1>/dev/null 2>&1 & -elif [ "${1}" = "check" ]; then +if [ "$1" = "windows" ]; then + $FREERDP_COMMAND "$RDP_FLAGS" /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +dynamic-resolution +auto-reconnect +home-drive /wm-class:"Microsoft Windows" /v:"$RDP_IP" 1>/dev/null 2>&1 & +elif [ "$1" = "check" ]; then dprint "CHECK" - $FREERDP_COMMAND $RDP_FLAGS /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +auto-reconnect +home-drive -wallpaper +dynamic-resolution $MULTI_FLAG /app:program:"explorer.exe" /v:$RDP_IP -elif [ "${1}" = "manual" ]; then + $FREERDP_COMMAND "$RDP_FLAGS" /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +auto-reconnect +home-drive -wallpaper +dynamic-resolution $MULTI_FLAG /app:program:"explorer.exe" /v:"$RDP_IP" +elif [ "$1" = "manual" ]; then dprint "MANUAL:$2" - $FREERDP_COMMAND $RDP_FLAGS /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +auto-reconnect +home-drive +dynamic-resolution $MULTI_FLAG /app:program:"$2" /v:"$RDP_IP" 1>/dev/null 2>&1 & -elif [ "${1}" != "install" ]; then + $FREERDP_COMMAND "$RDP_FLAGS" /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +auto-reconnect +home-drive +dynamic-resolution $MULTI_FLAG /app:program:"$2" /v:"$RDP_IP" 1>/dev/null 2>&1 & +elif [ "$1" != "install" ]; then dprint "DIR:${DIR}" - if [ -e "${DIR}/../apps/${1}/info" ]; then + if [ -e "${DIR}/../apps/$1/info" ]; then # shellcheck disable=SC1090 - . "${DIR}/../apps/${1}/info" - ICON="${DIR}/../apps/${1}/icon.svg" - elif [ -e "$HOME/.local/share/winapps/apps/${1}/info" ]; then + . "${DIR}/../apps/$1/info" + ICON="${DIR}/../apps/$1/icon.svg" + elif [ -e "$HOME/.local/share/winapps/apps/$1/info" ]; then # shellcheck disable=SC1090 - . "$HOME/.local/share/winapps/apps/${1}/info" - ICON="$HOME/.local/share/winapps/apps/${1}/icon.svg" - elif [ -e "/usr/local/share/winapps/apps/${1}/info" ]; then + . "$HOME/.local/share/winapps/apps/$1/info" + ICON="$HOME/.local/share/winapps/apps/$1/icon.svg" + elif [ -e "/usr/local/share/winapps/apps/$1/info" ]; then # shellcheck disable=SC1090 - . "/usr/local/share/winapps/apps/${1}/info" - ICON="/usr/local/share/winapps/apps/${1}/icon.svg" + . "/usr/local/share/winapps/apps/$1/info" + ICON="/usr/local/share/winapps/apps/$1/icon.svg" else echo "You need to run 'installer.sh' first." exit 1 @@ -116,9 +116,10 @@ elif [ "${1}" != "install" ]; then dprint "HOME:$HOME" FILE=$(echo "$2" | sed 's|'"$HOME"'|\\\\tsclient\\home|;s|/|\\|g;s|\\|\\\\|g') dprint "FILE:${FILE}" - $FREERDP_COMMAND $RDP_FLAGS /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +auto-reconnect +clipboard +home-drive -wallpaper +dynamic-resolution $MULTI_FLAG /wm-class:"$FULL_NAME" /app:program:"$WIN_EXECUTABLE",icon:"$ICON",name:"$FULL_NAME",cmd:"\"$FILE\"" /v:"$RDP_IP" 1>/dev/null 2>&1 & + # shellcheck disable=SC2140 + $FREERDP_COMMAND "$RDP_FLAGS" /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +auto-reconnect +clipboard +home-drive -wallpaper +dynamic-resolution $MULTI_FLAG /wm-class:"$FULL_NAME" /app:program:"$WIN_EXECUTABLE",icon:"$ICON",name:"$FULL_NAME",cmd:"\"$FILE\"" /v:"$RDP_IP" 1>/dev/null 2>&1 & else - $FREERDP_COMMAND $RDP_FLAGS /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +auto-reconnect +clipboard +home-drive -wallpaper +dynamic-resolution $MULTI_FLAG /wm-class:"$FULL_NAME" /app:program:"$WIN_EXECUTABLE",icon:"$ICON",name:"$FULL_NAME" /v:"$RDP_IP" 1>/dev/null 2>&1 & + $FREERDP_COMMAND "$RDP_FLAGS" /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +auto-reconnect +clipboard +home-drive -wallpaper +dynamic-resolution $MULTI_FLAG /wm-class:"$FULL_NAME" /app:program:"$WIN_EXECUTABLE",icon:"$ICON",name:"$FULL_NAME" /v:"$RDP_IP" 1>/dev/null 2>&1 & fi fi diff --git a/install/inquirer.sh b/install/inquirer.sh index 917e928..2b9e962 100755 --- a/install/inquirer.sh +++ b/install/inquirer.sh @@ -26,6 +26,8 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +# shellcheck disable=all + # store the current set options OLD_SET=$- set -e diff --git a/installer.sh b/installer.sh index 9ba30ff..845a435 100755 --- a/installer.sh +++ b/installer.sh @@ -42,14 +42,18 @@ function waFindInstalled() { rm -f "$HOME/.local/share/winapps/installed" rm -f "$HOME/.local/share/winapps/detected" cp "$DIR/install/ExtractPrograms.ps1" "$HOME/.local/share/winapps/ExtractPrograms.ps1" + # FIXME + # shellcheck disable=SC2066 for F in "$DIR/apps"; do [[ -e "$F" ]] || break - . "$DIR/apps/${F}/info" - echo "IF EXIST \"${WIN_EXECUTABLE}\" ECHO ${F} >> \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp" >>"$HOME/.local/share/winapps/installed.bat" + # shellcheck disable=SC1090 + . "$DIR/apps/$F/info" + printf "IF EXIST \"%s\" ECHO %s >> \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp" "$WIN_EXECUTABLE" "$F" >>"$HOME/.local/share/winapps/installed.bat" done - echo "powershell.exe -ExecutionPolicy Bypass -File \\\\tsclient\\home\\.local\\share\\winapps\\ExtractPrograms.ps1 > \\\\tsclient\home\\.local\\share\\winapps\\detected" >>"$HOME/.local/share/winapps/installed.bat" - echo "RENAME \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp installed" >>"$HOME/.local/share/winapps/installed.bat" - $FREERDP_COMMAND /d:"${RDP_DOMAIN}" /u:"${RDP_USER}" /p:"${RDP_PASS}" +auto-reconnect +home-drive -wallpaper +span /app:program:"C:\Windows\System32\cmd.exe",cmd:"/C \\\\tsclient\\home\\.local\\share\\winapps\\installed.bat" /v:${RDP_IP} 1>/dev/null 2>&1 & + printf "powershell.exe -ExecutionPolicy Bypass -File \\\\tsclient\\home\\.local\\share\\winapps\\ExtractPrograms.ps1 > \\\\tsclient\home\\.local\\share\\winapps\\detected" >>"$HOME/.local/share/winapps/installed.bat" + printf "RENAME \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp installed" >>"$HOME/.local/share/winapps/installed.bat" + # shellcheck disable=SC2140 + $FREERDP_COMMAND /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" +auto-reconnect +home-drive -wallpaper +span /app:program:"C:\Windows\System32\cmd.exe",cmd:"/C \\\\tsclient\\home\\.local\\share\\winapps\\installed.bat" /v:"$RDP_IP" 1>/dev/null 2>&1 & COUNT=0 while [ ! -f "$HOME/.local/share/winapps/installed" ]; do sleep 5 @@ -71,7 +75,7 @@ function waFindInstalled() { done if [ $MAKEDEMO = 1 ]; then rm -rf /tmp/winapps_demo - cp -a "$HOME/.local/share/winapps /tmp/winapps_demo" + cp -a "$HOME/.local/share/winapps" /tmp/winapps_demo exit fi else @@ -83,29 +87,29 @@ function waFindInstalled() { } function waConfigureApp() { - if [ -z "${ICON}" ]; then - ICON=$SYS_PATH/apps/${1}/icon.${2} + if [ -z "$ICON" ]; then + ICON=$SYS_PATH/apps/$1/icon.$2 fi - - . "$SYS_PATH/apps/${1}/info" + # shellcheck disable=SC1090 + . "$SYS_PATH/apps/$1/info" echo -n " Configuring $NAME..." if [ $USEDEMO != 1 ]; then - $SUDO rm -f "$APP_PATH/${1}.desktop" + $SUDO rm -f "$APP_PATH/$1.desktop" echo "[Desktop Entry] Name=$NAME -Exec=$BIN_PATH/winapps ${1} %F +Exec=$BIN_PATH/winapps $1 %F Terminal=false Type=Application Icon=$ICON -StartupWMClass=${FULL_NAME} -Comment=${FULL_NAME} -Categories=${CATEGORIES} -MimeType=${MIME_TYPES} - " | $SUDO tee "$APP_PATH/${1}.desktop" >/dev/null - $SUDO rm -f "$BIN_PATH/${1}" - echo "#!/usr/bin/env bash $BIN_PATH/winapps ${1} $* - " | $SUDO tee "$BIN_PATH/${1}" >/dev/null - $SUDO chmod a+x "$BIN_PATH/${1}" +StartupWMClass=$FULL_NAME +Comment=$FULL_NAME +Categories=$CATEGORIES +MimeType=$MIME_TYPES + " | $SUDO tee "$APP_PATH/$1.desktop" >/dev/null + $SUDO rm -f "$BIN_PATH/$1" + echo "#!/usr/bin/env bash $BIN_PATH/winapps $1 $* + " | $SUDO tee "$BIN_PATH/$1" >/dev/null + $SUDO chmod a+x "$BIN_PATH/$1" fi echo " Finished." @@ -114,21 +118,24 @@ MimeType=${MIME_TYPES} function waConfigureApps() { APPS=() - for F in $(cat "$HOME/.local/share/winapps/installed" | sed 's/\r/\n/g'); do - . "$DIR/apps/${F}/info" - APPS+=("${FULL_NAME} (${F})") + while IFS= read -r F; do + # shellcheck disable=SC1090 + . "$DIR/apps/$F/info" + APPS+=("$FULL_NAME ($F)") INSTALLED_EXES+=("$(echo "${WIN_EXECUTABLE##*\\}" | tr '[:upper:]' '[:lower:]')") - done + done < <(sed 's/\r/\n/g' < "$HOME/.local/share/winapps/installed") + # FIXME + # shellcheck disable=SC2207,SC2031 IFS=$'\n' APPS=($(sort <<<"${APPS[*]}")) unset IFS OPTIONS=("Set up all detected pre-configured applications" "Select which pre-configured applications to set up" "Do not set up any pre-configured applications") - if [ "${INSTALL_TYPE}" != 'User' ]; then + if [ "$INSTALL_TYPE" != 'User' ]; then menuFromArr APP_INSTALL "How would you like to handle WinApps pre-configured applications?" "${OPTIONS[@]}" else "grep -l -d skip" menuFromArr APP_INSTALL "How would you like to handle WinApps pre-configured applications? If any web browser is set-up, may be configured as default browser." "${OPTIONS[@]}" fi - if [ "${APP_INSTALL}" = "Select which pre-configured applications to set up" ]; then + if [ "$APP_INSTALL" = "Select which pre-configured applications to set up" ]; then checkbox_input "Which pre-configured apps would you like to set up?" APPS SELECTED_APPS echo "" >"$HOME/.local/share/winapps/installed" for F in "${SELECTED_APPS[@]}"; do @@ -139,16 +146,16 @@ function waConfigureApps() { fi $SUDO cp "$DIR/bin/winapps" "$BIN_PATH/winapps" COUNT=0 - if [ "${APP_INSTALL}" != "Do not set up any pre-configured applications" ]; then - for F in $(cat "$HOME/.local/share/winapps/installed" | sed 's/\r/\n/g'); do + if [ "$APP_INSTALL" != "Do not set up any pre-configured applications" ]; then + while IFS= read -r F; do COUNT=$((COUNT + 1)) - $SUDO cp -r "apps/${F}" "$SYS_PATH/apps" - waConfigureApp "${F}" svg - done + $SUDO cp -r "apps/$F" "$SYS_PATH/apps" + waConfigureApp "$F" svg + done < <(sed 's/\r/\n/g' < "$HOME/.local/share/winapps/installed") fi rm -f "$HOME/.local/share/winapps/installed" rm -f "$HOME/.local/share/winapps/installed.bat" - if (($COUNT == 0)); then + if ((COUNT == 0)); then echo " No configured applications." fi } @@ -156,14 +163,14 @@ function waConfigureApps() { function waConfigureAppsAllOfficiallySupported(){ $SUDO cp "$DIR/bin/winapps" "$BIN_PATH/winapps" COUNT=0 - for F in $(cat "$HOME/.local/share/winapps/installed" | sed 's/\r/\n/g'); do + while IFS= read -r F; do COUNT=$((COUNT + 1)) - $SUDO cp -r "apps/${F}" "$SYS_PATH/apps" - waConfigureApp "${F}" svg - done + $SUDO cp -r "apps/$F" "$SYS_PATH/apps" + waConfigureApp "$F" svg + done < <(sed 's/\r/\n/g' < "$HOME/.local/share/winapps/installed") rm -f "$HOME/.local/share/winapps/installed" rm -f "$HOME/.local/share/winapps/installed.bat" - if (($COUNT == 0)); then + if ((COUNT == 0)); then echo " No configured applications." fi } @@ -171,15 +178,17 @@ function waConfigureAppsAllOfficiallySupported(){ function waConfigureDetectedApps() { if [ -f "$HOME/.local/share/winapps/detected" ]; then sed -i 's/\r//g' "$HOME/.local/share/winapps/detected" + # shellcheck disable=SC1091 . "$HOME/.local/share/winapps/detected" APPS=() + # shellcheck disable=SC2153 for I in "${!NAMES[@]}"; do EXE=${EXES[$I]##*\\} EXE_LOWER=$(echo "$EXE" | tr '[:upper:]' '[:lower:]') if ( dlm=$'\x1F' IFS="$dlm" - [[ "$dlm${INSTALLED_EXES[*]}$dlm" != *"$dlm${EXE_LOWER}$dlm"* ]] + [[ "$dlm${INSTALLED_EXES[*]}$dlm" != *"$dlm$EXE_LOWER$dlm"* ]] ); then APPS+=("${NAMES[$I]} ($EXE)") fi @@ -188,7 +197,7 @@ function waConfigureDetectedApps() { unset IFS OPTIONS=("Set up all detected applications" "Select which applications to set up" "Do not set up any applications") menuFromArr APP_INSTALL "How would you like to handle other detected applications?" "${OPTIONS[@]}" - if [ "${APP_INSTALL}" = "Select which applications to set up" ]; then + if [ "$APP_INSTALL" = "Select which applications to set up" ]; then checkbox_input "Which other apps would you like to set up?" APPS SELECTED_APPS echo "" >"$HOME/.local/share/winapps/installed" for F in "${SELECTED_APPS[@]}"; do @@ -197,7 +206,7 @@ function waConfigureDetectedApps() { APP="${F% (*}" echo "$EXE|${APP}" >>"$HOME/.local/share/winapps/installed" done - elif [ "${APP_INSTALL}" = "Set up all detected applications" ]; then + elif [ "$APP_INSTALL" = "Set up all detected applications" ]; then for I in "${!EXES[@]}"; do EXE=${EXES[$I]##*\\} echo "$EXE|${NAMES[$I]}" >>"$HOME/.local/share/winapps/installed" @@ -227,6 +236,7 @@ CATEGORIES=\"WinApps\" # GNOME mimetypes MIME_TYPES=\"\" " | sudo tee "$SYS_PATH/apps/$EXE/info" >/dev/null + # shellcheck disable=SC2153 echo "${ICONS[$I]}" | base64 -d | sudo tee "$SYS_PATH/apps/$EXE/icon.ico" >/dev/null waConfigureApp "$EXE" ico COUNT=$((COUNT + 1)) @@ -306,7 +316,7 @@ function waUninstallSystem() { done } -if [ -z "${1}" ]; then +if [ -z "$1" ]; then OPTIONS=(User System) menuFromArr INSTALL_TYPE "Would you like to install for the current user or the whole system?" "${OPTIONS[@]}" elif [ "$1" = '--user' ]; then From 350e9201b4eca93561b8314a59ce5efb124ee097 Mon Sep 17 00:00:00 2001 From: LDprg <71488985+LDprg@users.noreply.github.com> Date: Fri, 24 May 2024 18:16:54 +0200 Subject: [PATCH 032/187] Fix line endings docker.md --- docs/docker.md | 113 +++++++++++++++++++++++++------------------------ 1 file changed, 57 insertions(+), 56 deletions(-) diff --git a/docs/docker.md b/docs/docker.md index 9afba83..d2cbcad 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -1,29 +1,29 @@ -# Docker - -## Why docker? - -While working with virsh is completely fine for winapps, however you have to setup and optimise you vm manually. Docker on the other hand setups most of the stuff automatically and also makes the vm highly portable between linux distros. - -# Requirements - -Since docker manages the dependencies of the container automatically you only need to install docker or podman itself. (Podman is recommended because of the faster container startup times. Note that podman and docker are interchangeable so no instructions will change depending on which one you use) - -You might also want to take a look in the docs: -- [podman docs](https://docs.podman.io/) -- [docker docs](https://docs.docker.com/) - -When using podman you want to make sure podman socket is enabled with: -```shell -sudo systemctl enable --now podman.socket -``` - -> [!NOTE] -> This will only work on linux systems since some kernel interfaces (like kvm) are needed by the vm. Because of this performance can vary in kernel versions (newer will likely perform better). - -# Setup docker container - -The easiest way to setup a windows vm is by using docker compose. Just create a `compose.yml` with following content: - +# Docker + +## Why docker? + +While working with virsh is completely fine for winapps, however you have to setup and optimise you vm manually. Docker on the other hand setups most of the stuff automatically and also makes the vm highly portable between linux distros. + +# Requirements + +Since docker manages the dependencies of the container automatically you only need to install docker or podman itself. (Podman is recommended because of the faster container startup times. Note that podman and docker are interchangeable so no instructions will change depending on which one you use) + +You might also want to take a look in the docs: +- [podman docs](https://docs.podman.io/) +- [docker docs](https://docs.docker.com/) + +When using podman you want to make sure podman socket is enabled with: +```shell +sudo systemctl enable --now podman.socket +``` + +> [!NOTE] +> This will only work on linux systems since some kernel interfaces (like kvm) are needed by the vm. Because of this performance can vary in kernel versions (newer will likely perform better). + +# Setup docker container + +The easiest way to setup a windows vm is by using docker compose. Just create a `compose.yml` with following content: + ```yaml name: "winapps" @@ -38,7 +38,8 @@ services: VERSION: "tiny11" RAM_SIZE: "4G" CPU_CORES: "4" - privileged: true + privileged: +true ports: - 8006:8006 - 3389:3389/tcp @@ -47,32 +48,32 @@ services: restart: on-failure volumes: - data:/storage -``` - -Now you can tune the ram/usage by changing RAM_SIZE/CPU_CORES. You can also specify the windows versions you want to use. You might also want to take a look at the [docker image repo](https://github.com/dockur/windows). - -> [!NOTE] -> Older versions than Windows 10 are not officially supported. However they might still work with some additional tuning. - -You can now just run: -```shell -docker compose up -``` - -After this just open http://127.0.0.1:8006 in your webbrowser and finish you windows installation as usual. - -Change the RDP_IP in your winapps config to localhost or "127.0.0.1". - -RDP will be automatically enabled, however you still need to load the reg files into you vm. - -Now you should be ready to go and try to connect to your vm with winapps. - -For stopping the vm just use: -```shell -docker compose stop -``` - -For starting again afterwards use: -```shell -docker compose start -``` \ No newline at end of file +``` + +Now you can tune the ram/usage by changing RAM_SIZE/CPU_CORES. You can also specify the windows versions you want to use. You might also want to take a look at the [docker image repo](https://github.com/dockur/windows). + +> [!NOTE] +> Older versions than Windows 10 are not officially supported. However they might still work with some additional tuning. + +You can now just run: +```shell +docker compose up +``` + +After this just open http://127.0.0.1:8006 in your webbrowser and finish you windows installation as usual. + +Change the RDP_IP in your winapps config to localhost or "127.0.0.1". + +RDP will be automatically enabled, however you still need to load the reg files into you vm. + +Now you should be ready to go and try to connect to your vm with winapps. + +For stopping the vm just use: +```shell +docker compose stop +``` + +For starting again afterwards use: +```shell +docker compose start +``` From a59e2506bedd1354fdb54f4230e71e2aab8cee0a Mon Sep 17 00:00:00 2001 From: LDprg <71488985+LDprg@users.noreply.github.com> Date: Fri, 24 May 2024 18:18:03 +0200 Subject: [PATCH 033/187] FIx strange chars docker.md --- docs/docker.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/docker.md b/docs/docker.md index d2cbcad..c46ca5f 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -38,8 +38,7 @@ services: VERSION: "tiny11" RAM_SIZE: "4G" CPU_CORES: "4" - privileged: -true + privileged: true ports: - 8006:8006 - 3389:3389/tcp From 4645df538b105c70b0c3f70d590c643c7bacdc59 Mon Sep 17 00:00:00 2001 From: LDprg Date: Fri, 24 May 2024 18:23:28 +0200 Subject: [PATCH 034/187] fix chown permission --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 199bc64..251dab7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ repos: rev: v1.5.5 hooks: - id: chmod - args: ["777"] + args: ["775"] files: (\.sh|winapps)$ - id: forbid-crlf - id: remove-crlf From cdf96c9453c895439200cd93e7efd05b1bdc70bd Mon Sep 17 00:00:00 2001 From: LDprg <71488985+LDprg@users.noreply.github.com> Date: Sun, 26 May 2024 09:56:22 +0200 Subject: [PATCH 035/187] Make docker.md a bit more clear --- docs/docker.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/docker.md b/docs/docker.md index c46ca5f..6bbf411 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -61,9 +61,12 @@ docker compose up After this just open http://127.0.0.1:8006 in your webbrowser and finish you windows installation as usual. -Change the RDP_IP in your winapps config to localhost or "127.0.0.1". - -RDP will be automatically enabled, however you still need to load the reg files into you vm. +> [!WARN] +> Change the RDP_IP in your winapps config to localhost or "127.0.0.1". + +> [!WARN] +> RDP will be automatically enabled, however you still need to load the [reg file](https://github.com/winapps-org/winapps/blob/main/install%2FRDPApps.reg) into you vm. +> Just use a browser inside the vm to download. Now you should be ready to go and try to connect to your vm with winapps. From 03918e511c641da4ec2b621d95d4e485b3dbcc84 Mon Sep 17 00:00:00 2001 From: LDprg <71488985+LDprg@users.noreply.github.com> Date: Sun, 26 May 2024 09:57:29 +0200 Subject: [PATCH 036/187] Fix typo in docker.md --- docs/docker.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docker.md b/docs/docker.md index 6bbf411..9c84a6e 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -61,10 +61,10 @@ docker compose up After this just open http://127.0.0.1:8006 in your webbrowser and finish you windows installation as usual. -> [!WARN] +> [!WARNING] > Change the RDP_IP in your winapps config to localhost or "127.0.0.1". -> [!WARN] +> [!WARNING] > RDP will be automatically enabled, however you still need to load the [reg file](https://github.com/winapps-org/winapps/blob/main/install%2FRDPApps.reg) into you vm. > Just use a browser inside the vm to download. From c82a3ef47dafe29e3fe1f9ebd06f36938ea1c76b Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Sun, 26 May 2024 12:30:48 +0200 Subject: [PATCH 037/187] fix: allow empty RDP_FLAGS --- bin/winapps | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/bin/winapps b/bin/winapps index 4ffe221..fdfc653 100755 --- a/bin/winapps +++ b/bin/winapps @@ -86,14 +86,18 @@ if [ "$MULTIMON" = "true" ]; then MULTI_FLAG="/multimon" fi +if [[ -n "$RDP_FLAGS" ]]; then + FREERDP_COMMAND="$FREERDP_COMMAND $RDP_FLAGS" +fi + if [ "$1" = "windows" ]; then - $FREERDP_COMMAND "$RDP_FLAGS" /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +dynamic-resolution +auto-reconnect +home-drive /wm-class:"Microsoft Windows" /v:"$RDP_IP" 1>/dev/null 2>&1 & + $FREERDP_COMMAND /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +dynamic-resolution +auto-reconnect +home-drive /wm-class:"Microsoft Windows" /v:"$RDP_IP" 1>/dev/null 2>&1 & elif [ "$1" = "check" ]; then dprint "CHECK" - $FREERDP_COMMAND "$RDP_FLAGS" /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +auto-reconnect +home-drive -wallpaper +dynamic-resolution $MULTI_FLAG /app:program:"explorer.exe" /v:"$RDP_IP" + $FREERDP_COMMAND /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +auto-reconnect +home-drive -wallpaper +dynamic-resolution $MULTI_FLAG /app:program:"explorer.exe" /v:"$RDP_IP" elif [ "$1" = "manual" ]; then dprint "MANUAL:$2" - $FREERDP_COMMAND "$RDP_FLAGS" /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +auto-reconnect +home-drive +dynamic-resolution $MULTI_FLAG /app:program:"$2" /v:"$RDP_IP" 1>/dev/null 2>&1 & + $FREERDP_COMMAND /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +auto-reconnect +home-drive +dynamic-resolution $MULTI_FLAG /app:program:"$2" /v:"$RDP_IP" 1>/dev/null 2>&1 & elif [ "$1" != "install" ]; then dprint "DIR:${DIR}" if [ -e "${DIR}/../apps/$1/info" ]; then @@ -117,9 +121,9 @@ elif [ "$1" != "install" ]; then FILE=$(echo "$2" | sed 's|'"$HOME"'|\\\\tsclient\\home|;s|/|\\|g;s|\\|\\\\|g') dprint "FILE:${FILE}" # shellcheck disable=SC2140 - $FREERDP_COMMAND "$RDP_FLAGS" /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +auto-reconnect +clipboard +home-drive -wallpaper +dynamic-resolution $MULTI_FLAG /wm-class:"$FULL_NAME" /app:program:"$WIN_EXECUTABLE",icon:"$ICON",name:"$FULL_NAME",cmd:"\"$FILE\"" /v:"$RDP_IP" 1>/dev/null 2>&1 & + $FREERDP_COMMAND /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +auto-reconnect +clipboard +home-drive -wallpaper +dynamic-resolution $MULTI_FLAG /wm-class:"$FULL_NAME" /app:program:"$WIN_EXECUTABLE",icon:"$ICON",name:"$FULL_NAME",cmd:"\"$FILE\"" /v:"$RDP_IP" 1>/dev/null 2>&1 & else - $FREERDP_COMMAND "$RDP_FLAGS" /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +auto-reconnect +clipboard +home-drive -wallpaper +dynamic-resolution $MULTI_FLAG /wm-class:"$FULL_NAME" /app:program:"$WIN_EXECUTABLE",icon:"$ICON",name:"$FULL_NAME" /v:"$RDP_IP" 1>/dev/null 2>&1 & + $FREERDP_COMMAND /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +auto-reconnect +clipboard +home-drive -wallpaper +dynamic-resolution $MULTI_FLAG /wm-class:"$FULL_NAME" /app:program:"$WIN_EXECUTABLE",icon:"$ICON",name:"$FULL_NAME" /v:"$RDP_IP" 1>/dev/null 2>&1 & fi fi From df42c44d9f87a823bd0fc116ef175f133c592c15 Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Sun, 26 May 2024 12:31:05 +0200 Subject: [PATCH 038/187] fix: run pre-commit --- docs/docker.md | 158 ++++++++++++++++++++++++------------------------- 1 file changed, 79 insertions(+), 79 deletions(-) diff --git a/docs/docker.md b/docs/docker.md index 9c84a6e..3c8819a 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -1,81 +1,81 @@ -# Docker - -## Why docker? - -While working with virsh is completely fine for winapps, however you have to setup and optimise you vm manually. Docker on the other hand setups most of the stuff automatically and also makes the vm highly portable between linux distros. - -# Requirements - -Since docker manages the dependencies of the container automatically you only need to install docker or podman itself. (Podman is recommended because of the faster container startup times. Note that podman and docker are interchangeable so no instructions will change depending on which one you use) - -You might also want to take a look in the docs: -- [podman docs](https://docs.podman.io/) -- [docker docs](https://docs.docker.com/) - -When using podman you want to make sure podman socket is enabled with: -```shell -sudo systemctl enable --now podman.socket -``` - -> [!NOTE] -> This will only work on linux systems since some kernel interfaces (like kvm) are needed by the vm. Because of this performance can vary in kernel versions (newer will likely perform better). - -# Setup docker container - -The easiest way to setup a windows vm is by using docker compose. Just create a `compose.yml` with following content: - -```yaml -name: "winapps" - -volumes: - data: - -services: - windows: - image: dockurr/windows - container_name: windows - environment: - VERSION: "tiny11" - RAM_SIZE: "4G" - CPU_CORES: "4" - privileged: true - ports: - - 8006:8006 - - 3389:3389/tcp - - 3389:3389/udp - stop_grace_period: 2m - restart: on-failure - volumes: - - data:/storage -``` - -Now you can tune the ram/usage by changing RAM_SIZE/CPU_CORES. You can also specify the windows versions you want to use. You might also want to take a look at the [docker image repo](https://github.com/dockur/windows). - -> [!NOTE] -> Older versions than Windows 10 are not officially supported. However they might still work with some additional tuning. - -You can now just run: -```shell -docker compose up -``` - -After this just open http://127.0.0.1:8006 in your webbrowser and finish you windows installation as usual. - -> [!WARNING] -> Change the RDP_IP in your winapps config to localhost or "127.0.0.1". +# Docker -> [!WARNING] +## Why docker? + +While working with virsh is completely fine for winapps, however you have to setup and optimise you vm manually. Docker on the other hand setups most of the stuff automatically and also makes the vm highly portable between linux distros. + +# Requirements + +Since docker manages the dependencies of the container automatically you only need to install docker or podman itself. (Podman is recommended because of the faster container startup times. Note that podman and docker are interchangeable so no instructions will change depending on which one you use) + +You might also want to take a look in the docs: +- [podman docs](https://docs.podman.io/) +- [docker docs](https://docs.docker.com/) + +When using podman you want to make sure podman socket is enabled with: +```shell +sudo systemctl enable --now podman.socket +``` + +> [!NOTE] +> This will only work on linux systems since some kernel interfaces (like kvm) are needed by the vm. Because of this performance can vary in kernel versions (newer will likely perform better). + +# Setup docker container + +The easiest way to setup a windows vm is by using docker compose. Just create a `compose.yml` with following content: + +```yaml +name: "winapps" + +volumes: + data: + +services: + windows: + image: dockurr/windows + container_name: windows + environment: + VERSION: "tiny11" + RAM_SIZE: "4G" + CPU_CORES: "4" + privileged: true + ports: + - 8006:8006 + - 3389:3389/tcp + - 3389:3389/udp + stop_grace_period: 2m + restart: on-failure + volumes: + - data:/storage +``` + +Now you can tune the ram/usage by changing RAM_SIZE/CPU_CORES. You can also specify the windows versions you want to use. You might also want to take a look at the [docker image repo](https://github.com/dockur/windows). + +> [!NOTE] +> Older versions than Windows 10 are not officially supported. However they might still work with some additional tuning. + +You can now just run: +```shell +docker compose up +``` + +After this just open http://127.0.0.1:8006 in your webbrowser and finish you windows installation as usual. + +> [!WARNING] +> Change the RDP_IP in your winapps config to localhost or "127.0.0.1". + +> [!WARNING] > RDP will be automatically enabled, however you still need to load the [reg file](https://github.com/winapps-org/winapps/blob/main/install%2FRDPApps.reg) into you vm. -> Just use a browser inside the vm to download. - -Now you should be ready to go and try to connect to your vm with winapps. - -For stopping the vm just use: -```shell -docker compose stop -``` - -For starting again afterwards use: -```shell -docker compose start -``` +> Just use a browser inside the vm to download. + +Now you should be ready to go and try to connect to your vm with winapps. + +For stopping the vm just use: +```shell +docker compose stop +``` + +For starting again afterwards use: +```shell +docker compose start +``` From 54e57b2f8b8c5e5b0e4562b8511ac35b03a926c7 Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Sun, 26 May 2024 12:31:31 +0200 Subject: [PATCH 039/187] feat: automatic installation of .reg file --- compose.yaml | 23 +++++++++++++++++++++++ {install => oem}/RDPApps.reg | 0 oem/install.bat | 3 +++ 3 files changed, 26 insertions(+) create mode 100644 compose.yaml rename {install => oem}/RDPApps.reg (100%) create mode 100644 oem/install.bat diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..173fc8a --- /dev/null +++ b/compose.yaml @@ -0,0 +1,23 @@ +name: "winapps" + +volumes: + data: + +services: + windows: + image: dockurr/windows + container_name: windows + environment: + VERSION: "tiny11" + RAM_SIZE: "8G" + CPU_CORES: "4" + privileged: true + ports: + - 8006:8006 + - 3389:3389/tcp + - 3389:3389/udp + stop_grace_period: 2m + restart: on-failure + volumes: + - data:/storage + - ./oem:/oem diff --git a/install/RDPApps.reg b/oem/RDPApps.reg similarity index 100% rename from install/RDPApps.reg rename to oem/RDPApps.reg diff --git a/oem/install.bat b/oem/install.bat new file mode 100644 index 0000000..182423c --- /dev/null +++ b/oem/install.bat @@ -0,0 +1,3 @@ +@echo off + +REG IMPORT C:\OEM\RDPApps.reg From 18229bfef984fae606c0b3f6139b5ffa17ace13d Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Sun, 26 May 2024 12:36:51 +0200 Subject: [PATCH 040/187] fix: use default ram size --- compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compose.yaml b/compose.yaml index 173fc8a..9599920 100644 --- a/compose.yaml +++ b/compose.yaml @@ -9,7 +9,7 @@ services: container_name: windows environment: VERSION: "tiny11" - RAM_SIZE: "8G" + RAM_SIZE: "4G" CPU_CORES: "4" privileged: true ports: From aba92bc535b37f2b6efe270923b546ba9400d631 Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Sun, 26 May 2024 13:02:24 +0000 Subject: [PATCH 041/187] feat: mention new compose file shipped with repo in docker docs --- docs/docker.md | 52 ++++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/docs/docker.md b/docs/docker.md index 3c8819a..ef6dabf 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -2,27 +2,25 @@ ## Why docker? -While working with virsh is completely fine for winapps, however you have to setup and optimise you vm manually. Docker on the other hand setups most of the stuff automatically and also makes the vm highly portable between linux distros. +While working with `virsh` is completely fine for winapps, you have to set up and optimize you vm manually. Docker on the other hand sets up most of the stuff automatically and also makes the VM highly portable between Linux distros. # Requirements -Since docker manages the dependencies of the container automatically you only need to install docker or podman itself. (Podman is recommended because of the faster container startup times. Note that podman and docker are interchangeable so no instructions will change depending on which one you use) +Since Docker manages the dependencies of the container automatically you only need to install Docker itself. -You might also want to take a look in the docs: -- [podman docs](https://docs.podman.io/) -- [docker docs](https://docs.docker.com/) +You can try using Podman too because of their faster container startup times, but note that Podman and Docker are not always fully interchangeable. In case you want to follow this guide using podman, you will have to install the `docker` CLI to be able to run `docker compose` commands. You'll also have to enable the Podman socket. Refer to the podman docs for how to do that. -When using podman you want to make sure podman socket is enabled with: -```shell -sudo systemctl enable --now podman.socket -``` +See: +- [Podman installation docs](https://podman.io/docs/installation) +- [Docker installation docs](https://docs.docker.com/engine/install) +- [Using `docker compose` with Podman](https://www.redhat.com/sysadmin/podman-docker-compose) (slightly outdated) -> [!NOTE] -> This will only work on linux systems since some kernel interfaces (like kvm) are needed by the vm. Because of this performance can vary in kernel versions (newer will likely perform better). +> [!NOTE] +> This will only work on Linux systems since some kernel interfaces (like KVM) are needed by the VM. Because of this performance can vary depending on kernel version (newer will likely perform better). # Setup docker container -The easiest way to setup a windows vm is by using docker compose. Just create a `compose.yml` with following content: +The easiest way to set up a Windows VM is by using docker compose. A compose file that looks like this is already shipped with winapps: ```yaml name: "winapps" @@ -49,28 +47,30 @@ services: - data:/storage ``` -Now you can tune the ram/usage by changing RAM_SIZE/CPU_CORES. You can also specify the windows versions you want to use. You might also want to take a look at the [docker image repo](https://github.com/dockur/windows). +Now you can tune the ram/usage by changing `RAM_SIZE` & `CPU_CORES`. You can also specify the windows versions you want to use. You might also want to take a look at the [repo of the Docker image](https://github.com/dockur/windows) for further information. -> [!NOTE] -> Older versions than Windows 10 are not officially supported. However they might still work with some additional tuning. +This compose file uses Windows 11 by default. You can use Windows 10 by changing the `VERSION` to `tiny10`. + +> [!NOTE] +> We use a stripped-down Windows installation by default. This is recommended, but you can still opt for stock windows by changing the version to one of the versions listed in the README of the images repository linked above. + +> [!NOTE] +> Older versions than Windows 10 are not officially supported by us. However they might still work with some additional tuning. You can now just run: ```shell -docker compose up +docker compose up -d ``` +to run the VM in the background. -After this just open http://127.0.0.1:8006 in your webbrowser and finish you windows installation as usual. +After this just open http://127.0.0.1:8006 in your web browser and wait for the Windows installation to finish. -> [!WARNING] -> Change the RDP_IP in your winapps config to localhost or "127.0.0.1". +> [!WARNING] +> Make sure to change the `RDP_IP` in your winapps config to `127.0.0.1`. -> [!WARNING] -> RDP will be automatically enabled, however you still need to load the [reg file](https://github.com/winapps-org/winapps/blob/main/install%2FRDPApps.reg) into you vm. -> Just use a browser inside the vm to download. +Now you should be ready to go and try to connect to your VM with winapps. -Now you should be ready to go and try to connect to your vm with winapps. - -For stopping the vm just use: +For stopping the VM just use: ```shell docker compose stop ``` @@ -79,3 +79,5 @@ For starting again afterwards use: ```shell docker compose start ``` + +(All compose commands have to be run from the directory where the `compose.yaml` is located.) From 7bb34d7b92293f8e7ab5b776dce190c4c930cdcb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 26 May 2024 13:02:32 +0000 Subject: [PATCH 042/187] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- docs/docker.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/docker.md b/docs/docker.md index ef6dabf..501e49b 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -6,7 +6,7 @@ While working with `virsh` is completely fine for winapps, you have to set up an # Requirements -Since Docker manages the dependencies of the container automatically you only need to install Docker itself. +Since Docker manages the dependencies of the container automatically you only need to install Docker itself. You can try using Podman too because of their faster container startup times, but note that Podman and Docker are not always fully interchangeable. In case you want to follow this guide using podman, you will have to install the `docker` CLI to be able to run `docker compose` commands. You'll also have to enable the Podman socket. Refer to the podman docs for how to do that. @@ -15,7 +15,7 @@ See: - [Docker installation docs](https://docs.docker.com/engine/install) - [Using `docker compose` with Podman](https://www.redhat.com/sysadmin/podman-docker-compose) (slightly outdated) -> [!NOTE] +> [!NOTE] > This will only work on Linux systems since some kernel interfaces (like KVM) are needed by the VM. Because of this performance can vary depending on kernel version (newer will likely perform better). # Setup docker container @@ -49,12 +49,12 @@ services: Now you can tune the ram/usage by changing `RAM_SIZE` & `CPU_CORES`. You can also specify the windows versions you want to use. You might also want to take a look at the [repo of the Docker image](https://github.com/dockur/windows) for further information. -This compose file uses Windows 11 by default. You can use Windows 10 by changing the `VERSION` to `tiny10`. +This compose file uses Windows 11 by default. You can use Windows 10 by changing the `VERSION` to `tiny10`. -> [!NOTE] +> [!NOTE] > We use a stripped-down Windows installation by default. This is recommended, but you can still opt for stock windows by changing the version to one of the versions listed in the README of the images repository linked above. -> [!NOTE] +> [!NOTE] > Older versions than Windows 10 are not officially supported by us. However they might still work with some additional tuning. You can now just run: @@ -65,7 +65,7 @@ to run the VM in the background. After this just open http://127.0.0.1:8006 in your web browser and wait for the Windows installation to finish. -> [!WARNING] +> [!WARNING] > Make sure to change the `RDP_IP` in your winapps config to `127.0.0.1`. Now you should be ready to go and try to connect to your VM with winapps. From 9126baa6996102690f752b7c16c50c055422fe97 Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Thu, 30 May 2024 10:14:35 +0000 Subject: [PATCH 043/187] fix: don't quote $SUDO --- installer.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/installer.sh b/installer.sh index 845a435..2eb0b6d 100755 --- a/installer.sh +++ b/installer.sh @@ -282,27 +282,27 @@ function waUninstallUser() { grep -l -d skip "bin/winapps" "$HOME/.local/share/applications/"* -s | while IFS= read -r F do echo -n " Removing $F..." - "$SUDO" rm "$F" + $SUDO rm "$F" echo " Finished." done grep -l -d skip "bin/winapps" "$HOME/.local/bin/"* -s | while IFS= read -r F do echo -n " Removing $F..." - "$SUDO" rm "$F" + $SUDO rm "$F" echo " Finished." done } function waUninstallSystem() { - "$SUDO" rm -f "/usr/local/bin/winapps" - "$SUDO" rm -rf "/usr/local/share/winapps" + $SUDO rm -f "/usr/local/bin/winapps" + $SUDO rm -rf "/usr/local/share/winapps" grep -l -d skip "bin/winapps" "/usr/share/applications/"* -s | while IFS= read -r F do if [ -z "$SUDO" ]; then waNoSudo fi echo -n " Removing $F..." - "$SUDO" rm "$F" + $SUDO rm "$F" echo " Finished." done grep -l -d skip "bin/winapps" "/usr/local/bin/"* -s | while IFS= read -r F @@ -311,7 +311,7 @@ function waUninstallSystem() { waNoSudo fi echo -n " Removing $F..." - "$SUDO" rm "$F" + $SUDO rm "$F" echo " Finished." done } From 109cbf5f793ab700e8c2a9c2754edc0cb5441cfc Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Thu, 30 May 2024 10:16:11 +0000 Subject: [PATCH 044/187] fix: actually use loop var --- installer.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/installer.sh b/installer.sh index 2eb0b6d..6e536d9 100755 --- a/installer.sh +++ b/installer.sh @@ -42,12 +42,10 @@ function waFindInstalled() { rm -f "$HOME/.local/share/winapps/installed" rm -f "$HOME/.local/share/winapps/detected" cp "$DIR/install/ExtractPrograms.ps1" "$HOME/.local/share/winapps/ExtractPrograms.ps1" - # FIXME - # shellcheck disable=SC2066 for F in "$DIR/apps"; do [[ -e "$F" ]] || break # shellcheck disable=SC1090 - . "$DIR/apps/$F/info" + . "$F/info" printf "IF EXIST \"%s\" ECHO %s >> \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp" "$WIN_EXECUTABLE" "$F" >>"$HOME/.local/share/winapps/installed.bat" done printf "powershell.exe -ExecutionPolicy Bypass -File \\\\tsclient\\home\\.local\\share\\winapps\\ExtractPrograms.ps1 > \\\\tsclient\home\\.local\\share\\winapps\\detected" >>"$HOME/.local/share/winapps/installed.bat" From f773560ca80c68b1f0f5a1a5b0877927dbf18b7a Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Thu, 30 May 2024 10:20:55 +0000 Subject: [PATCH 045/187] fix: fix SC2066; do not quote this --- installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer.sh b/installer.sh index 6e536d9..1ec9d45 100755 --- a/installer.sh +++ b/installer.sh @@ -42,7 +42,7 @@ function waFindInstalled() { rm -f "$HOME/.local/share/winapps/installed" rm -f "$HOME/.local/share/winapps/detected" cp "$DIR/install/ExtractPrograms.ps1" "$HOME/.local/share/winapps/ExtractPrograms.ps1" - for F in "$DIR/apps"; do + for F in $DIR/apps; do [[ -e "$F" ]] || break # shellcheck disable=SC1090 . "$F/info" From eb4176987a3c3528b63897e156b8c05893223374 Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Thu, 30 May 2024 10:21:34 +0000 Subject: [PATCH 046/187] fix: do not disable shellcheck errors annotated with FIXME --- installer.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/installer.sh b/installer.sh index 1ec9d45..89d6ab4 100755 --- a/installer.sh +++ b/installer.sh @@ -122,9 +122,8 @@ function waConfigureApps() { APPS+=("$FULL_NAME ($F)") INSTALLED_EXES+=("$(echo "${WIN_EXECUTABLE##*\\}" | tr '[:upper:]' '[:lower:]')") done < <(sed 's/\r/\n/g' < "$HOME/.local/share/winapps/installed") - # FIXME - # shellcheck disable=SC2207,SC2031 - IFS=$'\n' APPS=($(sort <<<"${APPS[*]}")) + IFS=$'\n' + APPS=($(sort <<<"${APPS[*]}")) unset IFS OPTIONS=("Set up all detected pre-configured applications" "Select which pre-configured applications to set up" "Do not set up any pre-configured applications") From a80e951e40e7e702b76174e97067cfab0d496d96 Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Thu, 30 May 2024 10:24:26 +0000 Subject: [PATCH 047/187] fix: this is just a warning, we can ignore it for now --- installer.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/installer.sh b/installer.sh index 89d6ab4..c73ab24 100755 --- a/installer.sh +++ b/installer.sh @@ -123,6 +123,7 @@ function waConfigureApps() { INSTALLED_EXES+=("$(echo "${WIN_EXECUTABLE##*\\}" | tr '[:upper:]' '[:lower:]')") done < <(sed 's/\r/\n/g' < "$HOME/.local/share/winapps/installed") IFS=$'\n' + # shellcheck disable=SC2207 APPS=($(sort <<<"${APPS[*]}")) unset IFS OPTIONS=("Set up all detected pre-configured applications" "Select which pre-configured applications to set up" "Do not set up any pre-configured applications") From 662378aefeb8aa045db12472a6a24168ca097f32 Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Thu, 30 May 2024 10:26:48 +0000 Subject: [PATCH 048/187] fix: ignore shellcheck info --- installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer.sh b/installer.sh index c73ab24..d76b39e 100755 --- a/installer.sh +++ b/installer.sh @@ -44,7 +44,7 @@ function waFindInstalled() { cp "$DIR/install/ExtractPrograms.ps1" "$HOME/.local/share/winapps/ExtractPrograms.ps1" for F in $DIR/apps; do [[ -e "$F" ]] || break - # shellcheck disable=SC1090 + # shellcheck disable=SC1090,SC1091 . "$F/info" printf "IF EXIST \"%s\" ECHO %s >> \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp" "$WIN_EXECUTABLE" "$F" >>"$HOME/.local/share/winapps/installed.bat" done From 7abfef3477831977e824c66dcaaf62c66797a879 Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Thu, 30 May 2024 12:09:16 +0000 Subject: [PATCH 049/187] fix: don't remove fixme --- installer.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/installer.sh b/installer.sh index d76b39e..cdaa74c 100755 --- a/installer.sh +++ b/installer.sh @@ -123,6 +123,7 @@ function waConfigureApps() { INSTALLED_EXES+=("$(echo "${WIN_EXECUTABLE##*\\}" | tr '[:upper:]' '[:lower:]')") done < <(sed 's/\r/\n/g' < "$HOME/.local/share/winapps/installed") IFS=$'\n' + # FIXME # shellcheck disable=SC2207 APPS=($(sort <<<"${APPS[*]}")) unset IFS From 0ea4b865ddbc0cbd227bc141e256e155246c48d2 Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Thu, 30 May 2024 12:10:18 +0000 Subject: [PATCH 050/187] fix: actually use glob pattern so the loop works --- installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer.sh b/installer.sh index cdaa74c..3cfe27f 100755 --- a/installer.sh +++ b/installer.sh @@ -42,7 +42,7 @@ function waFindInstalled() { rm -f "$HOME/.local/share/winapps/installed" rm -f "$HOME/.local/share/winapps/detected" cp "$DIR/install/ExtractPrograms.ps1" "$HOME/.local/share/winapps/ExtractPrograms.ps1" - for F in $DIR/apps; do + for F in $DIR/apps/*; do [[ -e "$F" ]] || break # shellcheck disable=SC1090,SC1091 . "$F/info" From 2e7dea1cce27f0ed5ee23dd7a6a83abd979db27b Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Thu, 30 May 2024 12:14:13 +0000 Subject: [PATCH 051/187] fix: fix shellcheck error --- installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer.sh b/installer.sh index 3cfe27f..3784a6c 100755 --- a/installer.sh +++ b/installer.sh @@ -42,7 +42,7 @@ function waFindInstalled() { rm -f "$HOME/.local/share/winapps/installed" rm -f "$HOME/.local/share/winapps/detected" cp "$DIR/install/ExtractPrograms.ps1" "$HOME/.local/share/winapps/ExtractPrograms.ps1" - for F in $DIR/apps/*; do + for F in "$DIR"/apps/*; do [[ -e "$F" ]] || break # shellcheck disable=SC1090,SC1091 . "$F/info" From aae906ab364aea30e60ac68f622694dc2ab64313 Mon Sep 17 00:00:00 2001 From: Alchemi1963 Date: Thu, 30 May 2024 23:18:31 +0200 Subject: [PATCH 052/187] Fixed printf \tsclient and no newline errors. --- installer.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/installer.sh b/installer.sh index 3784a6c..117ad23 100755 --- a/installer.sh +++ b/installer.sh @@ -42,15 +42,13 @@ function waFindInstalled() { rm -f "$HOME/.local/share/winapps/installed" rm -f "$HOME/.local/share/winapps/detected" cp "$DIR/install/ExtractPrograms.ps1" "$HOME/.local/share/winapps/ExtractPrograms.ps1" - for F in "$DIR"/apps/*; do - [[ -e "$F" ]] || break + for F in $(ls "${DIR}/apps"); do # shellcheck disable=SC1090,SC1091 - . "$F/info" - printf "IF EXIST \"%s\" ECHO %s >> \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp" "$WIN_EXECUTABLE" "$F" >>"$HOME/.local/share/winapps/installed.bat" + . "$DIR/apps/$F/info" + printf "IF EXIST \"%s\" ECHO %s >> \\\\\\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp\n" "$WIN_EXECUTABLE" "$F" >> "$HOME/.local/share/winapps/installed.bat" done - printf "powershell.exe -ExecutionPolicy Bypass -File \\\\tsclient\\home\\.local\\share\\winapps\\ExtractPrograms.ps1 > \\\\tsclient\home\\.local\\share\\winapps\\detected" >>"$HOME/.local/share/winapps/installed.bat" - printf "RENAME \\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp installed" >>"$HOME/.local/share/winapps/installed.bat" - # shellcheck disable=SC2140 + printf "powershell.exe -ExecutionPolicy Bypass -File \\\\\\\\tsclient\\home\\.local\\share\\winapps\\\\ExtractPrograms.ps1 > \\\\\\\\tsclient\home\\.local\\share\\winapps\\detected\n" >> "$HOME/.local/share/winapps/installed.bat" + printf "RENAME \\\\\\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp installed\n" >> "$HOME/.local/share/winapps/installed.bat" # shellcheck disable=SC2140 $FREERDP_COMMAND /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" +auto-reconnect +home-drive -wallpaper +span /app:program:"C:\Windows\System32\cmd.exe",cmd:"/C \\\\tsclient\\home\\.local\\share\\winapps\\installed.bat" /v:"$RDP_IP" 1>/dev/null 2>&1 & COUNT=0 while [ ! -f "$HOME/.local/share/winapps/installed" ]; do @@ -117,7 +115,10 @@ MimeType=$MIME_TYPES function waConfigureApps() { APPS=() while IFS= read -r F; do + [[ -n $F ]] || continue # shellcheck disable=SC1090 + F=$(echo $F | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') + echo \"$F\" >> test . "$DIR/apps/$F/info" APPS+=("$FULL_NAME ($F)") INSTALLED_EXES+=("$(echo "${WIN_EXECUTABLE##*\\}" | tr '[:upper:]' '[:lower:]')") From 9a4c689a6ab19e048c874bd27149369a7557fafd Mon Sep 17 00:00:00 2001 From: Alchemi1963 Date: Thu, 30 May 2024 23:22:05 +0200 Subject: [PATCH 053/187] Added empty parameter catch around line 90 --- installer.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/installer.sh b/installer.sh index 117ad23..bb5b33a 100755 --- a/installer.sh +++ b/installer.sh @@ -83,6 +83,9 @@ function waFindInstalled() { } function waConfigureApp() { + if [[ -z $1 ]]; then + return 1 + fi if [ -z "$ICON" ]; then ICON=$SYS_PATH/apps/$1/icon.$2 fi From 45b7111d5b5ee554c1333987c158d5f7a610eead Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 30 May 2024 21:47:54 +0000 Subject: [PATCH 054/187] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- installer.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/installer.sh b/installer.sh index bb5b33a..d687d6b 100755 --- a/installer.sh +++ b/installer.sh @@ -45,7 +45,7 @@ function waFindInstalled() { for F in $(ls "${DIR}/apps"); do # shellcheck disable=SC1090,SC1091 . "$DIR/apps/$F/info" - printf "IF EXIST \"%s\" ECHO %s >> \\\\\\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp\n" "$WIN_EXECUTABLE" "$F" >> "$HOME/.local/share/winapps/installed.bat" + printf "IF EXIST \"%s\" ECHO %s >> \\\\\\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp\n" "$WIN_EXECUTABLE" "$F" >> "$HOME/.local/share/winapps/installed.bat" done printf "powershell.exe -ExecutionPolicy Bypass -File \\\\\\\\tsclient\\home\\.local\\share\\winapps\\\\ExtractPrograms.ps1 > \\\\\\\\tsclient\home\\.local\\share\\winapps\\detected\n" >> "$HOME/.local/share/winapps/installed.bat" printf "RENAME \\\\\\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp installed\n" >> "$HOME/.local/share/winapps/installed.bat" # shellcheck disable=SC2140 @@ -84,7 +84,7 @@ function waFindInstalled() { function waConfigureApp() { if [[ -z $1 ]]; then - return 1 + return 1 fi if [ -z "$ICON" ]; then ICON=$SYS_PATH/apps/$1/icon.$2 @@ -118,10 +118,10 @@ MimeType=$MIME_TYPES function waConfigureApps() { APPS=() while IFS= read -r F; do - [[ -n $F ]] || continue + [[ -n $F ]] || continue # shellcheck disable=SC1090 - F=$(echo $F | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') - echo \"$F\" >> test + F=$(echo $F | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') + echo \"$F\" >> test . "$DIR/apps/$F/info" APPS+=("$FULL_NAME ($F)") INSTALLED_EXES+=("$(echo "${WIN_EXECUTABLE##*\\}" | tr '[:upper:]' '[:lower:]')") From f5bafe4e2cad03627add6a4fb15fe7fd2f5068bd Mon Sep 17 00:00:00 2001 From: Alchemi Date: Fri, 31 May 2024 10:21:51 +0200 Subject: [PATCH 055/187] Moved shellcheck line one down at line 51 --- installer.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/installer.sh b/installer.sh index d687d6b..f41013b 100755 --- a/installer.sh +++ b/installer.sh @@ -48,7 +48,8 @@ function waFindInstalled() { printf "IF EXIST \"%s\" ECHO %s >> \\\\\\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp\n" "$WIN_EXECUTABLE" "$F" >> "$HOME/.local/share/winapps/installed.bat" done printf "powershell.exe -ExecutionPolicy Bypass -File \\\\\\\\tsclient\\home\\.local\\share\\winapps\\\\ExtractPrograms.ps1 > \\\\\\\\tsclient\home\\.local\\share\\winapps\\detected\n" >> "$HOME/.local/share/winapps/installed.bat" - printf "RENAME \\\\\\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp installed\n" >> "$HOME/.local/share/winapps/installed.bat" # shellcheck disable=SC2140 + printf "RENAME \\\\\\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp installed\n" >> "$HOME/.local/share/winapps/installed.bat" + # shellcheck disable=SC2140 $FREERDP_COMMAND /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" +auto-reconnect +home-drive -wallpaper +span /app:program:"C:\Windows\System32\cmd.exe",cmd:"/C \\\\tsclient\\home\\.local\\share\\winapps\\installed.bat" /v:"$RDP_IP" 1>/dev/null 2>&1 & COUNT=0 while [ ! -f "$HOME/.local/share/winapps/installed" ]; do From b658df0a4cffb02276f6a7f4906d6ad16178f627 Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Fri, 31 May 2024 08:36:59 +0000 Subject: [PATCH 056/187] fix: prevent backslashes being escaped at all --- installer.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/installer.sh b/installer.sh index f41013b..2d15073 100755 --- a/installer.sh +++ b/installer.sh @@ -45,12 +45,12 @@ function waFindInstalled() { for F in $(ls "${DIR}/apps"); do # shellcheck disable=SC1090,SC1091 . "$DIR/apps/$F/info" - printf "IF EXIST \"%s\" ECHO %s >> \\\\\\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp\n" "$WIN_EXECUTABLE" "$F" >> "$HOME/.local/share/winapps/installed.bat" + printf "IF EXIST \"%s\" ECHO %s >> %s\n" "$WIN_EXECUTABLE" "$F" '\\tsclient\home\.local\share\winapps\installed.tmp' >> "$HOME/.local/share/winapps/installed.bat" done - printf "powershell.exe -ExecutionPolicy Bypass -File \\\\\\\\tsclient\\home\\.local\\share\\winapps\\\\ExtractPrograms.ps1 > \\\\\\\\tsclient\home\\.local\\share\\winapps\\detected\n" >> "$HOME/.local/share/winapps/installed.bat" - printf "RENAME \\\\\\\\tsclient\\home\\.local\\share\\winapps\\installed.tmp installed\n" >> "$HOME/.local/share/winapps/installed.bat" + printf "%s\n" 'powershell.exe -ExecutionPolicy Bypass -File \\tsclient\home\.local\share\\winapps\ExtractPrograms.ps1 > \\tsclient\home\.local\share\winapps\detected' >> "$HOME/.local/share/winapps/installed.bat" + printf "%s\n" 'RENAME \\tsclient\home\.local\share\winapps\installed.tmp installed' >> "$HOME/.local/share/winapps/installed.bat" # shellcheck disable=SC2140 - $FREERDP_COMMAND /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" +auto-reconnect +home-drive -wallpaper +span /app:program:"C:\Windows\System32\cmd.exe",cmd:"/C \\\\tsclient\\home\\.local\\share\\winapps\\installed.bat" /v:"$RDP_IP" 1>/dev/null 2>&1 & + $FREERDP_COMMAND /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" +auto-reconnect +home-drive -wallpaper +span /app:program:"C:\Windows\System32\cmd.exe",cmd:"$(printf '/C %s' '\\tsclient\home\.local\share\winapps\installed.bat')" /v:"$RDP_IP" 1>/dev/null 2>&1 & COUNT=0 while [ ! -f "$HOME/.local/share/winapps/installed" ]; do sleep 5 From 24f2ef4f33a3d1c3f821850823cd3cc90e16897d Mon Sep 17 00:00:00 2001 From: LDprg <71488985+LDprg@users.noreply.github.com> Date: Sat, 8 Jun 2024 19:35:05 +0200 Subject: [PATCH 057/187] Fix shellcheck --- installer.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/installer.sh b/installer.sh index 2d15073..0284601 100755 --- a/installer.sh +++ b/installer.sh @@ -42,7 +42,8 @@ function waFindInstalled() { rm -f "$HOME/.local/share/winapps/installed" rm -f "$HOME/.local/share/winapps/detected" cp "$DIR/install/ExtractPrograms.ps1" "$HOME/.local/share/winapps/ExtractPrograms.ps1" - for F in $(ls "${DIR}/apps"); do + for F in "$DIR"/apps/*; do + [[ -e "$F" ]] || break # shellcheck disable=SC1090,SC1091 . "$DIR/apps/$F/info" printf "IF EXIST \"%s\" ECHO %s >> %s\n" "$WIN_EXECUTABLE" "$F" '\\tsclient\home\.local\share\winapps\installed.tmp' >> "$HOME/.local/share/winapps/installed.bat" @@ -120,9 +121,9 @@ function waConfigureApps() { APPS=() while IFS= read -r F; do [[ -n $F ]] || continue + F=$(echo "$F" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') + echo \""$F"\" >> test # shellcheck disable=SC1090 - F=$(echo $F | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') - echo \"$F\" >> test . "$DIR/apps/$F/info" APPS+=("$FULL_NAME ($F)") INSTALLED_EXES+=("$(echo "${WIN_EXECUTABLE##*\\}" | tr '[:upper:]' '[:lower:]')") From 2fff49ee42c7e9e2551d9438faa53492b028839d Mon Sep 17 00:00:00 2001 From: LDprg <71488985+LDprg@users.noreply.github.com> Date: Sat, 8 Jun 2024 19:36:32 +0200 Subject: [PATCH 058/187] Fix shellcheck SC2238 --- installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer.sh b/installer.sh index 0284601..506c274 100755 --- a/installer.sh +++ b/installer.sh @@ -122,7 +122,7 @@ function waConfigureApps() { while IFS= read -r F; do [[ -n $F ]] || continue F=$(echo "$F" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') - echo \""$F"\" >> test + echo \""$F"\" >> "test" # shellcheck disable=SC1090 . "$DIR/apps/$F/info" APPS+=("$FULL_NAME ($F)") From 79652eeec53073fbafde80ea65fcf8edfa36ab87 Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Sun, 9 Jun 2024 11:27:21 +0200 Subject: [PATCH 059/187] fix: remove test --- installer.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/installer.sh b/installer.sh index 506c274..d8d664e 100755 --- a/installer.sh +++ b/installer.sh @@ -122,7 +122,6 @@ function waConfigureApps() { while IFS= read -r F; do [[ -n $F ]] || continue F=$(echo "$F" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') - echo \""$F"\" >> "test" # shellcheck disable=SC1090 . "$DIR/apps/$F/info" APPS+=("$FULL_NAME ($F)") From e43fce77079e97f7ddefa28f3bb7c0198c6a8036 Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Sun, 9 Jun 2024 11:30:27 +0200 Subject: [PATCH 060/187] fix: this path is already absolute --- installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer.sh b/installer.sh index d8d664e..5165fab 100755 --- a/installer.sh +++ b/installer.sh @@ -45,7 +45,7 @@ function waFindInstalled() { for F in "$DIR"/apps/*; do [[ -e "$F" ]] || break # shellcheck disable=SC1090,SC1091 - . "$DIR/apps/$F/info" + . "$F/info" printf "IF EXIST \"%s\" ECHO %s >> %s\n" "$WIN_EXECUTABLE" "$F" '\\tsclient\home\.local\share\winapps\installed.tmp' >> "$HOME/.local/share/winapps/installed.bat" done printf "%s\n" 'powershell.exe -ExecutionPolicy Bypass -File \\tsclient\home\.local\share\\winapps\ExtractPrograms.ps1 > \\tsclient\home\.local\share\winapps\detected' >> "$HOME/.local/share/winapps/installed.bat" From f8cef50eadd5198e9199ed48a70496a0c40dbbef Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Sun, 9 Jun 2024 13:35:53 +0200 Subject: [PATCH 061/187] fix: remove trailing spaces from all loops --- installer.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/installer.sh b/installer.sh index 5165fab..6a1116c 100755 --- a/installer.sh +++ b/installer.sh @@ -44,8 +44,10 @@ function waFindInstalled() { cp "$DIR/install/ExtractPrograms.ps1" "$HOME/.local/share/winapps/ExtractPrograms.ps1" for F in "$DIR"/apps/*; do [[ -e "$F" ]] || break + F="$(basename "$F")" + # shellcheck disable=SC1090,SC1091 - . "$F/info" + . "$DIR/apps/$F/info" printf "IF EXIST \"%s\" ECHO %s >> %s\n" "$WIN_EXECUTABLE" "$F" '\\tsclient\home\.local\share\winapps\installed.tmp' >> "$HOME/.local/share/winapps/installed.bat" done printf "%s\n" 'powershell.exe -ExecutionPolicy Bypass -File \\tsclient\home\.local\share\\winapps\ExtractPrograms.ps1 > \\tsclient\home\.local\share\winapps\detected' >> "$HOME/.local/share/winapps/installed.bat" @@ -152,6 +154,8 @@ function waConfigureApps() { COUNT=0 if [ "$APP_INSTALL" != "Do not set up any pre-configured applications" ]; then while IFS= read -r F; do + F=$(echo "$F" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') + COUNT=$((COUNT + 1)) $SUDO cp -r "apps/$F" "$SYS_PATH/apps" waConfigureApp "$F" svg @@ -168,6 +172,8 @@ function waConfigureAppsAllOfficiallySupported(){ $SUDO cp "$DIR/bin/winapps" "$BIN_PATH/winapps" COUNT=0 while IFS= read -r F; do + F=$(echo "$F" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') + COUNT=$((COUNT + 1)) $SUDO cp -r "apps/$F" "$SYS_PATH/apps" waConfigureApp "$F" svg @@ -285,12 +291,16 @@ function waUninstallUser() { rm -rf "$HOME/.local/share/winapps" grep -l -d skip "bin/winapps" "$HOME/.local/share/applications/"* -s | while IFS= read -r F do + F=$(echo "$F" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') + echo -n " Removing $F..." $SUDO rm "$F" echo " Finished." done grep -l -d skip "bin/winapps" "$HOME/.local/bin/"* -s | while IFS= read -r F do + F=$(echo "$F" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') + echo -n " Removing $F..." $SUDO rm "$F" echo " Finished." @@ -302,6 +312,8 @@ function waUninstallSystem() { $SUDO rm -rf "/usr/local/share/winapps" grep -l -d skip "bin/winapps" "/usr/share/applications/"* -s | while IFS= read -r F do + F=$(echo "$F" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') + if [ -z "$SUDO" ]; then waNoSudo fi @@ -311,6 +323,8 @@ function waUninstallSystem() { done grep -l -d skip "bin/winapps" "/usr/local/bin/"* -s | while IFS= read -r F do + F=$(echo "$F" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') + if [ -z "$SUDO" ]; then waNoSudo fi From 754a483e64e713ac48e3b94816f9b70bb4eb364e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 9 Jun 2024 11:36:00 +0000 Subject: [PATCH 062/187] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- installer.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/installer.sh b/installer.sh index 6a1116c..ac09d99 100755 --- a/installer.sh +++ b/installer.sh @@ -44,7 +44,7 @@ function waFindInstalled() { cp "$DIR/install/ExtractPrograms.ps1" "$HOME/.local/share/winapps/ExtractPrograms.ps1" for F in "$DIR"/apps/*; do [[ -e "$F" ]] || break - F="$(basename "$F")" + F="$(basename "$F")" # shellcheck disable=SC1090,SC1091 . "$DIR/apps/$F/info" @@ -173,7 +173,7 @@ function waConfigureAppsAllOfficiallySupported(){ COUNT=0 while IFS= read -r F; do F=$(echo "$F" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') - + COUNT=$((COUNT + 1)) $SUDO cp -r "apps/$F" "$SYS_PATH/apps" waConfigureApp "$F" svg From 5f2e052a43bef7b085900079601b028aea527179 Mon Sep 17 00:00:00 2001 From: MrTumnis <138890915+MrTumnis@users.noreply.github.com> Date: Wed, 12 Jun 2024 18:22:09 -0600 Subject: [PATCH 063/187] Update installer.sh Not adding a new line was causing a "directory does not exist" error because the line was continuos with the '#' --- installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer.sh b/installer.sh index ac09d99..a2f109d 100755 --- a/installer.sh +++ b/installer.sh @@ -110,7 +110,7 @@ Categories=$CATEGORIES MimeType=$MIME_TYPES " | $SUDO tee "$APP_PATH/$1.desktop" >/dev/null $SUDO rm -f "$BIN_PATH/$1" - echo "#!/usr/bin/env bash $BIN_PATH/winapps $1 $* + echo -e "#!/usr/bin/env bash \n $BIN_PATH/winapps $1 $* " | $SUDO tee "$BIN_PATH/$1" >/dev/null $SUDO chmod a+x "$BIN_PATH/$1" fi From 782c364f4dd6af7bfc6501caed18a378f6fe9410 Mon Sep 17 00:00:00 2001 From: Rohan Barar Date: Mon, 1 Jul 2024 16:38:31 +1000 Subject: [PATCH 064/187] Improved detection of running VMs. --- bin/winapps | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/winapps b/bin/winapps index fdfc653..2cfe6c4 100755 --- a/bin/winapps +++ b/bin/winapps @@ -65,8 +65,8 @@ if [ -z "$RDP_IP" ]; then echo " sudo usermod -a -G kvm $(whoami)" exit fi - if virsh list | grep -vq RDPWindows; then - echo "RDPWindows is not running, run:" + if ! virsh list --state-running --name | grep -q '^RDPWindows$'; then + echo "RDPWindows is not running. Please run:" echo " virsh start RDPWindows" exit fi From 07d726f964449f80c8aeaaa4889b11d8df67e236 Mon Sep 17 00:00:00 2001 From: Rohan Barar Date: Mon, 1 Jul 2024 21:36:02 +1000 Subject: [PATCH 065/187] Convert FreeRDP command to array format. --- bin/winapps | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/bin/winapps b/bin/winapps index 2cfe6c4..f47a887 100755 --- a/bin/winapps +++ b/bin/winapps @@ -4,6 +4,7 @@ if [ ! -f "$HOME/.config/winapps/winapps.conf" ] && [ ! -f "$HOME/.winapps" ]; t echo "You need to create a ~/.config/winapps/winapps.conf configuration. Exiting..." exit fi + DIR="$(dirname "$(readlink -f "$0")")" RUN="$(date)-$RANDOM" @@ -72,7 +73,6 @@ if [ -z "$RDP_IP" ]; then fi RDP_IP=$(virsh net-dhcp-leases default | grep RDPWindows | awk '{print $5}') RDP_IP=${RDP_IP%%\/*} - fi dprint "1:$1" @@ -86,18 +86,23 @@ if [ "$MULTIMON" = "true" ]; then MULTI_FLAG="/multimon" fi +# Append additional flags or parameters to FreeRDP if [[ -n "$RDP_FLAGS" ]]; then FREERDP_COMMAND="$FREERDP_COMMAND $RDP_FLAGS" fi if [ "$1" = "windows" ]; then - $FREERDP_COMMAND /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +dynamic-resolution +auto-reconnect +home-drive /wm-class:"Microsoft Windows" /v:"$RDP_IP" 1>/dev/null 2>&1 & + dprint "WINDOWS" + COMMAND=("${FREERDP_COMMAND}" "/d:${RDP_DOMAIN}" "/u:${RDP_USER}" "/p:${RDP_PASS}" "/scale:${RDP_SCALE}" "+dynamic-resolution" "+auto-reconnect" "+home-drive" "/wm-class:\"Microsoft Windows\"" "/v:${RDP_IP}") + "${COMMAND[@]}" 1>/dev/null 2>&1 & elif [ "$1" = "check" ]; then dprint "CHECK" - $FREERDP_COMMAND /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +auto-reconnect +home-drive -wallpaper +dynamic-resolution $MULTI_FLAG /app:program:"explorer.exe" /v:"$RDP_IP" + COMMAND=("${FREERDP_COMMAND}" "/d:${RDP_DOMAIN}" "/u:${RDP_USER}" "/p:${RDP_PASS}" "/scale:${RDP_SCALE}" "+auto-reconnect" "+home-drive" "-wallpaper" "+dynamic-resolution" "${MULTI_FLAG}" "/app:program:explorer.exe" "/v:${RDP_IP}") + "${COMMAND[@]}" elif [ "$1" = "manual" ]; then - dprint "MANUAL:$2" - $FREERDP_COMMAND /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +auto-reconnect +home-drive +dynamic-resolution $MULTI_FLAG /app:program:"$2" /v:"$RDP_IP" 1>/dev/null 2>&1 & + dprint "MANUAL:${2}" + COMMAND=("${FREERDP_COMMAND}" "/d:${RDP_DOMAIN}" "/u:${RDP_USER}" "/p:${RDP_PASS}" "/scale:${RDP_SCALE}" "+auto-reconnect" "+home-drive" "+dynamic-resolution" "${MULTI_FLAG}" "/app:program:${2}" "/v:${RDP_IP}") + "${COMMAND[@]}" 1>/dev/null 2>&1 & elif [ "$1" != "install" ]; then dprint "DIR:${DIR}" if [ -e "${DIR}/../apps/$1/info" ]; then @@ -121,9 +126,11 @@ elif [ "$1" != "install" ]; then FILE=$(echo "$2" | sed 's|'"$HOME"'|\\\\tsclient\\home|;s|/|\\|g;s|\\|\\\\|g') dprint "FILE:${FILE}" # shellcheck disable=SC2140 - $FREERDP_COMMAND /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +auto-reconnect +clipboard +home-drive -wallpaper +dynamic-resolution $MULTI_FLAG /wm-class:"$FULL_NAME" /app:program:"$WIN_EXECUTABLE",icon:"$ICON",name:"$FULL_NAME",cmd:"\"$FILE\"" /v:"$RDP_IP" 1>/dev/null 2>&1 & + COMMAND=("${FREERDP_COMMAND}" "/d:${RDP_DOMAIN}" "/u:${RDP_USER}" "/p:${RDP_PASS}" "/scale:${RDP_SCALE}" "+auto-reconnect" "+clipboard" "+home-drive" "-wallpaper" "+dynamic-resolution" "${MULTI_FLAG}" "/wm-class:${FULL_NAME}" "/app:program:${WIN_EXECUTABLE},icon:${ICON},name:${FULL_NAME},cmd:\"${FILE}\"" "/v:${RDP_IP}") + "${COMMAND[@]}" 1>/dev/null 2>&1 & else - $FREERDP_COMMAND /d:"$RDP_DOMAIN" /u:"$RDP_USER" /p:"$RDP_PASS" /scale:$RDP_SCALE +auto-reconnect +clipboard +home-drive -wallpaper +dynamic-resolution $MULTI_FLAG /wm-class:"$FULL_NAME" /app:program:"$WIN_EXECUTABLE",icon:"$ICON",name:"$FULL_NAME" /v:"$RDP_IP" 1>/dev/null 2>&1 & + COMMAND=("${FREERDP_COMMAND}" "/d:${RDP_DOMAIN}" "/u:${RDP_USER}" "/p:${RDP_PASS}" "/scale:${RDP_SCALE}" "+auto-reconnect" "+clipboard" "+home-drive" "-wallpaper" "+dynamic-resolution" "${MULTI_FLAG}" "/wm-class:${FULL_NAME}" "/app:program:${WIN_EXECUTABLE},icon:${ICON},name:${FULL_NAME}" "/v:${RDP_IP}") + "${COMMAND[@]}" 1>/dev/null 2>&1 & fi fi From 5342eb75cb12671eff01cb9334db09733cb2d69b Mon Sep 17 00:00:00 2001 From: Rohan Barar Date: Mon, 1 Jul 2024 21:42:39 +1000 Subject: [PATCH 066/187] Extract VM IPv4 address using regular expression. --- bin/winapps | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/winapps b/bin/winapps index f47a887..6eedc66 100755 --- a/bin/winapps +++ b/bin/winapps @@ -71,8 +71,7 @@ if [ -z "$RDP_IP" ]; then echo " virsh start RDPWindows" exit fi - RDP_IP=$(virsh net-dhcp-leases default | grep RDPWindows | awk '{print $5}') - RDP_IP=${RDP_IP%%\/*} + RDP_IP=$(virsh net-dhcp-leases default | grep "RDPWindows" | grep -oE '([0-9]{1,3}\.){3}[0-9]{1,3}') fi dprint "1:$1" From 68a7e4f7c546fa654c39835e02a5a166f3240118 Mon Sep 17 00:00:00 2001 From: Rohan Barar Date: Tue, 2 Jul 2024 08:24:22 +1000 Subject: [PATCH 067/187] Break array declarations across multiple lines to enhance readability. --- bin/winapps | 93 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 83 insertions(+), 10 deletions(-) diff --git a/bin/winapps b/bin/winapps index 6eedc66..228f397 100755 --- a/bin/winapps +++ b/bin/winapps @@ -90,17 +90,58 @@ if [[ -n "$RDP_FLAGS" ]]; then FREERDP_COMMAND="$FREERDP_COMMAND $RDP_FLAGS" fi -if [ "$1" = "windows" ]; then - dprint "WINDOWS" - COMMAND=("${FREERDP_COMMAND}" "/d:${RDP_DOMAIN}" "/u:${RDP_USER}" "/p:${RDP_PASS}" "/scale:${RDP_SCALE}" "+dynamic-resolution" "+auto-reconnect" "+home-drive" "/wm-class:\"Microsoft Windows\"" "/v:${RDP_IP}") - "${COMMAND[@]}" 1>/dev/null 2>&1 & -elif [ "$1" = "check" ]; then +if [ "$1" = "check" ]; then + # Open File Explorer dprint "CHECK" - COMMAND=("${FREERDP_COMMAND}" "/d:${RDP_DOMAIN}" "/u:${RDP_USER}" "/p:${RDP_PASS}" "/scale:${RDP_SCALE}" "+auto-reconnect" "+home-drive" "-wallpaper" "+dynamic-resolution" "${MULTI_FLAG}" "/app:program:explorer.exe" "/v:${RDP_IP}") + COMMAND=( + "${FREERDP_COMMAND}" + "/d:${RDP_DOMAIN}" + "/u:${RDP_USER}" + "/p:${RDP_PASS}" + "/scale:${RDP_SCALE}" + "+auto-reconnect" + "+home-drive" + "-wallpaper" + "+dynamic-resolution" + "${MULTI_FLAG}" + "/app:program:explorer.exe" + "/v:${RDP_IP}" + ) "${COMMAND[@]}" +elif [ "$1" = "windows" ]; then + # Open Virtual Machine + dprint "WINDOWS" + COMMAND=( + "${FREERDP_COMMAND}" + "/d:${RDP_DOMAIN}" + "/u:${RDP_USER}" + "/p:${RDP_PASS}" + "/scale:${RDP_SCALE}" + "+dynamic-resolution" + "+auto-reconnect" + "+home-drive" + "/wm-class:\"Microsoft Windows\"" + "/v:${RDP_IP}" + ) + # Run the command in the background, redirecting both stdout and stderr to /dev/null + "${COMMAND[@]}" 1>/dev/null 2>&1 & elif [ "$1" = "manual" ]; then + # Open Specified Application dprint "MANUAL:${2}" - COMMAND=("${FREERDP_COMMAND}" "/d:${RDP_DOMAIN}" "/u:${RDP_USER}" "/p:${RDP_PASS}" "/scale:${RDP_SCALE}" "+auto-reconnect" "+home-drive" "+dynamic-resolution" "${MULTI_FLAG}" "/app:program:${2}" "/v:${RDP_IP}") + COMMAND=( + "${FREERDP_COMMAND}" + "/d:${RDP_DOMAIN}" + "/u:${RDP_USER}" + "/p:${RDP_PASS}" + "/scale:${RDP_SCALE}" + "+auto-reconnect" + "+home-drive" + "+dynamic-resolution" + "${MULTI_FLAG}" + "/app:program:${2}" + "/v:${RDP_IP}" + ) + # Run the command in the background, redirecting both stdout and stderr to /dev/null "${COMMAND[@]}" 1>/dev/null 2>&1 & elif [ "$1" != "install" ]; then dprint "DIR:${DIR}" @@ -125,10 +166,42 @@ elif [ "$1" != "install" ]; then FILE=$(echo "$2" | sed 's|'"$HOME"'|\\\\tsclient\\home|;s|/|\\|g;s|\\|\\\\|g') dprint "FILE:${FILE}" # shellcheck disable=SC2140 - COMMAND=("${FREERDP_COMMAND}" "/d:${RDP_DOMAIN}" "/u:${RDP_USER}" "/p:${RDP_PASS}" "/scale:${RDP_SCALE}" "+auto-reconnect" "+clipboard" "+home-drive" "-wallpaper" "+dynamic-resolution" "${MULTI_FLAG}" "/wm-class:${FULL_NAME}" "/app:program:${WIN_EXECUTABLE},icon:${ICON},name:${FULL_NAME},cmd:\"${FILE}\"" "/v:${RDP_IP}") - "${COMMAND[@]}" 1>/dev/null 2>&1 & + COMMAND=( + "${FREERDP_COMMAND}" + "/d:${RDP_DOMAIN}" + "/u:${RDP_USER}" + "/p:${RDP_PASS}" + "/scale:${RDP_SCALE}" + "+auto-reconnect" + "+clipboard" + "+home-drive" + "-wallpaper" + "+dynamic-resolution" + "${MULTI_FLAG}" + "/wm-class:${FULL_NAME}" + "/app:program:${WIN_EXECUTABLE},icon:${ICON},name:${FULL_NAME},cmd:\"${FILE}\"" + "/v:${RDP_IP}" + ) + # Run the command in the background, redirecting both stdout and stderr to /dev/null + echo "${COMMAND[@]}" #1>/dev/null 2>&1 & else - COMMAND=("${FREERDP_COMMAND}" "/d:${RDP_DOMAIN}" "/u:${RDP_USER}" "/p:${RDP_PASS}" "/scale:${RDP_SCALE}" "+auto-reconnect" "+clipboard" "+home-drive" "-wallpaper" "+dynamic-resolution" "${MULTI_FLAG}" "/wm-class:${FULL_NAME}" "/app:program:${WIN_EXECUTABLE},icon:${ICON},name:${FULL_NAME}" "/v:${RDP_IP}") + COMMAND=( + "${FREERDP_COMMAND}" + "/d:${RDP_DOMAIN}" + "/u:${RDP_USER}" + "/p:${RDP_PASS}" + "/scale:${RDP_SCALE}" + "+auto-reconnect" + "+clipboard" + "+home-drive" + "-wallpaper" + "+dynamic-resolution" + "${MULTI_FLAG}" + "/wm-class:${FULL_NAME}" + "/app:program:${WIN_EXECUTABLE},icon:${ICON},name:${FULL_NAME}" + "/v:${RDP_IP}" + ) + # Run the command in the background, redirecting both stdout and stderr to /dev/null "${COMMAND[@]}" 1>/dev/null 2>&1 & fi fi From 45bbdf87ee04605a9df403ce8b2b278f493dbc35 Mon Sep 17 00:00:00 2001 From: Kazevic Date: Tue, 2 Jul 2024 03:44:09 -0300 Subject: [PATCH 068/187] Reformat code, fix typos, use apt instead of apt-get, improve consistency --- .pre-commit-config.yaml | 6 +- README.md | 52 ++-- apps/access-o365-x86/icon.svg | 3 +- apps/access-o365/icon.svg | 3 +- apps/access-x86/icon.svg | 3 +- apps/access/icon.svg | 3 +- apps/acrobat-x-pro/icon.svg | 3 +- apps/adobe-cc/icon.svg | 4 +- apps/aftereffects-cc/icon.svg | 4 +- apps/audition-cc/icon.svg | 4 +- apps/bridge-cc/icon.svg | 5 +- apps/bridge-cs6-x86/icon.svg | 5 +- apps/bridge-cs6/icon.svg | 5 +- apps/cmd/icon.svg | 2 +- apps/excel-o365-x86/icon.svg | 4 +- apps/excel-o365/icon.svg | 4 +- apps/excel-x86/icon.svg | 4 +- apps/excel/icon.svg | 4 +- apps/explorer/icon.svg | 3 +- apps/illustrator-cc/icon.svg | 4 +- apps/indesign-cc/icon.svg | 4 +- apps/lightroom-cc/icon.svg | 4 +- apps/outlook-o365-x86/icon.svg | 2 +- apps/outlook-o365/icon.svg | 2 +- apps/outlook-x86/icon.svg | 2 +- apps/outlook/icon.svg | 2 +- apps/photoshop-cc/icon.svg | 5 +- apps/photoshop-cs6-x86/icon.svg | 5 +- apps/photoshop-cs6/icon.svg | 5 +- apps/powershell/icon.svg | 4 +- apps/publisher-o365-x86/icon.svg | 2 +- apps/publisher-o365/icon.svg | 2 +- apps/publisher-x86/icon.svg | 2 +- apps/publisher/icon.svg | 2 +- apps/word-o365-x86/icon.svg | 3 +- apps/word-o365/icon.svg | 3 +- apps/word-x86/icon.svg | 3 +- apps/word/icon.svg | 3 +- docs/KVM.md | 95 ++++--- docs/docker.md | 45 ++-- icons/windows.svg | 2 +- kvm/RDPWindows.xml | 416 +++++++++++++++---------------- 42 files changed, 423 insertions(+), 315 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 251dab7..d30bf6a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,13 +6,13 @@ repos: rev: v1.5.5 hooks: - id: chmod - args: ["775"] + args: [ "775" ] files: (\.sh|winapps)$ - id: forbid-crlf - id: remove-crlf - id: forbid-tabs - id: remove-tabs - args: [--whitespaces-count, "2"] + args: [ --whitespaces-count, "2" ] - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.6.0 @@ -36,7 +36,7 @@ repos: - id: forbid-submodules - id: mixed-line-ending - id: pretty-format-json - args: ["--autofix", "--no-sort-keys"] + args: [ "--autofix", "--no-sort-keys" ] - id: sort-simple-yaml - id: trailing-whitespace diff --git a/README.md b/README.md index 4e805fb..882b909 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,21 @@ -# winapps +# WinApps -The winapps main project -Originally created by fmstrat https://github.com/Fmstrat/winapps/ +The WinApps main project, [originally created by fmstrat](https://github.com/Fmstrat/winapps) -Run Windows apps such as Microsoft Office/Adobe in Linux (Ubuntu/Fedora) and GNOME/KDE as if they were a part of the native OS, including Nautilus integration for right clicking on files of specific mime types to open them. +Run Windows apps such as Microsoft Office/Adobe in Linux (Ubuntu/Fedora) and GNOME/KDE as if they were a part of the native OS, +including Nautilus integration for right-clicking on files of specific mime types to open them. ## How it works -WinApps was created as an easy, one command way to include apps running inside a VM (or on any RDP server) directly into GNOME as if they were native applications. WinApps works by: +WinApps was created as an easy, one-command way to include apps running inside a VM (or on any RDP server) directly into GNOME as if they were native applications. WinApps works by: - Running a Windows RDP server in a background VM container - Checking the RDP server for installed applications such as Microsoft Office - If those programs are installed, it creates shortcuts leveraging FreeRDP for both the CLI and the GNOME tray - Files in your home directory are accessible via the `\\tsclient\home` mount inside the VM -- You can right click on any files in your home directory to open with an application, too +- You can right-click on any files in your home directory to open with an application, too ## Currently supported applications @@ -23,7 +23,7 @@ WinApps was created as an easy, one command way to include apps running inside a It does this by: -1. Scanning your system for offically configured applications (below) +1. Scanning your system for the officially configured applications (below) 2. Scanning your system for any other EXE files with install records in the Windows Registry Any officially configured applications will have support for high-resolution icons and mime types for automatically detecting what files can be opened by each application. Any other detected executable files will leverage the icons pulled from the EXE. @@ -79,14 +79,17 @@ Note: The officially configured application list below is fueled by the communit ## Installation -### Step 1: Set up a Windows Virtual Machine -The best solution for running a VM as a subsystem for WinApps would be docker. Docker allows to automize the install process and still uses kvm/qemu under the hood. We still provide the outdated KVM install instructions. +### Step 1: Set up a Windows virtual machine + +The best solution for running a VM as a subsystem for WinApps would be Docker. +Docker allows automizing the installation process and still uses KVM/QEMU under the hood. +We still provide the outdated KVM install instructions. To set up the VM for WinApps, follow this guide: -- [Creating a Virtual Machine with docker](docs/docker.md) -- [Creating a Virtual Machine in KVM (outdated)](docs/KVM.md) +- [Creating a virtual machine with Docker](docs/docker.md) +- [Creating a virtual machine in KVM (outdated)](docs/KVM.md) -If you already have a Virtual Machine or server you wish to use with WinApps, you will need to merge `install/RDPApps.reg` into the VM's Windows Registry. +If you already have a virtual machine or server you wish to use with WinApps, you will need to merge `install/RDPApps.reg` into the VM's Windows Registry. ### Step 2: Download the repo and prerequisites @@ -118,22 +121,23 @@ RDP_PASS="MyWindowsPassword" #FREERDP_COMMAND="xfreerdp" ``` -The username and password should be a full user account and password, such as the one created when setting up Windows or a domain user. It cannot be a user/PIN combination as those are not valid for RDP access. +The username and password should be a full user account and password, such as the one created when setting up Windows +or a domain user. It can't be a user/PIN combination as those aren't valid for RDP access. Options: -- When using a pre-existing non-KVM RDP server, you must use the `RDP_IP` to specify it's location -- If you are running a VM in KVM with NAT enabled, leave `RDP_IP` commented out and WinApps will auto-detect the right local IP +- When using a pre-existing non-KVM RDP server, you must use the `RDP_IP` to specify its location +- If you're running a VM in KVM with NAT enabled, leave `RDP_IP` commented out and WinApps will auto-detect the right local IP - For domain users, you can uncomment and change `RDP_DOMAIN` - On high-resolution (UHD) displays, you can set `RDP_SCALE` to the scale you would like [100|140|160|180] - To add flags to the FreeRDP call, such as `/audio-mode:1` to pass in a mic, use the `RDP_FLAGS` configuration option -- For multi-monitor setups, you can try enabling `MULTIMON`, however if you get a black screen (FreeRDP bug) you will need to revert back +- For multi-monitor setups, you can try enabling `MULTIMON`, however, if you get a black screen (FreeRDP bug) you will need to revert - If you enable `DEBUG`, a log will be created on each application start in `~/.local/share/winapps/winapps.log` -- If you are on a system, where the command for freeredp is not xfreerdp, change `FREERDP_COMMAND` to it. +- If you're on a system, where the command for freerdp is not xfreerdp, change `FREERDP_COMMAND` to it. ### Step 4: Run the WinApps installer -Lastly, check that FreeRDP can connect with: +Lastly, check if FreeRDP can connect with: ``` bin/winapps check @@ -149,7 +153,7 @@ If this step fails, try restarting the VM, or your problem could be related to: - Incorrect user credentials in `~/.config/winapps/winapps.conf` - Not merging `install/RDPApps.reg` into the VM -Then the final step is to run the installer which will prompt you for a system or user install: +Then the final step is to run the installer which will prompt you to a system or user install: ```bash ./installer.sh @@ -168,11 +172,13 @@ Adding applications with custom icons and mime types to the installer is easy. S - Re-run the installer - Submit a Pull Request to add it to WinApps officially -When running the installer, it will check for if any configured apps are installed, and if they are it will create the appropriate shortcuts on the host OS. +When running the installer, it will check for if any configured apps are installed, and if they are, +it will create the appropriate shortcuts on the host OS. ## Running applications manually -WinApps offers a manual mode for running applications that are not configured. This is completed with the `manual` flag. Executables that are in the path do not require full path definition. +WinApps offers a manual mode for running applications that aren't configured. This is completed with the `manual` flag. +Executables that are in the path don't require full path definition. ```bash ./bin/winapps manual "C:\my\directory\executableNotInPath.exe" @@ -181,7 +187,7 @@ WinApps offers a manual mode for running applications that are not configured. T ## Checking for new application support -The installer can be run multiple times, so simply run the below again and it will remove any current installations and update for the latest applications. +The installer can be run multiple times, so simply run the below again, and it will remove any current installations and update for the latest applications. ```bash ./installer.sh @@ -200,7 +206,7 @@ The following optional commands can be used to manage your application configura ./installer.sh --system --setupAllOfficiallySupportedApps # Configures all officially supported applications for the entire system ``` -## Shout outs +## Shout-outs - Some icons pulled from - Fluent UI React - Icons under [MIT License](https://github.com/Fmstrat/fluent-ui-react/blob/master/LICENSE.md) diff --git a/apps/access-o365-x86/icon.svg b/apps/access-o365-x86/icon.svg index 2e7240d..4b98d4f 100644 --- a/apps/access-o365-x86/icon.svg +++ b/apps/access-o365-x86/icon.svg @@ -1,3 +1,4 @@ - + diff --git a/apps/access-o365/icon.svg b/apps/access-o365/icon.svg index 2e7240d..4b98d4f 100644 --- a/apps/access-o365/icon.svg +++ b/apps/access-o365/icon.svg @@ -1,3 +1,4 @@ - + diff --git a/apps/access-x86/icon.svg b/apps/access-x86/icon.svg index 2e7240d..4b98d4f 100644 --- a/apps/access-x86/icon.svg +++ b/apps/access-x86/icon.svg @@ -1,3 +1,4 @@ - + diff --git a/apps/access/icon.svg b/apps/access/icon.svg index 2e7240d..4b98d4f 100644 --- a/apps/access/icon.svg +++ b/apps/access/icon.svg @@ -1,3 +1,4 @@ - + diff --git a/apps/acrobat-x-pro/icon.svg b/apps/acrobat-x-pro/icon.svg index 9c971f6..93f35fa 100644 --- a/apps/acrobat-x-pro/icon.svg +++ b/apps/acrobat-x-pro/icon.svg @@ -1,3 +1,4 @@ - + diff --git a/apps/adobe-cc/icon.svg b/apps/adobe-cc/icon.svg index 6c124a4..c4f106b 100644 --- a/apps/adobe-cc/icon.svg +++ b/apps/adobe-cc/icon.svg @@ -1 +1,3 @@ - + diff --git a/apps/aftereffects-cc/icon.svg b/apps/aftereffects-cc/icon.svg index 677803b..f807aaf 100644 --- a/apps/aftereffects-cc/icon.svg +++ b/apps/aftereffects-cc/icon.svg @@ -1 +1,3 @@ - + diff --git a/apps/audition-cc/icon.svg b/apps/audition-cc/icon.svg index af88949..5d216fd 100644 --- a/apps/audition-cc/icon.svg +++ b/apps/audition-cc/icon.svg @@ -1 +1,3 @@ - + diff --git a/apps/bridge-cc/icon.svg b/apps/bridge-cc/icon.svg index 6fd0faa..0392b1b 100644 --- a/apps/bridge-cc/icon.svg +++ b/apps/bridge-cc/icon.svg @@ -1 +1,4 @@ - + diff --git a/apps/bridge-cs6-x86/icon.svg b/apps/bridge-cs6-x86/icon.svg index 6fd0faa..0392b1b 100644 --- a/apps/bridge-cs6-x86/icon.svg +++ b/apps/bridge-cs6-x86/icon.svg @@ -1 +1,4 @@ - + diff --git a/apps/bridge-cs6/icon.svg b/apps/bridge-cs6/icon.svg index 6fd0faa..0392b1b 100644 --- a/apps/bridge-cs6/icon.svg +++ b/apps/bridge-cs6/icon.svg @@ -1 +1,4 @@ - + diff --git a/apps/cmd/icon.svg b/apps/cmd/icon.svg index db435c4..2a8f304 100644 --- a/apps/cmd/icon.svg +++ b/apps/cmd/icon.svg @@ -1,3 +1,3 @@ - + diff --git a/apps/excel-o365-x86/icon.svg b/apps/excel-o365-x86/icon.svg index 2992c1f..b6c35bb 100644 --- a/apps/excel-o365-x86/icon.svg +++ b/apps/excel-o365-x86/icon.svg @@ -1 +1,3 @@ - + + + diff --git a/apps/excel-o365/icon.svg b/apps/excel-o365/icon.svg index 2992c1f..b6c35bb 100644 --- a/apps/excel-o365/icon.svg +++ b/apps/excel-o365/icon.svg @@ -1 +1,3 @@ - + + + diff --git a/apps/excel-x86/icon.svg b/apps/excel-x86/icon.svg index 2992c1f..b6c35bb 100644 --- a/apps/excel-x86/icon.svg +++ b/apps/excel-x86/icon.svg @@ -1 +1,3 @@ - + + + diff --git a/apps/excel/icon.svg b/apps/excel/icon.svg index 2992c1f..b6c35bb 100644 --- a/apps/excel/icon.svg +++ b/apps/excel/icon.svg @@ -1 +1,3 @@ - + + + diff --git a/apps/explorer/icon.svg b/apps/explorer/icon.svg index 4f1252f..bcc6fa0 100644 --- a/apps/explorer/icon.svg +++ b/apps/explorer/icon.svg @@ -1 +1,2 @@ - + + diff --git a/apps/illustrator-cc/icon.svg b/apps/illustrator-cc/icon.svg index 21d31b3..e171bc7 100644 --- a/apps/illustrator-cc/icon.svg +++ b/apps/illustrator-cc/icon.svg @@ -1 +1,3 @@ - + diff --git a/apps/indesign-cc/icon.svg b/apps/indesign-cc/icon.svg index ceaa431..bf734fb 100644 --- a/apps/indesign-cc/icon.svg +++ b/apps/indesign-cc/icon.svg @@ -1 +1,3 @@ - + diff --git a/apps/lightroom-cc/icon.svg b/apps/lightroom-cc/icon.svg index 6d10ba7..fa3137e 100644 --- a/apps/lightroom-cc/icon.svg +++ b/apps/lightroom-cc/icon.svg @@ -1 +1,3 @@ - + diff --git a/apps/outlook-o365-x86/icon.svg b/apps/outlook-o365-x86/icon.svg index a459409..1c09e1a 100644 --- a/apps/outlook-o365-x86/icon.svg +++ b/apps/outlook-o365-x86/icon.svg @@ -1,3 +1,3 @@ - + diff --git a/apps/outlook-o365/icon.svg b/apps/outlook-o365/icon.svg index a459409..1c09e1a 100644 --- a/apps/outlook-o365/icon.svg +++ b/apps/outlook-o365/icon.svg @@ -1,3 +1,3 @@ - + diff --git a/apps/outlook-x86/icon.svg b/apps/outlook-x86/icon.svg index a459409..1c09e1a 100644 --- a/apps/outlook-x86/icon.svg +++ b/apps/outlook-x86/icon.svg @@ -1,3 +1,3 @@ - + diff --git a/apps/outlook/icon.svg b/apps/outlook/icon.svg index a459409..1c09e1a 100644 --- a/apps/outlook/icon.svg +++ b/apps/outlook/icon.svg @@ -1,3 +1,3 @@ - + diff --git a/apps/photoshop-cc/icon.svg b/apps/photoshop-cc/icon.svg index 9565f6d..eb0b520 100644 --- a/apps/photoshop-cc/icon.svg +++ b/apps/photoshop-cc/icon.svg @@ -1 +1,4 @@ - + diff --git a/apps/photoshop-cs6-x86/icon.svg b/apps/photoshop-cs6-x86/icon.svg index 9565f6d..eb0b520 100644 --- a/apps/photoshop-cs6-x86/icon.svg +++ b/apps/photoshop-cs6-x86/icon.svg @@ -1 +1,4 @@ - + diff --git a/apps/photoshop-cs6/icon.svg b/apps/photoshop-cs6/icon.svg index 9565f6d..eb0b520 100644 --- a/apps/photoshop-cs6/icon.svg +++ b/apps/photoshop-cs6/icon.svg @@ -1 +1,4 @@ - + diff --git a/apps/powershell/icon.svg b/apps/powershell/icon.svg index a423aca..b2b600f 100644 --- a/apps/powershell/icon.svg +++ b/apps/powershell/icon.svg @@ -1 +1,3 @@ - + + + diff --git a/apps/publisher-o365-x86/icon.svg b/apps/publisher-o365-x86/icon.svg index 82b310e..2ba2801 100644 --- a/apps/publisher-o365-x86/icon.svg +++ b/apps/publisher-o365-x86/icon.svg @@ -1,3 +1,3 @@ - + diff --git a/apps/publisher-o365/icon.svg b/apps/publisher-o365/icon.svg index 82b310e..2ba2801 100644 --- a/apps/publisher-o365/icon.svg +++ b/apps/publisher-o365/icon.svg @@ -1,3 +1,3 @@ - + diff --git a/apps/publisher-x86/icon.svg b/apps/publisher-x86/icon.svg index 82b310e..2ba2801 100644 --- a/apps/publisher-x86/icon.svg +++ b/apps/publisher-x86/icon.svg @@ -1,3 +1,3 @@ - + diff --git a/apps/publisher/icon.svg b/apps/publisher/icon.svg index 82b310e..2ba2801 100644 --- a/apps/publisher/icon.svg +++ b/apps/publisher/icon.svg @@ -1,3 +1,3 @@ - + diff --git a/apps/word-o365-x86/icon.svg b/apps/word-o365-x86/icon.svg index 643aaf4..145f733 100644 --- a/apps/word-o365-x86/icon.svg +++ b/apps/word-o365-x86/icon.svg @@ -1,3 +1,4 @@ - + diff --git a/apps/word-o365/icon.svg b/apps/word-o365/icon.svg index 643aaf4..145f733 100644 --- a/apps/word-o365/icon.svg +++ b/apps/word-o365/icon.svg @@ -1,3 +1,4 @@ - + diff --git a/apps/word-x86/icon.svg b/apps/word-x86/icon.svg index 643aaf4..145f733 100644 --- a/apps/word-x86/icon.svg +++ b/apps/word-x86/icon.svg @@ -1,3 +1,4 @@ - + diff --git a/apps/word/icon.svg b/apps/word/icon.svg index 643aaf4..145f733 100644 --- a/apps/word/icon.svg +++ b/apps/word/icon.svg @@ -1,3 +1,4 @@ - + diff --git a/docs/KVM.md b/docs/KVM.md index ea65b27..e2e1e15 100644 --- a/docs/KVM.md +++ b/docs/KVM.md @@ -1,21 +1,30 @@ # Creating a Virtual Machine in KVM -This step-by-step guide will take you through setting up a CPU and memory efficient virtual machine to use with WinApps leveraging KVM, an open-source virtualization software contained in most linux distributions. + +This step-by-step guide will take you through setting up a CPU and memory efficient virtual machine +to use with WinApps leveraging KVM, an open-source virtualization software contained in most Linux distributions. ## Install KVM + First up, you must install KVM and the Virtual Machine Manager. By installing `virt-manager`, you will get everything you need for your distribution: + ```bash -sudo apt-get install -y virt-manager +sudo apt install -y virt-manager ``` ## Download the Windows Professional and KVM VirtIO drivers -You will need Windows 10 Professional (or Enterprise or Server) to run RDP apps, Windows 10 Home will not suffice. You will also need drivers for VirtIO to ensure the best performance and lowest overhead for your system. You can download these at the following links. + +You will need Windows 10 Professional (or Enterprise or Server) to run RDP apps, Windows 10 Home will not suffice. +You will also need drivers for VirtIO to ensure the best performance and the lowest overhead for your system. +You can download these at the following links: Windows 10 ISO: https://www.microsoft.com/en-us/software-download/windows10ISO KVM VirtIO drivers (for all distros): https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso ## Create your virtual machine -The following guide will take you through the setup. If you are an expert user, you may wish to: + +The following guide will take you through the setup. If you're an expert user, you may wish to: + - [Define a VM from XML (may not work on all systems)](#define-a-vm-from-xml) - [Run KVM in user mode](#run-kvm-in-user-mode) @@ -39,11 +48,13 @@ Now select the location of your Windows 10 ISO, and `Automatically detect` the i ![](kvm/04.png) -Set your memory and CPUs. We recommend `2` CPUs and `4096MB` for memory. We will be using a Memory Ballooning service, meaning 4096 is the maximum amount of memory the VM will ever use, but will not use this amount except when it is needed. +Set your memory and CPUs. We recommend `2` CPUs and `4096MB` for memory. We will be using a Memory Ballooning service, +meaning 4096 is the maximum amount of memory the VM will ever use, but will not use this amount except when it is needed. ![](kvm/05.png) -Choose your virtual disk size, keep in mind this is the maximum size the disk will grow to, but it will not take up this space until it needs it. +Choose your virtual disk size, keep in mind this is the maximum size the disk will grow to, +but it will not take up this space until it needs it. ![](kvm/06.png) @@ -58,12 +69,14 @@ After clicking `Finish`, ensure under CPU that `Copy host CPU configuration` is ![](kvm/08.png) Next, go to the `XML` tab, and edit the `` section to contain: + ```xml ``` + Then `Apply`. This will drastically reduce idle CPU usage (from ~25% to ~3%). ![](kvm/09.png) @@ -84,30 +97,35 @@ For the NIC, set the `Device model` to `virtio`. ![](kvm/13.png) -Click the `Add Hardware` button in the lower right, and choose `Storage`. For `Device type`, select `CDROM device` and choose the VirtIO driver ISO you downloaded earlier. This will give the Windows 10 Installer access to drivers during the install process. Now click `Finish` to add the new CDROM device. +Click the `Add Hardware` button in the lower right, and choose `Storage`. For `Device type`, select `CDROM device` +and choose the VirtIO driver ISO you downloaded earlier. This will give the Windows 10 Installer access +to drivers during the installation process. Now click `Finish` to add the new CD-ROM device. ![](kvm/14.png) -You are now ready to click `Begin Installation` +You're now ready to click `Begin Installation` ![](kvm/15.png) Now move on to installing the virtual machine. ## Install the virtual machine + From here out you will install Windows 10 Professional as you would on any other machine. ![](kvm/16.png) -Once you get to the point of selecting the location for installation, you will see there are no disks available. This is because we need to load the VirtIO driver. Select `Load driver`. +Once you get to the point of selecting the location for installation, you will see there are no disks available. +This is because we need to load the VirtIO driver. Select `Load driver`. ![](kvm/17.png) -The installer will then ask you to specify where the driver is located. Select the `E:\` drive or whichever drive the VirtIO driver ISO is located on. +The installer will then ask you to specify where the driver is located. Select the `E:\` drive +or whichever drive the VirtIO driver ISO is located on. ![](kvm/18.png) -Choose the appropriate driver for the OS you have selected, which is most likely the `w10` driver for Windows 10. +Choose the appropriate driver for the OS you've selected, which is most likely the `w10` driver for Windows 10. ![](kvm/19.png) @@ -115,11 +133,12 @@ You will now see a disk you can select for the installation. ![](kvm/20.png) -Windows will begin to install, and you will likely need to reboot the VM a number times during this process. +Windows will begin to install, and you will likely need to reboot the VM a number of times during this process. ![](kvm/21.png) -At some point, you will come to a network screen. This is because the VirtIO drivers for the network have not yet been loaded. Simply click `I don't have internet`. +At some point, you will come to a network screen. This is because the VirtIO drivers +for the network haven't yet been loaded. Simply click `I don't have internet`. ![](kvm/22.png) @@ -127,31 +146,37 @@ It will confirm your choice, so just choose `Continue with limited setup`. ![](kvm/23.png) -After you get into Windows and login with the user you created during the install. Open up `Explorer` and navigate the `E:\` drive or wherever the VirtIO driver ISO is mounted. Double click the `virt-win-gt-64.exe` file to launch the VirtIO driver installer. +After you get into Windows and login with the user you created during the installation. Open `Explorer` +and navigate the `E:\` drive or wherever the VirtIO driver ISO is mounted. Double-click the `virt-win-gt-64.exe` file +to launch the VirtIO driver installer. ![](kvm/24.png) -Leave everything as default and click `Next` through the installer. This will install device drivers as well as the Memory Ballooning service. +Leave everything as default and click `Next` through the installer. This will install device drivers as well as +the Memory Ballooning service. ![](kvm/25.png) -Once you finish the driver install, you will need to make some registry changes to enable RDP Applications to run on the system. Start by downloading the [RDPApps.reg](/install/RDPApps.reg) file, right clicking on the `Raw` button, and clicking on `Save target as`. +Once you finish the driver install, you will need to make some registry changes to enable RDP Applications +to run on the system. Start by downloading the [RDPApps.reg](/install/RDPApps.reg) file, +right-clicking on the `Raw` button, and clicking on `Save target as`. ![](kvm/26.png) -Once you have downloaded the registry file, right click on it, and choose `Merge`, then accept any confirmations along the way. +Once you've downloaded the registry file, right-click on it, and choose `Merge`, then accept any confirmations along the way. ![](kvm/27.png) -Next up, we need to rename the VM so that WinApps can locate it. Go to the start menu and type `About` to bring up the `About your PC` settings. +Next up, we need to rename the VM so that WinApps can locate it. Go to the start menu and type `About` +to bring up the `About your PC` settings. ![](kvm/28.png) -Scroll down and click on `Rename this PC` +Scroll down and click on `Rename this PC`. ![](kvm/29.png) -Rename to `RDPWindows`, and then `Next`, but **do not** restart. +Rename to `RDPWindows`, and then `Next`, but **don't** restart. ![](kvm/30.png) @@ -159,36 +184,49 @@ Lastly, scroll down to `Remote Desktop`, and toggle `Enable Remote Desktop` on, ![](kvm/31.png) -At this point you will need to restart and you have completed your setup. +At this point, you will need to restart, and you've completed your setup. -Rather than restart you can go right ahead and install other applications like Microsoft Office or Adobe CC that could be used through WinApps. +Rather than restart, you can go right ahead and install other applications like Microsoft Office or Adobe CC +that could be used through WinApps. -You may also wish to install the [Spice Guest Tools](https://www.spice-space.org/download/windows/spice-guest-tools/spice-guest-tools-latest.exe) inside the VM which enables features like auto-desktop resize and cut-and-paste when using `virt-manager`. As WinApps uses RDP, this is not necessary if you do not plan to access the machine via `virt-manager`. +You may also wish to install +the [Spice Guest Tools](https://www.spice-space.org/download/windows/spice-guest-tools/spice-guest-tools-latest.exe) +inside the VM which enables features like auto-desktop resize and cut-and-paste when using `virt-manager`. +As WinApps uses RDP, this is unnecessary if you don't plan to access the machine via `virt-manager`. -Once you are finished, restart the VM, but do not log in. Simply close the VM viewer, and close the Virtual Machine Manager. +Once you're finished, restart the VM, but don't log in. Simply close the VM viewer, and close the Virtual Machine Manager. ## Expert installs ### Define a VM from XML + This expert guide for XML imports is specific to Ubuntu 20.04 and may not work on all hardware platforms. -You can refer to the [KVM](https://www.linux-kvm.org) documentation for specifics, but the first thing you need to do is set up a Virtual Machine running Windows 10 Professional (or any version that supports RDP). First, install KVM: +You can refer to the [KVM](https://www.linux-kvm.org) documentation for specifics, but the first thing you need to do is +set up a Virtual Machine running Windows 10 Professional (or any version that supports RDP). First, install KVM: + ``` bash -sudo apt-get install -y virt-manager +sudo apt install -y virt-manager ``` -Now, copy your Windows ISO and VirtIO iso (links to download in the main guide) into the folder and update the `kvm/RDPWindows.xml` appropriately. + +Now, copy your Windows ISO and VirtIO iso (links to download in the main guide) into the folder +and update the `kvm/RDPWindows.xml` appropriately. Next, define a VM called RDPWindows from the sample XML file with: + ``` bash virsh define kvm/RDPWindows.xml virsh autostart RDPWindows ``` + You should then open the VMs properties in `virt-manager` and ensure that under CPU `Copy host CPU configuration` is selected. -Boot it up, install windows, and then [Install the virtual machine](#install-the-virtual-machine). +Boot it up, install Windows, and then [Install the virtual machine](#install-the-virtual-machine). ### Run KVM in user mode + Now set up KVM to run as your user instead of root and allow it through AppArmor (for Ubuntu 20.04 and above): + ``` bash sudo sed -i "s/#user = "root"/user = "$(id -un)"/g" /etc/libvirt/qemu.conf sudo sed -i "s/#group = "root"/group = "$(id -gn)"/g" /etc/libvirt/qemu.conf @@ -197,4 +235,5 @@ sudo usermod -a -G libvirt $(id -un) sudo systemctl restart libvirtd sudo ln -s /etc/apparmor.d/usr.sbin.libvirtd /etc/apparmor.d/disable/ ``` + You will likely need to reboot to ensure your current shell is added to the group. diff --git a/docs/docker.md b/docs/docker.md index 501e49b..901c967 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -1,26 +1,32 @@ -# Docker +# Creating a Virtual Machine in Docker -## Why docker? +## Why Docker? -While working with `virsh` is completely fine for winapps, you have to set up and optimize you vm manually. Docker on the other hand sets up most of the stuff automatically and also makes the VM highly portable between Linux distros. +While working with `virsh` is completely fine for WinApps, you have to set up and optimize your VM manually. +Docker, on the other hand, sets up most of the stuff automatically and makes the VM highly portable between Linux distros. # Requirements -Since Docker manages the dependencies of the container automatically you only need to install Docker itself. +Since Docker manages the dependencies of the container automatically, you only need to install Docker itself. -You can try using Podman too because of their faster container startup times, but note that Podman and Docker are not always fully interchangeable. In case you want to follow this guide using podman, you will have to install the `docker` CLI to be able to run `docker compose` commands. You'll also have to enable the Podman socket. Refer to the podman docs for how to do that. +You can try using Podman too because of their faster container startup times, +but note that Podman and Docker aren't always fully interchangeable. In case you want to follow this guide using Podman, +you will have to install the `docker` CLI to be able to run `docker compose` commands. +You will also have to enable the Podman socket. Refer to the Podman docs for how to do that. See: + - [Podman installation docs](https://podman.io/docs/installation) - [Docker installation docs](https://docs.docker.com/engine/install) - [Using `docker compose` with Podman](https://www.redhat.com/sysadmin/podman-docker-compose) (slightly outdated) > [!NOTE] -> This will only work on Linux systems since some kernel interfaces (like KVM) are needed by the VM. Because of this performance can vary depending on kernel version (newer will likely perform better). +> This will only work on Linux systems since the VM needs some kernel interfaces (like KVM). Because of this, +> performance can vary depending on kernel version (newer will likely perform better). -# Setup docker container +# Setup Docker Container -The easiest way to set up a Windows VM is by using docker compose. A compose file that looks like this is already shipped with winapps: +The easiest way to set up a Windows VM is by using docker compose. A compose file that looks like this is already shipped with WinApps: ```yaml name: "winapps" @@ -47,35 +53,42 @@ services: - data:/storage ``` -Now you can tune the ram/usage by changing `RAM_SIZE` & `CPU_CORES`. You can also specify the windows versions you want to use. You might also want to take a look at the [repo of the Docker image](https://github.com/dockur/windows) for further information. +Now you can tune the RAM/usage by changing `RAM_SIZE` & `CPU_CORES`. You can also specify +the Windows versions you want to use. You might also want to take a look at the [repo of the Docker image](https://github.com/dockur/windows) for further information. This compose file uses Windows 11 by default. You can use Windows 10 by changing the `VERSION` to `tiny10`. > [!NOTE] -> We use a stripped-down Windows installation by default. This is recommended, but you can still opt for stock windows by changing the version to one of the versions listed in the README of the images repository linked above. +> We use a stripped-down Windows installation by default. This is recommended, +> but you can still opt for stock Windows by changing the version to one of the versions listed in +> the README of the images repository linked above. > [!NOTE] -> Older versions than Windows 10 are not officially supported by us. However they might still work with some additional tuning. +> We don't officially support older versions than Windows 10. However, they might still work with some additional tuning. You can now just run: + ```shell docker compose up -d ``` + to run the VM in the background. -After this just open http://127.0.0.1:8006 in your web browser and wait for the Windows installation to finish. +After this, just open http://127.0.0.1:8006 in your web browser and wait for the Windows installation to finish. > [!WARNING] -> Make sure to change the `RDP_IP` in your winapps config to `127.0.0.1`. +> Make sure to change the `RDP_IP` in your WinApps config to `127.0.0.1`. -Now you should be ready to go and try to connect to your VM with winapps. +Now you should be ready to go and try to connect to your VM with WinApps. + +For stopping the VM, just use: -For stopping the VM just use: ```shell docker compose stop ``` -For starting again afterwards use: +For starting again afterward, use: + ```shell docker compose start ``` diff --git a/icons/windows.svg b/icons/windows.svg index 6296a2a..ea5b408 100644 --- a/icons/windows.svg +++ b/icons/windows.svg @@ -1,3 +1,3 @@ - + diff --git a/kvm/RDPWindows.xml b/kvm/RDPWindows.xml index 4a7e227..cfd5a08 100644 --- a/kvm/RDPWindows.xml +++ b/kvm/RDPWindows.xml @@ -1,210 +1,210 @@ - RDPWindows - 50f121b4-93e7-46b5-b302-902d022dfa9c - - - - - - 4194304 - 1298432 - 2 - - /machine - - - hvm - - - - - - - - - - - - - Haswell-noTSX-IBRS - Intel - - - - - - - - - - - - - - - - - - - - - - - - - - - destroy - restart - destroy - - - - - - /usr/bin/qemu-system-x86_64 - - - - - - - - -
- - - - - - - - -
- - - - - - - - -
- - - -
- - - -
- - - - - - - - -
- - - - - -
- - - - - -
- - - - - -
- - - - - -
- - - - - -
- - - -
- - - - - - - -
- - - - - - - - - - - - - - - - -
- - - -
- - - - - - - - - - - - - -
- -