https://github.com/porfanid/workspace-switcher
Project to create a utility to switch between workspaces on a Xorg system
https://github.com/porfanid/workspace-switcher
linux open-source productivity utility x11 x11-wm xorg xserver
Last synced: about 1 month ago
JSON representation
Project to create a utility to switch between workspaces on a Xorg system
- Host: GitHub
- URL: https://github.com/porfanid/workspace-switcher
- Owner: porfanid
- License: mit
- Created: 2024-07-30T14:03:26.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2025-11-08T18:15:08.000Z (7 months ago)
- Last Synced: 2026-05-05T02:39:47.846Z (about 1 month ago)
- Topics: linux, open-source, productivity, utility, x11, x11-wm, xorg, xserver
- Language: C++
- Homepage: https://porfanid.github.io/Workspace-Switcher/
- Size: 653 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Workspace Switcher
## Overview
**Workspace Switcher** is a C++ program designed to switch between workspaces on X11 display servers. Utilizing the Xlib library, it allows users to navigate between workspaces with ease.
## Features
- Switch to the next workspace.
- Switch to the previous workspace.
## Requirements
- **X11 Development Libraries**: Required for X11 support.
- **C++17 or later**: Recommended for compatibility and modern features.
## Installation
You can install **Workspace Switcher** using one of the following methods:
### 1. Install from PPA
For Ubuntu users, installing from the PPA is the easiest method. First, add the PPA to your system and then install the package:
```bash
sudo add-apt-repository ppa:porfanid/workspaces
sudo apt-get update
sudo apt-get install workspace-switcher
```
### 2. Build from Source
If you prefer to build the application from source, follow these steps:
#### Install Dependencies
Install the necessary development libraries:
```bash
sudo apt-get install libx11-dev libxrandr-dev
```
#### Clone the Repository
Clone the repository to your local machine:
```bash
git clone https://github.com/porfanid/workspace-switcher.git
cd workspace-switcher
```
#### Build and Install the Program Using CMake
**Local Installation**: Build the program in the local directory:
```bash
mkdir build
cd build
cmake ..
make
```
This will generate the executable named `workspaces` in the local directory.
**Global Installation**: To install the program globally:
```bash
mkdir build
cd build
cmake ..
make install
```
This will install the executable named `workspaces` to your global system directories.
## Usage
Run the program with either `next` or `prev` as an argument to switch to the next or previous workspace, respectively.
### For X11:
```bash
./workspaces next
./workspaces prev
```
#### Demo
Here is a demonstration of the Workspace Switcher in action:
https://github.com/user-attachments/assets/cbda1d2b-cc11-4164-9144-d610973773fe
https://github.com/user-attachments/assets/13ab7ee9-1896-4bfc-9b22-c990d8027298
## How It Works
The program performs the following steps to switch workspaces:
1. **Open Display**: Connects to the X server.
2. **Get Root Window**: Retrieves the root window for the current display.
3. **Get Number of Workspaces**: Queries the number of available workspaces.
4. **Get Current Workspace**: Retrieves the ID of the current workspace.
5. **Calculate Target Workspace**: Determines which workspace to switch to based on user input (`next` or `prev`).
6. **Switch Workspace**: Sends an X11 `ClientMessage` event to change the workspace.
## Contributing
If you'd like to contribute to the project, please follow these steps:
1. **Fork the Repository**: Create a personal copy of the repository on GitHub.
2. **Create a New Branch**: Develop your feature or bug fix in a new branch.
3. **Submit a Pull Request**: Open a pull request with a clear description of your changes.
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
## Contact
For any questions or feedback, please contact:
- **Email**: pavlos[at]orfanidis.net.gr
- **GitHub**: [porfanid](https://github.com/porfanid)
---