The dock of elementary OS is plank
. So I analyzed the plank
source and found the reason why it could not process skip taskbar option of windows.
So I modified two parts of the plank to do it.
First, it gets the number of windows of the application includes skip taskbar optioned windows.
We can find exact source function from the plank
source.
It's get_num_windows
function of lib/Services/WindowControl.vala
.
At following, I added a condition to check is_skip_tasklist
.
public static uint get_num_windows (Bamf.Application app)
{
Wnck.Screen.get_default ();
Array<uint32>? xids = app.get_xids ();
warn_if_fail (xids != null);
uint count = 0;
for (var i = 0; xids != null && i < xids.length; i++) {
unowned Wnck.Window window = Wnck.Window.@get (xids.index (i));
if (window != null && window.get_transient () == null && !window.is_skip_tasklist ()) /* LOOK, should be added && !window.is_skip_tasklist() */
count++;
}
return count;
}
Second, it could not process indicator when the skip taskbar option of the windows is changed. The related part of the source is handle_user_visible_changed
function of lib/Items/ApplicationDockItem.vala
.
I added a line at the function as following.
void handle_user_visible_changed (bool user_visible)
{
update_indicator (); /* LOOK, should be called */
if (user_visible) {
app_window_added ();
return;
}
if (this is TransientDockItem)
App = null;
app_closed ();
}
Following simple python script is what visible/invisible special application on the plank. Before run this script, you should install python wnck module with the command, $ sudo apt-get install python-wnck
#!/usr/bin/python
import wnck
import sys
if __name__ == "__main__":
if len(sys.argv) != 3:
print "Usage: appvisible <appname> <1|0>"
sys.exit(0)
processname = sys.argv[1]
visible = sys.argv[2]
screen = wnck.screen_get_default()
screen.force_update()
for window in screen.get_windows():
if window.get_class_group().get_name() == processname:
if visible == "1":
window.set_skip_tasklist(True)
else:
window.set_skip_tasklist(False)
It can be used as following way.
$ appvisible gedit 0
- visible gedit on plank, $ appvisible gedit 1
- invisible gedit on plank.
Additional edit for un-minimize the skipped & minimized window.
#!/usr/bin/python
import gtk
import wnck
import sys
import time
if __name__ == "__main__":
if len(sys.argv) != 2:
print "Usage: unminimize <-l|appname>"
sys.exit(0)
appname = sys.argv[1]
screen = wnck.screen_get_default()
screen.force_update()
for window in screen.get_windows():
if not window.is_minimized():
continue
if not window.is_skip_tasklist():
continue
if appname == '-l':
print window.get_class_group().get_name()
elif window.get_class_group().get_name() == appname:
window.unminimize(gtk.gdk.x11_get_server_time(gtk.gdk.get_default_root_window()))
You can use it as ./unminimize -l
- list skipped & minimized windows, ./unminimize appname
.