by Aakaash Jois

通过Aakaash Jois

如何破解Mac并为其提供真正应得的精美壁纸 (How to hack your Mac and give it the gorgeous wallpapers it truly deserves)

Let’s face it. The default wallpapers on the Mac gets boring after a few weeks. And setting new wallpaper manually is tiresome. Well, what if I told you that I got my Mac greet me with a brand new, high resolution wallpaper every time I flip it open?

面对现实吧。 Mac上的默认壁纸会在几周后变得无聊。 手动设置新墙纸很麻烦。 好吧,如果我告诉您每次打开Mac时,我都会得到一台全新的高分辨率墙纸来迎接Mac,该怎么办?

If you’re a Chromecast user, you may be familiar with Chromecast Backdrop. Backdrop allows the Chromecast to display a slideshow of beautiful photos when it’s idle.

如果您是Chromecast用户,则可能对Chromecast Backdrop熟悉。 通过背景幕,Chromecast可以在闲置时以幻灯片形式显示精美照片。

While most users default to Facebook to post photos, a lot of photographers use Google+ to publish their work. Google selects some of these best photos to create brilliant slideshows.

尽管大多数用户默认使用Facebook发布照片,但是许多摄影师都使用Google+发布他们的作品。 Google会从其中一些最佳照片中选出精彩的幻灯片。

For a long time, this was exclusive to ChromeCast user. But a few months ago, Google released a nifty app for Mac called Google Featured Photos.

长期以来,这是ChromeCast用户专有的。 但是几个月前,谷歌为Mac发布了一个漂亮的应用程序,名为Google Featured Photos 。

You may be wondering why my title says “wallpaper” but then links to a “Screen Saver” app. Well, there’s the little trick. On a Mac, any screen saver can be made to run as a wallpaper with just one line of code.

您可能想知道为什么我的标题为“墙纸”,然后链接到“屏幕保护程序”应用程序。 好吧,这里有个小把戏。 在Mac上,只需一行代码即可使任何屏幕保护程序都可以作为墙纸运行。

First, you have to download and install the Google Featured Photos Screen Saver. Next, go to System PreferencesDesktop & Screen Saver and set the Google Featured Photos as the active screen saver. Now it’s time to run the magic code.

首先,您必须下载并安装Google特色照片屏幕保护程序 。 接下来,转到系统偏好设置桌面和屏幕保护程序,然后将Google特色照片设置为活动的屏幕保护程序。 现在该运行魔术代码了。

编码时间! (Coding Time!)

Fire up Terminal and paste the below line of code. It will set your screen saver as your wallpaper.

启动终端并粘贴以下代码行。 它将您的屏幕保护程序设置为墙纸。

/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background &

编辑:苹果公司决定在High Sierra进行一些重组。 (EDIT: Apple decided to restructure a bit in High Sierra.)

If you are using High Sierra (or later), the ScreenSaverEngine.app has been moved to a different location. Use the code below instead of the one above.

如果您使用的是High Sierra(或更高版本),则ScreenSaverEngine.app已移至其他位置。 使用下面的代码,而不是上面的代码。

/System/Library/CoreServices/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background &

Just replace all occurrences of Frameworks/ScreenSaver.framework/Resources with CoreServices and you will be good to go!

只需将所有出现的Frameworks/ScreenSaver.framework/Resources替换为CoreServices ,您就会很高兴!

Cool, right?

酷吧?

The problem with running just that line of code is that if you close the Terminal window — or if your Mac goes to sleep — the screen saver closes and your wallpaper goes back to whatever it was by default. To handle this, we need to go a bit deeper.

仅运行该行代码的问题是,如果关闭“终端”窗口,或者Mac进入睡眠状态,则屏幕保护程序将关闭,并且墙纸将恢复为默认值。 为了解决这个问题,我们需要更深入一些。

To detect when the Mac sleeps and wakes up, we need a small piece of software called “Sleepwatcher.” You can download it here. Just open the file and your Mac will extract the downloaded file (sometimes it might have to be extracted twice). After extracting, you’ll get a “sleepwatcher_2.2” folder. Just move this folder to Desktop and run the following lines of code in the Terminal.

为了检测Mac何时睡眠和唤醒,我们需要一小块名为“ Sleepwatcher”的软件。 您可以在此处下载。 只需打开文件,您的Mac就会解压缩下载的文件(有时可能需要解压缩两次)。 解压缩后,您将获得一个“ sleepwatcher_2.2”文件夹。 只需将此文件夹移动到桌面,然后在终端中运行以下代码行即可。

sudo mkdir -p /usr/local/sbin /usr/local/share/man/man8

You might need to enter your password after pasting this line. Next, run:

粘贴此行后,您可能需要输入密码。 接下来,运行:

