xmonad-contrib-0.18.1.9: Community-maintained extensions for xmonad
Copyright(c) Yecine Megdiche <yecine.megdiche@gmail.com>
LicenseBSD3-style (see LICENSE)
MaintainerYecine Megdiche <yecine.megdiche@gmail.com>
Stabilityunstable
Portabilityunportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

XMonad.Util.StickyWindows

Contents

Description

This module provides functionality to make windows "sticky" to a particular screen. When a window is marked as sticky on a screen, it will automatically follow that screen across workspace changes, staying visible even when you switch to a different workspace.

This is particularly useful for windows you want to keep visible at all times on a specific monitor, such as Picture-in-Picture videos, music players, communication apps, or reference documentation.

Synopsis

Usage

You can use this module with the following in your xmonad.hs:

import XMonad.Util.StickyWindows

To enable sticky windows, wrap your config with sticky:

main = xmonad $ … . sticky . … $ def { ... }

This adds the necessary hooks to manage sticky windows. Next, add keybindings to stick and unstick windows:

, ((modMask, xK_s), withFocused stick)
, ((modMask .|. shiftMask, xK_s), withFocused unstick)

Now you can:

  1. Focus a window and press Mod-s to make it sticky to the current screen
  2. Switch workspaces on that screen, and the sticky window will follow
  3. Press Mod-Shift-s to unstick the window

Note that windows are sticky to a specific screen, not to all screens. If you have multiple monitors, a window marked sticky on screen 0 will only follow workspace changes on screen 0, not on other screens.

The sticky state persists across XMonad restarts.

sticky :: XConfig l -> XConfig l Source #

Incorporates sticky window functionality into an XConfig. This adds the necessary log hook and event hook to:

  • Automatically move sticky windows when workspaces change on their screen
  • Clean up sticky state when windows are destroyed

Example usage:

main = xmonad $ … . sticky .  … $ def { ... }

stick :: Window -> X () Source #

Mark the given window as sticky to the current screen. The window will automatically follow this screen across workspace changes until explicitly unstuck with unstick or until the window is destroyed.

Typically used with withFocused:

, ((modMask, xK_s), withFocused stick)

unstick :: Window -> X () Source #

Remove the sticky status from the given window on the current screen. The window will no longer automatically follow workspace changes.

Typically used with withFocused:

, ((modMask .|. shiftMask, xK_s), withFocused unstick)