ewmh-0.1.5/0000755000175000017500000000000012753545120011525 5ustar jpjp00000000000000ewmh-0.1.5/ewmh/0000755000175000017500000000000012753545120012465 5ustar jpjp00000000000000ewmh-0.1.5/ewmh/ewmh.py0000644000175000017500000003303412717614565014014 0ustar jpjp00000000000000"""This module intends to provide an implementation of Extended Window Manager Hints, based on the Xlib modules for python. See the freedesktop.org `specification `_ for more information. """ from Xlib import display, X, protocol, Xatom import time class EWMH: """This class provides the ability to get and set properties defined by the EWMH spec. Each property can be accessed in two ways. For example, to get the active window:: win = ewmh.getActiveWindow() # or: win = ewmh.getProperty('_NET_ACTIVE_WINDOW') Similarly, to set the active window:: ewmh.setActiveWindow(myWindow) # or: ewmh.setProperty('_NET_ACTIVE_WINDOW', myWindow) When a property is written, don't forget to really send the notification by flushing requests:: ewmh.display.flush() :param _display: the display to use. If not given, Xlib.display.Display() is used. :param root: the root window to use. If not given, self.display.screen().root is used.""" NET_WM_WINDOW_TYPES = ( '_NET_WM_WINDOW_TYPE_DESKTOP', '_NET_WM_WINDOW_TYPE_DOCK', '_NET_WM_WINDOW_TYPE_TOOLBAR', '_NET_WM_WINDOW_TYPE_MENU', '_NET_WM_WINDOW_TYPE_UTILITY', '_NET_WM_WINDOW_TYPE_SPLASH', '_NET_WM_WINDOW_TYPE_DIALOG', '_NET_WM_WINDOW_TYPE_DROPDOWN_MENU', '_NET_WM_WINDOW_TYPE_POPUP_MENU', '_NET_WM_WINDOW_TYPE_NOTIFICATION', '_NET_WM_WINDOW_TYPE_COMBO', '_NET_WM_WINDOW_TYPE_DND', '_NET_WM_WINDOW_TYPE_NORMAL') """List of strings representing all known window types.""" NET_WM_ACTIONS = ( '_NET_WM_ACTION_MOVE', '_NET_WM_ACTION_RESIZE', '_NET_WM_ACTION_MINIMIZE', '_NET_WM_ACTION_SHADE', '_NET_WM_ACTION_STICK', '_NET_WM_ACTION_MAXIMIZE_HORZ', '_NET_WM_ACTION_MAXIMIZE_VERT', '_NET_WM_ACTION_FULLSCREEN', '_NET_WM_ACTION_CHANGE_DESKTOP', '_NET_WM_ACTION_CLOSE', '_NET_WM_ACTION_ABOVE', '_NET_WM_ACTION_BELOW') """List of strings representing all known window actions.""" NET_WM_STATES = ( '_NET_WM_STATE_MODAL', '_NET_WM_STATE_STICKY', '_NET_WM_STATE_MAXIMIZED_VERT', '_NET_WM_STATE_MAXIMIZED_HORZ', '_NET_WM_STATE_SHADED', '_NET_WM_STATE_SKIP_TASKBAR', '_NET_WM_STATE_SKIP_PAGER', '_NET_WM_STATE_HIDDEN', '_NET_WM_STATE_FULLSCREEN','_NET_WM_STATE_ABOVE', '_NET_WM_STATE_BELOW', '_NET_WM_STATE_DEMANDS_ATTENTION') """List of strings representing all known window states.""" def __init__(self, _display=None, root = None): self.display = _display or display.Display() self.root = root or self.display.screen().root self.__getAttrs = { '_NET_CLIENT_LIST': self.getClientList, '_NET_CLIENT_LIST_STACKING': self.getClientListStacking, '_NET_NUMBER_OF_DESKTOPS': self.getNumberOfDesktops, '_NET_DESKTOP_GEOMETRY': self.getDesktopGeometry, '_NET_DESKTOP_VIEWPORT': self.getDesktopViewPort, '_NET_CURRENT_DESKTOP': self.getCurrentDesktop, '_NET_ACTIVE_WINDOW': self.getActiveWindow, '_NET_WORKAREA': self.getWorkArea, '_NET_SHOWING_DESKTOP': self.getShowingDesktop, '_NET_WM_NAME': self.getWmName, '_NET_WM_VISIBLE_NAME': self.getWmVisibleName, '_NET_WM_DESKTOP': self.getWmDesktop, '_NET_WM_WINDOW_TYPE': self.getWmWindowType, '_NET_WM_STATE': self.getWmState, '_NET_WM_ALLOWED_ACTIONS': self.getWmAllowedActions, '_NET_WM_PID': self.getWmPid, } self.__setAttrs = { '_NET_NUMBER_OF_DESKTOPS': self.setNumberOfDesktops, '_NET_DESKTOP_GEOMETRY': self.setDesktopGeometry, '_NET_DESKTOP_VIEWPORT': self.setDesktopViewport, '_NET_CURRENT_DESKTOP': self.setCurrentDesktop, '_NET_ACTIVE_WINDOW': self.setActiveWindow, '_NET_SHOWING_DESKTOP': self.setShowingDesktop, '_NET_CLOSE_WINDOW': self.setCloseWindow, '_NET_MOVERESIZE_WINDOW': self.setMoveResizeWindow, '_NET_WM_NAME': self.setWmName, '_NET_WM_VISIBLE_NAME': self.setWmVisibleName, '_NET_WM_DESKTOP': self.setWmDesktop, '_NET_WM_STATE': self.setWmState, } # ------------------------ setters properties ------------------------ def setNumberOfDesktops(self, nb): """Set the number of desktops (property _NET_NUMBER_OF_DESKTOPS). :param nb: the number of desired desktops""" self._setProperty('_NET_NUMBER_OF_DESKTOPS', [nb]) def setDesktopGeometry(self, w, h): """Set the desktop geometry (property _NET_DESKTOP_GEOMETRY) :param w: desktop width :param h: desktop height""" self._setProperty('_NET_DESKTOP_GEOMETRY', [w, h]) def setDesktopViewport(self, w, h): """Set the viewport size of the current desktop (property _NET_DESKTOP_VIEWPORT) :param w: desktop width :param h: desktop height""" self._setProperty('_NET_DESKTOP_VIEWPORT', [w, h]) def setCurrentDesktop(self, i): """Set the current desktop (property _NET_CURRENT_DESKTOP). :param i: the desired desktop number""" self._setProperty('_NET_CURRENT_DESKTOP', [i, X.CurrentTime]) def setActiveWindow(self, win): """Set the given window active (property _NET_ACTIVE_WINDOW) :param win: the window object""" self._setProperty('_NET_ACTIVE_WINDOW', [1, X.CurrentTime, win.id], win) def setShowingDesktop(self, show): """Set/unset the mode Showing desktop (property _NET_SHOWING_DESKTOP) :param show: 1 to set the desktop mode, else 0""" self._setProperty('_NET_SHOWING_DESKTOP', [show]) def setCloseWindow(self, win): """Colse the given window (property _NET_CLOSE_WINDOW) :param win: the window object""" self._setProperty('_NET_CLOSE_WINDOW', [int(time.mktime(time.localtime())), 1], win) def setWmName(self, win, name): """Set the property _NET_WM_NAME :param win: the window object :param name: desired name""" self._setProperty('_NET_WM_NAME', name, win) def setWmVisibleName(self, win, name): """Set the property _NET_WM_VISIBLE_NAME :param win: the window object :param name: desired visible name""" self._setProperty('_NET_WM_VISIBLE_NAME', name, win) def setWmDesktop(self, win, i): """Move the window to the desired desktop by changing the property _NET_WM_DESKTOP. :param win: the window object :param i: desired desktop number""" self._setProperty('_NET_WM_DESKTOP', [i, 1], win) def setMoveResizeWindow(self, win, gravity=0, x=None, y=None, w=None, h=None): """Set the property _NET_MOVERESIZE_WINDOW to move or resize the given window. Flags are automatically calculated if x, y, w or h are defined. :param win: the window object :param gravity: gravity (one of the Xlib.X.*Gravity constant or 0) :param x: int or None :param y: int or None :param w: int or None :param h: int or None""" gravity_flags = gravity | 0b0000100000000000 # indicate source (application) if x is None: x = 0 else: gravity_flags = gravity_flags | 0b0000010000000000 # indicate presence of x if y is None: y = 0 else: gravity_flags = gravity_flags | 0b0000001000000000 # indicate presence of y if w is None: w = 0 else: gravity_flags = gravity_flags | 0b0000000100000000 # indicate presence of w if h is None: h = 0 else: gravity_flags = gravity_flags | 0b0000000010000000 # indicate presence of h self._setProperty('_NET_MOVERESIZE_WINDOW', [gravity_flags, x, y, w, h], win) def setWmState(self, win, action, state, state2=0): """Set/unset one or two state(s) for the given window (property _NET_WM_STATE). :param win: the window object :param action: 0 to remove, 1 to add or 2 to toggle state(s) :param state: a state :type state: int or str (see :attr:`NET_WM_STATES`) :param state2: a state or 0 :type state2: int or str (see :attr:`NET_WM_STATES`)""" if type(state) != int: state = self.display.get_atom(state, 1) if type(state2) != int: state2 = self.display.get_atom(state2, 1) self._setProperty('_NET_WM_STATE', [action, state, state2, 1], win) # ------------------------ getters properties ------------------------ def getClientList(self): """Get the list of windows maintained by the window manager for the property _NET_CLIENT_LIST. :return: list of Window objects""" return map(self._createWindow, self._getProperty('_NET_CLIENT_LIST')) def getClientListStacking(self): """Get the list of windows maintained by the window manager for the property _NET_CLIENT_LIST_STACKING. :return: list of Window objects""" return map(self._createWindow, self._getProperty('_NET_CLIENT_LIST_STACKING')) def getNumberOfDesktops(self): """Get the number of desktops (property _NET_NUMBER_OF_DESKTOPS). :return: int""" return self._getProperty('_NET_NUMBER_OF_DESKTOPS')[0] def getDesktopGeometry(self): """Get the desktop geometry (property _NET_DESKTOP_GEOMETRY) as an array of two integers [width, height]. :return: [int, int]""" return self._getProperty('_NET_DESKTOP_GEOMETRY') def getDesktopViewPort(self): """Get the current viewports of each desktop as a list of [x, y] representing the top left corner (property _NET_DESKTOP_VIEWPORT). :return: list of [int, int]""" return self._getProperty('_NET_DESKTOP_VIEWPORT') def getCurrentDesktop(self): """Get the current desktop number (property _NET_CURRENT_DESKTOP) :return: int""" return self._getProperty('_NET_CURRENT_DESKTOP')[0] def getActiveWindow(self): """Get the current active (toplevel) window or None (property _NET_ACTIVE_WINDOW) :return: Window object or None""" active_window = self._getProperty('_NET_ACTIVE_WINDOW') if active_window == None: return None return self._createWindow(active_window[0]) def getWorkArea(self): """Get the work area for each desktop (property _NET_WORKAREA) as a list of [x, y, width, height] :return: a list of [int, int, int, int]""" return self._getProperty('_NET_WORKAREA') def getShowingDesktop(self): """Get the value of "showing the desktop" mode of the window manager (property _NET_SHOWING_DESKTOP). 1 means the mode is activated, and 0 means deactivated. :return: int""" return self._getProperty('_NET_SHOWING_DESKTOP')[0] def getWmName(self, win): """Get the property _NET_WM_NAME for the given window as a string. :param win: the window object :return: str""" return self._getProperty('_NET_WM_NAME', win) def getWmVisibleName(self, win): """Get the property _NET_WM_VISIBLE_NAME for the given window as a string. :param win: the window object :return: str""" return self._getProperty('_NET_WM_VISIBLE_NAME', win) def getWmDesktop(self, win): """Get the current desktop number of the given window (property _NET_WM_DESKTOP). :param win: the window object :return: int""" return self._getProperty('_NET_WM_DESKTOP', win)[0] def getWmWindowType(self, win, str=False): """Get the list of window types of the given window (property _NET_WM_WINDOW_TYPE). :param win: the window object :param str: True to get a list of string types instead of int :return: list of (int|str)""" types = self._getProperty('_NET_WM_WINDOW_TYPE', win) if not str: return types return map(self._getAtomName, types) def getWmState(self, win, str=False): """Get the list of states of the given window (property _NET_WM_STATE). :param win: the window object :param str: True to get a list of string states instead of int :return: list of (int|str)""" states = self._getProperty('_NET_WM_STATE', win) if not str: return states return map(self._getAtomName, states) def getWmAllowedActions(self, win, str=False): """Get the list of allowed actions for the given window (property _NET_WM_ALLOWED_ACTIONS). :param win: the window object :param str: True to get a list of string allowed actions instead of int :return: list of (int|str)""" wAllowedActions = self._getProperty('_NET_WM_ALLOWED_ACTIONS', win) if not str: return wAllowedActions return map(self._getAtomName, wAllowedActions) def getWmPid(self, win): """Get the pid of the application associated to the given window (property _NET_WM_PID) :param win: the window object""" return self._getProperty('_NET_WM_PID', win)[0] def _getProperty(self, _type, win=None): if not win: win = self.root atom = win.get_full_property(self.display.get_atom(_type), X.AnyPropertyType) if atom: return atom.value def _setProperty(self, _type, data, win=None, mask=None): """Send a ClientMessage event to the root window""" if not win: win = self.root if type(data) is str: dataSize = 8 else: data = (data+[0]*(5-len(data)))[:5] dataSize = 32 ev = protocol.event.ClientMessage(window=win, client_type=self.display.get_atom(_type), data=(dataSize, data)) if not mask: mask = (X.SubstructureRedirectMask|X.SubstructureNotifyMask) self.root.send_event(ev, event_mask=mask) def _getAtomName(self, atom): try: return self.display.get_atom_name(atom) except: return 'UNKNOWN' def _createWindow(self, wId): if not wId: return None return self.display.create_resource_object('window', wId) def getReadableProperties(self): """Get all the readable properties' names""" return self.__getAttrs.keys() def getProperty(self, prop, *args, **kwargs): """Get the value of a property. See the corresponding method for the required arguments. For example, for the property _NET_WM_STATE, look for :meth:`getWmState`""" f = self.__getAttrs.get(prop) if not f: raise KeyError('Unknown readable property: %s' % prop) return f(self, *args, **kwargs) def getWritableProperties(self): """Get all the writable properties names""" return self.__setAttrs.keys() def setProperty(self, prop, *args, **kwargs): """Set the value of a property by sending an event on the root window. See the corresponding method for the required arguments. For example, for the property _NET_WM_STATE, look for :meth:`setWmState`""" f = self.__setAttrs.get(prop) if not f: raise KeyError('Unknown writable property: %s' % prop) f(self, *args, **kwargs) ewmh-0.1.5/ewmh/__init__.py0000644000175000017500000000005612753544253014605 0ustar jpjp00000000000000__version__ = '0.1.5' from .ewmh import EWMH ewmh-0.1.5/PKG-INFO0000644000175000017500000000311312753545120012620 0ustar jpjp00000000000000Metadata-Version: 1.1 Name: ewmh Version: 0.1.5 Summary: python implementation of Extended Window Manager Hints, based on Xlib Home-page: https://github.com/parkouss/pyewmh Author: parkouss Author-email: j.parkouss@gmail.com License: LGPL Description: Description =========== An implementation of EWMH (Extended Window Manager Hints) for python, based on Xlib. It allows EWMH-compliant window managers (most modern WMs) to be queried and controlled. pyewmh is distributed under the GNU Lesser General Public License, version 3, or, at your option, any later version. See `LICENSE.txt` for more information. Installation ------------ .. image:: https://pypip.in/version/ewmh/badge.png :target: https://pypi.python.org/pypi/ewmh/ Simply run: .. code-block:: shell pip install ewmh Documentation ------------- Online documentation is available here: http://ewmh.readthedocs.org/en/latest/. Contributors ------------ * Reuben Thomas * Hugo Osvaldo Barrera Thanks also to -------------- * Holger Witsch * Russell Sim Changelog --------- See the `CHANGES.txt` file. Platform: UNKNOWN Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 3 Classifier: Intended Audience :: Developers ewmh-0.1.5/setup.py0000644000175000017500000000146212753544156013252 0ustar jpjp00000000000000try: from setuptools import setup except ImportError: from distutils.core import setup import sys, re if sys.version_info < (2, 6): sys.exit("ewmh >= 0.1.3 requires python >= 2.6") setup(name='ewmh', version=re.findall("__version__ = '(.+)'", open('ewmh/__init__.py').read())[0], description='python implementation of Extended Window Manager Hints, based on Xlib', long_description=open('README.rst').read(), author='parkouss', author_email="j.parkouss@gmail.com", url='https://github.com/parkouss/pyewmh', packages=['ewmh'], install_requires=['python-xlib'], license='LGPL', classifiers=( 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 3', 'Intended Audience :: Developers', ), ) ewmh-0.1.5/README.rst0000644000175000017500000000154012753544124013217 0ustar jpjp00000000000000Description =========== An implementation of EWMH (Extended Window Manager Hints) for python, based on Xlib. It allows EWMH-compliant window managers (most modern WMs) to be queried and controlled. pyewmh is distributed under the GNU Lesser General Public License, version 3, or, at your option, any later version. See `LICENSE.txt` for more information. Installation ------------ .. image:: https://pypip.in/version/ewmh/badge.png :target: https://pypi.python.org/pypi/ewmh/ Simply run: .. code-block:: shell pip install ewmh Documentation ------------- Online documentation is available here: http://ewmh.readthedocs.org/en/latest/. Contributors ------------ * Reuben Thomas * Hugo Osvaldo Barrera Thanks also to -------------- * Holger Witsch * Russell Sim Changelog --------- See the `CHANGES.txt` file. ewmh-0.1.5/doc/0000755000175000017500000000000012753545120012272 5ustar jpjp00000000000000ewmh-0.1.5/doc/conf.py0000644000175000017500000001604012571550444013575 0ustar jpjp00000000000000# -*- coding: utf-8 -*- # # pyewmh documentation build configuration file, created by # sphinx-quickstart on Sun Sep 18 11:32:08 2011. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys, os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath('..')) from ewmh import __version__ # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'pyewmh' copyright = u'2011, parkouss' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = __version__ # The full version, including alpha/beta/rc tags. release = __version__ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build'] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'pyewmhdoc' # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). #latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). #latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', 'pyewmh.tex', u'pyewmh Documentation', u'parcouss', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Additional stuff for the LaTeX preamble. #latex_preamble = '' # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'pyewmh', u'pyewmh Documentation', [u'parcouss'], 1) ] # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = {'http://docs.python.org/': None} ewmh-0.1.5/doc/ewmh.rst0000644000175000017500000000256312571550444013775 0ustar jpjp00000000000000====================== The ewmh python module ====================== .. automodule:: ewmh.ewmh -------------- EWMH class -------------- .. autoclass:: EWMH :members: -------------- Examples -------------- These examples are tested on gnome. Exemple to set the active window in fullscreen mode:: from ewmh import EWMH ewmh = EWMH() # get the active window win = ewmh.getActiveWindow() # list all possible names states: # print EWMH.NET_WM_STATES # set the state on win ewmh.setWmState(win, 1, '_NET_WM_STATE_FULLSCREEN') # flush request ewmh.display.flush() Exemple to move every iceweasel windows on desktop 2:: from ewmh import EWMH ewmh = EWMH() # get every displayed windows wins = ewmh.getClientList() # get every iceweasel windows, by looking their class name: icewins = filter(lambda w: w.get_wm_class()[1] == 'Iceweasel', wins) # move them to desktop 2 (desktop numbering starts from 0): for w in icewins: ewmh.setWmDesktop(w, 1) # flush requests ewmh.display.flush() Example trying to close every windows on desktop 2:: from ewmh import EWMH ewmh = EWMH() # get every displayed windows on desktop 2: wins = filter(lambda w: ewmh.getWmDesktop(w) == 1, ewmh.getClientList()) # trying to close them: for w in wins: ewmh.setCloseWindow(w) # flush requests ewmh.display.flush() ewmh-0.1.5/doc/Makefile0000644000175000017500000001075612571550444013746 0ustar jpjp00000000000000# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" @echo " text to make text files" @echo " man to make manual pages" @echo " changes to make an overview of all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: -rm -rf $(BUILDDIR)/* html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/pyewmh.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/pyewmh.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $$HOME/.local/share/devhelp/pyewmh" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/pyewmh" @echo "# devhelp" epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." latexpdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." make -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." man: $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." ewmh-0.1.5/doc/index.rst0000644000175000017500000000065612571550444014145 0ustar jpjp00000000000000.. pyewmh documentation master file, created by sphinx-quickstart on Sun Sep 18 11:32:08 2011. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. Welcome to pyewmh's documentation! ================================== Contents: .. toctree:: :maxdepth: 2 ewmh Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` ewmh-0.1.5/setup.cfg0000644000175000017500000000007312753545120013346 0ustar jpjp00000000000000[egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 ewmh-0.1.5/ewmh.egg-info/0000755000175000017500000000000012753545120014157 5ustar jpjp00000000000000ewmh-0.1.5/ewmh.egg-info/SOURCES.txt0000644000175000017500000000042412753545120016043 0ustar jpjp00000000000000CHANGES.txt LICENSE.txt MANIFEST.in README.rst setup.py doc/Makefile doc/conf.py doc/ewmh.rst doc/index.rst ewmh/__init__.py ewmh/ewmh.py ewmh.egg-info/PKG-INFO ewmh.egg-info/SOURCES.txt ewmh.egg-info/dependency_links.txt ewmh.egg-info/requires.txt ewmh.egg-info/top_level.txtewmh-0.1.5/ewmh.egg-info/requires.txt0000644000175000017500000000001412753545120016552 0ustar jpjp00000000000000python-xlib ewmh-0.1.5/ewmh.egg-info/PKG-INFO0000644000175000017500000000311312753545120015252 0ustar jpjp00000000000000Metadata-Version: 1.1 Name: ewmh Version: 0.1.5 Summary: python implementation of Extended Window Manager Hints, based on Xlib Home-page: https://github.com/parkouss/pyewmh Author: parkouss Author-email: j.parkouss@gmail.com License: LGPL Description: Description =========== An implementation of EWMH (Extended Window Manager Hints) for python, based on Xlib. It allows EWMH-compliant window managers (most modern WMs) to be queried and controlled. pyewmh is distributed under the GNU Lesser General Public License, version 3, or, at your option, any later version. See `LICENSE.txt` for more information. Installation ------------ .. image:: https://pypip.in/version/ewmh/badge.png :target: https://pypi.python.org/pypi/ewmh/ Simply run: .. code-block:: shell pip install ewmh Documentation ------------- Online documentation is available here: http://ewmh.readthedocs.org/en/latest/. Contributors ------------ * Reuben Thomas * Hugo Osvaldo Barrera Thanks also to -------------- * Holger Witsch * Russell Sim Changelog --------- See the `CHANGES.txt` file. Platform: UNKNOWN Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 3 Classifier: Intended Audience :: Developers ewmh-0.1.5/ewmh.egg-info/top_level.txt0000644000175000017500000000000512753545120016704 0ustar jpjp00000000000000ewmh ewmh-0.1.5/ewmh.egg-info/dependency_links.txt0000644000175000017500000000000112753545120020225 0ustar jpjp00000000000000 ewmh-0.1.5/MANIFEST.in0000644000175000017500000000010712571550444013264 0ustar jpjp00000000000000include CHANGES.txt include LICENSE.txt include doc/* prune doc/_build ewmh-0.1.5/LICENSE.txt0000644000175000017500000001674312571550444013366 0ustar jpjp00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. ewmh-0.1.5/CHANGES.txt0000644000175000017500000000176012753544330013344 0ustar jpjp000000000000002016-08-13 Julien Pagès released 0.1.5 2016-08-12 Hugo Osvaldo Barrera rely on upstream python-xlib package for all python versions 2016-05-20 Julien Pagès released 0.1.4 2016-04-16 Mike Smith fix getWmWindowName(w, True) issue 2014-12-05 Julien Pagès released 0.1.3 2014-12-04 Russell Sim fix a relative import issue (dropping support fot python < 2.6) 2014-05-29 Julien Pagès released 0.1.2 2014-05-29 Reuben Thomas fix a crash in getActiveWindow improve / fix english mistakes add license information 2014-05-29 Julien Pagès released 0.1.1 correction as stated by Holger Witsch: EWMH.setWmState does not behave well if state2 is not an int added support for python3 with working PyPi dependency 2011-09-18 parcouss first release 0.1