cortile

command module
v2.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2024 License: MIT Imports: 13 Imported by: 0

README

Cortile

build date downloads os platform

Linux auto tiling manager with hot corner support for Openbox, Fluxbox, IceWM, Xfwm, KWin, Marco, Muffin, Mutter and other EWMH compliant window managers using the X11 window system. Therefore, this project provides dynamic tiling for XFCE, LXDE, LXQt, KDE and GNOME (Mate, Deepin, Cinnamon, Budgie) based desktop environments.

Simply keep your current window manager and install cortile on top of it. Once enabled, the tiling manager will handle resizing and positioning of existing and new windows.

Features features

  • Workspace based tiling.
  • Auto detection of panels.
  • User interface for tiling mode.
  • Systray icon indicator and menu.
  • Keyboard, hot corner and systray bindings.
  • Vertical, horizontal and fullscreen mode.
  • Socket communication commands.
  • Remember layout proportions.
  • Floating and sticky windows.
  • Drag & drop window swap.
  • Workplace aware layouts.
  • Multi monitor support.

Support for keyboard and mouse events sets cortile apart from other tiling solutions. The go implementation ensures a fast and responsive system, where multiple layouts, keyboard shortcuts, drag & drop and hot corner events simplify and speed up your daily work.

demo

Installation installation

Manually download/extract the latest binary file from releases or use wget/tar:

wget -qO- $(wget -qO- https://api.github.com/repos/leukipp/cortile/releases/latest | \
jq -r '.assets[] | select(.name | contains ("linux_amd64.tar.gz")) | .browser_download_url') | \
tar -xvz

Run the binary file and cortile will automatically tile until you stop it:

./cortile

Another installation method can be found in the development section. The latest official release is published on GitHub. Versions distributed via package managers are community supported and may be outdated.

Service

To enable auto tiling on startup, you can run cortile as a service after the graphical user interface has been loaded. A template to run cortile as a systemd service is provided in the services folder. You may have to adjust the filepath/symlink under ExecStart and enable the user service:

# copy systemd service file
cp cortile.service ~/.config/systemd/user/

# reload systemd configuration
systemctl --user daemon-reload

# enable systemd service
systemctl --user enable cortile.service

# start systemd service
systemctl --user start cortile.service
Usage

The layouts are based on the master-slave concept, where one side of the screen is considered to be the master area and the other side is considered to be the slave area:

  • vertical-right: split the screen vertically, master area on the right.
  • vertical-left: split the screen vertically, master area on the left.
  • horizontal-top: split the screen horizontally, master area on the top.
  • horizontal-bottom: split the screen horizontally, master area on the bottom.
  • maximized: single window that fills the entire tiling area.
  • fullscreen: single window that fills the entire screen.

The number of windows per side and the occupied space can be changed dynamically. Adjustments to window sizes are considered to be proportion changes of the underlying layout.

Windows placed on the master side are static and the layout will only change as long the space is not fully occupied. Once the master area is full, the slave area is used, where the layout changes dynamically based on available space and configuration settings.

Configuration configuration

The configuration file is located at ~/.config/cortile/config.toml (or XDG_CONFIG_HOME) and is created with default values during the first startup. Additional information about individual entries can be found in the comments section of the config.toml file.

config

Shortcuts

The default keyboard shortcuts are assigned as shown below. If some of them are already in use by your system, update the default values in the [keys] section of the configuration file:

Keys Description
Ctrl+Shift+Home Enable tiling on the current screen
Ctrl+Shift+End Disable tiling on the current screen
Ctrl+Shift+R Disable tiling and restore windows
Ctrl+Shift+T Toggle between enable and disable
Ctrl+Shift+BackSpace Reset layouts to default proportions
Ctrl+Shift+Next Cycle through next layouts
Ctrl+Shift+Prior Cycle through previous layouts
Ctrl+Shift+Left Activate vertical-left layout
Ctrl+Shift+Right Activate vertical-right layout
Ctrl+Shift+Up Activate horizontal-top layout
Ctrl+Shift+Down Activate horizontal-bottom layout
Ctrl+Shift+Space Activate maximized layout
Ctrl+Shift+Return Activate fullscreen layout
Ctrl+Shift+KP_5 Make the active window master
Ctrl+Shift+KP_6 Make the next window master
Ctrl+Shift+KP_4 Make the previous window master
Ctrl+Shift+KP_Add Increase number of master windows
Ctrl+Shift+KP_Subtract Decrease number of master windows
Ctrl+Shift+Plus Increase number of maximum slave windows
Ctrl+Shift+Minus Decrease number of maximum slave windows
Ctrl+Shift+KP_3 Increase proportion of master-slave area
Ctrl+Shift+KP_1 Decrease proportion of master-slave area
Ctrl+Shift+KP_2 Focus next window
Ctrl+Shift+KP_8 Focus previous window

Hot corner events are defined under the [corners] section and are triggered when the pointer enters one of the target areas:

Corners Description
Top-Left Focus previous window
Top-Right Make the active window master
Bottom-Right Increase proportion of master-slave area
Bottom-Left Decrease proportion of master-slave area

