Let’s continue the Sway window manager (in Arch Linux) series I started inmy previous postand continued inthe other post.
Screenshots
We can use “grimshot”, part ofsway-contrib, to take screenshots, which requires the main program for performing the actual screenshot, “grim”.
1 | sudopacman-Ssway-contribgrim |
By default, such utilities are installed in “/usr/share/sway-contrib”, which is not part of the PATH. So, put that directory in the PATH environment variable or prefix the call with the full path.
Here’s the help of grimshot:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | $ /usr/share/sway-contrib/grimshot --help Usage: grimshot [--notify] [--cursor] [--wait N] (copy|save) [active|screen|output|area|window|anything] [FILE|-] grimshot check grimshot usage Commands: copy: Copy the screenshot data into the clipboard. save: Save the screenshot to a regular file or '-' to pipe to STDOUT. savecopy: Save the screenshot to a regular file and copy the data into the clipboard. check: Verify if required tools are installed and exit. usage: Show this message and exit. Targets: active: Currently active window. screen: All visible outputs. output: Currently active output. area: Manually select a region. window: Manually select a window. anything: Manually select an area, window, or output. |
You can try running that from the command line and do some experiments.
Then, you might want to set a few keybindings in the Sway config file, e.g.:
1 2 3 4 5 6 7 8 9 10 11 | set $screenshot /usr/share/sway-contrib/grimshot ### Screenshot bindsym { # Capture the currently active output Print exec $screenshot --notify save output # Capture the currently active window Shift+Print exec $screenshot --notify save active # Select and capture a custom rectangular area Ctrl+Print exec $screenshot --notify save area } |
Let’s also install an image viewer, like “Eye of Gnome”:
1 | sudopacman-Seog |
This way, we can open the generated screenshot images.
Brightness and volume
How do you set the screen’s brightness and volume using the corresponding keys?
First, we need a program to control the brightness, “brightnessctl”. For the volume, we use “wpctl”, part of “wireplumber”:
1 | sudopacman-Sbrightnessctlwireplumber |
Here are the keybindings for the media keys for brightness and volume (if your keyboard has them):
1 2 3 4 5 6 | ### Brightness and Volume bindsymXF86MonBrightnessDownexecbrightnessctlset5%- bindsymXF86MonBrightnessUpexecbrightnessctlset5%+ bindsymXF86AudioRaiseVolumeexecwpctlset-volume-l1.0@DEFAULT_SINK@5%+ bindsymXF86AudioLowerVolumeexecwpctlset-volume-l1.0@DEFAULT_SINK@5%- bindsymXF86AudioMuteexecwpctlset-mute@DEFAULT_SINK@toggle |
Note the use of “-l 1.0” meaning that we don’t want to allow the wireplumber to increase the volume above 100%.
Running from a Display Manager
The default installation already created a file in the appropriate folder to let SDDM start the Sway session.
1 2 3 4 5 6 | $cat/usr/share/wayland-sessions/sway.desktop [DesktopEntry] Name=Sway Comment=Ani3-compatibleWaylandcompositor Exec=sway Type=Application |
Let’s install the SDDM package:
1 | sudo-Ssddm |
Then, we enable the service at boot:
1 | sudosystemctlenablesddm |
If we want to start it without rebooting, the first time we run:
1 | sudosystemctlstartsddm |
And now you can enter Sway from here.
Stay tuned for other posts on the Sway WM!
