-
Notifications
You must be signed in to change notification settings - Fork 14
Sway How To
Sway is a tiling window manager for Wayland. It is based on the i3 tiling window manager (which does not support Wayland).
We have included Sway in Citadel as a secondary option for users who prefer not to use GNOME. Sway does not provide a full desktop environment. Some features that are normally expected in a desktop environment are fulfilled either by running command-line applications or through the integration of additional tools. Where possible, we plan to implement tools to make some common tasks easier for the user.
The Sway session can be started by editing the kernel command line during boot (pressing either Tab or e) and adding the following command-line argument:
citadel.sway
The Sway modifier key is the Super (Windows) key. Each shortcut is a combination of Super and some other key.
- Opening a terminal in the current realm: Super+Enter
- Opening a Citadel terminal: Super+Shift+Enter
- Opening the desktop launcher (
sgflow
): Super+d - Opening Nautilus in the current realm: Super+n
- Locking the screen: Super+9
- Take a screenshot: Super+PrtSc
- Select a region and take a screenshot: Super+Shift+PrtSc
The full configuration can be found in /etc/sway/config
within Citadel. If
anything changes from this documentation, the config file is the canonical
source.
Sway supports multiple workspaces (and even multiple displays). Windows can be moved from workspace to workspace, where they will be displayed according to whatever window management mode(s) are enabled for the workspace in question.
To navigate to a workspace, press Super + the workspace number. This works for workspaces 1-8 (Super+8 selects the 8th workspace).
To move the focused window to another workspace, press Super + Shift + the workspace number (Super+Shift+8 will move the window to the 8th workspace).
Window focusing is done using the keyboard (or mouse). The same shortcuts
apply to each mode. Pressing the Super key + an arrow key will move the
focus in the direction of the arrow. The VIM directional keys (hjkl
) are
also supported.
Tiling mode is the default. In this mode, the entire workspace is divided among the open windows. The windows can be arranged horizontally or vertically.
- Tiling windows vertically: Super+v
- Tiling windows horizontally: Super+b
- Cycling back to tiling mode when another mode is enabled: Super+e
It is also possible to cycle between horizontal and vertical splits in tiling mode with the Super+e shortcut.
Windows are tabbed horizontally. One window/tab is displayed at a time.
- Enabling tabbed mode: Super+w
Windows are stacked vertically. As with the tabbed mode, one window is displayed at a time.
- Enabling stacked mode: Super+s
This is similar to how other desktops manage windows. Some applications that open pop-ups or multiple windows are best run in floating mode.
- Enabling floating mode: Super+Shift+Space
Floating windows can be resized using the Super+r shortcut on the focused window. This puts the window into resize mode. The arrow keys can then be used to resize the window. Pressing the Esc key will exit this mode.
Citadel includes a stable 1.x release of Sway. This should work for users who are already comfortable using Sway and using the command-line to perform certain actions. However, we consider Sway support in Citadel to be a work-in-progress and there are certain convenience features missing that we intend to implement.
Sway includes a status bar that will display information about network
connections, volume level, battery levels, etc. The status bar (swaybar
) does
not contain any logic to query these status items by itself, requiring that
third-party status tools are used to gather updated status information and
present information to display on the status bar. The status items are
displayed textually.
sgstatus
is a tool that was written to present status information in a
graphical format. It will uses some of the same methods of querying status info
as the GNOME shell. It also does this on-demand by listening for events instead
of repeatedly querying for status updates on a periodic basis (like other
status tools). It will interact with the Sway status bar by querying status
information and then sending icons that reflect the status to be displayed by
the status bar.
NOTE: sgstatus
currently does not work in citadel, for the
following reasons -- this needs to be fixed to work with the current tray impplementation in Sway 1.0.
Applications are launched using a custom launcher we wrote called sgflow
. Activating the launcher will present the
user with a dialog to search and launch applications. Pressing Esc will close the dialog.
Sway, like other tiling window managers, does not include native tools for
connecting to the network. Command-line tools such as nmtui
are normally used
to connect to wifi because the graphical tools provided by GNOME do not work
in Sway. However, nmtui
brings in a bunch of unwanted dependencies so in
the interest of keeping Citadel minimal, nmtui
is not included in Citadel.
Currently, there are two ways to configure a wifi connection. The first is to
set it up in GNOME prior to starting Sway. The second is to use the nmcli
command line tool with the Citadel terminal.
Some easier options are being explored to address this in the future.
Run the following commands in the Citadel terminal to connect to a wifi network in Sway:
$ nmcli device wifi rescan
$ nmcli device wifi list
$ nmcli device wifi connect <ssid> --ask
The --ask
flag will cause nmcli
to prompt you for the wifi password.
In addition to the keyboard shortcuts for taking screenshots, screenshots can be taken from the Citadel terminal.
Citadel includes command-line tools for taking screenshots in Sway 1.0. The main tool is called grim
, which handles taking the screen shots itself. To take a screenshot with grim
, it must be run in the Citadel terminal. The following is an example of the various options:
citadel:~ $ grim
Usage: grim [options...] <output-file>
-h Show help message and quit.
-s <factor> Set the output image scale factor. Defaults to the
greatest output scale factor.
-g <geometry> Set the region to capture.
-o <output> Set the output name to capture.
The simplest way to use grim
is to run it with an output file:
citadel:~ $ grim screenshot.png
The second tool is a supplement to grim
called slurp
. slurp
lets you interactively select a region on the screen. Piping output from slurp
to the geometry flag of grim
will take a screenshot of the selected region, for example:
citadel:~ $ slurp | grim -g - screenshot.png
slurp
has some other interesting options:
citadel:~ $ slurp -h
Usage: slurp [options...]
-h Show help message and quit.
-d Display dimensions of selection.
-b #rrggbb Set background color.
-c #rrggbb Set border color.
-s #rrggbb Set selection color.
-w n Set border weight.