I am trying to fix a bug in lxpanel’s taskbar plugin, and needed to launch an urgent window. Here’s how I did it in a little python.
#!/usr/bin/python
# urgent.py -- launch an urgent window (Copyright messages are at the bottom)
# To use:
# sudo apt-get install python-xlib
# ./urgent.py
import sys
import Xlib
from Xlib import X, display, Xutil
d = display.Display()
s = d.screen()
w = s.root.create_window(
50, 50, 300, 200, 2,
s.root_depth,
X.InputOutput,
X.CopyFromParent,
background_pixel = s.white_pixel,
)
w.set_wm_name( 'Urgent!' )
w.set_wm_hints( flags = Xutil.UrgencyHint )
w.map()
try:
while 1:
e = d.next_event()
except Xlib.error.ConnectionClosedError:
pass
# This code is based on:
# examples/xrandr.py -- demonstrate the RandR extension
# from http://python-xlib.sourceforge.net/
#
# Copyright (C) 2014 Andy Balaam
# Copyright (C) 2009 David H. Bronke
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA