forked from libccy/vivaldi-tweak
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpatch-osx
executable file
·30 lines (21 loc) · 1.02 KB
/
patch-osx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# Quit Vivaldi
osascript -e 'quit app "Vivaldi.app"'
# Find path to Framework folder of current version and save it as variable
findPath="`find /Applications/Vivaldi.app -name Vivaldi\ Framework.framework`"
# Copy custom.css and custom.js files to Vivaldi.app
dir="$( cd "$( dirname "$0" )" && pwd )"
cp $dir/custom.css "$findPath"/Resources/vivaldi/style/
cp $dir/custom.js "$findPath"/Resources/vivaldi/
# Save path to browser.html as variable
browserHtml="$findPath"/Resources/vivaldi/browser.html
# Insert references, if not present, and save to temporary file
sed 's| </head>| <link rel="stylesheet" href="style/custom.css" /></head>|;s| </body>| <script src="custom.js"></script></body>|' "$browserHtml" > "$browserHtml".temp
# Backup original file
cp "$browserHtml" "$browserHtml".bak
# Overwrite
mv "$browserHtml".temp "$browserHtml"
# Pause script
read -rsp $'Press [Enter] to restart Vivaldi...\n'
# Open Vivaldi
open /Applications/Vivaldi.app --args --debug-packed-apps --silent-debugger-extension-api