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: pi3-sway-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 pi3-sway-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:

pi3-sway-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/agw/.config/sway/output/*

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

Future work

Here a few ideas on how to improve pi3-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.0.3.tar.gz (17.1 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.0.3-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sway-smart-workspace-0.0.3.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for sway-smart-workspace-0.0.3.tar.gz
Algorithm Hash digest
SHA256 5da034606410721c135515407715c072db33a9792c78e3f72a49c89fe77daab0
MD5 9ca6d121d12ff0a73cf889182f297992
BLAKE2b-256 5f4268e5aed88ae3a3e9ee5a505024f9d6e3a3fb41e7beb288c1dd5ae32e4ea2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sway_smart_workspace-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 21.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for sway_smart_workspace-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7e1669b1095842865489e2171ab1dec486ea5227b395a6e3baac4d5c1200dcdb
MD5 4fdbda1f25359b8cb898a0745f3e4247
BLAKE2b-256 1326f8cfa2ab381396f2459c6fdff3fb15f330c7d6c3f2bc8191899b3106c6bf

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