How Can I Start a Program Minimised, and Restore Maximised?

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.

0

1 Answer

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).

2

Your Answer

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

Chloe Bennett

Chloe Bennett

Culture, Media & Entertainment Columnist

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.

Share this article
Twitter Facebook Pinterest