在 gnome shell 中關閉相同應用程式的所有窗口

在 gnome shell 中關閉相同應用程式的所有窗口

如標題所示,是否有一個快捷方式可以在 gnome shell 中關閉同一應用程式的所有窗口,或者有一個擴充功能可以執行此操作?

謝謝。

答案1

您可以在終端機中執行以下命令。

killall <application>

或按超級鍵(windows/apple/ubuntu 鍵)並輸入 xkill。然後點擊您要殺死的應用程式。

答案2

您可能想試乘視窗選項-gnome-shell-擴展來自 bitbucket.org,最後更新於 2012 年 11 月(因此似乎得到了積極維護)。

....新增了關閉目前視窗的選項(與“辭職' 按鈕關閉整個應用(IE全部它是視窗))。

享受!

附:

或者,您可能(也)想研究這個已解決的線程,這似乎提供了另一種解決方案。


編輯:退出儀表板" 現在是 gnome 擴充網站上的擴充。

答案3

假設您正在使用 UNITY 及其 LAUNCHER,您可以透過在 LAUNCHER 中選擇目標應用程序,然後使用right arrow「退出」按鈕來執行此操作(「關閉相同應用程式的所有視窗」)。

答案4

這是一個腳本,當您單擊某個應用程式的視窗之一(使用killall)時,該腳本將關閉該應用程式的所有視窗:

#! /usr/bin/env python

import sys,os, subprocess

# Function based on code from Apport
def get_window_pid():
    xprop = subprocess.Popen(['xprop', '_NET_WM_PID'],
            stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    (out, err) = xprop.communicate()
    if xprop.returncode == 0:
        try:
            return int(out.split()[-1])
        except ValueError:
            error_message(_('Cannot identify package'),
                    _('xprop failed to determine process ID of the window') + '\n\n' + err)
            return -1
    else:
        error_message(_('Cannot identify package'),
                _('xprop failed to determine process ID of the window') + '\n\n' + err)
        return -1

def get_window_exe():
    pid = get_window_pid()

    if pid == -1:
        return ''

    return os.path.realpath('/proc/' + str(pid) + '/exe')

def close_all():
    app = get_window_exe()
    os.system('killall ' + app)

if __name__=='__main__':
    close_all()

將其儲存到檔案(例如closeall),並確保它位於系統路徑中並且可執行。

然後您可以隨時按Alt+F2並鍵入來運行它closeall

相關內容