Skip to content

pabloavi/river-luatile-layout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

river-luatile-layout

WORK IN PROGRESS. LOTS OF BREAKING CHANGES TO BE MADE.

Pack of river layouts using river-luatile.

Table of Contents

Features

  • A lot of layouts.
  • Configuration file that reloads on window open/close.
  • Functions to be used inside mappings.
  • Per-monitor configuration.
  • Per-tag layout: remember the layout of each tag, even on restart.

Installation

Install river-luatile, and after that clone this project into its config directory (as this is only a config).

git clone https://github.com/pabloavi/river-luatile-layout.git ~/.config/river-luatile

Usage

Inside RiverWM, one may run the following commands to set the layout to luatile and start (or restart, wether it was already working) it:

killall river-luatile
riverctl spawn river-luatile
riverctl default-layout luatile

We provide some functions that can be used inside mappings, for example:

riverctl map normal Super+Control K send-layout-cmd luatile "main_count_up()"
riverctl map normal Super+Control H send-layout-cmd luatile "main_ratio_down()"
riverctl map normal Super SPACE send-layout-cmd luatile "cycle_layout()"
riverctl map normal Super+Shift SPACE send-layout-cmd luatile "cycle_layout(true)" # reverse

These are just examples, all available functions are listed in the Table below.

Functions

Function Description
toggle_gaps() Toggles gaps to standard value or 0.
switch_layout() Switches to the next layout.
cycle_layout(bool) Cycles through all layouts. If argument is true, it sets the layout to previous one; therefore, cycle_layout() goes to next layout.
list_layouts() Prints all available layouts alphabetically in /tmp/river_layouts.
main_count_up() Increases the number of main windows.
main_count_down() Decreases the number of main windows.
main_ratio_up() Increases the ratio of the main area.
main_ratio_down() Decreases the ratio of the main area.
toggle_prefer_horizontal() Toggles the prefer horizontal flag. When PREFER_HORIZONTAL is set to true, the windows try to maximize its horizontal area

Configuration

We provide a config file, layout.json, which should be placed in ~/.config/river. Below there is an example. It has a first field, default, which defines properties for all layouts; if one variable (or the whole field) remains unset, they will be assigned a fallback value. Additionally, there is a field for each monitor (output, for river). Inside it, there is a layout field to set its starting layout, and an override with a configuration per layout, whose variables will have priority with respect to default.

{
  "default": {
    "layout": "rivertile",
    "MAIN_RATIO": 0.65,
    "INNER_GAPS": 10,
    "OUTER_GAPS": 10,
    "SMART_GAPS": false,
    "MAIN_COUNT": 2,
    "PREFER_HORIZONTAL": true
  },
  "eDP-1": {
    "layout": "centered",
    "override": {
      "centered": {
        "MAIN_RATIO": 0.5,
        "GAPS": 10,
        "SMART_GAPS": false,
        "MAIN_COUNT": 1,
        "PREFER_HORIZONTAL": false
      },
      "monocle": {
        "OFFSET": 20
      },
      "rivertile": {
        "MAIN_COUNT": 2
      },
      "grid": {
        "PREFER_HORIZONTAL": false
      }
    }
  }
}

It is important to note that all variables are parsed to Lua as global variables, so they must be the same defined below. Furthermore, not every variable applies to every layout (even though setting it doesn't cause any issue).

Variables

Variable Description
MAIN_RATIO Ratio of the main area.
GAPS Gaps between windows.
SMART_GAPS If true, gaps are only applied when there are more than one window.
MAIN_COUNT Number of main windows.
PREFER_HORIZONTAL If true, the windows try to maximize its horizontal area.
OFFSET Offset of the monocle layout.

Layouts

(Using Waybar and a modified version of One Dark Pro colorscheme, by NvChad).

BSPWM (dwindle)

Default Reverse
bspwm bspwm_reverse

Centered

Notice in the second image that the split comes first to the right side (that's what REVERSE does in this layout). When using more than one main (MAIN_COUNT>1) the horizontal/vertical flag becomes useful.

Default, 1 main Reverse, 2 main, PREFER_HORIZONTAL = true
centered centered_2_reverse

Grid

In grid layout, we never let empty spaces around the screen. Therefore, the parameter PREFER_HORIZONTAL is provided to choose how to cover that space maximizing space of windows horizontally or vertically.

Prefer horizontal Prefer vertical
grid_horizontal grid_vertical

Monocle

MADE BY pinpox, monocle

Just almost maximized windows; notice the offset of windows top-right and the border of main window.

monocle

Rivertile

MADE BY KMIJPH, rivertile. Slightly modified to not have empty space and to support SMART_GAPS = true.

The basic rivertile layout, with option to use more than one main window, and place them top/bottom and left/right.

rivertile

Rivertile-simple

MADE BY MaxVerevkin, rivertile_simple

The default layout of river-luatile, with no option to use more than one main window or modify its placement.

rivertile_simple

Tabbed (although no tab)

It can be set to keep the main window left or right. Notice that the space in left-bottom of the screen; the windows can be seen with a vertical offset. In the second image, the fourth window is selected, to see that it can be changed. A function bring_to_front() is provided, to move the current window to the top of its "deck".

View 1 & 2 View 1 & 4
tabbed tabbed_2

TODO

In order of priority:

  • Add support for SMART_BORDERS.
  • Finish README.md.
  • Add full support of INNER_GAPS and OUTER_GAPS (only remains rivertile).
  • Improve centered split when there are fewer windows than MAIN_COUNT.
  • Refactor bspwm layout, as it is dirty (even though it perfectly works).
  • Add support for MAIN_COUNT in bspwm layout.

About

river-luatile layouts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages