mirror of
https://github.com/dperelman/swap-workspaces.git
synced 2026-05-10 02:12:02 -04:00
Swap/move the current workspace (and all its windows), with either the next, previous or a specified target workspace.
| delete-empty-workspace.sh | ||
| insert-workspace.sh | ||
| LICENSE | ||
| move-to-workspace.sh | ||
| notes.adoc | ||
| README.adoc | ||
| swap-workspaces.sh | ||
# swap-workspaces Swap/move the current workspace, with either the next, previous or a specified target workspace. This swaps over all the windows from the src and target workspaces, then swaps the workspace names. Also includes helper scripts that use that `insert-workspace.sh` and `delete-empty-workspace.sh` that will add/remove a workspace in the middle of the list instead of the normal behavior of doing so at the end by swapping workspaces before/after deleting/adding the workspace. Also includes another script `move-to-workspace.sh` that allowing moving just some windows to a different workspace to support splitting a workspace into two or more workspaces. It uses `zenity` to allow selection of which desktop to move windows to and then every window left-clicked on will be moved to that desktop until another mouse button is clicked. ## Requirements You need `wmctrl` installed. See: https://www.freedesktop.org/wiki/Software/wmctrl/ For Debian/Ubuntu, you can do: ```shell $ sudo apt install wmctrl ``` Uses my https://git.aweirdimagination.net/perelman/rename-desktop script to avoid the dependency on Xfce of the upstream version. You can install it with ```shell $ pipx install https://git.aweirdimagination.net/perelman/rename-desktop/archive/main.zip ``` ## Installation ```shell $ sudo cp swap-workspaces.sh /usr/bin/swap-workspaces ``` ## Usage ### Swap with specific workspace, by ID You can swap the current workspace with any other by passing in the target workspace id: ```shell $ swap-workspaces <target workspace id> ``` NOTE: This expects XFCE workspace numbers, which start from 1. ### Swap with previous or next workspace This will move the current workspace left or right, by swapping it with the previous or next workspace: ```shell $ swap-workspace prev $ swap-workspace next ``` ### Insert workspace after the current one This may take some time as it actually adds a new workspace at the end and swaps it one-by-one over to the current position. ```shell $ insert-workspace.sh ``` ### Delete the current workspace As the filename suggests, this will do nothing if there are windows on the current workspace (ignoring windows that are on all workspaces). It will first swap the current workspace over to be the last one and then remove it. ```shell $ delete-empty-workspace.sh ``` ### Move some windows to a different workspace ```shell $ move-to-workspace.sh ``` ## Credits The rename desktop code came from https://github.com/ngeiswei/rename-xfce-workspace