transfered existing blog into a new hugo project

This commit is contained in:
Eric Phillips
2025-12-19 22:14:51 -07:00
commit 7486c791c9
24 changed files with 754 additions and 0 deletions
+95
View File
@@ -0,0 +1,95 @@
---
title: "Sway Config"
date: 2021-05-06T19:23:15-06:00
tags:
- sway
- config
draft: false
---
I had been using [dwm](https://dwm.suckless.org/) for a very long time. The keyboard focused interface and minimal resource usage were very appealing to me. When [swaywm](https://swaywm.org/) reached 1.0 release I gave it a try and was hooked. The only thing I really miss from dwm is the default window layout. Wayland uses less resources than xwindows for some reason and all the configuration is in the sway config or the configs for any apps, there is no Xresources and whatever other crazy amount of configs there were for xwindows and it's stack.
Progams that I'm using:
- [swaywm](https://swaywm.org/): compositor and window manager
- [waybar](https://github.com/Alexays/Waybar): bar and tray
- [mako](https://github.com/emersion/mako): notification daemon, replaces twmn from dwm setup
- [alacritty](https://github.com/alacritty/alacritty): terminal, switched from termite since it is no longer maintained.
- [wofi](https://hg.sr.ht/~scoopta/wofi): launcher, replaces dmenu from dwm setup
Sway allows for the config to be split between files using `include path/to/file/`. The include directive with parse out things like `$(hostname)` so that a machine specific config can be used as well as a default. I used this to create a seperate display config for my home workstation/laptop and my traveling laptop. One has 3 screens and the other typically only one hiDPI screen. This also works well with my new [dotfiles](https://blog.ewpt3ch.dev/posts/dotfiles) approach. Onto the configuration goodies.
Set some variables to use in the config
```config
### Variables
#
# Logo key. Use Mod1 for Alt.
set $mod Mod1
# Home row direction keys, like vim
set $left h
set $down j
set $up k
set $right l
# Your preferred terminal emulator
set $term alacritty
# Your preferred application launcher
set $menu wofi
# setup grim and slurp for screen shots
set $screenshot grim ~/Images/screenshots/scrn-$(date +"%Y%m%d-%H%M%S").png
set $screenclip slurp | grim -g - ~/Images/screenshots/scrn-$(date +"%Y%m%d-%H%M%S").png
set $mail termite --name=mail
set $mixer termite --name=mixer
set $volume /home/ewpt3ch/bin/volumeset
```
Setup the input devices:
```config
### Input configuration
# set capslock to be control
input * xkb_options ctrl:nocaps
# need to move this to machine level config
input "2:7:SynPS/2_Synaptics_TouchPad" {
accel_profile adaptive
pointer_accel .5
dwt enabled
tap enabled
tap_button_map lrm
}
```
Hide the cursor after time or when typing:
```config
# hide mouse cursor¬
seat seat0 hide_cursor 5000¬
seat seat0 hide_cursor when-typing enable
```
Some keybindings showing the use of previously set variables
```config
### Key bindings
#
# Notifications
bindsym Control+Space exec makoctl dismiss
bindsym Control+Shift+Space exec makoctl dismiss --all
# Screen capture
bindsym $mod+Print exec $screenshot
bindsym $mod+Shift+Print exec $screenclip
#media
bindsym XF86AudioMute exec $volume mute
bindsym XF86AudioRaiseVolume exec $volume up
bindsym XF86AudioLowerVolume exec $volume down
```
I got this python script to make [inactive windows transparent](https://github.com/swaywm/sway/blob/master/contrib/inactive-windows-transparency.py), we start it like
`exec --no-startup-id python ~/bin/inactive-windows-transparency.py`
Then the very last lines of the config bring in a system-wide default that gets updated by pacman and my machine-specific configurations
```config
include /etc/sway/config.d/*
include ~/.config/sway/$(hostname)/*
```