Chapter 10 - Assign Sway workspaces to outputs¶
In this chapter, you will assign Sway workspaces to specific outputs. The Raspberry Pi has two micro HDMI ports that we will use to display certains workspaces on specific screens.
The idea behind this is to have two workspaces to display the BeeScreens applications on each screens and two others workspaces as a fallback in case of debugging purposes.
It will be easier to understand if you have a second screen connected to your Raspberry Pi but it is not required.
Steps¶
Identify the outputs¶
To identify the outputs, you will use the swaymsg
command. This command is used to send commands to Sway. You can use it to get information about the current state of Sway.
The following command will identify the outputs. It must be executed on the Raspberry Pi within Sway with the help of the Foot terminal.
On the Raspberry Pi, execute the following command(s). | |
---|---|
The output of the command should look similar to this. Notice the name of the output, HDMI-A-1
. This is the name that will be used to identify the outputs. It could be HDMI-A-2
if you plugged the micro HDMI to the other port of the Raspberry Pi.
- The output is connected to a Philips 275E1 monitor model.
Switch the output to the other screen and execute the command again. The output should look similar to this. Notice the name of the output, HDMI-A-2
. This is the name that will be used to identify the outputs. It could be HDMI-A-1
if you plugged the micro HDMI to the other port of the Raspberry Pi the first time.
- The output is connected to a Philips 275E1 monitor model.
The following command will identify the outputs. It must be executed on the Raspberry Pi within Sway with the help of the Foot terminal.
On the Raspberry Pi, execute the following command(s). | |
---|---|
The output of the command should look similar to this. Notice the name of the outputs, HDMI-A-1
and HDMI-A-2
. These are the names that will be used to identify the outputs.
- Both output is connected to a Philips 275E1 monitor model.
- Both output is connected to a Philips 275E1 monitor model.
Set the outputs layout in Sway¶
Set the outputs layout in Sway. Change the position of the screens and their resolution if needed. In this configuration, the two screens are side by side.
A bonus step is to hide the cursor after 1 second of inactivity and move it to the bottom right corner of the screen.
Set the workspaces outputs in Sway¶
Set the workspaces outputs in Sway. In this configuration, the left screen will have the workspaces 1 and 3 and the right screen will have the workspaces 2 and 4.
This will allow to switch from one screen to the other by pressing Win+1 or Win+2 and to switch to a "debug" workspace on the left screen by pressing Win+3 and to a "debug" workspace on the right screen by pressing Win+4.
For workspaces greater than 4, the assignment will be done on the screen that is focused.
On the Raspberry Pi, execute the following command(s). | |
---|---|
Check the results¶
You must have two screens plugged to the Raspberry Pi to check the results.
Log out from Sway with Win+Shift+E. Log back to Sway.
The two screens should be side by side and the workspaces should be assigned to the correct screen. The applications defined in the previous chapter should be running on the correct screen.
Summary¶
Congrats! You now have a multi-screen setup with Sway on the Raspberry Pi. Each screen has its own workspace with its own applications.