Separate hosts file and add seraph, xinitrc

This commit is contained in:
Adam Gausmann 2019-01-30 01:45:19 -06:00
parent 915201e650
commit 6afa15d7d7
7 changed files with 47 additions and 11 deletions

View file

@ -1,4 +0,0 @@
[ayypad.i3status]
wireless = ["wlp4s0"]
ethernet = ["enp2s0"]
disks = ["/", "/home"]

12
hosts/ayypad.toml Normal file
View file

@ -0,0 +1,12 @@
[i3status]
wireless = ["wlp4s0"]
ethernet = ["enp2s0"]
disks = ["/", "/home"]
[xinit]
outputs = [
{ name = "eDP", config = ["--auto", "--primary"] },
{ name = "HDMI-A-0" },
{ name = "DisplayPort-0" },
{ name = "DisplayPort-1" },
]

10
hosts/seraph.toml Normal file
View file

@ -0,0 +1,10 @@
[i3status]
ethernet = ["enp5s0"]
disks = ["/", "/home"]
[xinit]
outputs = [
{ name = "HDMI-A-0", config = ["--auto", "--primary"] },
{ name = "DVI-D-0", config = ["--auto", "--left-of", "HDMI-A-0"] },
{ name = "DisplayPort-0" },
]

View file

@ -1,5 +1,4 @@
#!/bin/sh
cd $(dirname "$0")
git submodule update --init
pipenv run -- ./install.py "$@"

View file

@ -38,9 +38,13 @@ def main():
templates_dir = args.dotfiles / 'templates'
include_dir = args.dotfiles / 'include'
host_filename = args.dotfiles / 'hosts' / '{}.toml'.format(args.hostname)
with open(args.dotfiles / 'hosts.toml') as hosts_file:
hosts_config = toml.load(hosts_file)
if host_filename.exists():
with open(host_filename) as host_file:
host_config = toml.load(host_file)
else:
host_config = {}
lookup = mako.lookup.TemplateLookup(
directories=[
@ -58,7 +62,7 @@ def main():
lookup=lookup,
)
output = template.render(
host=hosts_config[args.hostname]
host=host_config
)
output_path = args.home / template_path.relative_to(templates_dir)
with open(output_path, 'w+') as output_file:

View file

@ -1,9 +1,10 @@
<% i3status = host.get('i3status', {}) %>\
general {
colors = true
interval = 5
}
% for iface in host['i3status']['wireless']:
% for iface in i3status.get('wireless', []):
wireless ${iface} {
format_up = "${iface} %ip %essid %quality"
format_down = "${iface} down"
@ -11,7 +12,7 @@ wireless ${iface} {
order += "wireless ${iface}"
% endfor
% for iface in host['i3status']['ethernet']:
% for iface in i3status.get('ethernet', []):
ethernet ${iface} {
format_up = "${iface} %ip"
format_down = "${iface} down"
@ -19,7 +20,7 @@ ethernet ${iface} {
order += "ethernet ${iface}"
% endfor
% for disk in host['i3status']['disks']:
% for disk in i3status.get('disks', ['/']):
disk "${disk}" {
format = "${disk} %avail"
}

14
templates/.xinitrc Normal file
View file

@ -0,0 +1,14 @@
<% xinit = host.get('xinit', {}) %>\
#!/bin/sh
% for output in xinit.get('outputs', []):
xrandr --output '${output['name']}' --set TearFree on \
% if output.get('config'):
${' '.join(output['config'])}
%endif
% endfor
xset s 0 0
xset -dpms
exec /usr/bin/ck-launch-session /usr/bin/dbus-launch --sh-syntax --exit-with-session /usr/bin/i3