# Falkon QML Tutorial - 9. Falkon windows Hello, in this chapter I will show you how to work with windows. ## Access windows api The windows API can be accessed through code. ```qml Falkon.Windows ``` More information can be found in the [documentation](http://falkon.sgorava.xyz/docs/class_qml_windows.html). ### Get windows To get to the windows we can use three methods `get(windowId)`, `getCurrent()` and `getAll()`. These methods return a window or array of windows of type `Window` (see [documentation](http://falkon.sgorava.xyz/docs/class_qml_window.html) ) which van be manipulated further. Example: ```qml /* Get a specific window with known ID */ var window = Falkon.Windows.get(0) /* Get current window */ var currentWindow = Falkon.Windows.getCurrent() /* Get all windows */ var allWindows = Falkon.Windows.getAll() ``` ### Create a new window To create a new window we have to supply it with URL and window type. The `type` is optional and by default the `NewWindow` will be used. ```qml Falkon.Windows.create({ url: 'https://falkon.org/' type: Falkon.Enums.WindowType.NewWindow }) ``` ### Remove an existing window To remove an existing window we need to first know its ID in current session and than we can use the `remove` method. ```qml Falkon.Windows.remove(WINDOW_ID) ``` ### Available signals #### created(Window) Triggered when new window was created with the new window in parameter. #### removed(Window) Triggered when window was removed (closed) with the window as a parameter. The `Window.id` property provided by this signal is `-1` and because of this I recommend to use `window` itself as a backup identifier. ## Window properties Each window has some properties which can be read, we can also get to all tabs which belong to that window. ```qml window.id window.incognito window.title window.state window.type window.tabs window.focussed window.height window.width ``` More detailed information can be found in the [documentation](http://falkon.sgorava.xyz/docs/class_qml_window.html). ## Example The example will create a sidebar in which will be a list of currently open Falkon windows with information and buttons to create and remove windows. ![Windows list in the sidebar](../images/qml_tutorial9/sidebar_windows_list.png) ### Code The code for this example can be found at [extensions/qml_tutorial_9](../extensions/qml_tutorial_9)