Generate X monitor section is no more required

This commit is contained in:
Mikhail Klementev 2019-12-29 14:35:39 +00:00
parent 1270b2e209
commit 55a825a7c0
No known key found for this signature in database
GPG Key ID: BE44DA8C062D87DC
6 changed files with 2 additions and 40 deletions

1
.gitignore vendored
View File

@ -1,2 +1 @@
nix/local.nix
nix/monitor.nix

View File

@ -42,14 +42,6 @@ You need to **relogin** if you install virt-manager (libvirt) first time.
$ go get -u code.dumpstack.io/tools/appvm
## Generate resolution
By default uses 1920x1080. If you need to regenerate `appvm/nix/monitor.nix`:
$ $GOPATH/src/code.dumpstack.io/tools/appvm/generate-resolution.sh 3840 2160 > $GOPATH/src/code.dumpstack.io/tools/appvm/nix/monitor.nix
Autodetection is a bash-spaghetti, so you need to check results. BTW it's just a X.org monitor section.
## Run application
$ appvm start chromium --verbose

View File

@ -125,8 +125,8 @@ func list(l *libvirt.Libvirt) {
for _, f := range files {
if f.Name() != "base.nix" &&
f.Name() != "local.nix" && f.Name() != "monitor.nix" &&
f.Name() != "local.nix.template" && f.Name() != "monitor.nix.template" {
f.Name() != "local.nix" &&
f.Name() != "local.nix.template" {
fmt.Println("\t", f.Name()[0:len(f.Name())-4])
}
}
@ -161,12 +161,6 @@ func prepareTemplates(appvmPath string) (err error) {
}
}
if _, err = os.Stat(appvmPath + "/nix/monitor.nix"); os.IsNotExist(err) {
err = copyFile(appvmPath+"/nix/monitor.nix.template", appvmPath+"/nix/monitor.nix")
if err != nil {
return
}
}
return
}

View File

@ -1,16 +0,0 @@
#!/bin/bash
if [[ "$1" == "" || "$2" == "" ]]; then
echo -e "Usage:\t$0 X Y"
exit 1
fi
MONITOR_SIZE="$(xrandr | grep mm | head -n 1 | awk '{ print $(NF-2) " " $(NF) }' | sed 's/mm//g')"
CVT="$(cvt ${1} ${2} | 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 "}"

View File

@ -1,7 +1,6 @@
{pkgs, ...}:
{
imports = [
<nix/monitor.nix>
<nix/local.nix>
];

View File

@ -1,6 +0,0 @@
{
services.xserver.monitorSection = ''
Modeline "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
Option "PreferredMode" "1920x1080_60.00"
'';
}