# Luakit Documentation / Classes / widget:window

# Class `widget:window`

Window widget
This module is only available from the UI process Lua state.

The window widget is the main container for any windows on the screen.

## Methods

### window:set_default_size (width, height)

Set the default size of the window. If this is not called, the default size is 800x600.

#### Parameters

- width
  Type: integer
  The default width of the window, in pixels.
- height
  Type: integer
  The default height of the window, in pixels.

## Properties

### window.title

Type: string
Read-write
The window title, as displayed on its title bar.

### window.decorated

Type: boolean
Default: `true`
Read-write
Whether the window is decorated. If the window is decorated, a title bar will be shown. Some window managers permit disabling this decoration, which creates a borderless window.

### window.urgency_hint

Type: boolean
Default: `false`
Read-write
Whether the window is requesting the user's attention.

### window.fullscreen

Type: boolean
Default: `false`
Read-write
Whether the window is in fullscreen mode.

### window.maximized

Type: boolean
Default: `false`
Read-write
Whether the window is maximized.

### window.id

Type: integer
Read-only
A unique identification number assigned to the window. This number will not be reassigned if the window is closed and another is ooened; new windows will always have new unique identification numbers.

### window.win_xid

Type: integer
Read-only
The window's X11 window ID. Available only when using the X11 windowing system.

### window.root_win_xid

Type: integer
Read-only
The X11 root window's window ID. Available only when using the X11 windowing system.

### window.screen

Type: userdata
Read-write
The screen the window is on.

### window.icon

Type: string
Read-write
Path to an image file to set as the window icon. This property can only be set; reading this property always returns `nil`.

## Signals

### "can-close"

Emitted before a window is closed. Allows Lua code to force the window to remain open.

#### Return Values

- boolean
  `true` to allow closing the window, `false` to keep the window open.

### "key-press"

Emitted when a key is pressed while the window has the input focus.

#### Parameters

- modifiers
  Type: table
  An array of strings, one for each modifier key held.
- key
  Type: string
  The key that was pressed, if printable, or a keysym otherwise.

#### Return Values

- boolean
  `true` if the event has been handled and should not be propagated further.

### "add"

Emitted when a new widget is set as this widget's child.

#### Parameters

- child
  Type: widget
  The new child widget.

### "remove"

Emitted when a child widget is removed.

#### Parameters

- child
  Type: widget
  The child widget that was removed.

### "property::*"

Emitted when some properties change value.

## Attribution

#### Copyright

- 2010 Mason Larobina