devilspie2 icon indicating copy to clipboard operation
devilspie2 copied to clipboard

maximize* commands don't work for Emacs

Open davidhedlund opened this issue 1 year ago • 1 comments

See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1033471 for the bug

davidhedlund avatar Mar 26 '23 05:03 davidhedlund

https://github.com/gitGNU/gnu_devilspie2/issues/1

davidhedlund avatar Mar 26 '23 05:03 davidhedlund

Just had another poke at this… looks like emacs is doing things to the window shortly after opening it, and that's conflicting with what devilspie2 is told to do.

Waiting for a short time seems to be enough to work around this.

if get_class_instance_name() == "emacs" then
  os.execute("sleep 0.5") -- ← 💤
  maximize()
  set_window_workspace(2)
end

dsalt avatar Oct 19 '24 23:10 dsalt

Just had another poke at this… looks like emacs is doing things to the window shortly after opening it, and that's conflicting with what devilspie2 is told to do.

Waiting for a short time seems to be enough to work around this.

if get_class_instance_name() == "emacs" then
  os.execute("sleep 0.5") -- ← 💤
  maximize()
  set_window_workspace(2)
end

Impressive, even 0.02 works fine on my computer:

if get_class_instance_name() == "emacs" then
  os.execute("sleep 0.02")
  maximize()
end

I'm very happy with your help, big thanks!

Tasks

Suggestion: Document the example

I added this to https://www.emacswiki.org/emacs/FullScreen under the "devilspie2" section (currently https://www.emacswiki.org/emacs/FullScreen#h5o-50)

if get_class_instance_name() == "emacs" then
    os.execute("sleep 0.1")
    -- Emacs applies default window size with a delay, potentially overriding devilspie2. A brief pause ensures devilspie2's maximize action takes effect after Emacs completes its initial sizing.
  maximize()
end

Could you please add it to https://github.com/dsalt/devilspie2/blob/master/README.md#simple-script-example with the additional comment (see "early-init.el" at https://www.emacswiki.org/emacs/FullScreen for reference)?:

-- The preferred method for maximizing Emacs involves using an early-init.el file, which allows for quicker maximization compared to configuring it in init.el. However, many Emacs users prefer to keep all their configuration in init.el. In such cases, devilspie2 can be a useful alternative for achieving quick maximization without modifying the Emacs startup process.

Questions

  • Is this the official repository for devilspie2?
  • So this is not a devilspie2 bug, I guess we should close it now, right?
  • Should I close:
    • https://github.com/gitGNU/gnu_devilspie2/issues/1
    • https://savannah.nongnu.org/bugs/index.php?63979 (now closed)
    • https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1033471

davidhedlund avatar Oct 20 '24 00:10 davidhedlund

Questions, in order:

  • Essentially, yes, though savannah is used for releases and the repository there is maintained. (I know that devilspie2 source in Debian has a watch file which points there, but it needs maintaining.)
  • Well. It's more or less suitably tagged now, I think.
  • This one and the one on savannah are handled. Up to you for the other one.

dsalt avatar Oct 20 '24 01:10 dsalt

Questions, in order:

* Essentially, yes, though savannah is used for releases and the repository there is maintained. (I know that devilspie2 source in Debian has a watch file which points there, but it needs maintaining.)

* Well. It's more or less suitably tagged now, I think.

* This one and the one on savannah are handled. Up to you for the other one.

Thank you!

And what do you think about the "Suggestion: Document the example" section in the comment above?

davidhedlund avatar Oct 20 '24 01:10 davidhedlund

Do you think that https://savannah.nongnu.org/bugs/?62848 can be solved by utilizing sleep too?

davidhedlund avatar Oct 20 '24 01:10 davidhedlund

Want to write something yourself? Fine if not, but either way it should be handled as a separate issue (or PR); and I do agree that it should be done.

As for savannah bug 62848, it's an xseticon bug.

dsalt avatar Oct 20 '24 01:10 dsalt

See #27.

The “log out and log back in” in the devilspie2 section in https://www.emacswiki.org/emacs/FullScreen should be unnecessary if devilspie2 is already running; also, 0.45 provides a desktop file.

dsalt avatar Oct 20 '24 20:10 dsalt

See #27.

The “log out and log back in” in the devilspie2 section in https://www.emacswiki.org/emacs/FullScreen should be unnecessary if devilspie2 is already running

I added "Log out and then log back into your desktop environment and start emacs, to make sure that devilspie2 autostarts and maximizes emacs."

also, 0.45 provides a desktop file.

Sorry, what do you mean? I couldn't find anything about that at https://www.emacswiki.org/emacs/FullScreen#h5o-45

davidhedlund avatar Oct 20 '24 20:10 davidhedlund

Want to write something yourself? Fine if not, but either way it should be handled as a separate issue (or PR); and I do agree that it should be done.

I didn't want to spoil the example documentation if you have personal preferences. But even if you have it, it's probably good if there are many different examples for the most popular programs, which emacs is part of.

PR submitted by dsalt:

  • https://github.com/dsalt/devilspie2/pull/27

As for savannah bug 62848, it's an xseticon bug.

Thank you for having a look.

davidhedlund avatar Oct 20 '24 21:10 davidhedlund

Re. the desktop file: the second part (Autostart devilspie2) of the script on that page creates one, and that's only useful for 0.44 and older.)

(If that “solved” is directed at #27, better to comment there.)

dsalt avatar Oct 20 '24 21:10 dsalt

Re. the desktop file: the second part (Autostart devilspie2) of the script on that page creates one, and that's only useful for 0.44 and older.)

(If that “solved” is directed at #27, better to comment there.)

That's great! I added "Devilspie2 0.44 and earlier versions do not include a desktop file, requiring users to create one manually:" to https://www.emacswiki.org/emacs/FullScreen

davidhedlund avatar Oct 20 '24 22:10 davidhedlund

I just

  • Closed https://github.com/gitGNU/gnu_devilspie2/issues/1
  • Emailed https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1033471 that this bug report is invalid, the workaround, and the link to the PR of the documentation of the workaround.

davidhedlund avatar Oct 21 '24 00:10 davidhedlund