Skip to content

Commit 3805b10

Browse files
UTsweetyfishBLumia
authored andcommitted
fix: Revert "feat: adjust-grub-theme: get screen size from xrandr"
Beta 2 放弃: 1. dde-api 根据 xrandr 生成主题 2. deepin-installer GFXMODE=auto This reverts commit 006a25d.
1 parent 7abd630 commit 3805b10

1 file changed

Lines changed: 2 additions & 45 deletions

File tree

adjust-grub-theme/main.go

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"os"
1616
"os/exec"
1717
"path/filepath"
18-
"regexp"
1918
"strconv"
2019
"strings"
2120

@@ -174,44 +173,6 @@ func getScreenSizeFromGrubParams(grubParamsFilePath string) (w, h int, err error
174173
return
175174
}
176175

177-
func getScreenSizeFromXrandr() (w, h int, err error) {
178-
out, err := exec.Command("xrandr").Output()
179-
if err != nil {
180-
return 0, 0, err
181-
}
182-
// try to get primary screen resolution, for example, extract 1440x900
183-
// from "LVDS1 connected primary 1440x900+0+0 (normal left inverted
184-
// right x axis y axis)"
185-
re := regexp.MustCompile(` connected primary (\d+)x(\d+)`)
186-
matches := re.FindStringSubmatch(string(out))
187-
if len(matches) == 3 {
188-
w, err := strconv.Atoi(matches[1])
189-
if err != nil {
190-
return 0, 0, err
191-
}
192-
h, err := strconv.Atoi(matches[2])
193-
if err != nil {
194-
return 0, 0, err
195-
}
196-
return w, h, nil
197-
}
198-
// if failed, try to get the master screen resolution
199-
re = regexp.MustCompile(`Screen 0: .*current (\d+) x (\d+)`)
200-
matches = re.FindStringSubmatch(string(out))
201-
if len(matches) == 3 {
202-
w, err := strconv.Atoi(matches[1])
203-
if err != nil {
204-
return 0, 0, err
205-
}
206-
h, err := strconv.Atoi(matches[2])
207-
if err != nil {
208-
return 0, 0, err
209-
}
210-
return w, h, nil
211-
}
212-
return 0, 0, fmt.Errorf("Failed to extract primary screen resolution")
213-
}
214-
215176
func cropSaveStyleBox(img image.Image, filenamePrefix string, r int) {
216177
imgW := img.Bounds().Dx()
217178
imgH := img.Bounds().Dy()
@@ -531,12 +492,8 @@ func main() {
531492
optScreenWidth, optScreenHeight, err = getScreenSizeFromGrubParams(grubParamsFile)
532493
if err != nil {
533494
logger.Debug(err)
534-
optScreenWidth, optScreenHeight, err = getScreenSizeFromXrandr()
535-
if err != nil {
536-
logger.Debug(err)
537-
optScreenWidth = 1024
538-
optScreenHeight = 768
539-
}
495+
optScreenWidth = 1024
496+
optScreenHeight = 768
540497
}
541498
logger.Debug("screen width:", optScreenWidth)
542499
logger.Debug("screen height:", optScreenHeight)

0 commit comments

Comments
 (0)