mirror of
https://code.dumpstack.io/tools/appvm.git
synced 2024-12-03 11:26:35 +00:00
Implements generation of monitor section
This commit is contained in:
parent
1d9c9c2196
commit
802c70e0ec
12
README.md
12
README.md
|
@ -4,8 +4,6 @@ Simple application VM's based on Nix package manager.
|
|||
|
||||
Designed primarily for full screen usage without guest additions.
|
||||
|
||||
By default uses 3840x2160, so you need to change `appvm/nix/base.nix` monitorSection. Autodetection based on host resolution will be done after.
|
||||
|
||||
It's a proof-of-concept, but you can still use it. Also there is a lot of strange things inside, don't afraid of :)
|
||||
|
||||
## Install Nix package manager
|
||||
|
@ -23,9 +21,17 @@ It's a proof-of-concept, but you can still use it. Also there is a lot of strang
|
|||
|
||||
(if you clone appvm to home directory)
|
||||
|
||||
## Generate resolution
|
||||
|
||||
By default uses 3840x2160. If you need to regenerate `appvm/nix/monitor.nix`:
|
||||
|
||||
$ appvm/appvm.sh generate-resolution 1920 1080 > appvm/nix/monitor.nix
|
||||
|
||||
Autodetection is a bash-spaghetti, so you need to check results. BTW it's just a X.org monitor section.
|
||||
|
||||
## Create VM
|
||||
|
||||
$ $HOME/appvm/appvm.sh chromium
|
||||
$ $HOME/appvm/appvm.sh build chromium
|
||||
|
||||
## Run application
|
||||
|
||||
|
|
13
appvm.sh
13
appvm.sh
|
@ -19,6 +19,17 @@ if [[ "$1" == "build" && "$2" != "" ]]; then
|
|||
chmod +x ${VM_BIN_PATH}
|
||||
chmod +x bin/appvm.${2}
|
||||
unlink result
|
||||
elif [[ "$1" == "generate-resolution" && "$2" != "" && "$3" != "" ]]; then
|
||||
MONITOR_SIZE="$(xrandr | grep mm | head -n 1 | awk '{ print $(NF-2) " " $(NF) }' | sed 's/mm//g')"
|
||||
CVT="$(cvt ${2} ${3} | grep Modeline)"
|
||||
echo "{"
|
||||
echo " services.xserver.monitorSection = ''"
|
||||
echo " " ${CVT}
|
||||
echo " " Option '"PreferredMode"' $(echo ${CVT} | awk '{ print $2 }')
|
||||
echo " " DisplaySize ${MONITOR_SIZE} # In millimeters
|
||||
echo " '';"
|
||||
echo "}"
|
||||
else
|
||||
echo "Usage: $0 build APPLICATION"
|
||||
echo -e "Usage:\t$0 build APPLICATION"
|
||||
echo -e "or:\t$0 generate-resolution X Y"
|
||||
fi
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
{
|
||||
imports = [
|
||||
<nix/monitor.nix>
|
||||
];
|
||||
|
||||
system.nixos.stateVersion = "18.03";
|
||||
|
||||
services.xserver = {
|
||||
|
|
7
nix/monitor.nix
Normal file
7
nix/monitor.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
services.xserver.monitorSection = ''
|
||||
Modeline "3840x2160_60.00" 712.75 3840 4160 4576 5312 2160 2163 2168 2237 -hsync +vsync
|
||||
Option "PreferredMode" "3840x2160_60.00"
|
||||
DisplaySize 610 350
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue