Skip to main content

一个简单的程序,它查看 sway 配置并找到每个输出的绑定工作区,然后在鼠标当前打开的输出上打开该工作区。

项目描述

关于

允许 sway 包含多个输出的配置的简单程序,允许用户为他们将连接到的每个输出拥有 10 个工作区。并且通过组合通常的控件和光标位置仅在焦点所在的输出上更改工作区。

这也允许与工作空间的开放方式进行更无缝的交互。

用法

usage: sway-smart-workspace [-h] [-d] -i INDEX [-o OUTPUT_LOCATION] [-s] [-k]

Changes the workspace, based on what output your cursor is on.

optional arguments:
  -h, --help            show this help message and exit
  -d, --debug           Turn on debug mode.

Required:

 -i INDEX, --index INDEX
                       The indexed workspace for the output where the cursor is currently located
 -o OUTPUT_LOCATION, --output-location OUTPUT_LOCATION
                    The dir for where the location output configurations are located

Shift:
  manipulate the active window

 -s, --shift           Moves the active window to the index workspace
 -k, --keep-with-it    Moves the active window to the index workspace, and moves with it

安装

使用 pip 安装(推荐):

pip install sway-smart-workspace

在使用此脚本执行预期操作之前,您需要调用它一次。

这将创建一个文件夹,其中包含您当前所在输出的控件和输出

默认位置 :: 是 $HOME/.config/sway/outputs

如果您希望更改使用的文件夹,则需要使用 --output-location 参数调用脚本,否则只需像这样调用它:

 sway-smart-workspace -i 1

现在控件和输出配置已创建,您必须在自己的 sway 配置中找到通常处理这些控件的位置,然后将其删除。相反,将其替换为包含您的输出文件夹所在位置的语句。

所以换句话说,而不是:

bindsym $mod+1 workspace number 1
bindsym $mod+2 workspace number 2
bindsym $mod+3 workspace number 3
bindsym $mod+4 workspace number 4
bindsym $mod+5 workspace number 5
bindsym $mod+6 workspace number 6
bindsym $mod+7 workspace number 7
bindsym $mod+8 workspace number 8
bindsym $mod+9 workspace number 9
bindsym $mod+0 workspace number 10

bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10

你应该有

include $HOME/.config/sway/outputs/*

现在重新加载你的摇摆配置,你就可以开始了。

未来的工作

这里有一些关于如何改进 sway-smart-workspace 的想法,将来可以改进。如果有人想提交解决以下问题之一的公关,请随时这样做:)

  • 自动调整工作区的默认摇摆配置,以便进行更顺畅的安装
  • 永远不要在全球范围内安装带有 pip 的东西在这里有点糟糕,所以 aur 包可能会很好。

学分

感谢 Michał Wieluński 的灵感 ( pi3-switch ) 和 Tony Crisci 的易于使用的 i3 python 库 ( i3ipc-python )。

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

sway-smart-workspace-0.1.4.tar.gz (17.0 kB 查看哈希

已上传 source

内置分布

sway_smart_workspace-0.1.4-py3-none-any.whl (17.5 kB 查看哈希

已上传 py3