Skip to content

Instantly share code, notes, and snippets.

@hamrammi
Last active August 10, 2016 07:41
Show Gist options
  • Save hamrammi/f77465b56fb21dbd3698ea493822dab7 to your computer and use it in GitHub Desktop.
Save hamrammi/f77465b56fb21dbd3698ea493822dab7 to your computer and use it in GitHub Desktop.
Ubuntu: Minimize all windows except active one
#! /usr/bin/python
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('Wnck', '3.0')
from gi.repository import Gtk, Wnck
screen = Wnck.Screen.get_default()
screen.force_update()
while Gtk.events_pending():
Gtk.main_iteration()
windows = screen.get_windows()
active_app = screen.get_active_window().get_application()
for w in windows:
if not w.get_application() == active_app:
w.minimize()
@hamrammi
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment