DEV Community

loading...

A fully integrated Sway setup

Kamus Hadenes
Originally published at blog.hadenes.io on ・8 min read

Being a long time i3wm user, when I found out about Wayland and Sway the move felt like a natural evolution.

I won’t focus much on the many benefits of Wayland, nor will I deep dive on why tilling window managers work best for me.

In this post, I’ll focus on describing my environment and how I have all the information and commands I need just a few keystrokes away.

For each individual “module”, I’ll create a separate post describing it’s development and configuration and link it here.

Please check back periodically, or subscribe, to known when new information is posted.

The Components

This setup involves a lot of different software, like Nix(OS) for managing all my configuration, but I won’t focus on the reproducibility for now, and just list the software that are used daily to achieve my goals.

  • Sway - the tilling window manager
  • Waybar - an Wayland bar
  • Wofi - a dmenu-like rofi replacement
  • Taskwarrior - task management
  • vdirsyncer - fetch calendar events through CalDav
  • khal - read calendar events from vdirsyncer
  • mbsync - fetch mail from multiple accounts and store them in Maildir format
  • goimapnotify - reduce the number of requests to the mail servers
  • mu - index all Maildir mail
  • wf-recorder - record the desktop
  • grimshot - screenshots with grim + slurp
  • wl-clipboard - manage automated copy/paste
  • clipman - manage and record the clipboard
  • bitwarden-cli - store and retrieve sensitive data
  • swaylock - screen lock
  • mako - notification daemon
  • kanshi - automatic display configuration
  • wdisplays - manual display configuration
  • systemd - services and recurrent tasks
  • Python and Bash - several customized scripts

Besides all this software, I also make use of some services to provide the functionality I need.

  • Chess.com - I play Chess, mainly on Chess.com, and use their API to get notified when it’s my turn to make a move
  • CoinMarketCap - used to get cryptocurrency ticker data
  • AwesomeAPI - used to get forex ticker data
  • AWS CheckIP - used to get my external IP
  • wttr.in - used for weather data

For the Waybar modules, instead of letting Waybar itself handle the command calling, I use systemd timers and save the output to a specific folder ~/.cache/waybar/output, which I then cat with Waybar.

The reason for that is that Waybar duplicates the modules for each monitor you have, effectively running your scripts twice (or more).

The Desktop

Like mentioned above, I won’t go into details of my usage of a tilling window manager, and will focus on showing where my information is located.

The desktop can be divided in three areas, containing a few sections each.

Top Area

The top area is a Waybar bar with three “clusters” of modules.

2021-02-28T00:11:57,845580127-03:00.png

Top Left - Finance

Information I need to manage my finances and investments.

2021-02-28T00:20:57,192740259-03:00.png

2021-02-28T00:19:29,154590293-03:00.png

  • itau.py - contains my main bank balance and statement, updated automatically every 15 minutes
  • nubank.py - contains my secondary bank balance and statement, and also it’s card statement, updated automatically every 15 minutes
  • forex.py - exchange rates for several different currencies, color-coded
  • crypto.py - exchange rates for several different cryptocurrencies, color-coded, with price fluctuation for 1h, 24h and 7d intervals

Top Center - Network

Information about my current connection and VPN status.

network.png

  • nordvpn.py - displays NordVPN connection status and allow to connect/disconnect
  • fortinet.sh - displays Fortinet SSL VPN connection status and allow to disconnect
  • external_ip.py - displays your external / public IP
  • Waybar Network - the default Waybar network module

Top Right - Tasks, Tray and Notifications

Tasks, notifications, badges and tray icons.

topright.png

  • opsgenie.py - displays my on-call rotation status
  • pomodoro.py - a Pomodoro timer
  • task.py - displays my Taskwarrior’s tasks count and list
  • mail.py - displays my mail count
  • chess.py - displays a notification when it’s my turn on Chess.com
  • recorder.sh - displays a badge if the screen is being recorded

Bottom Area

The bottom area is a Waybar bar with three “clusters” of modules.

2021-02-28T00:47:17,622807852-03:00.png

Bottom Left - Sway

Nothing special here, just Sway workspaces.

bleft.png

Bottom Center - Hardware

General hardware information, like temperature, CPU and memory usage, battery status, energy consumption, screen brightness and audio volume.

bcenter.png

Bottom Right - Weather, Calendar and Events

Date and time, weather information and calendar events.

