Skip to content

Instantly share code, notes, and snippets.

@robhurring
Last active December 15, 2015 16:09
Show Gist options
  • Save robhurring/5287144 to your computer and use it in GitHub Desktop.
Save robhurring/5287144 to your computer and use it in GitHub Desktop.
Bootstrap-like grid "framework" for slate window manager.
# add this to your ~/.slate file
# source our grid
source ~/.slate.grid if_exists
# use the grid to position windows
alias left-half move 0;0 ${span-6};${row-12}
alias right-half move ${push-6};0 ${span-6};${row-12}
alias top-left-quarter move 0;0 ${span-6};${row-6}
alias top-right-quarter move ${push-6};0 ${span-6};${row-6}
alias bottom-left-quarter move 0;${drop-6} ${span-6};${row-6}
alias bottom-right-quarter move ${push-6};${drop-6} ${span-6};${row-6}
# A 12x12 Grid "Framework" for Slate Window Manager
# NOTE: this could be much better in a .slate.js file :)
# Example2:
# # create a 6x4 window in the top-left cornet
# move 0;0 ${span-6};${row-4}
#
# # move a 6x12 (halfscreen) window next to the 6x4
# move ${push-6};0 ${span-6};${row-12}
#
# # move a 6x8 window in the bottom-left corner
# move 0;${drop-4} ${span-6};${row-8}
alias column screenSizeX/12.0
alias row screenSizeY/12.0
alias top screenOriginY
alias left screenOriginX
# Row Spans
# when "hightening" a window to Y rows (row-Y)
#
# Example:
# # create a window that takes up 50% of the screen
# resize ${span-6};${row-6}
alias row-1 ${row}*1
alias row-2 ${row}*2
alias row-3 ${row}*3
alias row-4 ${row}*4
alias row-5 ${row}*5
alias row-6 ${row}*6
alias row-7 ${row}*7
alias row-8 ${row}*8
alias row-8 ${row}*9
alias row-10 ${row}*10
alias row-11 ${row}*11
alias row-12 ${row}*12
# Column Spans
# when widening a window to X columns (span-X)
#
# Example:
# # create a window that takes up 50% of the screen
# resize ${span-6};${row-6}
alias span-1 ${column}*1
alias span-2 ${column}*2
alias span-3 ${column}*3
alias span-4 ${column}*4
alias span-5 ${column}*5
alias span-6 ${column}*6
alias span-7 ${column}*7
alias span-8 ${column}*8
alias span-8 ${column}*9
alias span-10 ${column}*10
alias span-11 ${column}*11
alias span-12 ${column}*12
# Offsets for rows
# when pushing a window Y rows from the top (drop-Y)
#
# Example:
# # create a window that takes up 50% of the screen
# resize ${span-6};${row-6}
alias drop-1 ${top}+(${row}*1)
alias drop-2 ${top}+(${row}*2)
alias drop-3 ${top}+(${row}*3)
alias drop-4 ${top}+(${row}*4)
alias drop-5 ${top}+(${row}*5)
alias drop-6 ${top}+(${row}*6)
alias drop-7 ${top}+(${row}*7)
alias drop-8 ${top}+(${row}*8)
alias drop-9 ${top}+(${row}*9)
alias drop-10 ${top}+(${row}*10)
alias drop-11 ${top}+(${row}*11)
alias drop-12 ${top}+(${row}*12)
# Offsets for columns
# when pushing a window X columns from the left (push-X)
#
# Example:
# # create a window that takes up the _right_ half of the screen
# move ${push-6};0 ${span-6};${row-6}
alias push-1 ${left}+(${column}*1)
alias push-2 ${left}+(${column}*2)
alias push-3 ${left}+(${column}*3)
alias push-4 ${left}+(${column}*4)
alias push-5 ${left}+(${column}*5)
alias push-6 ${left}+(${column}*6)
alias push-7 ${left}+(${column}*7)
alias push-8 ${left}+(${column}*8)
alias push-9 ${left}+(${column}*9)
alias push-10 ${left}+(${column}*10)
alias push-11 ${left}+(${column}*11)
alias push-12 ${left}+(${column}*12)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment