mirror of
https://github.com/yannbertrand/macos-defaults
synced 2024-11-14 23:57:07 +00:00
✨ Add finder AppleShowAllFiles command
This commit is contained in:
parent
15801e65ce
commit
35745a034a
6 changed files with 114 additions and 0 deletions
|
@ -316,6 +316,27 @@ categories:
|
|||
text: Afficher toutes les extensions de fichier dans le Finder
|
||||
versions: [Big Sur, Catalina, Mojave]
|
||||
after: killall Finder
|
||||
- key: AppleShowAllFiles
|
||||
domain: com.apple.Finder
|
||||
title: Afficher les fichiers cachés
|
||||
description: Afficher les fichiers cachés dans le Finder.
|
||||
param:
|
||||
type: bool
|
||||
examples:
|
||||
- value: false
|
||||
text: Ne pas afficher les fichiers cachés dans le Finder
|
||||
image:
|
||||
filename: "false.png"
|
||||
width: 740
|
||||
height: 451
|
||||
- value: true
|
||||
text: Afficher les fichiers cachés dans le Finder
|
||||
image:
|
||||
filename: "true.png"
|
||||
width: 740
|
||||
height: 451
|
||||
versions: [Catalina]
|
||||
after: killall Finder
|
||||
- key: FXEnableExtensionChangeWarning
|
||||
domain: com.apple.finder
|
||||
title: Alerte au changement d'extension
|
||||
|
|
21
defaults.yml
21
defaults.yml
|
@ -317,6 +317,27 @@ categories:
|
|||
text: Show all file extensions inside the Finder
|
||||
versions: [Big Sur, Catalina, Mojave]
|
||||
after: killall Finder
|
||||
- key: AppleShowAllFiles
|
||||
domain: com.apple.Finder
|
||||
title: Show hidden files
|
||||
description: Show hidden files in the Finder.
|
||||
param:
|
||||
type: bool
|
||||
examples:
|
||||
- value: false
|
||||
text: Do not show hidden files inside the Finder
|
||||
image:
|
||||
filename: "false.png"
|
||||
width: 740
|
||||
height: 451
|
||||
- value: true
|
||||
text: Show hidden files inside the Finder
|
||||
image:
|
||||
filename: "true.png"
|
||||
width: 740
|
||||
height: 451
|
||||
versions: [Catalina]
|
||||
after: killall Finder
|
||||
- key: FXEnableExtensionChangeWarning
|
||||
domain: com.apple.finder
|
||||
title: Changing file extension warning
|
||||
|
|
BIN
images/finder/AppleShowAllFiles/false.png
Normal file
BIN
images/finder/AppleShowAllFiles/false.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 35 KiB |
BIN
images/finder/AppleShowAllFiles/true.png
Normal file
BIN
images/finder/AppleShowAllFiles/true.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 50 KiB |
36
record/finder/AppleShowAllFiles/false.js
Normal file
36
record/finder/AppleShowAllFiles/false.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
const path = require('path');
|
||||
const MacRunner = require('../../mac-runner');
|
||||
const { compressPngImage } = require('../../utils')
|
||||
|
||||
module.exports = {
|
||||
run: async (outputPath) => {
|
||||
console.log('> Recording finder show hidden files to false');
|
||||
|
||||
try {
|
||||
const runner = new MacRunner();
|
||||
await runner
|
||||
.setDefault('com.apple.Finder', 'AppleShowAllFiles', '-bool false', 'killall Finder')
|
||||
.openApp('Finder', '~')
|
||||
.captureApp('Finder', `${outputPath}/false.png`)
|
||||
.deleteDefault('com.apple.Finder', 'AppleShowAllFiles', 'killall 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.Finder AppleShowAllFiles && killall Finder')
|
||||
}
|
36
record/finder/AppleShowAllFiles/true.js
Normal file
36
record/finder/AppleShowAllFiles/true.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
const path = require('path');
|
||||
const MacRunner = require('../../mac-runner');
|
||||
const { compressPngImage } = require('../../utils')
|
||||
|
||||
module.exports = {
|
||||
run: async (outputPath) => {
|
||||
console.log('> Recording finder show hidden files to true');
|
||||
|
||||
try {
|
||||
const runner = new MacRunner();
|
||||
await runner
|
||||
.setDefault('com.apple.Finder', 'AppleShowAllFiles', '-bool true', 'killall Finder')
|
||||
.openApp('Finder', '~')
|
||||
.captureApp('Finder', `${outputPath}/true.png`)
|
||||
.deleteDefault('com.apple.Finder', 'AppleShowAllFiles', 'killall 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.Finder AppleShowAllFiles && killall Finder')
|
||||
}
|
Loading…
Reference in a new issue