diff --git a/hosts.toml b/hosts.toml deleted file mode 100644 index 28be823..0000000 --- a/hosts.toml +++ /dev/null @@ -1,4 +0,0 @@ -[ayypad.i3status] -wireless = ["wlp4s0"] -ethernet = ["enp2s0"] -disks = ["/", "/home"] diff --git a/hosts/ayypad.toml b/hosts/ayypad.toml new file mode 100644 index 0000000..5d1dc97 --- /dev/null +++ b/hosts/ayypad.toml @@ -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" }, +] diff --git a/hosts/seraph.toml b/hosts/seraph.toml new file mode 100644 index 0000000..3b9dc53 --- /dev/null +++ b/hosts/seraph.toml @@ -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" }, +] diff --git a/install b/install index 9a3fe1d..a6d10dd 100755 --- a/install +++ b/install @@ -1,5 +1,4 @@ #!/bin/sh cd $(dirname "$0") -git submodule update --init pipenv run -- ./install.py "$@" diff --git a/install.py b/install.py index 109c510..8a345cb 100755 --- a/install.py +++ b/install.py @@ -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: diff --git a/templates/.config/i3status/config b/templates/.config/i3status/config index 165ec49..4c5e3bd 100644 --- a/templates/.config/i3status/config +++ b/templates/.config/i3status/config @@ -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" } diff --git a/templates/.xinitrc b/templates/.xinitrc new file mode 100644 index 0000000..389dd47 --- /dev/null +++ b/templates/.xinitrc @@ -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