Alfred修改内置Terminal为iTerm
用这个脚本:
on write_to_file(this_data, target_file, append_data)
try
set the target_file to the target_file as string
set the open_target_file to open for access file target_file with write permission
if append_data is false then set eof of the open_target_file to 0
write this_data to the open_target_file starting at eof
close access the open_target_file
return true
on error
try
close access file target_file
end try
return false
end try
end write_to_file on alfred_script(q) -- Write the command to run to a file. This is done because Applescript quoting is impossible to get right, esp. for backslashes.
set tmp_dir to path to temporary items as string from user domain
set applescript_alfred_file to tmp_dir & "alfredscript"
set alfred_file to POSIX path of applescript_alfred_file
write_to_file(q & return, applescript_alfred_file, false) -- Create this file, which prevents iTerm2 from restoring a saved window arrangement.
do shell script "touch ~/Library/Application' Support/iTerm/quiet'" -- Test cases:
-- 1. iTerm2 running, has windows open. Should open a new window for Alfred command.
-- 2. iTerm2 running, no windows open. Should open a new window for Alfred command.
-- 3. iTerm2 not running, set to restores arrangement. Should not restore arrangement but open a new window for the Afred command.
-- 4. iTerm2 not running. No windows to restore. Should open a single window for the Alfred command.
-- 5. iTerm2 not running. Has windows to restore. Restores windows and then opens a new window for the Alfred command. -- Compose a script. This is necessary because compiling in a 'tell application' command causes the app to be launched, which would happen prior to the creation of the quiet file.
set theScript to "tell application \"iTerm.app\"
if (exists current window) then
tell current window to create tab with default profile
tell current session of current window
write contents of file \"" & alfred_file & "\"
end tell
else
create window with default profile
tell current session of current window
write contents of file \"" & alfred_file & "\"
end tell
end if
activate
end tell" -- Invoke the script.
run script theScript -- Clean up
-- do shell script "rm -f ~/Library/Application' Support/iTerm/quiet' /tmp/alfredscript"
end alfred_script
参考:
http://time-track.cn/change-terminal-to-iterm-in-alfred.html
Alfred修改内置Terminal为iTerm的更多相关文章
- Ionic4.x Theming(主题) 增加内置主题 颜色 修改内置组件默认样式 修改底部 Tabs 背景颜色以及按钮颜色
1.Ionic4.x Theming(主题) Ionic4.x 修改主题颜色的话需要在 src/theme/variables.scss 文件中修改. https://ionicframework.c ...
- Spring Boot修改内置Tomcat端口号 (zhuan)
http://blog.csdn.net/argel_lj/article/details/49851625 ********************************************* ...
- Spring Boot修改内置Tomcat端口号
spring Boot 内置Tomcat默认端口号为8080,在开发多个应用调试时很不方便,本文介绍了修改 Spring Boot内置Tomcat端口号的方法. 一.EmbeddedServletCo ...
- (一)Spring Boot修改内置Tomcat端口号--解决tomcat端口被占用的问题
Spring Boot 内置Tomcat默认端口号为8080,在开发多个应用调试时很不方便,本文介绍了修改 Spring Boot内置Tomcat端口号的方法. 一.EmbeddedServletCo ...
- spring boot修改内置容器tomcat的服务端口
方式一 在spring boot的web 工程中,可以使用内置的web container.有时需要修改服务端口,可以通过配置类和@Configuration注解来完成. // MyConfigura ...
- XAF-如何修改内置的编辑器(Property Editor)
本示例演示在web/win中给 日期选择控制显示出一个时钟及修改时间的控件.效果如下: 如果你装了XAF在这个路径中已经有了这个示例: %PUBLIC%\Documents\DevExpress De ...
- springboot之修改内置tomcat配置项
1.spring boot默认端口号是8080,如果要修改端口的话,只需要修改application.properties文件,在其中加入 例如: server.port=8081 2.在正常的项目中 ...
- Spring-Boot 内置静态资源文件地址修改
Spring-Boot 内置MVC静态文件地址修改 Why:1.Spring-Boot修改内置SpringMVC静态资源路径,提高项目目录结构的安全性.2.配置拦截路径时可以剔除静态文件拦截How:1 ...
- springboot(八)内置SpringMvc静态文件地址修改
参考:作者:恒宇少年链接:https://www.jianshu.com/p/c6ab1081fd5f 介绍: SpringMVC大家都不陌生,而被SpringBoot集成的SpringMVC除了 ...
随机推荐
- 统计学中z分布、t分布、F分布及χ^2分布
Z就是正态分布,X^2分布是一个正态分布的平方,t分布是一个正态分布除以(一个X^2分布除以它的自由度然后开根号),F分布是两个卡方分布分布除以他们各自的自由度再相除 比如X是一个Z分布,Y(n)=X ...
- Android Studio真机测试
本页内容 1.真机测试好处多 2.开始吧!真机测试 1.真机测试好处多 不久前才开我的Android Studio之旅,就遇上了一个大麻烦——创建的模拟器各种运行出错.尝试了各种解决方法,都没有什么结 ...
- linux安装mysql后root无法登录
[root@localhost mysql]# mysql -u root -pEnter password: ERROR 1045 (28000): Access denied for user ' ...
- awk基础03-分支和循环语句
awk既然是一门解释型语言,则就可以支持如分支语句.循环语句等.今天就来学习一下在awk中的分支和循环语句.如果您有过任何一门编程语言的基础,则下面所讲内容也是很好理解的. 分支语句 if-e ...
- (广搜)Catch That Cow -- poj -- 3278
链接: http://poj.org/problem?id=3278 Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 6211 ...
- 在改变某一项目的svn的地址,relocate
不要忘记删除原有.svn文件.
- linux下svn服务器的搭建
网上的教程实在是太恶心了,不是太老,就是有问题,刚参考的一篇文章也有问题.自己记录下来,以后用就方便了,现在一边重新安装一遍,一边记录.笔者亲测,今天是5月29号深夜. linux用的是centos6 ...
- Docker Warning : the backing xfs filesystem is formatted without d_type support
CentOS7 下安装配置 Docker,遇到如下的WARNING, WARNING: overlay: the backing xfs filesystem is formatted without ...
- Sqlserver 密码过期时间查询
DECLARE @login nvarchar(30) -- 查询设定密码过期的登陆账号SELECT @login = nameFROM sys.sql_loginsWHERE is_expirati ...
- ActiveX 控件重绘无效问题,用CClientDC 而不是CPaintDC
ActiveX 控件重绘子控件时,用Invalid()会出现无效的情况即不会更新界面. OnPaint 方法里,是用的 CPaintDC,经测试无效,后换CClientDC,发现可以,百度查他们的区别 ...