Meta(
    title: "Migrating to Sway",
    summary: Some("Testing out Sway since I\'ve essentially been using XFwm as a tiling WM for a while anyway"),
    published: Some(Time(
        year: 2023,
        month: 4,
        day: 12,
        hour: 14,
        minute: 45,
        second: 5,
    )),
    tags: [
        "sway",
        "wayland",
        "linux",
    ],
)
---
Someone posted recently saying that they'd heard a rumor that there wasn't enough technical content in Gemini. Here's another contribution to that sphere..

I am definitely a minimalist when it comes to computing, and a bit of a "power user" (as much as I hate that designation, I guess it fits), but I've been hesitant to jump on the tiling WM train despite recognizing the benefits of that workflow. I think the reason has mostly been that I just couldn't be bothered to learn a bunch of new keyboard shortcuts. But that's frankly not much of an excuse since Sway is ultimately configurable however you like it.

I did play around for a while with dwm back when it first came on the scene years ago. I liked it, but not all of the shortcuts made sense to me and I didn't feel like having them compiled into the binary was in fact a great way to go, because for one thing you have to update sometimes, and for another thing that would require maintaining my own config.h file to use on each machine I run. I'd much rather just put a dotfile in place than a custom compiled binary for every machine. Anyway, I didn't end up making it my daily driver. At the time I was using PekWM, which I still have fond memories of. For those who don't know what PekWM is, it's a stacking X11 WM with tabbing built in. Basically you can drag one window onto another and the two windows will be joined as one, with a tab for each in the titlebar to select which one gets displayed. It came with no panel, and I didn't use one. All I had was a right click menu. But after playing with dwm, I did adopt dmenu as my application launcher.

PekWM, however, is among a long list of X11 window managers that has fallen into disuse and is not being actively maintained. I set up a very highly customized OpenBox and used that for a while, going so far as adding my own custom shortcuts for simple tiling layouts (I still liked the concept). But when I replaced my old desktop machine with a Raspberry PI for a home server and a laptop for hacking, my OpenBox setup was relegated to the PI and I settled into using XFCE for a number of years.

My XFCE setup has evolved over time, first losing the bottom panel, then shrinking the top panel, then acquiring a custom theme with very slim titlebars. I added a lot of my keyboard shortcuts for tiling, but mostly just used fullscreen windows and workspaces. I started Zterm as a simple way to have Vim and a terminal open at the same time. Then switched to NeoVim, and used to built in terminal for a while. Then I discovered Zellij (which I've been using on XFCE up until this week) which is a cool terminal multiplexer in the vein of GNU screen or Tmux. And then, realizing that I've been essentially using XFCE as a tiling WM for a while anyway, I decided to just bite the bullet and try out Sway. It's been about 48hrs now, and I think I'm hooked.

### My configuration
I'm not really doing anything fancy in my configuration. I've got the titlebars cut right down to about a 3-4mm strip and the included status bar set to autohide. I really don't like giving up screen real estate. I'm using Wofi as a launcher, although I may switch to bemenu because it's simpler. I haven't decided yet. I've changed the keybindings to match what I've grown used to over the years. Super + 1 switches you to desktop 1, Super + 2 to #2 and so forth, while Super +F1 moves the focused window to desktop 1 and so on. I don't like the defaults where you're expected to hold Super + Ctrl at the same time. Makes my fingers hurt.

The little things that took a little digging to configure right were things like making sure that I had an ssh-agent up and running on login and investigating why neither Thunderbird nor Firefox would open from Wofi (but they will from bemenu or a terminal). I gave up on that last one because I don't use Firefox on the daily, I use Qutebrowser, and I put in a shortcut to start Thunderbird using Super + M just like I had in XFCE.

It's funny, but using it pretty much doesn't feel any different. I've got even more screen real estate, which is good on my backup laptop which only goes to 1080 resolution, and even less distractions than before. The last thing I think I need to figure out is how to exit without using the touchpad, as the exit keycombo brings up the "swaynag" program, and you have to actually click a button to tell it that yes, you really want to leave. That's kind of an odd default I would say, considering how keyboard driven the rest of the desktop is.

### Gnome really pisses me off
I've been on a quest for screen real estate for years now. I remember vividly when GTK+ moved from the 2.0 series to the 3.0 series that pretty muich every widget took up oodles of space compared with the old version. I used to have a pretty highly customized gtkrc file and gtk.css to try to cut a lot of that down, but honestly I'm tired of fucking around with it. I'm only bringing it up because of the stark contrast after a couple of days using Sway. I really, really want to like Gnome. I like the simplicity, and I do think that it's an attractive overall design. But what I want out of it is a nice simple way to may all of the hugh ui elements shrink down to the smallest possible size so that I have room to display a couple files side by side with a terminal underneath to check if my code is still compiling. Sway makes that really, really easy in comparison. It's definitely not pretty though. But I mostly don't care about that.

### No more terminal multiplexer (probably)
I've felt no real need for anything like a terrminal emulator with split panes or a terminal multiplexer these past couple days, as the compositor just does it for me. It's also nice to be able to quickly fullscreen one window, then shrinkn it back down with a keypress. So Zellij might be relegated to remote only use when I log into the server for maintenance.

### Getting NeoVim to use the system clipboard
This is something that has always annoyed me about Vim. Vim has it's own clipboard implementation that doesn't, by default, integrate with the system clipboard. It's part of why I just used the builtin terminal for a while. Anyway, it was probably always fixable, but I didn't take the time to dive into it until earlier this week. And since I'm on NeoVim now, and using an `init.lua` for configuration rather than `init.vim`, here's my little lua snippet.
```
-- Integrate with system clipboard
vim.keymap.set('v', '<C-c>', '"+y')
vim.keymap.set('n', '<C-v>', '"+p')
```
This doesn't interfere with the use of the builtin cut buffers, but it enables me to put a visual selection into the system clipboard with the expected Ctrl-c shortcut, and to paste from the system clipboard into an editor buffer using Ctrl-v. Note that the latter requires being in 'Normal' mode. If I'm in 'Insert' mode then it's the same shortcut used to paste into my terminal, or Ctrl-Shift-V.