sudo cp ~/Desktop/sleepwatcher_2.2/sleepwatcher /usr/local/sbin

Then run:

然后运行:

sudo cp ~/Desktop/sleepwatcher_2.2/sleepwatcher.8 /usr/local/share/man/man8

Awesome! You have successfully installed Sleepwatcher.

太棒了! 您已经成功安装了Sleepwatcher。

Now let’s add the lines of code needed to make Sleepwatcher run the screen saver when your Mac wakes up, and kill the screen saver when your Mac goes to sleep.

现在,让我们添加必要的代码行,以使Sleepwatcher在Mac唤醒时运行屏幕保护程序,并在Mac进入睡眠状态时终止屏幕保护程序。

Sleepwatcher searches for and runs two files, .sleep when the Mac sleeps, and .wakeup when the Mac wakes up. We just need to create these 2 files in the user’s Home Directory.

对于Sleepwatcher搜索并运行两个文件, .sleep时的Mac睡觉,和.wakeup当MAC醒来。 我们只需要在用户的主目录中创建这两个文件。

In the Terminal, type nano ~/.wakeup then paste the below code.

在终端中,键入nano ~/.wakeup然后粘贴以下代码。

#!/bin/bashosascript -e 'do shell script "/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background & EOF"'

Now press Control + X to exit. When it asks if you want to save the file, press Y and then press the enter key to confirm the file name. This will create the .wakeup file. Now to create the .sleep file.

现在按Control + X退出。 当询问您是否要保存文件时,请按Y ,然后按Enter键以确认文件名。 这将创建.wakeup文件。 现在创建.sleep文件。

Just like above, type nano ~/.sleep and paste the below code.

与上面一样,键入nano ~/.sleep并粘贴以下代码。

#!/bin/bash
osascript -e 'do shell script "kill `ps -ax | grep [S]creenSaver | cut -c1-6` EOF"'

Again, press Control + X to exit, Y to save, and then the enter key to confirm the file name. Now the .sleep file will be created.

再次,按Control + X退出, Y保存,然后按Enter键确认文件名。 现在,将创建.sleep文件。

In Terminal, run the below line of code.

在终端中,运行下面的代码行。

chmod 700 ~/.sleep ~/.wakeup

It changes the permissions for the newly created files so that it can be run by Sleepwatcher.

它更改了新创建文件的权限,以便可以由Sleepwatcher运行。

Now that you’ve created the scripts, you just need to add Sleepwatcher to launchd so that it can start when the system starts, then continue to run in the background. Paste the following code code into your Terminal.

现在,您已经创建了脚本,只需要添加Sleepwatcher以launchd它,以便它可以在系统启动时启动,然后继续在后台运行。 将以下代码粘贴到终端中。

cp ~/Desktop/sleepwatcher_2.2/config/de.bernhard-baehr.sleepwatcher-20compatibility-localuser.plist ~/Library/LaunchAgents

This will copy the Sleepwatcher property list file so that it can be added to launchd. Now just paste the code below into Terminal to add Sleepwatcher to launchd.

这将复制Sleepwatcher属性列表文件,以便可以将其添加到launchd 。 现在,只需将下面的代码粘贴到Terminal中即可将Sleepwatcher添加到launchd

launchctl load ~/Library/LaunchAgents/de.bernhard-baehr.sleepwatcher-20compatibility-localuser.plist

Awesome! You can now restart your Mac and the launchd will run the Sleepwatcher scripts at the startup. Just put your Mac to sleep and wake it up. Then you’ll be welcomed with a beautiful wallpaper.

太棒了! 现在,您可以重新启动Mac,启动的Mac将在launchd时运行Sleepwatcher脚本。 只需将Mac睡眠并唤醒它即可。 然后,您会得到美丽的墙纸的欢迎。

If you want to uninstall everything and go back to default, follow the link below.

如果您想卸载所有内容并恢复默认设置,请点击以下链接。

To uninstall, run the following lines in Terminal one by one.After running these, you can uninstall the Google Screen Saver and restart your Mac. It should be removed. Let me know…medium.com

要卸载,请在终端一一运行以下行。 运行这些文件后,您可以卸载Google屏幕保护程序并重新启动Mac。 应该将其删除。 让我知道… medium.com

I hope you enjoyed this short tutorial, and enjoy these beautiful wallpaper photos. If you liked this, hit the ❤️ and stay tuned for more.

我希望您喜欢这个简短的教程,并喜欢这些美丽的壁纸照片。 如果您喜欢这个,请打❤️并继续关注更多内容。

翻译自: https://www.freecodecamp.org/news/this-is-the-wallpaper-your-mac-truly-deserves-with-a-bit-of-coding-f3149bbeb51/

