Skip to main content

Simple program that looks through the i3 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 looks through the i3 config and finds the bound workspaces for each output, and then opening that workspace on the output, that the mouse is currently on.

Allowing for a more seameless interaction with how workspaces are openend.

Usage

usage: pi3-smart-workspace [-h] [-d] -i INDEX [-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

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-smart-workspace

Example config to be inserted into your i3 config.

# Displays
set $primary eDP
set $top HDMI-A-0
set $bottom HDMI2

# Workspaces
set $ws1 1:1
... # And so on
set $ws{n} {n}:{n}

set $TopWs1 {n+1}:1
... # and so on
set $TopWs{k} {n+1+k}:{k}

set $BottomWs1 {k+1}:1
... # and so on
set $BottomWs{q} {k+1+q}:{q}

workspace $ws1 output $primary
... # and so on
workspace $ws{n} output $primary

workspace $TopWs1 output $top
... # and so on
workspace $TopWs{k} output $top

workspace $BottomWs1 output $bottom
... # and so on
workspace $BottomWs{q} output $bottom

# Shift workspace
bindsym $mod+1 exec --no-startup-id pi3-smart-workspace -i 1
bindsym $mod+2 exec --no-startup-id pi3-smart-workspace -i 2
bindsym $mod+3 exec --no-startup-id pi3-smart-workspace -i 3
bindsym $mod+4 exec --no-startup-id pi3-smart-workspace -i 4
bindsym $mod+5 exec --no-startup-id pi3-smart-workspace -i 5
bindsym $mod+6 exec --no-startup-id pi3-smart-workspace -i 6
bindsym $mod+7 exec --no-startup-id pi3-smart-workspace -i 7
bindsym $mod+8 exec --no-startup-id pi3-smart-workspace -i 8

# Move focused container to workspace
bindsym $mod+Shift+1 exec --no-startup-id pi3-smart-workspace -i 1 -s
bindsym $mod+Shift+2 exec --no-startup-id pi3-smart-workspace -i 2 -s
bindsym $mod+Shift+3 exec --no-startup-id pi3-smart-workspace -i 3 -s
bindsym $mod+Shift+4 exec --no-startup-id pi3-smart-workspace -i 4 -s
bindsym $mod+Shift+5 exec --no-startup-id pi3-smart-workspace -i 5 -s
bindsym $mod+Shift+6 exec --no-startup-id pi3-smart-workspace -i 6 -s
bindsym $mod+Shift+7 exec --no-startup-id pi3-smart-workspace -i 7 -s
bindsym $mod+Shift+8 exec --no-startup-id pi3-smart-workspace -i 8 -s

# Move to workspace with focused container
bindsym $mod+Ctrl+1 exec --no-startup-id pi3-smart-workspace -i 1 -sk
bindsym $mod+Ctrl+2 exec --no-startup-id pi3-smart-workspace -i 2 -sk
bindsym $mod+Ctrl+3 exec --no-startup-id pi3-smart-workspace -i 3 -sk
bindsym $mod+Ctrl+4 exec --no-startup-id pi3-smart-workspace -i 4 -sk
bindsym $mod+Ctrl+5 exec --no-startup-id pi3-smart-workspace -i 5 -sk
bindsym $mod+Ctrl+6 exec --no-startup-id pi3-smart-workspace -i 6 -sk
bindsym $mod+Ctrl+7 exec --no-startup-id pi3-smart-workspace -i 7 -sk
bindsym $mod+Ctrl+8 exec --no-startup-id pi3-smart-workspace -i 8 -sk

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

  • Save the outputs and the mapped outputs in a json file, instead of looking through the config every time a button is pressed.

    This would greatly reduce the cost of running this program, if we could just look up the required value in the json instead of the whole i3 config.

    In order for this to be a thing, we need to transition away from looking at active display, have the user set a exec_always and out indexer in their i3 config.

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

pi3-smart-workspace-0.1.21.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

pi3_smart_workspace-0.1.21-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file pi3-smart-workspace-0.1.21.tar.gz.

File metadata

  • Download URL: pi3-smart-workspace-0.1.21.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.9.0

File hashes

Hashes for pi3-smart-workspace-0.1.21.tar.gz
Algorithm Hash digest
SHA256 1dc329090b007782e03f2ac79902d9b64909dc000b61ca38db5c10ac3c0dd09f
MD5 b22a01df032731ebc6969aca84db45ca
BLAKE2b-256 0d2fdfe93703107203d51a4a64e02034446536e8047f44d401adc7f3121d151c

See more details on using hashes here.

File details

Details for the file pi3_smart_workspace-0.1.21-py3-none-any.whl.

File metadata

  • Download URL: pi3_smart_workspace-0.1.21-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.9.0

File hashes

Hashes for pi3_smart_workspace-0.1.21-py3-none-any.whl
Algorithm Hash digest
SHA256 9ce2e7d1a965c7ec349d7d98f132b3d761fc30507fb63f58a20c82885ec3fe46
MD5 22517badea5df5978d15ff7d6d53dc21
BLAKE2b-256 385d0461c03ab9602fea05a0404dc8f0358a2a3949c641dee198dd737cd69511

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