def find_config():
'''Find the i3 config file in either
${HOME}/.i3/config or ${HOME}/.config/i3
Exit if not found.
'''
if args.verbose:
print('Searching for i3 config file....')
print('Looking in .i3 ...')
homedir = str(Path.home())
doti3 = homedir + '/.i3/config'
dotconfig = homedir + '/.config/i3/config'
config = Path(doti3)
if (config.is_file()):
if args.verbose:
print('Found .i3/config!')
return config
else:
if args.verbose:
print('File not found. Trying another directory.')
config = Path(dotconfig)
if (config.is_file()):
if args.verbose:
print('Found .config/i3/config!')
return config
else:
print('No config files found.')
print('Please make sure the file is in ~/.i3 or ~/.config')
sys.exit(1)
评论列表
文章目录