Files

49 lines
1.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# TODO
## 窗口横向贴左 / 贴右键位
**状态**:搁置(等上游支持后再做)
### 需求
当前 `Super+C`(`Mod+C { center-column; }`)用于将窗口横向居中。
希望能再分别设置横向贴左、贴右,例如:
| 键位 | 动作 |
|---|---|
| `Mod+C` | 居中(现状) |
| `Mod+Ctrl+C` | 横向贴左 |
| `Mod+Shift+C` | 横向贴右 |
### 卡点
- niri 26.04 **没有** 左/右对齐动作,只有 `center-column` / `center-window` / `center-visible-columns`。
- niri **没有插件 API**:外部工具(含 piri 这类"插件系统")只能监听事件流 + 调用已有 action,无法新增合成器内部动作;而横向对齐需要改内部 view offset,因此纯外部方案无法真正实现。
- 上游 `align-column` / `align-window` 仍是未合并 PR([#3033](https://github.com/niri-wm/niri/pull/3033)、[#4417](https://github.com/niri-wm/niri/pull/4417))。
- 注意:`Mod+Ctrl+C` 目前已被 `center-visible-columns` 占用,届时需处理冲突。
### 触发条件与届时做法
上游 PR #4417 合并进 niri 后,本需求退化为纯配置问题,在 `dms/binds.kdl` 增加:
```kdl
Mod+Ctrl+C { align-column horizontal="left"; }
Mod+Shift+C { align-column horizontal="right"; }
```
(如保留 `center-visible-columns`,需为其换一个不冲突的键位)
### 已评估但暂时放弃的替代方案
| 方案 | 放弃原因 |
|---|---|
| 薄 patch + 自定义 PKGBUILD | 每次上游更新需维护/rebase patch |
| AUR `niri-git` | 滚动版,且上游尚未合并该特性 |
| `niri_tweaks` 的 `niri_right_align.sh` | dummy 窗口会导致终端闪烁,对窗口操作不可接受;且只能贴右 |
| piri 插件系统 | 只有状态驱动的自动对齐,无法手动贴左/贴右 |
### 参考
- niri Action 列表:`niri msg action`
- 上游对齐 PR:<https://github.com/niri-wm/niri/pull/4417>