Systray events are defined under the [systray] section and are triggered when the pointer keys are pressed while hovering the icon:

Pointer Description
Middle-Click Toggle between enable and disable
Scroll-Up Cycle through previous layouts
Scroll-Down Cycle through next layouts
Scroll-Right Increase proportion of master-slave area
Scroll-Left Decrease proportion of master-slave area

Common pointer shortcuts used in some environments:

  • Move window: Alt+Left-Click.
  • Resize window: Alt+Right-Click.
  • Maximize window: Alt+Double-Click.

Communication communication

External processes may communicate directly with cortile using unix domain sockets. The sock parameter (-sock /tmp/cortile.sock) defines a path for a socket file that can be used to exchange data between processes. Internally however, two socket files are used. One is for incoming (/tmp/cortile.sock.in) and one for outgoing (/tmp/cortile.sock.out) communication.

Outgoing - Events
Outgoing events and states

User triggered events (e.g. tile workspace) are broadcasted to the outgoing socket as json string. One can listen to them by using netcat or similar alternatives:

# Netcat
nc -Ulk /tmp/cortile.sock.out

# Socat
socat UNIX-LISTEN:/tmp/cortile.sock.out,reuseaddr,fork STDOUT

For debugging purposes, you can also dump the json messages into a file:

# Netcat
nc -Ulk /tmp/cortile.sock.out 2>&1 | tee /tmp/cortile.json

# Socat
socat -v UNIX-LISTEN:/tmp/cortile.sock.out,reuseaddr,fork OPEN:/tmp/cortile.json,create,truncate
Incoming - Commands
Incoming commands and requests

Similarly, requests about the internal state of cortile can be sent to the incoming socket:

# Netcat
echo '{"State":"workspaces"}' | nc -U /tmp/cortile.sock.in

# Socat
echo '{"State":"workspaces"}' | socat STDIN UNIX-CONNECT:/tmp/cortile.sock.in

Since the communication is asynchronous, it is necessary to listen to the outgoing socket at the same time in order to receive the response.

Example files for sending commands and receiving states can be found in the scripts folder.

Development development

You need go >= 1.20 to compile cortile.

Install - go
Option 1: Install go via package manager

Use a package manager supported on your system:

# apt
sudo apt install golang

# yum
sudo yum install golang

# dnf
sudo dnf install golang

# pacman
sudo pacman -S go
Option 2: Install go via archive download

Download a binary release suitable for your system:

cd /tmp/ && wget https://dl.google.com/go/go1.20.linux-amd64.tar.gz
sudo tar -xvf go1.20.linux-amd64.tar.gz
sudo mv -fi go /usr/local

Set required environment variables:

echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.profile
echo "export GOPATH=~/.go" >> ~/.profile
source ~/.profile

Verify the installed go version:

go env | grep "GOPATH\|GOVERSION"
Install - cortile
Option 1: Install cortile via remote source

Install directly from develop branch:

go install github.com/leukipp/cortile@develop
Option 2: Install cortile via local source

Clone source code from develop branch:

git clone https://github.com/leukipp/cortile.git -b develop
cd cortile

If necessary you can make local changes, then execute:

go install -ldflags="-X 'main.date=$(date --iso-8601=seconds)'"

Start cortile in verbose mode:

$GOPATH/bin/cortile -v

Additional additional

Special settings:

  • Use the edge_margin property to account for additional spaces.
    • e.g. for deskbar panels or conky infographics.
  • Use the window_slaves_max property to limit the number of windows.
    • e.g. with one active master and window_slaves_max = 2, all windows following the third window are stacked behind the two slaves.

Hot corners:

  • Use tiling_enabled = false if you prefer to utilize only the hot corner functionalities.
  • Use the hot [corners] properties to execute any external command available on your system.
    • e.g. use bottom_center = "firefox" to open a web browser window.

Systray:

  • Use the tiling_icon property to add any external command to the systray menu.
    • e.g. use tiling_icon = [...,['firefox', 'Open Browser'],...] to add a web browser entry.

Issues issues

Cortile works best with Xfwm and Openbox window systems. However, it`s still possible that you may encounter problems during usage.

Windows:

  • It's recommended to disable all build-in window snapping features (snap to other windows, snap to screen borders).
  • Automatic panel detection may not work under some window managers, use the edge_margin property to adjust for additional margins.
  • Particularly in GNOME based desktop environments, window displacements or resizing issues may occur.
  • Sticky windows may cause unwanted layout modifications during workspace changes.

Systray:

  • Adjust the bindings in the [systray] section, as some pointer events may not fire across different desktop environments.
  • Window managers not supporting StatusNotifierItem for displaying systray icons will need to install snixembed.

Debugging:

  • If you encounter problems start the process with cortile -vv, which provides additional debug outputs.
  • A log file is created by default under /tmp/cortile.log.

Credits credits

Based on zentile (Berin Larson) and pytyle3 (Andrew Gallant).
The main libraries used in this project are xgbutil, toml, systray, dbus, fsnotify and logrus.

License license

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL