XMonad.Layout.DecorationEx.Widgets

xmonad-contrib-0.18.1: Community-maintained extensions for xmonad

Copyright | 2023 Ilya Portnov
License | BSD-style (see xmonad/LICENSE)
Maintainer | portnov84@rambler.ru
Stability | unstable
Portability | unportable
Safe Haskell | None
Language | Haskell2010

XMonad.Layout.DecorationEx.Widgets

Contents

- Data types
- Utility functions
- Presets for standard widgets

Description

This module contains data types and utilities to deal with decoration widgets. A widget is anything that is displayed on window decoration, and, optionally, can react on clicks. Examples of widgets are usual window buttons (minimize, maximize, close), window icon and window title.

Synopsis

- data StandardCommand
  - = FocusWindow
  - | FocusUp
  - | FocusDown
  - | MoveToNextGroup
  - | MoveToPrevGroup
  - | DwmPromote
  - | ToggleSticky
  - | ToggleMaximize
  - | Minimize
  - | CloseWindow
  - | GridWindowMenu
- class DecorationWidget widget => TextWidget widget where
  - widgetString :: forall (engine :: Type -> Type -> Type). DrawData engine widget -> widget -> X String
- data GenericWidget cmd
  - = TitleWidget
  - | WindowIcon {
    - swCommand :: !cmd
    }
  - | GenericWidget {
    - swCheckedText :: !String
    - swUncheckedText :: !String
    - swCommand :: !cmd
    }
- type StandardWidget = GenericWidget StandardCommand
- isWidgetChecked :: DecorationWidget widget => widget -> Window -> X Bool
- titleW :: StandardWidget
- toggleStickyW :: StandardWidget
- minimizeW :: StandardWidget
- maximizeW :: StandardWidget
- closeW :: StandardWidget
- dwmpromoteW :: StandardWidget
- moveToNextGroupW :: StandardWidget
- moveToPrevGroupW :: StandardWidget

# Data types

data StandardCommand #

Standard window commands.

One can extend this list by simply doing

    data MyWindowCommand =
        Std StandardCommand
      | SomeFancyCommand

    instance WindowCommand MyWindowCommand where ...

    type MyWidget = GenericWidget MyWindowCommand

Constructors

FocusWindow | Focus the window
FocusUp | Move focus to previous window
FocusDown | Move focus to following window
MoveToNextGroup | Move the window to the next group (see XMonad.Layout.Groups)
MoveToPrevGroup | Move the window to the previous group
DwmPromote | Execute `dwmpromote` (see XMonad.Actions.DwmPromote)
ToggleSticky | Make window sticky or unstick it (see XMonad.Actions.CopyWindow)
ToggleMaximize | Maximize or restore window (see XMonad.Layout.Maximize)
Minimize | Minimize window (see XMonad.Actions.Minimize)
CloseWindow | Close the window
GridWindowMenu | Show window menu via XMonad.Actions.GridSelect (see XMonad.Actions.WindowMenu)

#### Instances

Instances details

Default StandardCommand # |
Instance details Defined in XMonad.Layout.DecorationEx.Widgets Methods def :: StandardCommand #
Read StandardCommand # |
Instance details Defined in XMonad.Layout.DecorationEx.Widgets Methods readsPrec :: Int -> ReadS StandardCommand # readList :: ReadS [StandardCommand] # readPrec :: ReadPrec StandardCommand # readListPrec :: ReadPrec [StandardCommand] #
Show StandardCommand # |
Instance details Defined in XMonad.Layout.DecorationEx.Widgets Methods showsPrec :: Int -> StandardCommand -> ShowS # show :: StandardCommand -> String # showList :: [StandardCommand] -> ShowS #
Eq StandardCommand # |
Instance details Defined in XMonad.Layout.DecorationEx.Widgets Methods (==) :: StandardCommand -> StandardCommand -> Bool # (/=) :: StandardCommand -> StandardCommand -> Bool #
WindowCommand StandardCommand # |
Instance details Defined in XMonad.Layout.DecorationEx.Widgets Methods executeWindowCommand :: StandardCommand -> Window -> X Bool # isCommandChecked :: StandardCommand -> Window -> X Bool #
TextWidget StandardWidget # |
Instance details Defined in XMonad.Layout.DecorationEx.Widgets Methods widgetString :: forall (engine :: Type -> Type -> Type). DrawData engine StandardWidget -> StandardWidget -> X String #