如何破解Mac并为其提供真正应得的精美壁纸相关推荐

  1. 如何破解Mac软件的付费限制(一)

    一.前言 在使用Mac的过程中,经常会碰到一些软件,属于付费使用产品.那么处于好奇或者自学的目的,能不能绕过这个限制呢.今天简单的分享下我破解的几款软件当中的一款,具体是什么软件就不说了,主要是提供下 ...

  2. 关于破解版XD安装(提供链接)及插件离线安装方法

    注:这里只提供mac的下载及安装方法哦,是自己亲测后发上来的 破解版XD for mac 附上下载链接:XD for mac 安装方法就不多bb了,链接里站主很贴心的提供了两种方法,版本也很多根据系统 ...

  3. 关于QQ密码暴力破解的一些想法(仅提供一个想法)

    首先我认为单一号码暴力破解的成功可能性应该接近于0,不知道其他人有什么看法呢?比如我的QQ:55511如用穷举法,估计花费n年的时间也是不能破解的.因为本身我的密码包含了中文(当然还有其他).肯定是行 ...

  4. FPGA基于Tri Mode Ethernet MAC实现UDP通信 提供3套工程源码和技术支持

    目录 1.前言 2.我这里已有的UDP方案 3.米联客UDP协议栈 4.详细设计方案 5.Tri Mode Ethernet MAC的使用 6.vivado工程1详解 7.vivado工程2详解 8. ...

  5. 怎样在iPhone或Mac上取消 Apple提供的付费订阅?

    我们可以取消您用 App Store 中的某款 App 购买的订阅.您还可以取消 Apple TV+.Apple News+.Apple Fitness+ 以及其他由 Apple 提供的订阅.那我们该 ...

  6. iPhone或Mac上取消 Apple 提供的付费订阅教程

    取消您用 App Store 中的某款 App 购买的订阅.您还可以取消 Apple TV+.Apple News+.Apple Fitness+ 以及其他由 Apple 提供的订阅. 如何在 iPh ...

  7. 如何在iPhone或Mac上取消 Apple提供的付费订阅?

    我们可以取消您用 App Store 中的某款 App 购买的订阅.您还可以取消 Apple TV+.Apple News+.Apple Fitness+ 以及其他由 Apple 提供的订阅.那我们该 ...

  8. mac securecrt程序无响应_Adobe庆祝Photoshop问世30周年 为Mac和iPad版本提供新功能

    Adobe今天庆祝Photoshop诞生30周年,之前它已经在Mac和iPad上对该应用程序进行了多次更新.Mac上的一项重要新功能是支持MacOS Mojave和更高版本上的黑暗模式.Photosh ...

  9. 百度网盘下载限速破解-Mac版

    很多朋友都吐槽百度网盘恶心的限速,平时用的少就忍了,前两天我的婚纱照放到了网盘里,1.7G,下了一天才下了几百兆,po主实在不能忍了,于是众里寻里千百度,果然功夫不负有心人,让我集众家智慧于一身,下面 ...

最新文章

  1. python的scramy架构_Scrapy的架构初探
  2. 超时,重试,熔断,限流
  3. react打包后图片丢失_如何快速构建React组件库
  4. 创建Python虚拟环境——下
  5. 腾讯物联网开发者社区平台Tencent Things Network发布 让IoT应用开发快速安全
  6. == 与 === 介绍与区别
  7. python去掉列表中的单引号_Python:如何从列表项中删除单引号(Python: How to remove single quotes from list item)...
  8. 项目展示-新浪微博客户端
  9. 20145228 《信息安全系统设计基础》第九周学习总结 (2)
  10. 懒人神器——新手必备的图片后期处理软件
  11. Hash(MD5校验工具)
  12. 可计算代数数论(2012-12-09 20:56、2013-03-23 21:39、2013-06-23 20:27、2013-06-23 20:32、2014-05-16 17:49)
  13. 生成器模式(Builder)
  14. 10张图看懂人口普查数据
  15. 服务器安全防护和保护措施方案-数据湾
  16. kaggle电影数据分析报告
  17. MATLAB的取整函数与取余函数
  18. linux系统的种类
  19. 星瀚资本杨歌,慧聪集团姚永超,腾飞资本任溶 | TO B创业过冬策略,开源节流...
  20. PyTorch中使用LSTM处理变长序列

热门文章

  1. 异常的产生与传递 java
  2. java演练代码 银行取款演练 java
  3. css3 2D动画效果 200303
  4. django-模型类中的数据类型-添加中
  5. linux-权限管理acl高级
  6. 陆奇上任之后第二次面向媒体,针对阿波罗计划说了什么?
  7. JS面向对象程序设计(OOP:Object Oriented Programming)
  8. Servlet JSP : web.xml 配置学习
  9. Django笔记(1)
  10. 谈谈JS里的{ }大括号和[ ]中括号的用法