mirror of
				https://github.com/oSoWoSo/DistroHopper.git
				synced 2024-08-14 22:46:53 +00:00 
			
		
		
		
	Issue 650 - Allow --screenpct which will scale VM's screen size
This commit is contained in:
		
							parent
							
								
									44a8c68aef
								
							
						
					
					
						commit
						d431d91618
					
				
					 1 changed files with 33 additions and 14 deletions
				
			
		
							
								
								
									
										41
									
								
								quickemu
									
										
									
									
									
								
							
							
						
						
									
										41
									
								
								quickemu
									
										
									
									
									
								
							|  | @ -682,13 +682,6 @@ function vm_boot() { | ||||||
|     local X_RES=1152 |     local X_RES=1152 | ||||||
|     local Y_RES=648 |     local Y_RES=648 | ||||||
|     if [ "${XDG_SESSION_TYPE}" == "x11" ]; then |     if [ "${XDG_SESSION_TYPE}" == "x11" ]; then | ||||||
|       local LOWEST_WIDTH="" |  | ||||||
|       if [ -z "${SCREEN}" ]; then |  | ||||||
|         LOWEST_WIDTH=$(xrandr --listmonitors | grep -v Monitors | cut -d' ' -f4 | cut -d'/' -f1 | sort | head -n1) |  | ||||||
|       else |  | ||||||
|         LOWEST_WIDTH=$(xrandr --listmonitors | grep -v Monitors | grep "^ ${SCREEN}:" | cut -d' ' -f4 | cut -d'/' -f1 | head -n1) |  | ||||||
|       fi |  | ||||||
|       if [ "${FULLSCREEN}" ]; then |  | ||||||
|       if [ -z "${SCREEN}" ]; then |       if [ -z "${SCREEN}" ]; then | ||||||
|         X_RES=$(xrandr --listmonitors | grep -v Monitors | cut -d' ' -f4 | cut -d'/' -f1 | sort | head -n1) |         X_RES=$(xrandr --listmonitors | grep -v Monitors | cut -d' ' -f4 | cut -d'/' -f1 | sort | head -n1) | ||||||
|         Y_RES=$(xrandr --listmonitors | grep -v Monitors | cut -d' ' -f4 | cut -d'/' -f2 | cut -d'x' -f2 | sort | head -n1) |         Y_RES=$(xrandr --listmonitors | grep -v Monitors | cut -d' ' -f4 | cut -d'/' -f2 | cut -d'x' -f2 | sort | head -n1) | ||||||
|  | @ -696,18 +689,26 @@ function vm_boot() { | ||||||
|         X_RES=$(xrandr --listmonitors | grep -v Monitors | grep "^ ${SCREEN}:" | cut -d' ' -f4 | cut -d'/' -f1 | head -n1) |         X_RES=$(xrandr --listmonitors | grep -v Monitors | grep "^ ${SCREEN}:" | cut -d' ' -f4 | cut -d'/' -f1 | head -n1) | ||||||
|         Y_RES=$(xrandr --listmonitors | grep -v Monitors | grep "^ ${SCREEN}:" | cut -d' ' -f4 | cut -d'/' -f2 | cut -d'x' -f2 | head -n1) |         Y_RES=$(xrandr --listmonitors | grep -v Monitors | grep "^ ${SCREEN}:" | cut -d' ' -f4 | cut -d'/' -f2 | cut -d'x' -f2 | head -n1) | ||||||
|       fi |       fi | ||||||
|       elif [ "${LOWEST_WIDTH}" -ge 3840 ]; then | 
 | ||||||
|  |       if [ "${FULLSCREEN}" ]; then | ||||||
|  |         : | ||||||
|  |       elif [ "${SCREENPCT}" ] ; then | ||||||
|  |         X_RES=$(( X_RES*SCREENPCT/100 )) | ||||||
|  |         Y_RES=$(( Y_RES*SCREENPCT/100 )) | ||||||
|  |       elif [ "${X_RES}" -ge 3840 ]; then | ||||||
|         X_RES=3200 |         X_RES=3200 | ||||||
|         Y_RES=1800 |         Y_RES=1800 | ||||||
|       elif [ "${LOWEST_WIDTH}" -ge 2560 ]; then |       elif [ "${X_RES}" -ge 2560 ]; then | ||||||
|         X_RES=2048 |         X_RES=2048 | ||||||
|         Y_RES=1152 |         Y_RES=1152 | ||||||
|       elif [ "${LOWEST_WIDTH}" -ge 1920 ]; then |       elif [ "${X_RES}" -ge 1920 ]; then | ||||||
|         X_RES=1664 |         X_RES=1664 | ||||||
|         Y_RES=936 |         Y_RES=936 | ||||||
|       elif [ "${LOWEST_WIDTH}" -ge 1280 ]; then |       elif [ "${X_RES}" -ge 1280 ]; then | ||||||
|         X_RES=1152 |         X_RES=1152 | ||||||
|         Y_RES=648 |         Y_RES=648 | ||||||
|  |       else | ||||||
|  |         : | ||||||
|       fi |       fi | ||||||
|     fi |     fi | ||||||
|   fi |   fi | ||||||
|  | @ -1315,6 +1316,7 @@ function usage() { | ||||||
|   echo "  --fullscreen                      : Starts VM in full screen mode (Ctl+Alt+f to exit)" |   echo "  --fullscreen                      : Starts VM in full screen mode (Ctl+Alt+f to exit)" | ||||||
|   echo "  --ignore-msrs-always              : Configure KVM to always ignore unhandled machine-specific registers" |   echo "  --ignore-msrs-always              : Configure KVM to always ignore unhandled machine-specific registers" | ||||||
|   echo "  --screen <screen>                 : Use specified screen to determine the window size." |   echo "  --screen <screen>                 : Use specified screen to determine the window size." | ||||||
|  |   echo "  --screenpct <percent>             : Percent of fullscreen for VM if --fullscreen is not specified." | ||||||
|   echo "  --shortcut                        : Create a desktop shortcut" |   echo "  --shortcut                        : Create a desktop shortcut" | ||||||
|   echo "  --snapshot apply <tag>            : Apply/restore a snapshot." |   echo "  --snapshot apply <tag>            : Apply/restore a snapshot." | ||||||
|   echo "  --snapshot create <tag>           : Create a snapshot." |   echo "  --snapshot create <tag>           : Create a snapshot." | ||||||
|  | @ -1479,6 +1481,7 @@ PUBLIC="" | ||||||
| PUBLIC_PERMS="" | PUBLIC_PERMS="" | ||||||
| PUBLIC_TAG="" | PUBLIC_TAG="" | ||||||
| SCREEN="" | SCREEN="" | ||||||
|  | SCREENPCT="" | ||||||
| SHORTCUT=0 | SHORTCUT=0 | ||||||
| SNAPSHOT_ACTION="" | SNAPSHOT_ACTION="" | ||||||
| SNAPSHOT_TAG="" | SNAPSHOT_TAG="" | ||||||
|  | @ -1558,6 +1561,22 @@ else | ||||||
|             SCREEN="${2}" |             SCREEN="${2}" | ||||||
|             shift |             shift | ||||||
|             shift;; |             shift;; | ||||||
|  |           -screenpct|--screenpct) | ||||||
|  |             if [ ! -z "${2##*[!0-9]*}" ] ; then | ||||||
|  |               if [[ ${2} -ge 25 && ${2} -lt 100 ]] ; then | ||||||
|  |                 SCREENPCT=${2} | ||||||
|  |               else | ||||||
|  |                 echo "screenpct invalid must be 25 <= pct < 100" | ||||||
|  |                 usage | ||||||
|  |                 exit 1 | ||||||
|  |               fi | ||||||
|  |             else | ||||||
|  |               echo "screenpct needs to be an integer in range 25 <= pct < 100" | ||||||
|  |               usage | ||||||
|  |               exit 1 | ||||||
|  |             fi | ||||||
|  |             shift | ||||||
|  |             shift;; | ||||||
|           -snapshot|--snapshot) |           -snapshot|--snapshot) | ||||||
|             SNAPSHOT_ACTION="${2}" |             SNAPSHOT_ACTION="${2}" | ||||||
|             if [ -z "${SNAPSHOT_ACTION}" ]; then |             if [ -z "${SNAPSHOT_ACTION}" ]; then | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue