sh slack-macos-night-mode.sh

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh slack-macos-night-mode.sh相关的知识,希望对你有一定的参考价值。

#!/usr/bin/env bash
set -e
set -o pipefail
set -u

OUTPUTFILE="/Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js"

# ensure that the script is not run as root or sudo
if [[ $EUID = 0 ]]; then
  echo "Do not run as root or sudo. It should be run as the user running Slack. You will be prompted if sudo access is needed."
  exit
fi

if [[ $OSTYPE =~ darwin* ]] ; then

    # close Slack
    echo "Closing Slack"
    osascript -e 'quit app "Slack"' || true > /dev/null

    #add the code
    echo "Adding the necessary code"
    sudo tee -a "$OUTPUTFILE" > /dev/null <<'EOF'

document.addEventListener('DOMContentLoaded', function() {
 $.ajax({
   url: 'https://cdn.rawgit.com/laCour/slack-night-mode/master/css/raw/black.css',
   success: function(css) {
     $("<style></style>").appendTo('head').html(css);
   }
 });
});
EOF

    # restart Slack
    echo "Restarting Slack"
    #osascript -e 'open app "Slack"' || true > /dev/null
    open -a Slack

else
    echo "Only OSX or MacOS is currently supported"
    exit
fi

以上是关于sh slack-macos-night-mode.sh的主要内容,如果未能解决你的问题,请参考以下文章

如何使我的命令行在具有扩展名(.sh)和名称如“weird.sh.sh.sh”的文件上工作

sh sh_template.sh

sh sh.sh

Linux下面如何运行 SH文件

配置告警系统主脚本main.sh mon.sh load.sh 502.sh disk.sh

shell 脚本各种执行方式(source ./*.sh, . ./*.sh, ./*.sh)的区别