Skip to content

Latest commit

 

History

48 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#+TITLE: Sway Dotfiles
#+AUTHOR: shyweeds
#+DESCRIPTION: Wayland desktop config based on Arch Linux + Sway

* Introduction

This repo holds my Arch Linux desktop config files, built on Sway (a Wayland
compositor) and managed with =GNU Stow= symlinks. It keeps separate config
directories for two machines (HP laptop and mini PC), switched via the =sway=
and =alacritty= symlinks, and uses =systemd-user= to manage the desktop services.

* Directory structure

| Path                      | Description                                                                 |
|---------------------------+-----------------------------------------------------------------------------|
| =sway_hp_laptop/=           | Sway config for the HP laptop (=sway= points here)                            |
| =sway_mini_pc/=             | Sway config for the mini PC                                                 |
| =sway=                      | Symlink to the active device (HP laptop by default)                         |
| =alacritty_hp_laptop/=      | Alacritty config for the HP laptop (=alacritty= points here)                  |
| =alacritty_mini_pc/=        | Alacritty config for the mini PC                                            |
| =alacritty=                 | Symlink to the active device (HP laptop by default)                         |
| =waybar/=                   | Top status bar config and style                                             |
| =fuzzel/=                   | App launcher config (JetBrains Mono Nerd / 20pt / Bold)                     |
| =swaync/=                   | Notification center config (volume + MPRIS controls)                        |
| =systemd/=                  | systemd-user services (waybar/swaync, etc.)                                 |
| =systemd_user_environment/= | systemd-user environment variables (flatpak / fcitx5)                       |
| =greetd/=                   | Login manager (greetd + tuigreet)                                           |
| =mihomo/=                   | Mihomo (Clash Meta) kernel config, deployed to =/etc/mihomo= after decryption |
| =xray_dockers/=             | Xray server/client Docker deploy configs (not version-controlled)           |
| =deploy.sh=                 | Config deploy script                                                        |
| =deploy_software.sh=        | Software install/uninstall and system setup script                          |

* Main components

** Sway (window manager)
- Main modifier is =Mod4= (Win); use =hjkl= to move focus
- Desktop programs: =fuzzel= (launcher), =waybar= (status bar), =swaync= (notification center),
  =swayosd= (on-screen display), =polkit-gnome= (PolicyKit auth agent),
  =grim=+=slurp= (screenshot), =swaylock= (lock screen)
- Lock after 300s idle, turn off the screen after 600s
- =pre-start.sh= / =50-systemd-user.conf= import =DISPLAY=, =SWAYSOCK=,
  =WAYLAND_DISPLAY=, etc. into the systemd-user environment and start =sway-session.target=

** systemd-user services
All desktop services bind to =PartOf=sway-session.target= and start/stop with Sway:

| Service                                     | Program              |
|---------------------------------------------+----------------------|
| =waybar.service=                              | status bar           |
| =swaync.service=                              | notification center  |
| =swayosd-server.service=                      | on-screen display    |
| =polkit-gnome-authentication-agent-1.service= | PolicyKit auth agent |
| =fcitx5.service=                              | Chinese input method |

** Waybar (status bar)
- Top bar with the Arch icon (click opens fuzzel), workspaces, clock/idle inhibitor, CPU/memory,
  power, battery, and system tray
- Click CPU/memory to open =btop= in alacritty

** Input method
- =fcitx5= + =fcitx5-rime=, started by a systemd-user service
- Rime 数据(雾凇拼音 + 小鹤双拼)由 =plum= 部署到 =~/.local/share/fcitx5/rime=,
  默认方案为 =double_pinyin_flypy=(小鹤双拼);见 =deploy_software.sh= 第 13 节

** Mihomo (proxy kernel)
- Transparent proxy kernel based on =Clash Meta=, configured as a single =config.yaml=, running in =/etc/mihomo=
- Installed from the official GitHub release (=mihomo-linux-amd64-v3-*.pkg.tar.zst= via =pacman -U=),
  which also ships =mihomo.service=; =deploy.sh= enables it after deploying the config
- Sensitive fields (the subscription =url= and the DNS =nameserver-policy= DoH URLs) are encrypted
  with =sops= + =age=; the plaintext =config.yaml= is produced by =mihomo/decrypt.sh= and deployed to =/etc/mihomo=
- =tun.enable: true= needs root

* Deployment

1. Install software (Arch Linux):

   #+begin_src sh
     ./deploy_software.sh
   #+end_src

   This script updates the system, installs/removes packages, enables =sshd=, =greetd=, =firewalld=,
   configures git, generates an SSH key, and sets up firewalld rules. It also installs =sops= and
   =age= (used to decrypt the mihomo config), installs =mihomo= from its official GitHub release
   (=mihomo-linux-amd64-v3-*.pkg.tar.zst= via =pacman -U=), and deploys =fcitx5-rime= + 雾凇拼音 +
   小鹤双拼 through =plum=.

   If either download fails (no network, GitHub unreachable, etc.), the script prints a warning
   with manual instructions and continues without aborting:

   #+begin_src sh
     # mihomo (fallback)
     paru -S mihomo    # or: yay -S mihomo

     # rime (fallback)
     git clone https://github.com/rime/plum.git ~/.local/share/plum
     cd ~/.local/share/plum
     rime_dir=~/.local/share/fcitx5/rime bash rime-install iDvel/rime-ice
     rime_dir=~/.local/share/fcitx5/rime bash rime-install iDvel/rime-ice:others/recipes/config:schema=double_pinyin_flypy
   #+end_src

2. Switch the device config (e.g. for the mini PC):

   #+begin_src sh
     ln -sfn sway_mini_pc sway
     ln -sfn alacritty_mini_pc alacritty
   #+end_src

3. Deploy the config files (create symlinks with GNU Stow):

   #+begin_src sh
     ./deploy.sh
   #+end_src

   This script links the user configs (sway, waybar, alacritty, fuzzel, swaync, systemd,
   systemd_user_environment) to =$HOME=, links =greetd= and =mihomo= to the system root =/=
   (needs root), and enables the systemd-user services. The mihomo plaintext =config.yaml= is
   decrypted by =mihomo/decrypt.sh= before deployment and linked as =/etc/mihomo/config.yaml=,
   then =mihomo.service= is enabled. If =mihomo= is not installed, =deploy.sh= prints a warning
   and skips the mihomo config/service instead of aborting.

* Usage

- Startup: the =greetd= login manager starts Sway via =sway-session.sh=; when Sway exits,
  =sway-session.target= and its services are stopped by systemd.
- Common keybindings:

| Key              | Action                                                  |
|------------------+---------------------------------------------------------|
| =Mod+Return=     | Open terminal                                           |
| =Mod+d=          | Open app launcher                                       |
| =Mod+Shift+q=    | Close window                                            |
| =Mod+Shift+e=    | Exit Sway                                               |
| =Mod+Shift+c=    | Reload config                                           |
| =Mod+1~0=        | Switch workspace                                        |
| =Mod+Shift+1~0=  | Move window to workspace                                |
| =Mod+Shift+space= | Toggle floating window                                 |
| =Mod+r=          | Enter resize mode                                       |
| =Print=          | Screenshot region (grim+slurp, saved to =~/Pictures=)   |
| =Mod+Shift+n=    | Open notification center                                |

About

sway_dotfiles test

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Contributors

Languages