From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: David Hedlund Newsgroups: gmane.emacs.devel Subject: Solution to a proposed FAQ, how to maximize emacs quickly (like `emacs --maximize`) for GNU/Linux Date: Tue, 26 Sep 2023 14:11:07 +0200 Message-ID: <19e53542-bfb0-4e48-8845-01fd34d93dbb@beloved.name> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------Wzhc0LNd3Ly0vwCrc5Co0abA" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20586"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird To: Emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Sep 26 14:12:14 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ql6vG-00059U-FN for ged-emacs-devel@m.gmane-mx.org; Tue, 26 Sep 2023 14:12:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ql6uM-0006X2-2L; Tue, 26 Sep 2023 08:11:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ql6uK-0006V2-9s for Emacs-devel@gnu.org; Tue, 26 Sep 2023 08:11:16 -0400 Original-Received: from relay3-d.mail.gandi.net ([217.70.183.195]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ql6uG-0008WD-0s for Emacs-devel@gnu.org; Tue, 26 Sep 2023 08:11:14 -0400 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id B4F8060005 for ; Tue, 26 Sep 2023 12:11:08 +0000 (UTC) Content-Language: en-US X-GND-Sasl: public@beloved.name Received-SPF: pass client-ip=217.70.183.195; envelope-from=public@beloved.name; helo=relay3-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:311062 Archived-At: This is a multi-part message in MIME format. --------------Wzhc0LNd3Ly0vwCrc5Co0abA Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Methods to always maximize `emacs` (for example, from Alt+F2 in MATE), without the slightly distracting visual effect when the default frame size is growing to fullscreen. The window will be maximized quickly, like "emacs --maximize". ########################### Windows - Solved A while ago I suggested how to expand the Emacs window rapidly for Windows - https://lists.gnu.org/archive/html/emacs-devel/2023-04/msg00155.html It has now been added: " Alternatively, you can avoid the visual effect of Emacs changing its frame size entirely in your init file (i.e., without using the Registry), like this: (setq frame-resize-pixelwise t) (set-frame-position nil 0 0) (set-frame-size nil (display-pixel-width) (display-pixel-height) t) " - https://www.gnu.org/software/emacs/manual/html_node/efaq/Fullscreen-mode-on-MS_002dWindows.html. Here's the old revision: https://web.archive.org/web/20230202024025/https://www.gnu.org/software/emacs/manual/html_node/efaq/Fullscreen-mode-on-MS_002dWindows.html ########################### GNU/Linux - proposed new section: https://www.gnu.org/software/emacs/manual/html_node/efaq/Fullscreen-mode-on-GNU-Linux.html As far as I know, this cannot be done entirely with Emacs LISP for GNU/Linux, but I found a workaround by combining it with devilspie2. I've successfully used this recipe for Trisquel 11: * Step 1 to quickly maximize the window[1]: Install, configure, and autostart devilspie2 to nearly maximize emacs[1]. Run this in a terminal or as a script: # Install devilspie2 sudo apt-get -y install devilspie2 # Configure devilspie2 mkdir -p ~/.config/devilspie2/ width="$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f1)" height="$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f2)" tee ~/.config/devilspie2/emacs.lua /dev/null << EOF if (get_class_instance_name() == "emacs") then     set_window_geometry(0, 0, $width, $height); end EOF # Autostart devilspie2 mkdir -p "$HOME/.config/autostart/" # The directory does not exist by default cd "$HOME/.config/autostart/" || exit file="devilspie-2.desktop" touch "$file" desktop-file-edit \ --set-name="Devilspie 2" \ --set-comment="Perform scripted actions on windows as they are created" \ --set-key="Type" --set-value="Application" \ --set-key="Exec" --set-value="devilspie2" \ --set-key="X-MATE-Autostart-Delay" --set-value="0" \ "$file" desktop-file-validate "$file" * Step 2 to quickly maximize the window[1]: Add this to ~/.emacs: (add-to-list 'default-frame-alist '(fullscreen . maximized)) * Log out and then log back into your desktop environment * Every time you open `emacs`, regardless how you are opening it, it will open the window equally fast as `emacs --maximize` [1]: Workaround to bug: maximize* commands don't work for Emacs - https://savannah.nongnu.org/bugs/index.php?63979 The above steps can of course be rewritten and described for general use to make it useful for any GNU/Linux distro. --------------Wzhc0LNd3Ly0vwCrc5Co0abA Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Methods to always maximize `emacs` (for example, from Alt+F2 in MATE), without the slightly distracting visual effect when the default frame size is growing to fullscreen. The window will be maximized quickly, like "emacs --maximize".

###########################

Windows - Solved

A while ago I suggested how to expand the Emacs window rapidly for Windows -  https://lists.gnu.org/archive/html/emacs-devel/2023-04/msg00155.html

It has now been added:

"

Alternatively, you can avoid the visual effect of Emacs changing its frame size entirely in your init file (i.e., without using the Registry), like this:

(setq frame-resize-pixelwise t)
(set-frame-position nil 0 0)
(set-frame-size nil (display-pixel-width) (display-pixel-height) t)

" - https://www.gnu.org/software/emacs/manual/html_node/efaq/Fullscreen-mode-on-MS_002dWindows.html. Here's the old revision: https://web.archive.org/web/20230202024025/https://www.gnu.org/software/emacs/manual/html_node/efaq/Fullscreen-mode-on-MS_002dWindows.html


###########################

GNU/Linux - proposed new section: https://www.gnu.org/software/emacs/manual/html_node/efaq/Fullscreen-mode-on-GNU-Linux.html


As far as I know, this cannot be done entirely with Emacs LISP for GNU/Linux, but I found a workaround by combining it with devilspie2.


I've successfully used this recipe for Trisquel 11:

* Step 1 to quickly maximize the window[1]: Install, configure, and autostart devilspie2 to nearly maximize emacs[1]. Run this in a terminal or as a script:

# Install devilspie2
sudo apt-get -y install devilspie2

# Configure devilspie2
mkdir -p ~/.config/devilspie2/

width="$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f1)"
height="$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f2)"

tee ~/.config/devilspie2/emacs.lua /dev/null << EOF
if (get_class_instance_name() == "emacs") then

    set_window_geometry(0, 0, $width, $height);

end
EOF

# Autostart devilspie2
mkdir -p "$HOME/.config/autostart/" # The directory does not exist by default
cd "$HOME/.config/autostart/" || exit
file="devilspie-2.desktop"
touch "$file"
desktop-file-edit \
--set-name="Devilspie 2" \
--set-comment="Perform scripted actions on windows as they are created" \
--set-key="Type" --set-value="Application" \
--set-key="Exec" --set-value="devilspie2" \
--set-key="X-MATE-Autostart-Delay" --set-value="0" \
"$file"
desktop-file-validate "$file"

* Step 2 to quickly maximize the window[1]: Add this to ~/.emacs: (add-to-list 'default-frame-alist '(fullscreen . maximized))
* Log out and then log back into your desktop environment
* Every time you open `emacs`, regardless how you are opening it, it will open the window equally fast as `emacs --maximize`

[1]: Workaround to bug: maximize* commands don't work for Emacs - https://savannah.nongnu.org/bugs/index.php?63979



The above steps can of course be rewritten and described for general use to make it useful for any GNU/Linux distro.

--------------Wzhc0LNd3Ly0vwCrc5Co0abA--