如何通过 bash 脚本顺利地对 Snow Leopard 进行更改
我有一个 bash 脚本,运行它来切换桌面图标的可见性,如下所示:
#!/bin/bash
DESKTOP=$(defaults read com.apple.finder "CreateDesktop")
if [ $DESKTOP == 1 ]
then
defaults write com.apple.finder CreateDesktop -bool false
else
defaults write com.apple.finder CreateDesktop -bool true
fi
killall Finder
它可以工作,但这里有两个问题,我不知道是否可以使用 bash 来实现。
运行此脚本时,它会打开终端运行应用程序并保持终端打开。
有什么方法可以让这个脚本运行而不需要打开终端吗? 我找到了这个链接使可执行的bash文件运行单击时,它使用Platypus作为脚本的包装器,但我想知道是否可以在不使用任何额外工具的情况下本地执行某些操作:)
运行脚本时Killall Finder
使一切重新启动,因此屏幕闪烁,您会丢失窗口的实际状态
是否可以仅使桌面图标平滑地淡入/淡出,而不影响基于 Finder 的窗口和其他资源?
这个 Camouflage 应用程序的工作原理如下,所以基本上我想知道是否可以复制使用 bash 脚本实现此行为。
嗯,就是这样,我希望它很容易理解。 你可以说我可以使用这个迷彩应用程序来满足我的需要,但实际上我正在尝试了解一些它并尝试自己做(显然,在你的帮助下:)
提前致谢
更新
我正在查看第二个问题,我不确定,但似乎有问题的应用程序不会隐藏 destkop 中的图标,而是在桌面上最前面的级别(即图标上方)之间创建一个覆盖层并生成图像这与桌面图像的使用相同。因此,淡入淡出效果,因为它可以控制出现时的图像过渡。帮助我分析这一点的是,每次关闭应用程序时,图标都会重新出现。所以一定和它有关系。 如果我错了,确实可以采取其他方式,请分享您的意见:)
I have a bash script that I run to toggle visibility for my desktop icons which is the following:
#!/bin/bash
DESKTOP=$(defaults read com.apple.finder "CreateDesktop")
if [ $DESKTOP == 1 ]
then
defaults write com.apple.finder CreateDesktop -bool false
else
defaults write com.apple.finder CreateDesktop -bool true
fi
killall Finder
it works, but there's 2 issues here I don't know how if it's possible to do using bash.
when running this script it It opens up terminal run the app and leave the terminal opened.
Is there any way to make this script run without have to open the terminal?
I've found this link Making an executable bash file run when clicked which use Platypus as a wrapper for your script, but I would like to know if it's possible to do something natively without any extra tool :)
when running the script the killall Finder
makes everything restart so the screen blinks and you lose the actual state of your windows
Is is possible to make only the desktop icons fade-in/out smoothly without affecting windows and other resources based on Finder?
this Camouflage app works like this, so basically I would like to know if it's possible to replicate this behavior using bash script.
Well that's it, I hope it's easy to understand.
You could say that I could use this camouflage app for my needs but actually I'm trying to learn a bit about it and trying to do it myself (and obviously, with your help :)
Thanks in advance
Update
I was having a look at the second issue and I'm not sure but it seems that app in question doesn't hide the icons from destkop but instead, it creates an overlay between the most front level on the desktop(that is over the icons) and generate an image which is the same used as a desktop image. hence the fading effect, since it can control the image transition when appearing. what helped me analyze this was since every time you close the app the icons appear back. So it must have something do to with it.
If I am wrong the it's really possible to do other way, please share your opinion :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定第二个问题的解决方案,但对于第一个问题:查看您链接到的 StackOverflow 问题的第三答案:
使可执行的 bash 文件在单击时运行
您可以使用
AppleScript Editor< 创建应用程序包/code> 或
Automator
将运行您的脚本而无需打开终端窗口。Not sure about a solution for your second question, but for the first: take a look at the third answer for the StackOverflow question you linked to:
Making an executable bash file run when clicked
You can create an application bundle with
AppleScript Editor
orAutomator
that will run your script without opening a Terminal window.