2

There are various options to start a program minimised, or to start a program maximised and they work well, but I'm always looking for new challenges.

If I start a program minimised using the Devil's Pie method, and then click on it in the launcher, it restores to its regular size. Instead, I would like it to restore to a maximised state.

In other words, I want it to act as though it had started maximised, and then been minimised.

3

You can achieve a minimized maximized window using Python:

import wnck
import gtk
import subprocess
import time

chrome = subprocess.Popen(["google-chrome"])

b = True
while b:
    screen = wnck.screen_get_default()
    while gtk.events_pending():
        gtk.main_iteration()
    windows = screen.get_windows()
    for w in windows:
        if w.get_pid() == chrome.pid:
            w.maximize()
            w.minimize()
            b = False
    time.sleep(1)


chrome.wait()

google-chrome in this case will maximize then minimize. After this you just create a .desktop that can launch the script like the example shown below:

[Desktop Entry]
Version=1.0
Type=Application
Name=Application Name
Comment=Application Comment
Exec=python /exact/path/to/python/script.py
Icon=icon
Categories=valid categories;

Make sure to set the desktop as a executable file or it will not function.

The script should be edited on line 6 where google-chrome should be replaced with whatever command you wish to execute. If the program have parameters they can be passed as following: "google-chrome", "para1", "para2".

Cred to this question for the python script (changed to chrome in my testing).

  • Interesting solution, I had to sudo apt-get install python-wnck on Xubuntu 14.04 to get it to work. – TuKsn Jul 2 '14 at 14:17
  • Oh, was already installed on Ubuntu :) – Xweque Jul 2 '14 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.