
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に設定していたため、2倍になっていました。そのため、ウィンドウマネージャーは(当然のことながら)Emacsをフルスクリーンモードで開きました。ennobの解決策を試したときに、この問題が分かりました。http://ubuntuforums.org/showthread.php?t=2282182ennob のコードでは、フレーム サイズは 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 以上で、デフォルトのフォントが 14 pt ( (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)