xmonad-contrib-0.17.0.9: Community-maintained extensions for xmonad
Copyright(c) 2020 Leon Kowarschick
LicenseBSD3-style (see LICENSE)
MaintainerLeon Kowarschick. <thereal.elkowar@gmail.com>
Stabilityunstable
Portabilityunportable
Safe HaskellNone
LanguageHaskell2010

XMonad.Hooks.WindowSwallowing

Contents

Description

Provides a handleEventHook that implements window swallowing.

If you open a GUI-window (i.e. feh) from the terminal, the terminal will normally still be shown on screen, unnecessarily taking up space on the screen. With window swallowing, can detect that you opened a window from within another window, and allows you "swallow" that parent window for the time the new window is running.

NOTE: This module depends on pstree to analyze the process hierarchy, so make sure that is on your $PATH.

NOTE that this does not always work perfectly:

  • Because window swallowing needs to check the process hierarchy, it requires both the child and the parent to be distinct processes. This means that applications which implement instance sharing cannot be supported by window swallowing. Most notably, this excludes some terminal emulators as well as tmux from functioning as the parent process. It also excludes a good amount of child programs, because many graphical applications do implement instance sharing. For example, window swallowing will probably not work with your browser.
  • To check the process hierarchy, we need to be able to get the process ID by looking at the window. This requires the _NET_WM_PID X-property to be set. If any application you want to use this with does not provide the _NET_WM_PID, there is not much you can do except for reaching out to the author of that application and asking them to set that property.
Synopsis

Usage

You can use this module by including the following in your ~/.xmonad/xmonad.hs:

import XMonad.Hooks.WindowSwallowing

and using swallowEventHook somewhere in your handleEventHook, for example:

myHandleEventHook = swallowEventHook (className =? "Alacritty" <||> className =? "Termite") (return True)

The variant swallowEventHookSub can be used if a layout from XMonad.Layouts.SubLayouts is used; instead of swallowing the window it will merge the child window with the parent. (this does not work with floating windows)

For more information on editing your handleEventHook and key bindings, see XMonad.Doc.Extending.

swallowEventHook Source #

Arguments

:: Query Bool

query the parent window has to match for window swallowing to occur. Set this to return True to run swallowing for every parent.

-> Query Bool

query the child window has to match for window swallowing to occur. Set this to return True to run swallowing for every child

-> Event

The event to handle.

-> X All 

handleEventHook that will swallow child windows when they are opened from another window.

swallowEventHookSub Source #

Arguments

:: Query Bool

query the parent window has to match for window swallowing to occur. Set this to return True to run swallowing for every parent.

-> Query Bool

query the child window has to match for window swallowing to occur. Set this to return True to run swallowing for every child

-> Event

The event to handle.

-> X All 

handleEventHook that will merge child windows via XMonad.Layouts.SubLayouts when they are opened from another window.