我如何开发像 Deskshade 的 DeskLock 这样的东西?
抱歉打扰了,但我还有另一个问题。我如何从 macrabbit 的 Deskshade 应用程序中执行类似 DeskLock 的操作?我已经制作了小窗户,这就是我所做的。我知道如何在 10.6 中使用PresentationOptions“锁定”屏幕,但我不想冒险,因为上次它不会让我返回;]
编辑:DeskShade 应用程序实际上是为了覆盖您的桌面,隐藏所有图标。它还允许您通过多次淡入淡出/滑动来随机化壁纸图案。还有一项名为 DeskLock 的额外功能,它实际上呈现一个带有锁定图标的半透明黑色斜面(类似于 Mac 中内置的 AppSwitcher),并且您可以放置个人文本。当您单击锁定图标时,它会显示一个模式,要求您输入可以设置的密码。您也可以只输入此密码而不按任何键,然后按 Enter 键,即可解锁屏幕。这也使用了隐藏桌面的 DeskShade 功能。
谢谢!
Sorry to be a nuisance, but I have yet ANOTHER question. How would I do something like DeskLock from macrabbit's Deskshade app? I've made the little window and that's as far as I've come. I know how to "lock" the screen in 10.6 with PresentationOptions, but I don't want to risk it because last time it wouldn't let me back in ;]
EDIT: The DeskShade app actually is meant to cover your desktop, hiding all icons. It also allows you to randomize wallpaper patterns with several fade/swipes. There is one extra feature called DeskLock that actually presents a translucent black bevel (similar to AppSwitcher build into Mac) with a lock icon, and you can place personal text. When you click the lock icon, it presents a modal that asks for a password you can set. You can also just type this password without pressing anything, followed by the Enter key, and it unlocks the screen. This uses the DeskShade feature of hiding the desktop as well.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要创建覆盖窗口,您必须子类化 NSWindow 并设置其样式掩码和背景颜色:
然后需要设置窗口的框架,以便它覆盖所有屏幕,并且需要适当地设置其窗口级别:
正如您所提到的,您可以使用
NSApp
的NSApplicationPresentationOptions
设置来控制用户与系统交互的方式。在不锁定自己的情况下进行测试的一种简单方法是设置一个NSTimer
,该方法调用一个方法,在超时后将应用程序从 kiosk 模式中拉出来。To create the overlay window you have to subclass NSWindow and set its style mask and background color:
You then need to set the window's frame so that it covers all screens, and you need to set its window level appropriately:
As you've mentioned, you can use the
NSApplicationPresentationOptions
settings forNSApp
to control how the user can interact with the system. An easy way to test this without locking yourself out is to set anNSTimer
that calls a method that pulls the app out of kiosk mode after a timeout period.