fix: tmux Wayland clipboard and serena mutable config - #786
Conversation
Add WAYLAND_DISPLAY and SWAYSOCK so clipboard tools like wl-copy work inside tmux sessions. fix(serena): use activation script for mutable config file Replace home.file with activation script so the config file is a regular writable file instead of a read-only symlink.
|
You do not have enough credits to review this pull request. Please purchase more credits to continue. |
📝 WalkthroughSummary by CodeRabbit
WalkthroughThree configuration files are updated: a Hyprland clipboard keybinding is modified to avoid xremap conflicts, Serena's configuration file deployment switches from direct home.file writing to an activation-based copying approach, and tmux gains Wayland environment variable propagation with enhanced timestamp precision. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @shunkakinoki, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances user experience by enabling Wayland clipboard operations within tmux sessions and improving the flexibility of the Serena application's configuration. The changes ensure that Wayland-specific environment variables are propagated to tmux, allowing clipboard tools to function correctly, and refactor the Serena configuration to be directly editable by the user. Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Mesa DescriptionTL;DRFixes Wayland clipboard in tmux sessions by adding What changed?
Description generated by Mesa. Update settings |
There was a problem hiding this comment.
Code Review
This pull request introduces two fixes. The update to the tmux configuration correctly adds WAYLAND_DISPLAY and SWAYSOCK to update-environment, enabling Wayland clipboard utilities within tmux sessions. The change for the Serena configuration switches from a Nix-managed symlink to a user-writable file using a home-manager activation script. While this approach is sound, I've identified a minor issue in the script's logic that could cause problems in an edge case and have suggested a more robust implementation.
| }; | ||
| home.activation.serenaConfig = config.lib.dag.entryAfter [ "writeBoundary" ] '' | ||
| mkdir -p "$(dirname "${serenaConfigDest}")" | ||
| if [ ! -f "${serenaConfigDest}" ] || [ -L "${serenaConfigDest}" ]; then |
There was a problem hiding this comment.
The current condition [ ! -f "${serenaConfigDest}" ] || [ -L "${serenaConfigDest}" ] can lead to unexpected behavior. If ${serenaConfigDest} points to a directory, [ ! -f ... ] evaluates to true, causing the script to attempt rm -f on a directory. This will fail and is likely not the intended behavior.
Using [ ! -e "${serenaConfigDest}" ] || [ -L "${serenaConfigDest}" ] is more robust. It correctly triggers the copy only if the destination doesn't exist or is a symlink, and it correctly does nothing if it's an existing file or directory.
if [ ! -e "${serenaConfigDest}" ] || [ -L "${serenaConfigDest}" ]; then
There was a problem hiding this comment.
Pull request overview
Updates Home Manager configuration to improve Wayland clipboard behavior inside tmux and to make Serena’s config file writable (not a Nix store symlink), aligning runtime behavior with tool expectations.
Changes:
- Extend tmux
update-environmentto carry Wayland/Sway session variables into tmux sessions. - Replace Serena
home.file(store symlink) with an activation-time copy into~/.serena/to keep the config writable/persistent.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| home-manager/programs/tmux/tmux.conf | Adds WAYLAND_DISPLAY and SWAYSOCK to tmux’s environment update list to support Wayland clipboard tooling inside tmux. |
| config/serena/default.nix | Switches Serena config provisioning from a Nix symlink to an activation script that materializes a writable file under ~/.serena/. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| mkdir -p "$(dirname "${serenaConfigDest}")" | ||
| if [ ! -f "${serenaConfigDest}" ] || [ -L "${serenaConfigDest}" ]; then | ||
| rm -f "${serenaConfigDest}" | ||
| cp "${serenaConfigSrc}" "${serenaConfigDest}" | ||
| chmod u+w "${serenaConfigDest}" |
There was a problem hiding this comment.
Activation snippet performs filesystem mutations (mkdir/rm/cp/chmod) without using Home Manager’s $DRY_RUN_CMD, so home-manager switch --dry-run (and similar tooling) will still modify the real filesystem. Please prefix these commands with $DRY_RUN_CMD (consistent with other activation entries in this repo) so dry-runs remain side-effect free.
| mkdir -p "$(dirname "${serenaConfigDest}")" | |
| if [ ! -f "${serenaConfigDest}" ] || [ -L "${serenaConfigDest}" ]; then | |
| rm -f "${serenaConfigDest}" | |
| cp "${serenaConfigSrc}" "${serenaConfigDest}" | |
| chmod u+w "${serenaConfigDest}" | |
| $DRY_RUN_CMD mkdir -p "$(dirname "${serenaConfigDest}")" | |
| if [ ! -f "${serenaConfigDest}" ] || [ -L "${serenaConfigDest}" ]; then | |
| $DRY_RUN_CMD rm -f "${serenaConfigDest}" | |
| $DRY_RUN_CMD cp "${serenaConfigSrc}" "${serenaConfigDest}" | |
| $DRY_RUN_CMD chmod u+w "${serenaConfigDest}" |
The Hyper+V (CTRL ALT SHIFT SUPER V) binding for clipse TUI was being intercepted by xremap and remapped to Ctrl+V (paste), preventing the clipboard manager from opening. Change to $mod+Ctrl+V which bypasses xremap.
Summary
WAYLAND_DISPLAYandSWAYSOCKtoupdate-environmentsowl-copy/wl-pastework inside tmux sessionshome.filewith an activation script so the config is a writable file instead of a read-only Nix store symlinkTest plan
pwd | wl-copyworks~/.serena/serena_config.ymlis a regular writable file aftermake switchSummary by cubic
Fix Wayland clipboard in tmux by adding WAYLAND_DISPLAY and SWAYSOCK to update-environment, show seconds in the tmux clock, and change the Hyprland clipse shortcut to $mod+Ctrl+V to avoid xremap conflicts. Make Serena config writable by replacing the read-only home.file symlink with an activation script that copies serena_config.yml to ~/.serena and sets permissions.
Written for commit 4a1f97a. Summary will update on new commits.