Package: devilspie2
Version: 0.42
###
Affected devilspie2 commands
The command that I'm describing in the sections below is maximize(). However,
I've also failed with these maximize* commands for Emacs:
- maximize_horizontally()
- maximize_vertically()
#
Background
"To avoid the slightly distracting visual effect of Emacs starting with its default
frame size and then growing to fullscreen, you can add..." - Emacs FAQ
I added this to .emacs:
```
;; Cirumvent the visual distracting effect caused by: `(add-to-list
'default-frame-alist '(fullscreen . maximized))` that is added later
(setq frame-resize-pixelwise t)
(set-frame-position (selected-frame) 0 0)
(set-frame-size (selected-frame) (display-pixel-width) (display-pixel-height) t)
;; (display-pixel-width) and (display-pixel-height) above will detect the
correct resolution, they can be replaced with their values or half their values
if you want to experiment with them.
;; Maximize the frame
(add-to-list 'default-frame-alist '(fullscreen . maximized))
```
However, the hack did not remove the/visually distracting effect/, so I decided
to give devilspie2 a shot instead:
#
devilspie2 setup
Add this to ~/.config/devilspie2/test.lua:
```
debug_print("Window Name: " .. get_window_name())
debug_print("Application name: " .. get_application_name())
debug_print("WM_CLASS: " .. get_class_instance_name())
debug_print("Window Class: " .. get_window_class())
if (get_class_instance_name() == "mate-terminal") then maximize(); end -- works
if (get_class_instance_name() == "emacs") then
maximize(); -- does not work
set_window_workspace(2); -- works!
end
```
Then run: `devilspie2 --debug &`
Open mate-terminal, it will give you this output in the terminal:
```
Window Name: Terminal
Application name: Terminal
WM_CLASS: mate-terminal
Window Class: Mate-terminal
```
Open Emacs, it will give you this output in the terminal:
```
Window Name: emacs@username-System-Product-Name
Application name: emacs
WM_CLASS: emacs
Window Class: Emacs
```
devilspie2 moved the Emacs window to the second workspace in the DE, and it
maximized the mate-terminal.
However, it did not maximize Emacs (without error reports). With a more
profound evaluation, it actually
maximized the Emacs window 2 out of 100 times when I opened multiple devilspie2
sessions (I could not reproduce this by re-opening Emacs 100 times in a single
session):
- devilspie2 --debug &
- open emacs. close emacs. Repeat 10 times.
- Ctrl+C, open another session:
- devilspie2 --debug &
- open emacs. close emacs. Repeat 10 times.
- Ctrl+C, open another session:
- devilspie2 --debug &
- open emacs. close emacs. Repeat 10 times.
- Ctrl+C, open another session:
- devilspie2 --debug &
- open emacs. close emacs. Repeat 10 times.
- Ctrl+C, open another session:
- devilspie2 --debug &
- open emacs. close emacs. Repeat 10 times. <-- Maximized the first time I
opened it (5 devilspie2 sessions open)
- Ctrl+C, open another session:
- devilspie2 --debug &
- open emacs. close emacs. Repeat 10 times. <-- Maximized the first time I
opened it (6 devilspie2 sessions open)
- Ctrl+C, open another session:
- devilspie2 --debug &
- open emacs. close emacs. Repeat 10 times.
- Ctrl+C, open another session:
- devilspie2 --debug &
- open emacs. close emacs. Repeat 10 times.
- Ctrl+C, open another session:
- devilspie2 --debug &
- open emacs. close emacs. Repeat 10 times.
- Ctrl+C, open another session:
- devilspie2 --debug &
- open emacs. close emacs. Repeat 10 times.
- Ctrl+C, open another session:
- devilspie2 --debug &
- open emacs. close emacs. Repeat 10 times.