Add finder showWindowTitlebarIcons screenshots and record script

This commit is contained in:
Yann Bertrand 2022-08-17 17:45:15 +02:00
parent dc49a8b14b
commit f2a1d848d6
5 changed files with 100 additions and 0 deletions

View file

@ -510,9 +510,17 @@ categories:
examples:
- text: Show icon in the title bar
value: true
image:
filename: "true.png"
width: 740
height: 451
- text: Hide icon from the title bar
default: true
value: false
image:
filename: "false.png"
width: 740
height: 451
versions: [Monterey]
after: killall Finder
- key: NSToolbarTitleViewRolloverDelay

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View file

@ -0,0 +1,46 @@
const MacRunner = require('../../mac-runner')
const { compressPngImage } = require('../../utils')
module.exports = {
run: async (outputPath) => {
console.log('> Recording finder show window title bar icons to false')
try {
const runner = new MacRunner()
await runner
.setDefault(
'com.apple.universalaccess',
'showWindowTitlebarIcons',
'-bool false',
'0'
)
.killApp('Finder')
.openApp('Finder', '~')
.captureApp('Finder', `${outputPath}/false.png`)
.deleteDefault('com.apple.universalaccess', 'showWindowTitlebarIcons')
.killApp('Finder')
.run()
} catch (runnerError) {
logRollbackInfo()
throw new Error(runnerError)
}
try {
await compressPngImage(`${outputPath}/false.png`, outputPath, 'false')
} catch (compressPngImageError) {
logRollbackInfo()
throw new Error(compressPngImageError)
}
return { filepath: `${outputPath}/false` }
},
}
function logRollbackInfo() {
console.info(
'Please manually run this command to make sure everything is properly reset:'
)
console.info(
'defaults delete com.apple.universalaccess showWindowTitlebarIcons && killall Finder'
)
}

View file

@ -0,0 +1,46 @@
const MacRunner = require('../../mac-runner')
const { compressPngImage } = require('../../utils')
module.exports = {
run: async (outputPath) => {
console.log('> Recording finder showWindowTitlebarIcons to true')
try {
const runner = new MacRunner()
await runner
.setDefault(
'com.apple.universalaccess',
'showWindowTitlebarIcons',
'-bool true',
'1'
)
.killApp('Finder')
.openApp('Finder', '~')
.captureApp('Finder', `${outputPath}/true.png`)
.deleteDefault('com.apple.universalaccess', 'showWindowTitlebarIcons')
.killApp('Finder')
.run()
} catch (runnerError) {
logRollbackInfo()
throw new Error(runnerError)
}
try {
await compressPngImage(`${outputPath}/true.png`, outputPath, 'true')
} catch (compressPngImageError) {
logRollbackInfo()
throw new Error(compressPngImageError)
}
return { filepath: `${outputPath}/true` }
},
}
function logRollbackInfo() {
console.info(
'Please manually run this command to make sure everything is properly reset:'
)
console.info(
'defaults delete com.apple.universalaccess showWindowTitlebarIcons && killall Finder'
)
}