Revamp host output config; add swaylock config
This commit is contained in:
parent
813953cb28
commit
a5c53506c6
8 changed files with 106 additions and 44 deletions
|
@ -1,15 +1,31 @@
|
|||
is-virtual = false
|
||||
base16-scheme = "seti"
|
||||
wireless = ["wlp5s0"]
|
||||
ethernet = ["enp6s0"]
|
||||
disks = ["/"]
|
||||
# hwmon2 = k10temp, temp1 = Tctl
|
||||
temperature-path = "/sys/class/hwmon/hwmon2/temp1_input"
|
||||
|
||||
outputs = [
|
||||
"\"ASUSTek COMPUTER INC VG258 M1LMQS004947\" position 0 1080 mode 1920x1080@165Hz bg ~/.local/share/backgrounds/adventurer/l.jpg fill",
|
||||
"\"BNQ BenQ GL2580 46J02196SL0\" position 1920 1080 mode 1920x1080@60Hz bg ~/.local/share/backgrounds/adventurer/r.jpg fill",
|
||||
"\"BNQ BenQ GL2580 46J02151SL0\" position 960 0 mode 1920x1080@60Hz bg ~/.local/share/backgrounds/adventurer/t.jpg fill ",
|
||||
"\"Pioneer Electronic Corporation AV Receiver Unknown\" mode 3840x2160@60Hz scale 2.0 bg ~/.local/share/backgrounds/adventurer/full.jpg fill",
|
||||
]
|
||||
default-background = false
|
||||
[[outputs]]
|
||||
match = "*"
|
||||
background = ["~/.local/share/backgrounds/adventurer/full.jpg", "fill"]
|
||||
|
||||
[[outputs]]
|
||||
match = "ASUSTek COMPUTER INC VG258 M1LMQS004947"
|
||||
position = [0, 1080]
|
||||
mode = "1920x1080@165Hz"
|
||||
background = ["~/.local/share/backgrounds/adventurer/l.jpg", "fill"]
|
||||
|
||||
[[outputs]]
|
||||
match = "BNQ BenQ GL2580 46J02196SL0"
|
||||
position = [1920, 1080]
|
||||
mode = "1920x1080@60Hz"
|
||||
background = ["~/.local/share/backgrounds/adventurer/r.jpg", "fill"]
|
||||
|
||||
[[outputs]]
|
||||
match = "BNQ BenQ GL2580 46J02151SL0"
|
||||
position = [960, 0]
|
||||
mode = "1920x1080@60Hz"
|
||||
background = ["~/.local/share/backgrounds/adventurer/t.jpg", "fill"]
|
||||
|
||||
[[outputs]]
|
||||
match = "Pioneer Electronic Corporation AV Receiver Unknown"
|
||||
mode = "3840x2160@60Hz"
|
||||
scale = 2
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
is-virtual = false
|
||||
base16-scheme = "seti"
|
||||
wireless = ["wlp0s20f3"]
|
||||
ethernet = ["eno1"]
|
||||
disks = ["/"]
|
||||
|
||||
outputs = [
|
||||
"* bg ~/.local/share/backgrounds/concord/full.jpg fill",
|
||||
"\"Pioneer Electronic Corporation AV Receiver Unknown\" mode 3840x2160@60Hz scale 2.0",
|
||||
]
|
||||
default-background = false
|
||||
[[outputs]]
|
||||
match = "*"
|
||||
background = ["~/.local/share/backgrounds/concord/full.jpg", "fill"]
|
||||
|
||||
[[outputs]]
|
||||
match = "Pioneer Electronic Corporation AV Receiver Unknown"
|
||||
mode = "3840x2160@60Hz"
|
||||
scale = 2
|
||||
|
|
10
hosts/default.toml
Normal file
10
hosts/default.toml
Normal file
|
@ -0,0 +1,10 @@
|
|||
is-virtual = false
|
||||
base16-scheme = "seti"
|
||||
disks = ["/"]
|
||||
system-font = "Fira Sans"
|
||||
system-mono-font = "Fira Mono"
|
||||
#temperature-path = ""
|
||||
|
||||
[[outputs]]
|
||||
match = "*"
|
||||
background = ["~/.local/share/backgrounds/sway-dark-1920x1080.png", "fill"]
|
|
@ -1,10 +1,7 @@
|
|||
base16-scheme = "seti"
|
||||
wireless = ["wlp4s0"]
|
||||
ethernet = ["enp2s0"]
|
||||
disks = ["/"]
|
||||
temperature-path = "/sys/class/hwmon/hwmon5/temp1_input"
|
||||
|
||||
outputs = [
|
||||
"* bg ~/.local/share/backgrounds/faithful/full.jpg fill",
|
||||
]
|
||||
default-background = false
|
||||
[[outputs]]
|
||||
match = "*"
|
||||
background = ["~/.local/share/backgrounds/faithful/full.jpg", "fill"]
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
base16-scheme = "seti"
|
||||
wireless = ["wlan0"]
|
||||
ethernet = ["eth0"]
|
||||
disks = ["/"]
|
||||
|
||||
outputs = [
|
||||
"HDMI-A-1 mode 3840x2160@30Hz scale 2.0",
|
||||
#TODO when HDMI cable arrives
|
||||
#"name HDMI-A-1 mode 3840x2160@60Hz scale 2.0",
|
||||
]
|
40
install.py
40
install.py
|
@ -4,6 +4,7 @@ import argparse
|
|||
import os
|
||||
import shutil
|
||||
import socket
|
||||
import subprocess
|
||||
import sys
|
||||
from functools import partial
|
||||
from pathlib import Path
|
||||
|
@ -79,15 +80,48 @@ def main():
|
|||
raw_dir = args.dotfiles / 'raw'
|
||||
templates_dir = args.dotfiles / 'templates'
|
||||
include_dir = args.dotfiles / 'include'
|
||||
default_host_filename = args.dotfiles / 'hosts' / 'default.toml'
|
||||
host_filename = args.dotfiles / 'hosts' / '{}.toml'.format(args.hostname)
|
||||
|
||||
with open(default_host_filename) as host_file:
|
||||
host_config = toml.load(host_file)
|
||||
|
||||
if host_filename.exists():
|
||||
with open(host_filename) as host_file:
|
||||
host_config = toml.load(host_file)
|
||||
else:
|
||||
host_config = {}
|
||||
host_config.update(toml.load(host_file))
|
||||
|
||||
host_config['name'] = args.hostname
|
||||
|
||||
# Preprocess output configs for sway
|
||||
for output in host_config['outputs']:
|
||||
# Generate config lines for sway template
|
||||
lines = []
|
||||
for key in output:
|
||||
if key == 'match':
|
||||
continue
|
||||
if isinstance(output[key], list):
|
||||
val = ' '.join(repr(elem) for elem in output[key])
|
||||
else:
|
||||
val = repr(output[key])
|
||||
lines.append(f'{key} {val}')
|
||||
|
||||
output['sway-lines'] = lines
|
||||
|
||||
# Attempt to resolve device names for swaylock template
|
||||
# (Workaround https://github.com/swaywm/swaylock/issues/114)
|
||||
#
|
||||
# This will only work if this is run on the target host
|
||||
# and if sway is running, but that is usually the case...
|
||||
if output['match'] != '*':
|
||||
get_outputs = subprocess.check_output(
|
||||
['swaymsg', '-t', 'get_outputs', '-p'],
|
||||
).decode('utf-8')
|
||||
for line in get_outputs.splitlines():
|
||||
# Line format: Output <device> '<match identifier>'
|
||||
if line.startswith('Output') and output['match'] in line:
|
||||
output['device'] = line.split()[1]
|
||||
break
|
||||
|
||||
lookup = mako.lookup.TemplateLookup(
|
||||
directories=[
|
||||
str(templates_dir),
|
||||
|
|
|
@ -38,12 +38,12 @@ client.placeholder $base01 $base01 $base05 $base01 $base01
|
|||
client.background $base07
|
||||
|
||||
% for output in host.get('outputs', []):
|
||||
output ${output}
|
||||
output ${repr(output['match'])} {
|
||||
% for line in output['sway-lines']:
|
||||
${line}
|
||||
% endfor
|
||||
}
|
||||
% endfor
|
||||
|
||||
% if host.get('default-background', True):
|
||||
output * bg ${home}/.local/share/backgrounds/sway-dark-1920x1080.png fill
|
||||
% endif
|
||||
|
||||
gaps inner 8
|
||||
|
||||
|
@ -63,7 +63,7 @@ exec swayidle
|
|||
exec dunst
|
||||
exec udiskie
|
||||
|
||||
font pango:Fira Mono 8
|
||||
font pango:${host['system-mono-font']} 8
|
||||
focus_follows_mouse no
|
||||
|
||||
floating_modifier $mod
|
||||
|
@ -155,7 +155,7 @@ bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle
|
|||
bar {
|
||||
tray_output none
|
||||
status_command i3status
|
||||
font pango:Fira Mono 10
|
||||
font pango:${host['system-mono-font']} 10
|
||||
|
||||
${get_base16('i3', 'bar-colors')}
|
||||
|
||||
|
|
15
templates/.config/swaylock/config
Normal file
15
templates/.config/swaylock/config
Normal file
|
@ -0,0 +1,15 @@
|
|||
ignore-empty-password
|
||||
indicator-idle-visible
|
||||
color=000000
|
||||
scaling=fill
|
||||
font=${host['system-font']}
|
||||
|
||||
% for output in host['outputs']:
|
||||
% if 'background' in output and (output['match'] == '*' or 'device' in output):
|
||||
% if output['match'] == '*':
|
||||
image=${output['background'][0]}
|
||||
% else:
|
||||
image=${output['device']}:${output['background'][0]}
|
||||
% endif
|
||||
% endif
|
||||
% endfor
|
Loading…
Add table
Reference in a new issue