Skip to main content

About

Simple program that allows sway to include configurations for several outputs allowing the user to have 10 workspaces for each output that they'll ever connect to. And by a combination of the usual controls and the cursor location change workspace only on the output that the focus is on.

This also allows for a more seameless interaction with how workspaces are openend.

Usage

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

Installation

Install using pip (recommended):

pip install sway-smart-workspace

Before using this script for what is meant to do, you need to call it once.

this creates a folder with the controls and outputs for the output that you currently are on

default location :: is $HOME/.config/sway/outputs

if you wish to change which folder is used, the script needs to be called with the --output-location parameter else just call it like so:

 sway-smart-workspace -i 1

Now that the controls and output configuration is created, you have to locate the place in you own sway config that usually handels these controls, and remove them. Instead, replace it with an include statement for where your outputs folder is located.

So in otherwords instead of:

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

You should have

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

Now reload you sway configuration and you are good to go.

Future work

Here a few ideas on how to improve sway-smart-workspace could be improved in the future. If anyone wants to submit a pr that solves one of the problems stated below feel free to do so :)

  • Automatically yeet the default sway configuration of the worksapaces so that a more smooth install can happen
  • Never install something with pip in the global sence is kinda a bummer here, so an aur package would probably be good.

Credits

Thanks to Michał Wieluński for an inspiration (pi3-switch) and Tony Crisci for an easy-to-use i3 python library (i3ipc-python).

Metadata

Release files for sway-smart-workspace 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sway-smart-workspace 0.1.4
File Size Uploaded
sway-smart-workspace-0.1.4.tar.gz 17.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sway-smart-workspace 0.1.4
File Interpreter ABI Platform
sway_smart_workspace-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 34.5 kB

Release files / sway-smart-workspace-0.1.4.tar.gz

Download URL sway-smart-workspace-0.1.4.tar.gz
Size 17.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d2384e86c87d683d668a2b1256f0d0a791896b7625267a727c436a4c5624f944
BLAKE2b-256 checksum
How to use checksums
1eceb8f5aec7adeca5f0e796dfe582859db1265384c787dab7c218765152a83b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

Release files / sway_smart_workspace-0.1.4-py3-none-any.whl

Download URL sway_smart_workspace-0.1.4-py3-none-any.whl
Size 17.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d25447ded2c447dcca7ee9184bac86d260801cef73e517de707e5e66a910b4b
BLAKE2b-256 checksum
How to use checksums
52a5272080e843851be77595f34750f3dc674984f2345eb52b32769f05e5a8f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.0

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page