Search documentation of Plushie

# Plushie.KeyModifiers (Plushie v0.7.2)

Copy Markdown View Source

Keyboard modifier state at the time of a key event.

Each field is a boolean indicating whether that modifier was held.

## Fields

- `ctrl` - Control key (Ctrl on Windows/Linux).
- `shift` - Shift key.
- `alt` - Alt key (Option on macOS).
- `logo` - Logo/Super key (Windows key, Command symbol on macOS).
- `command` - Platform command key (Ctrl on Windows/Linux, Cmd on macOS).

## Example

    %Plushie.KeyModifiers{ctrl: true, shift: false, alt: false, logo: false, command: true}

Use the query functions for readable conditional logic:

    if KeyModifiers.ctrl?(event.modifiers) do
      handle_shortcut(event)
    end

## Summary

### Types

t()

### Functions

alt?(key_modifiers)

Returns true if the Alt modifier is active.

command?(key_modifiers)

Returns true if the platform Command modifier is active.

ctrl?(key_modifiers)

Returns true if the Ctrl modifier is active.

logo?(key_modifiers)

Returns true if the Logo/Super modifier is active.

shift?(key_modifiers)

Returns true if the Shift modifier is active.

## Types

# t()

    @type t() :: %Plushie.KeyModifiers{
      alt: boolean(),
      command: boolean(),
      ctrl: boolean(),
      logo: boolean(),
      shift: boolean()
    }

## Functions

# alt?(key_modifiers)

    @spec alt?(modifiers :: t()) :: boolean()

Returns true if the Alt modifier is active.

# command?(key_modifiers)

    @spec command?(modifiers :: t()) :: boolean()

Returns true if the platform Command modifier is active.

# ctrl?(key_modifiers)

    @spec ctrl?(modifiers :: t()) :: boolean()

Returns true if the Ctrl modifier is active.

# logo?(key_modifiers)

    @spec logo?(modifiers :: t()) :: boolean()

Returns true if the Logo/Super modifier is active.

# shift?(key_modifiers)

    @spec shift?(modifiers :: t()) :: boolean()

Returns true if the Shift modifier is active.