| Copyright | (c) Yecine Megdiche <yecine.megdiche@gmail.com> |
|---|---|
| License | BSD3-style (see LICENSE) |
| Maintainer | Yecine Megdiche <yecine.megdiche@gmail.com> |
| Stability | unstable |
| Portability | unportable |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
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.
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:
- Focus a window and press
Mod-sto make it sticky to the current screen - Switch workspaces on that screen, and the sticky window will follow
- Press
Mod-Shift-sto 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)