Skip to main content

Simple program that looks through the sway config and finds the bound workspaces for each output, and then opening that workspace on the output, that the mouse is currently on.

Project description

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).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sway-smart-workspace-0.1.4.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sway_smart_workspace-0.1.4-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file sway-smart-workspace-0.1.4.tar.gz.

File metadata

  • Download URL: sway-smart-workspace-0.1.4.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for sway-smart-workspace-0.1.4.tar.gz
Algorithm Hash digest
SHA256 d2384e86c87d683d668a2b1256f0d0a791896b7625267a727c436a4c5624f944
MD5 37af7e2b80f32dd4fdb31a40e61f5a95
BLAKE2b-256 1eceb8f5aec7adeca5f0e796dfe582859db1265384c787dab7c218765152a83b

See more details on using hashes here.

File details

Details for the file sway_smart_workspace-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: sway_smart_workspace-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for sway_smart_workspace-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7d25447ded2c447dcca7ee9184bac86d260801cef73e517de707e5e66a910b4b
MD5 cd4fd31bb3ba9cfb27e7d32cee696bd0
BLAKE2b-256 52a5272080e843851be77595f34750f3dc674984f2345eb52b32769f05e5a8f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page