Skip to content

Instantly share code, notes, and snippets.

@sdsykes
sdsykes / SwapScreens.rb
Created October 12, 2015 10:17
Uses TotalSpaces2 to swap all windows to the other screen
#!/usr/bin/env ruby
require 'totalspaces2'
displays = TotalSpaces2.display_list
if displays.count != 2
puts "Must have 2 displays attached"
exit 1
end
@sdsykes
sdsykes / gist:df43e9ddaba4dabc05dc
Created October 26, 2015 14:33
cmx.io frame about sip
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css">
<script src="http://cmx.io/v/0.1/cmx.js" charset="utf-8"></script>
<style>.cmx-user-scene4 .cmx-text-border .cmx-path {stroke: orange}</style>
<body>
<div style="max-width:900px; -webkit-transform:rotate(0deg)">
<scene id="scene1" width="300">
<drawing t="translate(0,31)">
@sdsykes
sdsykes / desktop_equaliser.rb
Created November 24, 2017 07:56
Balance desktops after unplugging or plugging in an external monitor using TotalSpaces2
#!/usr/bin/env ruby
require 'totalspaces2'
columns = TotalSpaces2.grid_columns
displays = TotalSpaces2.display_list()
if displays.size == 1
spaces_count = TotalSpaces2.number_of_spaces
if spaces_count > columns && spaces_count % columns == columns - 1