class DecorationWidget widget => TextWidget widget where #

Type class for widgets that can be displayed as text fragments by `TextDecoration` engine.

Methods

widgetString :: forall (engine :: Type -> Type -> Type). DrawData engine widget -> widget -> X String #

#### Instances

Instances details

TextWidget StandardWidget # |
Instance details Defined in XMonad.Layout.DecorationEx.Widgets Methods widgetString :: forall (engine :: Type -> Type -> Type). DrawData engine StandardWidget -> StandardWidget -> X String #

data GenericWidget cmd #

Generic data type for decoration widgets.

Constructors

TitleWidget | Window title (just text label)
WindowIcon | Window icon with some associated command | Other widgets
Fields swCommand :: !cmd Window command
GenericWidget |
Fields swCheckedText :: !String Text for checked widget state swUncheckedText :: !String Text for unchecked widget state swCommand :: !cmd Window command

#### Instances

Instances details

TextWidget StandardWidget # |
Instance details Defined in XMonad.Layout.DecorationEx.Widgets Methods widgetString :: forall (engine :: Type -> Type -> Type). DrawData engine StandardWidget -> StandardWidget -> X String #
Read cmd => Read (GenericWidget cmd) # |
Instance details Defined in XMonad.Layout.DecorationEx.Widgets Methods readsPrec :: Int -> ReadS (GenericWidget cmd) # readList :: ReadS [GenericWidget cmd] # readPrec :: ReadPrec (GenericWidget cmd) # readListPrec :: ReadPrec [GenericWidget cmd] #
Show cmd => Show (GenericWidget cmd) # |
Instance details Defined in XMonad.Layout.DecorationEx.Widgets Methods showsPrec :: Int -> GenericWidget cmd -> ShowS # show :: GenericWidget cmd -> String # showList :: [GenericWidget cmd] -> ShowS #
(Default cmd, Read cmd, Show cmd, WindowCommand cmd) => DecorationWidget (GenericWidget cmd) # |
Instance details Defined in XMonad.Layout.DecorationEx.Widgets Associated Types
type WidgetCommand (GenericWidget cmd) |
Instance details Defined in XMonad.Layout.DecorationEx.Widgets type WidgetCommand (GenericWidget cmd) = cmd
Methods widgetCommand :: GenericWidget cmd -> Int -> WidgetCommand (GenericWidget cmd) # isShrinkable :: GenericWidget cmd -> Bool #
type WidgetCommand (GenericWidget cmd) # |
Instance details Defined in XMonad.Layout.DecorationEx.Widgets type WidgetCommand (GenericWidget cmd) = cmd

type StandardWidget = GenericWidget StandardCommand #

Generic widget type specialized for `StandardCommand`

# Utility functions

isWidgetChecked :: DecorationWidget widget => widget -> Window -> X Bool #

Check if the widget should be displayed in `checked` state.

# Presets for standard widgets

titleW :: StandardWidget #

Widget for window title

toggleStickyW :: StandardWidget #

Widget for ToggleSticky command.

minimizeW :: StandardWidget #

Widget for Minimize command

maximizeW :: StandardWidget #

Widget for ToggleMaximize command

closeW :: StandardWidget #

Widget for CloseWindow command

dwmpromoteW :: StandardWidget #

moveToNextGroupW :: StandardWidget #

moveToPrevGroupW :: StandardWidget #