├── README.md └── enable-fullscreen.sh /README.md: -------------------------------------------------------------------------------- 1 | To enable automatic screen detection and resizing in VMWare for Linux virtual machines with i3 window manager, couple of systemd commands 2 | have to be initiated. 3 | 4 | The script will download, enable and start the services which are installed by "open-vm-tools". 5 | 6 | Also, to enable copying and pasting from "host to guest" and vice versa in i3, the following line must be added in the i3 config file: 7 | 8 | ```bash 9 | exec vmware-user-suid-wrapper --no-startup-id 10 | ``` 11 | 12 | or 13 | 14 | ```bash 15 | exec vmware-user --no-startup-id 16 | ``` 17 | 18 | At the moment the following distributions are supported 19 | 20 | - Ubuntu 21 | - Fedora 22 | - Arch Linux 23 | - Kali Linux 24 | - ParrotSec OS 25 | 26 | Get the script and run it: 27 | 28 | ```bash 29 | git clone https://github.com/Kr0ff/VMWare-Guest-FullScreen 30 | cd VMWare-Guest-FullScreen 31 | chmod +x enable-fullscreen.sh 32 | ./enable-fullscreen.sh 33 | ``` 34 | 35 | ### Please note that the folder where the scripts look for if the i3 config exists is 36 | - `$HOME/.config/i3/config` 37 | 38 | **This is the default folder where the i3 config is placed upon installing the package** 39 | 40 | 41 | -------------------------------------------------------------------------------- /enable-fullscreen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | GREEN="\e[32m" 4 | YELLOW="\e[33m" 5 | RED="\e[31m" 6 | CYAN="\e[36m" 7 | LBLUE="\e[94m" 8 | LGREEN="\e[92m" 9 | LPURPLE="\e[1;35m" 10 | RESET="\e[00m" 11 | 12 | ART=" 13 | ============================================= 14 | VGF - Get fullscreen working on your guest VM 15 | ============================================= 16 | @Kr0ff 17 | " 18 | printf "${CYAN}${ART}${RESET}\n" 19 | 20 | function kalilinux { 21 | printf "${YELLOW}[!]${RESET} Now running pacman to install 'open-vm-tools' package\n " 22 | sudo apt update && sudo apt install open-vm-tools -y 23 | printf "\n" 24 | start_services 25 | } 26 | 27 | function archlinux { 28 | printf "${YELLOW}[!]${RESET} Now running pacman to install 'open-vm-tools' package\n " 29 | sudo pacman -Syu open-vm-tools --noconfirm 30 | printf "\n" 31 | start_services 32 | } 33 | 34 | function fedora { 35 | printf "${YELLOW}[!]${RESET} Now running pacman to install 'open-vm-tools' package\n " 36 | sudo dnf update && sudo dnf -y install open-vm-tools 37 | printf "\n" 38 | start_services 39 | } 40 | 41 | function ubuntu { 42 | printf "${YELLOW}[!]${RESET} Now running pacman to install 'open-vm-tools' package\n " 43 | sudo apt update && sudo apt install open-vm-tools -y 44 | printf "\n" 45 | start_services 46 | } 47 | 48 | function parrotsec { 49 | printf "${YELLOW}[!]${RESET} Now running pacman to install 'open-vm-tools' package\n " 50 | sudo apt update && sudo apt install open-vm-tools -y 51 | printf "\n" 52 | start_services 53 | } 54 | 55 | function check_vmtools { 56 | printf "${YELLOW}The script requires root permissions to enable and start the services${RESET}\n\n" 57 | printf "${LBLUE}[*]${RESET} Please enter sudo password when asked\n" 58 | sleep 1 59 | if ! [ -x "$(which vmware-user-suid-wrapper 2>/dev/null)" ]; then 60 | printf "${RED}[-]${RESET} 'open-vm-tools' is not installed\n" >&2 61 | sleep 1 62 | printf "${LPURPLE}[?]${RESET} Would you like to install 'open-vm-tools' ? [Y/n] " 63 | read USER_INPUT 64 | if [[ (${USER_INPUT} = "") || (${USER_INPUT} = "y") || (${USER_INPUT} = "Y") ]]; then 65 | check_distro 66 | elif [[ (${USER_INPUT} = "n") || (${USER_INPUT} = "N") ]]; then 67 | printf "${RED}[-]${RESET} CYAAAA... !\n" 68 | exit 1 69 | else 70 | exit 1 71 | fi 72 | else 73 | printf "${GREEN}[+] Package 'open-vm-tools' is already installed !${RESET}\n" 74 | start_services 75 | fi 76 | } 77 | 78 | function check_distro { 79 | KALI="`cat /etc/os-release | grep -o 'kali' | head -n 1`" 80 | FEDORA="`cat /etc/os-release | grep -o 'fedora' | head -n 1`" 81 | ARCHLINUX="`cat /etc/os-release | grep -o 'arch' | head -n 1`" 82 | UBUNTU="`cat /etc/os-release | grep -o 'ubuntu' | head -n 1`" 83 | PARROTSEC="`cat /etc/os-release | grep -o 'Parrot OS' | head -n 1`" 84 | 85 | printf "${LBLUE}[*]${RESET} Checking distribution\n" 86 | if [[ ${KALI} ]]; then 87 | printf "${LGREEN}[+]${RESET} Distribution is ${LBLUE}Kali linux${RESET}\n" 88 | kalilinux 89 | elif [[ ${FEDORA} ]]; then 90 | printf "${LGREEN}[+]${RESET} Distribution is ${LBLUE}Fedora${RESET}\n" 91 | fedora 92 | elif [[ ${ARCHLINUX} ]]; then 93 | printf "${LGREEN}[+]${RESET} Distribution is ${LBLUE}Arch Linux${RESET}\n" 94 | archlinux 95 | elif [[ ${UBUNTU} ]]; then 96 | printf "${LGREEN}[+]${RESET} Distribution is ${LBLUE}Ubuntu${RESET}\n" 97 | ubuntu 98 | elif [[ ${PARROTSEC} ]]; then 99 | printf "${LGREEN}[+]${RESET} Distribution is ${LBLUE}ParrotSec${RESET}\n" 100 | parrotsec 101 | fi 102 | } 103 | 104 | function start_services { 105 | printf "${LBLUE}[*]${RESET} Now going to start all services required\n" 106 | sleep 1 107 | printf "${GREEN}[+]${RESET} Service 'vmtoolsd' will be enabled and started\n" 108 | if ! [ -x "$(sudo systemctl enable vmtoolsd.service; sudo systemctl start vmtoolsd.service)"]; then 109 | printf "${RED}[-]${RESET} Service 'vmtoolsd' does not exist\n" 110 | printf "${YELLOW}[!]${RESET} Check if 'open-vm-tools is installed\n" 111 | exit 1 112 | fi 113 | sleep 1 114 | printf "${GREEN}[+]${RESET} Service 'vmware-vmblock-fuse' will be enabled and started\n" 115 | 116 | if ! [ -x "$(sudo systemctl enable vmware-vmblock-fuse.service; sudo systemctl start vmware-vmblock-fuse.service)"]; then 117 | printf "${RED}[-]${RESET} Service 'vmware-vmblock-fuse' does not exist !\n" 118 | printf "${YELLOW}[!]${RESET} Are you sure 'open-vm-tools is installed ?\n" 119 | exit 1 120 | fi 121 | 122 | sleep 1 123 | printf "${GREEN}[+]${RESET} Adding 'vmware-user-suid-wrapper' to i3 config to enable copy/paste\n" 124 | 125 | if [ "$(ls $HOME/.config/i3/ | grep "config" | head -n 1 )" = "config" ]; then 126 | echo "exec vmware-user-suid-wrapper --no-startup-id" >> $HOME/.config/i3/config 127 | else 128 | printf "${RED}[-]${RESET} Cannot find i3 config, please check where your config file is placed and edit the script\n" 129 | exit 1 130 | fi 131 | } 132 | 133 | check_vmtools 134 | exit 0 135 | --------------------------------------------------------------------------------