DevLog

์•Œํ”„๋ ˆ๋“œ ํ„ฐ๋ฏธ๋„ iterm์œผ๋กœ ๋ณ€๊ฒฝ ๋ณธ๋ฌธ

๐Ÿง‘๐Ÿป‍๐Ÿ’ป ๊ฐœ๋ฐœ๊ฐœ๋ฐœ/๊ธฐํƒ€

์•Œํ”„๋ ˆ๋“œ ํ„ฐ๋ฏธ๋„ iterm์œผ๋กœ ๋ณ€๊ฒฝ

Seungjae Lee 2021. 10. 31. 15:39
-- Set this property to true to always open in a new window
property open_in_new_window : true

-- Handlers
on new_window()
	tell application "iTerm" to create window with default profile
end new_window

on new_tab()
	tell application "iTerm" to tell the first window to create tab with default profile
end new_tab

on call_forward()
	tell application "iTerm" to activate
end call_forward

on is_running()
	application "iTerm" is running
end is_running

on has_windows()
	if not is_running() then return false
	if windows of application "iTerm" is {} then return false
	true
end has_windows

on send_text(custom_text)
	tell application "iTerm" to tell the first window to tell current session to write text custom_text
end send_text

-- Main
on alfred_script(query)
	if has_windows() then
		if open_in_new_window then
			new_window()
		else
			new_tab()
		end if
	else
		-- If iTerm is not running and we tell it to create a new window, we get two
		-- One from opening the application, and the other from the command
		if is_running() then
			new_window()
		else
			call_forward()
		end if
	end if

	-- Make sure a window exists before we continue, or the write may fail
	repeat until has_windows()
		delay 0.01
	end repeat

	send_text(query)
	call_forward()
end alfred_script

 

https://hjm79.top/alfred-4-%EC%B4%88%EA%B8%B0-%EC%84%A4%EC%A0%95/

 

alfred 4 ์ดˆ๊ธฐ ์„ค์ • - ๋งฅ ํ•„์ˆ˜ ์•ฑ - ์›Œํฌํ”Œ๋กœ์šฐ ๋งˆ๋‹ˆ์˜ ๋ธ”๋กœ๊ทธ

๋งฅ ํ•„์ˆ˜ ์•ฑ์ค‘์— ํ•˜๋‚˜์ธ alfred 4 ์ดˆ๊ธฐ ์„ค์ • ๋ถ€๋ถ„ ์ž…๋‹ˆ๋‹ค. File Search, Web Search, Clipboard, Snippets, terminal ๋ถ€๋ถ„ ๋“ฑ ๊ธฐ๋ณธ ์„ค์ •์„ ์ ์–ด๋ดค์Šต๋‹ˆ๋‹ค. ๋งฅ ํ•„์ˆ˜ ์•ฑ์ธ ์•Œํ”„๋ ˆ๋“œ์ž…๋‹ˆ๋‹ค.

hjm79.top

 

Comments