Set Explorer settings (user) based on setup mode

* Addresses issue #94
This commit is contained in:
2Shirt 2019-05-12 19:04:55 -06:00
parent 971c8c66ad
commit e8bc2e1005
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
3 changed files with 20 additions and 3 deletions

View file

@ -66,9 +66,13 @@ def config_explorer_system():
write_registry_settings(SETTINGS_EXPLORER_SYSTEM, all_users=True)
def config_explorer_user():
"""Configure Windows Explorer for current user."""
write_registry_settings(SETTINGS_EXPLORER_USER, all_users=False)
def config_explorer_user(setup_mode='All'):
"""Configure Windows Explorer for current user per setup_mode."""
settings_explorer_user = {
k: v for k, v in SETTINGS_EXPLORER_USER.items()
if setup_mode not in v.get('Invalid modes', [])
}
write_registry_settings(settings_explorer_user, all_users=False)
def config_windows_updates():

View file

@ -109,6 +109,7 @@ SETTINGS_EXPLORER_SYSTEM = {
SETTINGS_EXPLORER_USER = {
# Desktop icons
r'Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu': {
'Invalid modes': ['Cur'],
'DWORD Items': {
# This PC
'{20D04FE0-3AEA-1069-A2D8-08002B30309D}': 0,
@ -117,6 +118,7 @@ SETTINGS_EXPLORER_USER = {
},
},
r'Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel': {
'Invalid modes': ['Cur'],
'DWORD Items': {
# This PC
'{20D04FE0-3AEA-1069-A2D8-08002B30309D}': 0,
@ -136,21 +138,28 @@ SETTINGS_EXPLORER_USER = {
},
# File Explorer
r'Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced': {
'Invalid modes': ['Cur'],
'DWORD Items': {
# Replace PowerShell with CMD in Win+X menu
'DontUsePowerShellOnWinX': 1,
# Change default Explorer view to "Computer"
'LaunchTo': 1,
},
},
r'SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced': {
'DWORD Items': {
# Launch Folder Windows in a Separate Process
'SeparateProcess': 1,
},
},
# Hide People bar
r'Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People': {
'Invalid modes': ['Cur'],
'DWORD Items': {'PeopleBand': 0},
},
# Hide Search button / box
r'Software\Microsoft\Windows\CurrentVersion\Search': {
'Invalid modes': ['Cur'],
'DWORD Items': {'SearchboxTaskbarMode': 1},
},
}

View file

@ -193,6 +193,7 @@ def get_actions(setup_mode, answers):
# Handle "special" actions
if _key == 'KIT_NAME_FULL':
# Cleanup WK folders
_key = KIT_NAME_FULL
_action['KWArgs'] = {'folder_path': global_vars['ClientDir']}
elif _key == 'Ninite bundle':
@ -201,6 +202,9 @@ def get_actions(setup_mode, answers):
kw.lower(): kv for kw, kv in answers.items()
if SETUP_QUESTIONS.get(kw, {}).get('Ninite', False)
})
elif _key == 'Explorer (user)':
# Explorer settings (user)
_action['KWArgs'] = {'setup_mode': setup_mode}
# Add to dict
actions[_key] = _action