aboutsummaryrefslogtreecommitdiff
path: root/kitty/kitty-themes/.tools/libcapture.sh
blob: ff5159187efbd18c87586370b2ee6760ee4ab7d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env bash

function capture_linux() {
	local title="$1"
	local output="$2"
	import -window "$title" "$output"
}

function capture_osx() {
	local title="$1"
	local output="$2"
	# get system id of the new created window
	sys_id=$(./windowid.swift "kitty" "$title")
	screencapture -wl"$sys_id" "$output"
}

function capture() {
	if [[ "$OSTYPE" == "linux-gnu" ]]; then
		capture_linux "$@"
	elif [[ "$OSTYPE" == "darwin"* ]]; then
		capture_osx "$@"
	fi
}