Skip to content

RadioNoiseE/exposway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MacOS X Expose Feature Implementation on swayWM

Chinese version available: README-zh_CN.org.

exposway.png

Bring MacOS X Expose-like features to life on swayWM!

Version

Currently still in the experimental stage, contributions are welcomed! See the ‘Contributions’ section.

Introduction

This implements the feature to overview all opened applications’ window and quickly switch to the selected window under the swayWM window manager. It’s inspired by MacOS X’s Expose feature, similar to:

  1. MacOS’s Mission Control;
  2. Gnome’s Activities Overview;
  3. KDE’s Present Windows.

Currently this only supports Linux, and not yet being adapted to BSD (though in the roadmap).

As far as I know, there is no such implementations under window managers. In swayWM, there is a similar thing called sov (Sway OverView), but it only provides workspace preview functionality without workspace snapshot preview. As they said:

No down-scaled and confusing thumbnails, just crystal clear app names and titles.

The reason, I believe, is that it’s difficult to obtain snapshots/status of all application windows without hacking the compositor under Wayland. This program solves this problem by using a bash script that launches with swayWM to receive windows’ update-related messages from sway-ipc, then calling grim to take screenshots and storing them in a cache directory, which will be further discussed in the ‘FAQ’ chapter.

Features

Lightweight & Minimal dependencies.

Installation

Dependencies

DependencyDescription
swayWMRequired
WaylandRequired, tested version is 1.22.0
CairoRequired for interface drawing
PangoRequired for text rendering
xkbcommonRequired for handling keyboard input
jqUsed in collect.sh for parsing JSON, can be replaced
grimUsed in collect.sh for taking application window snapshots, can be replaced

Installation

Clone this project locally and run:

make

By default it uses doas instead of sudo, clang as the default C compiler and installs the binary to /usr/local, to change this behaviour, use:

make CC=gcc SU=sudo PREFIX=/usr # use gcc as compiler, sudo and install binary to /usr/bin/*

Then modify the swayWM configuration file, add:

bindsym $mod+z exec exposway  # Trigger expose when the mod+z shortcut is pressed
exec exposway-daemon          # Execute daemon when swayWM starts

Finally, add environment variables, such by adding to the ~/.bashrc file:

export EXPOSWAYMON="$HOME/.local/state/exposway/output"
export EXPOSWAYDIR="$HOME/.local/state/exposway/"

This specifies the cache directory used by exposway, and if there’s a need to change it, remember also to modify collect.sh.

Now you can achieve the expose effect by pressing the shortcut key.

Usage

After setting up as above and restarting the device, you will enter Expose mode after you press the designated shortcut key. When the direction keys are pressed, a selection box will appear around the firstly created window. Press the arrow keys again to select the window you want to switch to and press space to jump to it.

To exit directly, press the esc key.

Configuration

Modify the expose.h header file and recompile. Configurable options include:

  • Selection box color/size/spacing;
  • Title size/color;
  • Monitor border/grid factor;
  • Key repeat.

FAQ

When encountering issues, please first launch the exposway-daemon using the -d option and run exposway in the terminal, then check the log file located at $EXPOSWAYDIR/expose.log.

Application Snapshot Delay in Expose

Due to the current implementation, the application snapshot is only updated when an event (focus/fullscreen/move/float/title change) occurs for a particular window and the focus is on that window when the event is triggered. You can add a periodic update function in the collect.sh script, but it has not been implemented for resource considerations.

Incorrect Application Snapshots in Expose

Also due to implementation limitations. Typical scenarios include:

  • When you switch to a workspace, automatically focus on a window (at this point, exposway-daemon calls grim to update the window snapshot); then you quickly switch to another workspace. If the time you stay on that workspace is too short, grim will capture the snapshot of the last stayed workspace due to a slight delay of grim.
  • When you open a window and then quickly create another window on top of it, grim will capture the snapshot of the occluded window; this generally won’t happen as the first window wouldn’t gain focus.

Contributions

This project is still in the vary experimental stage and contributions are very welcomed!

Features planned to be implemented (in order of priority):

  • More elegant/robust application snapshot acquisition;
  • Code optimization such as frame redraw mechanism;
  • Improved Expose algorithm;
  • Improved windows traversing algorithm;
  • Gradual/fade-in and fade-out animations on startup and exit;
  • Use mouse to select windows.

Any other new features are also welcomed. Fell free to open issues for discussion/open PRs.

Please use LLVM for code style. For clangd related LSP, use make compdb to generate complie_commands.json.

About

MacOS X Exposé like feature for SwayWM.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published