bright.png

  • weather.py - weather information using wttr.in
  • khal.py - calendar events information using Khal, with meeting link parsing for one-click joins
  • Waybar Clock - the default Waybar Clock Module

Center

The central part is where my programs / windows are present, and also where my Wofi menus pop-up to do a range of stuff.

Keybindings

To use all the above, I resort to keybindings that are easily mapped into my mind.

Here’s a non-exhaustive list.

In my case, $mod is the left Super key (Windows)

Sway

Keybindings for interacting with Sway and it’s windows

Keybinding Effect Mnemonic
$mod + Shift + q Kill focused window Q is for quit
$mod + Shift + r Reload Sway R is for reload
$mod + (Left, Right, Up, Down) Focus left, right, up or down Well, directions
$mod + Shift + (Left, Right, Up, Down) Move focused window left, right, up or down Well, directions
$mod + f Put focused window on fullscreen F is for fullscreen
$mod + Shift + Space Toggle tilling / floating mode for focused window Space is very central, so is the window mode
$mod + Shift + Minus Move focused window to scratchpad (out of view) Minus subtracts stuff, and I’m subtracting this window out of view
$mod + Minus Cycle through scratchpad windows, use $mod + Shift + Space to bring it back in full Minus subtracts stuff, and I subtracted this window out of view, and now I’m bringing it back
$mod + (1-9) Change workspace to the specified workspace number The number is the workspace, no secrets
$mod + Shift + (1-9) Move the focused window to the specificed workspace number The number is the workspace, no secrets
$mod + Control + (Left, Right, Up, Down) Move the current workspace to the monitor left, right, up or down Well, directions

Resize

Keybindings to resize a window

Keybinding Effect Mnemonic
$mod + r Enter resize mode R is for resize
$mod + r + (Left, RIght, Up, Down) Increase or decrease the focused window on the specified direction Well, directions

Task

Keybindings to manage tasks, depends on task.py

Keybinding Effect Mnemonic
$mod + t Enter task mode T is for task
$mod + t + n Create a new task N is for new
$mod + t + v Create a new task pre-filled with the clipboard contents V as in Ctrl+V
$mod + t + d Mark a task as Done D is for done
$mod + t + s Sync tasks with server running task sync S is for sync
$mod + t + a Annotate a task with multi-line text A is for annotate
$mod + t + i Get full task information by running task info I is for info
$mod + t + r Remove a task R is for remove
$mod + t + p Toggle the Pomodoro timer P is for Pomodoro
$mod + t + b End the Pomodoro session None, really

Applications

Keybindings for opening applications

Keybinding Effect Mnemonic
$mod + a Enter application mode A is for application
$mod + e $mod + a + e Open the default editor (in my case, Emacs) E is for editor
$mod + g $mod + a + g Open the default browser (in my case, Brave) G was originally for Google Chrome, no longer the case but it stuck
$mod + a + n Open the file manager (in my case, Nautilus) N is for Nautilus
$mod + a + o Open OBS O is for OBS
$mod + a + s Open multiple chat apps (Telegram, Slack, WhatsApp) S is for social
$mod + Return $mod + a + t Open the default terminal emulator (in my case, Kitty) T is for terminal, and Return (Enter) is what you type to run a command
$mod + a + z Open Zoom Z is for Zoom

Record and Streaming

Keybindings to quickly record the screen outside OBS

Keybinding Effect Mnemonic
$mod + m + r Enter record mode M is for mode, R is for record
$mod + m + r + r Start a new full screen recording on the current monitor R is for record
$mod + m + r + w Start a new recording of the current focused window W is for window
$mod + m + r + s Stop the current running recording S is for stop

Snippets

Keybindings to get and create snippets

Keybinding Effect Mnemonic
$mod + m + s Enter snippets mode M is for mode, S is for snippet
$mod + s $mod + m + s + s Open the snippet selection dialog S is for snippet
$mod + m + s + n Create a new snippet N is for new

VPN

Keybindings for toggling VPN connections

Keybinding Effect Mnemonic
$mod + v Enter VPN mode V is for VPN
$mod + v + v Toggle default VPN provider (in my case, NordVPN) V is for VPN
$mod + v + n Toggle my company’s VPN N is the first letter of my company

Conclusion

In this post, I presented an overview of how my desktop works.

With this setup, I was able to achieve an almost zero-friction setup that is likely the best option until machines can read your brain directly.

For more information and implementation details, please read each linked article.

Discussion (0)