우분투 14.04 emacs: 전체 화면 기본값을 취소하는 방법은 무엇입니까?

우분투 14.04 emacs: 전체 화면 기본값을 취소하는 방법은 무엇입니까?

emacs를 시작하면 항상 전체 화면입니다. Emacs를 시작하는 구성을 찾을 수 없습니다.~ 아니다전체 화면(최대화). 이 문제가 있는 사람은 나뿐만이 아닙니다.

http://ubuntuforums.org/showthread.php?t=2282182

체계:

  • 델 XPS 15
  • Ubuntu 14.04(공장 설치)
  • Emacs 24.3.1(출고 시 설치, 업데이트됨)

이 옵션을 시도했는데 --geometry명령줄에서 작동하지만 도크 아이콘의 동작은 변경되지 않습니다. 아이콘을 제거하더라도 custom 을 사용하여 명령줄에서 시작 --geometry하고 새 아이콘을 잠그면 전체 화면에서 다시 시작됩니다. 설정 에도 운이 없었 *-frame-alist습니다. 이 작업을 수행할 수 있는 다른 구성은 무엇입니까?

답변1

HiDPI 화면이 있는 Dell XPS도 있는데 같은 문제가 발생했습니다. Emacs 시작 파일에서 프레임 너비를 88자로 설정했기 때문에 Emacs는 사용 가능한 것보다 더 많은 화면 공간을 차지하려고 했습니다. 이는 HiDPI 디스플레이에서 읽을 수 있도록 UI 배율 인수를 2로 설정했기 때문에 두 배가 되었습니다. . 그래서 창 관리자는 (올바로) Emacs를 전체 화면 모드로 열었습니다. 나는 ennob의 솔루션을 시도했을 때 그것을 알아 냈습니다.http://ubuntuforums.org/showthread.php?t=2282182. ennob의 코드에서 프레임 크기는 40 x 25자이므로 내 시스템에서는 프레임 크기가 80x50이 됩니다. 약간의 실험을 통해 Emacs는 프레임의 실제 너비와 높이를 설정할 때 요청된 텍스트 너비와 높이에 배율 인수를 곱한다는 것을 확인했습니다.

dconf에서 스케일 팩터를 얻을 수 있습니다:

dconf read /com/ubuntu/user-interface/scale-factor

내 시스템에서는 {'eDP1': 16}. 1의 스케일 팩터는 {'eDP1': 8}. 그래서 저는 ennob의 코드를 일반화하고 이것을 Emacs 시작 파일에 추가했습니다(저의 경우 ~/.emacs.d/init.el):

(defun my:window-setup-hook ()
  (when (and (string= system-type "gnu/linux") window-system)
    (toggle-frame-maximized)
    (let* ((dconf-entry
            (shell-command-to-string
             "dconf read /com/ubuntu/user-interface/scale-factor"))
           (scale-factor (progn (string-match "'[eD][FD]P1': \\([0-9]+\\)[,\}]"
                                              dconf-entry)
                                (string-to-int (match-string 1 dconf-entry))))
           (text-width (truncate (/ desired-width (/ scale-factor 8.0))))
           (text-height (truncate (/ desired-height (/ scale-factor 8.0)))))
      (message "set-frame-size is %dx%d, scale-factor is %s"
               text-width text-height scale-factor)
      (set-frame-size (selected-frame) text-width text-height))))

(setq window-setup-hook 'my:window-setup-hook)

이는 축척 비율이 2보다 크고 기본 글꼴이 14pt( (set-face-attribute 'default nil :height 140))인 경우에 적합합니다. 따라서 저는 여전히 수많은 요인을 이해하지 못하지만 당면한 문제는 해결되었으며 이것이 귀하에게도 도움이 되기를 바랍니다.

답변2

@chris-simpkins의 답변은 거의 효과가 있었지만 전체 화면을 전환하는 기능은 어떤 이유로 작동하지 않았습니다./ 내 의견에 따르면 다음은 저에게 맞는 코드입니다(더 좁은 화면을 선호합니다).

(defun toggle-fullscreen-x11 ()
  "Toggle full screen on X11"
  (interactive)
  (when (eq window-system 'x)
    (set-frame-parameter
     nil 'fullscreen
     (when (not (frame-parameter nil 'fullscreen)) 'fullboth))))

(defun my:window-setup-hook ()
  (toggle-fullscreen-x11)
  (when window-system
    (let* ((dconf-entry
            (shell-command-to-string
             "dconf read /com/ubuntu/user-interface/scale-factor"))
           (scale-factor (progn (string-match "{'eDP1': \\([0-9]+\\)}"
                                              dconf-entry)
                                (string-to-int (match-string 1 dconf-entry))))
           ;; text-width make room for gutter and fringes
           (text-width (truncate (/ 48 (/ scale-factor 8.0))))
           (text-height (truncate (/ 50 (/ scale-factor 8.0)))))
      (set-frame-size (selected-frame) text-width text-height))))
(setq window-setup-hook 'my:window-setup-hook)

관련 정보