mirror of
https://github.com/Foltik/dotfiles
synced 2025-01-23 07:10:26 -05:00
Add property inference based on files present
This commit is contained in:
parent
97843dbbf3
commit
8d2657ac8f
32
lib/parse.py
32
lib/parse.py
@ -1,4 +1,5 @@
|
|||||||
import yaml
|
import yaml
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
class Package:
|
class Package:
|
||||||
def __init__(self, obj):
|
def __init__(self, obj):
|
||||||
@ -10,9 +11,40 @@ class Package:
|
|||||||
else:
|
else:
|
||||||
self.name = obj
|
self.name = obj
|
||||||
self.source = 'core'
|
self.source = 'core'
|
||||||
|
|
||||||
|
self.update_from_files()
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
def update_from_files(self):
|
||||||
|
if self.source == 'none':
|
||||||
|
self.source = None
|
||||||
|
|
||||||
|
default_config = Path('lain/.config/' + self.name)
|
||||||
|
if hasattr(self, 'config'):
|
||||||
|
self.config = Path('lain/' + self.config)
|
||||||
|
elif default_config.is_dir():
|
||||||
|
self.config = default_config
|
||||||
|
else:
|
||||||
|
self.config = None
|
||||||
|
|
||||||
|
default_script = Path('scripts/' + self.name + '.fish')
|
||||||
|
if hasattr(self, 'script'):
|
||||||
|
self.script = Path('scripts/' + self.script)
|
||||||
|
elif default_script.is_file():
|
||||||
|
self.script = default_script
|
||||||
|
else:
|
||||||
|
self.script = None
|
||||||
|
|
||||||
|
default_unit = Path('lain/.config/systemd/user/' + self.name + '.service')
|
||||||
|
if hasattr(self, 'userunits'):
|
||||||
|
self.userunits = list(map(lambda unit: Path('lain/.config/systemd/user/' + unit), self.userunits))
|
||||||
|
elif default_unit.is_file():
|
||||||
|
self.userunits = [default_unit]
|
||||||
|
else:
|
||||||
|
self.userunits = None
|
||||||
|
|
||||||
class Category:
|
class Category:
|
||||||
def __init__(self, name, packages):
|
def __init__(self, name, packages):
|
||||||
self.name = name
|
self.name = name
|
||||||
|
12
packages.yml
12
packages.yml
@ -2,10 +2,10 @@ Base:
|
|||||||
- fish
|
- fish
|
||||||
- systemd:
|
- systemd:
|
||||||
source: none
|
source: none
|
||||||
user-units:
|
userunits:
|
||||||
- i3@0
|
- i3@0.service
|
||||||
- xmodmap@0
|
- xmodmap@0.service
|
||||||
- xresources@0
|
- xresources@0.service
|
||||||
|
|
||||||
Terminal:
|
Terminal:
|
||||||
- alacritty
|
- alacritty
|
||||||
@ -23,13 +23,13 @@ System Tools:
|
|||||||
Window Manager:
|
Window Manager:
|
||||||
- ppi3-git:
|
- ppi3-git:
|
||||||
source: aur
|
source: aur
|
||||||
- compton:
|
- compton
|
||||||
|
|
||||||
Desktop Tools:
|
Desktop Tools:
|
||||||
- python-pywal:
|
- python-pywal:
|
||||||
script: wal.fish
|
script: wal.fish
|
||||||
config: .config/wal
|
config: .config/wal
|
||||||
user-units:
|
userunits:
|
||||||
- wallpaper.service
|
- wallpaper.service
|
||||||
- wallpaper.timer
|
- wallpaper.timer
|
||||||
- rofi
|
- rofi
|
||||||
|
Loading…
Reference in New Issue
Block a user