mirror of
https://github.com/Foltik/dotfiles
synced 2025-01-07 08:42:47 -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
|
||||
from pathlib import Path
|
||||
|
||||
class Package:
|
||||
def __init__(self, obj):
|
||||
@ -10,8 +11,39 @@ class Package:
|
||||
else:
|
||||
self.name = obj
|
||||
self.source = 'core'
|
||||
|
||||
self.update_from_files()
|
||||
|
||||
def __repr__(self):
|
||||
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:
|
||||
def __init__(self, name, packages):
|
||||
|
12
packages.yml
12
packages.yml
@ -2,10 +2,10 @@ Base:
|
||||
- fish
|
||||
- systemd:
|
||||
source: none
|
||||
user-units:
|
||||
- i3@0
|
||||
- xmodmap@0
|
||||
- xresources@0
|
||||
userunits:
|
||||
- i3@0.service
|
||||
- xmodmap@0.service
|
||||
- xresources@0.service
|
||||
|
||||
Terminal:
|
||||
- alacritty
|
||||
@ -23,13 +23,13 @@ System Tools:
|
||||
Window Manager:
|
||||
- ppi3-git:
|
||||
source: aur
|
||||
- compton:
|
||||
- compton
|
||||
|
||||
Desktop Tools:
|
||||
- python-pywal:
|
||||
script: wal.fish
|
||||
config: .config/wal
|
||||
user-units:
|
||||
userunits:
|
||||
- wallpaper.service
|
||||
- wallpaper.timer
|
||||
- rofi
|
||||
|
Loading…
Reference in New Issue
Block a user