Created
December 4, 2012 12:39
-
-
Save meise/4203395 to your computer and use it in GitHub Desktop.
script to capture current i3 workspace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bindsym $mod+Shift+S exec /usr/local/bin/screenshot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
require 'json' | |
require 'pathname' | |
WORKSPACES = JSON.load(`i3-msg -t get_workspaces`) | |
STORAGE_LOCATION = Pathname(ENV['HOME'] + '/screenshots') | |
WORKSPACES.each do |workspace| | |
next unless workspace['visible'] | |
image_path = STORAGE_LOCATION + "#{workspace['num']}.#{rand(0-9999)}.png" | |
%x{ i3-msg workspace #{workspace['name']} } | |
sleep 1 | |
%x{ import -window root #{image_path} } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment