Created
October 6, 2016 21:26
-
-
Save sxslex/4d4dfab28d62f4478eb5c7a0757e7237 to your computer and use it in GitHub Desktop.
kill_to_window_name.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
"""Fecha todas as janelas pelo nome.""" | |
from gi.repository import Gtk, Wnck | |
import os | |
Gtk.init([]) | |
screen = Wnck.Screen.get_default() | |
screen.force_update() | |
nome = os.sys.argv[1] | |
windows = [ | |
w for w in screen.get_windows() | |
if w.get_name() == nome | |
] | |
print(nome + ': ' + str(len(windows))) | |
for window in windows: | |
os.system( | |
'kill -9 %s' % str(window.get_pid()) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment