Code Monkey home page Code Monkey logo

dual-wechat's Introduction

0 Abstract

本文主要介绍了如何在Mac上通过脚本实现微信双开,并通过自动操作创建应用程序,修改图标后直接当作第二个微信使用,无需打开终端输入代码,且双开后无终端出现。

1 基本原理

如果您不想理解原理,或者不懂Shell,可以直接跳转到最后章节。

使用Linux nohup命令实现,将微信主程序输出到一个“黑洞”里,即使此时关掉终端也不会影响双开微信的运行。

将以下代码复制到终端(Teriminal)运行,即可开启第二个微信,开启后,关闭终端也可以正常运行。

nohup /Applications/WeChat.app/Contents/MacOS/WeChat > /dev/null 2>&1 

弊端是每次都需要复制此代码到终端,非常不优雅,接下来的章节介绍如何使用自动操作打包。

2 使用自动操作打包脚本

自动操作(Automator)是Mac电脑上自带的一款软件,通过设置,可以实现电脑上的大部分操作自动进行,可以简单理解为一个更加硬核的快捷指令(Shortcuts)。

  1. 在启动台找到自动操作(Automator),点开打开。

  1. 选择新建文稿

  1. 选择文稿类型为应用程序

  1. 找到实用工具——运行Shell脚本,双击或者拖拽至右侧空白处。

  1. 复制代码至文本框,Shell类型默认/bin/zsh或/bin/bash即可。
nohup /Applications/WeChat.app/Contents/MacOS/WeChat > /dev/null 2>&1 

  1. 保存文件(Cmd+S),名称随意,位置选择应用程序(Applications),文件格式选择应用程序,存储即可。

  1. 打开启动台,图标出现,点击即可启动第二个微信。

3 嫌丑换图标

这个图标只是脚本启动APP的图标,脚本执行之后出现的第二个微信还是原版本的,如果还是嫌丑就改图标,自己设计或者去网上找一个心仪的图标。我喜欢这个黑白的,因为有植物大战僵尸里面模仿者(Imitater)的感觉。

  1. 复制(Cmd+C)下载好的图标文件。
  2. 在应用程序(Applications)文件夹里找到刚保存的脚本程序,右击图标,点击显示简介

  1. 点击右上方的小图标,周围变蓝即可,然后粘贴(Cmd+V),即可完成。

4 效果展示及懒人包

把双开启动软件放在dock栏,点击之后就可以实现微信双开,而且全程无终端打开,也不会出现其他方法中关闭终端,第二个微信就关闭的情况。

同样的,如果更改代码,也可以实现其他软件的双开,可以自行探索。

如果你实在太懒了,不想操作,那么点击下面链接,下载我修改好的可以直接使用。

5 已知问题

这种*操作存在一定问题,这是WeChat程序决定的,暂无解决方案:

  • 点击微信A通知横幅,会跳转至微信B窗口。
  • 电脑休眠之后,再次开启可能会提示“登录遇到问题,请重新登录”
  • 重新登录时,可能必须使用扫码才能登录。

dual-wechat's People

Contributors

clouduh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.