5 个稳定版本
新 2.1.0 | 2024 年 8 月 15 日 |
---|---|
2.0.0 | 2024 年 4 月 23 日 |
1.1.2 | 2024 年 2 月 17 日 |
1.1.1 | 2023 年 8 月 29 日 |
#226 在 GUI 中
每月 69 次下载
3MB
550 行
river-bsp-layout
使用 river-layout-toolkit
创建二进制空间划分 / 网格布局的自定义 River 布局管理器
3 窗口示例
+----------------+----------------+
| | |
| | |
| +----------------+
| | |
| | |
+----------------+----------------+
4 窗口示例
+----------------+----------------+
| | |
| | |
+----------------+----------------+
| | |
| | |
+----------------+----------------+
安装
Fedora
dnf copr enable areif-dev/river-bsp-layout
dnf install river-bsp-layout
其他 - Cargo
cargo install river-bsp-layout --locked
构建
- 确保您已安装
cargo
。推荐安装方式是从 https://rust-lang.net.cn/tools/install 的rustup.sh
- 使用以下命令克隆此仓库
git clone https://github.com/areif-dev/river-bsp-layout
- 进入克隆的目录
cd river-bsp-layout
- 运行
cargo build --release
- 将编译的二进制文件从
target/release/river-bsp-layout
移动到您的$PATH
中的任何目录- 如果您已安装
cargo
,一种选择是将二进制文件移动到$HOME/.cargo/bin
- 如果您已安装
从 River init 开始
假设您正在使用默认的 bash
init 脚本,将文件末尾的以下行替换为
riverctl default-layout rivertile
rivertile -view-padding 6 -outer-padding 6 &
替换为
riverctl default-layout bsp-layout
river-bsp-layout --inner-gap 5 --outer-gap 10 --split-perc 0.5 &
CLI 帮助
Usage: river-bsp-layout [OPTIONS]
Options:
-h, --help Print help
-V, --version Print version
Inner Gap Options:
-i, --inner-gap <DEFAULT_INNER_GAP> The number of pixels to pad each inner edge of a window by default [default: 0]
-l, --ig-left <IG_LEFT> The number of pixels to pad the left inner edge of each window. This Overrides `default_inner_gap`. Optional
-r, --ig-right <IG_RIGHT> The number of pixels to pad the right inner edge of each window. This Overrides `default_inner_gap`. Optional
-b, --ig-bottom <IG_BOTTOM> The number of pixels to pad the bottom inner edge of each window. This Overrides `default_inner_gap`. Optional
-t, --ig-top <IG_TOP> The number of pixels to pad the top inner edge of each window. This Overrides `default_inner_gap`. Optional
Outer Gap Options:
-o, --outer-gap <DEFAULT_OUTER_GAP> The default size of the gap between windows and the edge of the screen [default: 0]
-L, --og-left <OG_LEFT> The number of pixels to place between the left screen edge and any windows. Overrides `default_outer_gap` for the left side. Optional
-R, --og-right <OG_RIGHT> The number of pixels to place between the right screen edge and any windows. Overrides `default_outer_gap` for the right side. Optional
-B, --og-bottom <OG_BOTTOM> The number of pixels to place between the bottom screen edge and any windows. Overrides `default_outer_gap` for the bottom side. Optional
-T, --og-top <OG_TOP> The number of pixels to place between the top screen edge and any windows. Overrides `default_outer_gap` for the top side. Optional
Split Options:
-s, --split-perc <DEFAULT_SPLIT_PERC> The default percentage of available area that the primary window should occupy after any split takes place [default: 0.5]
-H, --hsplit-perc <HSPLIT_PERC> The percentage of available area that the primary window should occupy after a horizontal split. This will override the value of `default_split_perc` only for
horizontal splits
-v, --vsplit-perc <VSPLIT_PERC> The percentage of available area that the primary window should occupy after a vertical split. This will override the value of `default_split_perc` only for vertical
splits
--start-hsplit Whether the first split that's made should divide the screen horizontally. If this is not set, then the first split will be vertical
Other Options:
--reverse Reverse the order of the views as well as the order they are added
CLI 示例
在此配置中,所有内部间隙均设置为 5 像素,所有外部间隙均设置为 10,除顶部间隙外,其值为 0,因此顶部窗口与栏对齐。
可以使用以下调用实现此配置
river-bsp-layout --inner-gap 5 --outer-gap 10 --og-top 0
此配置具有均匀的外部间隙为 10 像素,每个边缘的内部间隙为 5 像素。
river-bsp-layout --inner-gap 5 --outer-gap 10
此配置主要用于演示可以单独配置边缘间隙的可能性。
river-bsp-layout --ig-top 1 --og-bottom 5 --ig-right 10 --og-left 15 --og-top 20 --ig-bottom 25 --og-right 30 --ig-left 35
此运行演示了在分割时将屏幕分割成不等大小的块的能力。这允许您更专注于主要窗口。
river-bsp-layout --inner-gap 5 --outer-gap 10 --split-perc 0.61803
Riverctl 用户命令
大部分情况下,您可以将与启动时发送给 bsp-layout 相同的选项传递给 riverctl send-layout-cmd
。然而,一些额外的 riverctl
选项存在,例如 --start-vsplit
,这将设置垂直分割为主分割。
此外,还有选项 --(inc|dec)-(h|v)split
,这允许您从当前分割百分比中添加或减去指定数量。此命令可以用来暂时将更多注意力集中在特定窗口上,并且当与快捷键绑定时非常方便。
最后,--reverse
选项——虽然不是新的——与同名 cli 选项的行为略有不同。cli 的行为是在屏幕的右侧和底部渲染新视图,而用户 cmd 选项将在每次调用时将堆栈反转到现有状态的反面。
与之前版本的 bsp-layout 中每次只能解析一个命令不同,2.1.0 版本及以后的版本能够解析几乎同时传递的任何选项组合。唯一例外是 --start-vsplit
和 --start-hsplit
,这两个选项是互斥的。
Usage: riverctl send-layout-cmd bsp-layout [OPTIONS]
Inner Gap Options:
-i, --inner-gap <DEFAULT_INNER_GAP>
The number of pixels to pad each inner edge of a window by default
-l, --ig-left <IG_LEFT>
The number of pixels to pad the left inner edge of each window. This Overrides `default_inner_gap`. Optional
-r, --ig-right <IG_RIGHT>
The number of pixels to pad the right inner edge of each window. This Overrides `default_inner_gap`. Optional
-b, --ig-bottom <IG_BOTTOM>
The number of pixels to pad the bottom inner edge of each window. This Overrides `default_inner_gap`. Optional
-t, --ig-top <IG_TOP>
The number of pixels to pad the top inner edge of each window. This Overrides `default_inner_gap`. Optional
Outer Gap Options:
-o, --outer-gap <DEFAULT_OUTER_GAP>
The default size of the gap between windows and the edge of the screen
-L, --og-left <OG_LEFT>
The number of pixels to place between the left screen edge and any windows. Overrides `default_outer_gap` for the left side. Optional
-R, --og-right <OG_RIGHT>
The number of pixels to place between the right screen edge and any windows. Overrides `default_outer_gap` for the right side. Optional
-B, --og-bottom <OG_BOTTOM>
The number of pixels to place between the bottom screen edge and any windows. Overrides `default_outer_gap` for the bottom side. Optional
-T, --og-top <OG_TOP>
The number of pixels to place between the top screen edge and any windows. Overrides `default_outer_gap` for the top side. Optional
Split Options:
-s, --split-perc <DEFAULT_SPLIT_PERC>
The default percentage of available area that the primary window should occupy after any split takes place
-H, --hsplit-perc <HSPLIT_PERC>
The percentage of available area that the primary window should occupy after a horizontal split. This will override the value of `default_split_perc` only for horizontal splits
-v, --vsplit-perc <VSPLIT_PERC>
The percentage of available area that the primary window should occupy after a vertical split. This will override the value of `default_split_perc` only for vertical splits
--start-hsplit
Set the first split to horizontal. Mutually exclusive with `--start-vsplit`
--start-vsplit
Set the first split to vertical. Mutually exclusive with `--start-hsplit`
--inc-hsplit <INC_HSPLIT>
Increase the hsplit percentage by a certain amount
--inc-vsplit <INC_VSPLIT>
Increase the vsplit percentage by a certain amount
--dec-vsplit <DEC_VSPLIT>
Decrease the vsplit percentage by a certain amount
--dec-hsplit <DEC_HSPLIT>
Decrease the hsplit percentage by a certain amount
Other Options:
--reverse
Reverse the order of the views as well as the order they are added
用户命令示例
- 翻转堆栈的朝向,并将所有内部间距设置为 5 像素宽
riverctl send-layout-cmd bsp-layout "--reverse -i 5"
- 将快捷键绑定到增加垂直分割百分比的少量操作
riverctl map normal $MOD+Shift L send-layout-cmd bsp-layout "--inc-vsplit .005"
- 将堆栈的第一个分割设置为水平
riverctl send-layout-cmd bsp-layout "--start-hsplit"
依赖项
~7–21MB
~251K SLoC