sources/tech/20191216 Setting up the sway window manager on Fedora.md
5.0 KiB
Setting up the sway window manager on Fedora
Sometimes during a critical activity, working with overlapping windows becomes counterproductive. You might find a tiled window manager like sway to be a good alternative.
Sway is a tiling Wayland compositor. It has the advantage of compatibility with an existing i3 configuration, so you can use it to replace i3 and use Wayland as the display protocol.
Installing sway
To setup sway, open a new terminal and type the following command
sudo dnf install sway
Once the installation is completed, log out of your user session. At the login screen, select your user account. Before you enter your password, choose Sway from the menu, as shown in the following image.
After login, your desktop looks like this:
Configuration
To begin configuration, copy the default config into your user directory. Do that using the following commands.
mkdir -p .config/sway
cp /etc/sway/config ~/.config/sway/
Sway is highly configurable. It’s suggested you read the project’s wiki page to fine tune your settings. For example, to change the keyboard layout, open a new terminal and run this command:
$ swaymsg -t get_inputs
[george@mrwhite ~]$ swaymsg -t get_inputs
Input device: VirtualPS/2 VMware VMMouse
Type: Mouse
Identifier: 2:19:VirtualPS/2_VMware_VMMouse
Product ID: 19
Vendor ID: 2
Libinput Send Events: enabled
Input device: VirtualPS/2 VMware VMMouse
Type: Mouse
Identifier: 2:19:VirtualPS/2_VMware_VMMouse
Product ID: 19
Vendor ID: 2
Libinput Send Events: enabled
Input device: AT Translated Set 2 keyboard
Type: Keyboard
Identifier: 1:1:AT_Translated_Set_2_keyboard
Product ID: 1
Vendor ID: 1
Active Keyboard Layout: Portuguese (Brazil)
Libinput Send Events: enabled
Copy the identifier keyboard code. Open your ~/.config/sway/config file with your text editor and edit the configuration accordingly:
## Input configuration
input "1:1:AT_Translated_Set_2_keyboard" {
xkb_layout br
}
Save the settings. To reload the configurations, press Super+Shift+c. (Typically the Super key is mapped to the logo key on a PC.)
Waybar
Sway’s default status bar may not have all the functions you want. Fortunately Waybar is a good replacement. To install, run the follow commands. (Note, however, that COPR is not an official Fedora repository and not supported by the Fedora Project.)
sudo dnf copr enable alebastr/waybar
sudo dnf install waybar
Open your ~/.config/sway/config file. Edit the bar configuration like this:
bar {
swaybar_command waybar
}
Reload the configuration and you’ll now see the waybar in action, as shown below.
To customize the waybar, you can visit this wiki page for more details and ideas.
Alacritty
Alacritty is a terminal emulator that uses the GPU for rendering, and a good replacement for urxvt. To install run the following lines
sudo dnf copr enable pschyska/alacritty
sudo dnf install alacritty
To enable it as default terminal emulator edit your ~/.config/sway/config. Change this line:
set $term urxvt256c-ml
To:
set $term alacritty
Reload your configuration.
When you open a new terminal with Super+C, alacritty will be open as seen in the following image:
Photo by Ivan Vranić on Unsplash.
via: https://fedoramagazine.org/setting-up-the-sway-window-manager-on-fedora/
作者:George Luiz Maluf 选题:lujun9972 译者:译者ID 校对:校对者ID