Update kanshi to use settings instead of profiles

Add kanshi config to Northstar

Standardise monitor config across machines

Move waybar alt bar definition to Vanguard config specifically, don't
need to use hacky solution
This commit is contained in:
Evie Litherland-Smith 2024-06-15 09:57:26 +01:00
parent e869e866f1
commit 8f179c9f6b
6 changed files with 303 additions and 269 deletions

View file

@ -1,8 +1,42 @@
{...}: {
imports = [./default.nix];
wayland.windowManager.sway.config.output = {
"eDP-1" = {
scale = "1.25";
};
wayland.windowManager.sway.config = let
defaultOutput = "eDP-1";
in {
output.${defaultOutput}.scale = "1.25";
workspaceOutputAssign = [
{
output = defaultOutput;
workspace = "1";
}
];
};
services.kanshi = {
enable = true;
settings = let
laptopScreen = {
criteria = "eDP-1";
scale = 1.25;
position = "3000,636";
};
monitor1 = {
criteria = "Acer Technologies ED270R TJMEE0043W01";
mode = "1920x1080@165Hz";
position = "1080,420";
};
monitor2 = {
criteria = "Ancor Communications Inc VS278 FALMQS032358";
position = "0,0";
transform = "270";
};
in [
{output = laptopScreen;}
{
profile = {
name = "docked";
outputs = [laptopScreen monitor1 monitor2];
};
}
];
};
}

View file

@ -1,9 +1,6 @@
{...}: {
imports = [./work.nix];
wayland.windowManager.sway.config.output = {
"Dell Inc. DELL P3223QE CCG8YN3" = {
pos = "0 0";
scale = "1.5";
};
wayland.windowManager.sway.config = {
output."Dell Inc. DELL P3223QE CCG8YN3".scale = "1.5";
};
}

View file

@ -1,34 +1,37 @@
{...}: {
imports = [./work.nix];
wayland.windowManager.sway.config.output = {
"eDP-1" = {
scale = "1.25";
position = "2560 576";
};
"Dell Inc. DELL P3223QE CCG8YN3" = {
scale = "1.5";
position = "0 0";
};
wayland.windowManager.sway.config = let
defaultOutput = "eDP-1";
in {
output.${defaultOutput}.scale = "1.25";
workspaceOutputAssign = [
{
output = defaultOutput;
workspace = "1";
}
];
};
services.kanshi = {
enable = true;
systemdTarget = "sway-session.target";
profiles = let
settings = let
laptopScreen = {
criteria = "eDP-1";
status = "enable";
scale = 1.25;
position = "2560,576";
};
monitor = {
criteria = "Dell Inc. DELL P3223QE CCG8YN3";
status = "enable";
scale = 1.5;
position = "0,0";
};
in {
undocked = {
outputs = [laptopScreen];
};
docked = {
outputs = [monitor laptopScreen];
};
};
in [
{output = laptopScreen;}
{
profile = {
name = "docked";
outputs = [laptopScreen monitor];
};
}
];
};
}

View file

@ -1,4 +1,8 @@
{pkgs, ...}: {
{
config,
pkgs,
...
}: {
imports = [
./default.nix
../programs/games/default.nix
@ -8,30 +12,39 @@
freecad
prusa-slicer
];
wayland.windowManager.sway.config = {
startup = [
{command = "${pkgs.xorg.xrandr}/bin/xrandr --output DP-2 --primary";}
];
wayland.windowManager.sway.config = let
defaultOutput = "DP-2";
in {
output = {
"Acer Technologies ED270R TJMEE0043W01" = {
mode = "1920x1080@165Hz";
pos = "1080 420";
position = "1080 420";
adaptive_sync = "off";
};
"Ancor Communications Inc VS278 FALMQS032358" = {
pos = "0 0";
position = "0 0";
transform = "270";
};
};
workspaceOutputAssign = [
{
output = "HDMI-A-1";
output = defaultOutput;
workspace = "1";
}
];
startup = [
{command = "${pkgs.xorg.xrandr}/bin/xrandr --output ${defaultOutput} --primary";}
];
};
programs.waybar.settings = {
main.output = ["DP-2"];
alt.output = ["HDMI-A-1"];
alt = {
inherit (config.programs.waybar.settings.main) layer position "sway/workspaces";
name = "alt";
output = ["HDMI-A-1"];
"modules-left" = [];
"modules-center" = ["sway/workspaces"];
"modules-right" = [];
};
};
}

View file

@ -7,6 +7,8 @@
accentColour2,
...
}: {
programs.waybar.systemd.target = lib.mkIf config.wayland.windowManager.sway.systemd.enable "sway-session.target";
services.kanshi.systemdTarget = lib.mkIf config.wayland.windowManager.sway.systemd.enable "sway-session.target";
wayland.windowManager.sway = {
enable = true;
package =

View file

@ -1,8 +1,6 @@
{
config,
lib,
pkgs,
hostname,
fonts,
accentColour,
...
@ -13,237 +11,224 @@
};
programs.waybar = {
enable = true;
systemd = {
enable = true;
target = "sway-session.target";
};
settings = rec {
main = {
name = "main";
layer = "top";
position = "bottom";
# Layout
"modules-left" = [
"sway/workspaces"
"sway/window"
];
"modules-center" = [];
"modules-right" = [
"mpris"
"custom/notification"
"pulseaudio"
"network"
"bluetooth"
"clock#calendar"
"clock"
"backlight"
"battery"
"custom/weather"
"tray"
];
# Module config
"sway/workspaces" = {
format = "{icon}";
format-icons = {
"1" = "󰫃 ";
"2" = "󰫄 ";
"3" = "󰫅 ";
"4" = "󰫆 ";
"5" = "󰫇 ";
"6" = "󰫈 ";
default = "󰋙 ";
urgent = "󰁡 ";
};
# show-special = false;
# sort-by-number = true;
all-outputs = false;
persistent-workspaces = {
"1" = [];
"2" = [];
"3" = [];
"4" = [];
"5" = [];
"6" = [];
};
systemd.enable = true;
settings.main = {
name = "main";
layer = "top";
position = "bottom";
# Layout
"modules-left" = [
"sway/workspaces"
"sway/window"
];
"modules-center" = [];
"modules-right" = [
"mpris"
"custom/notification"
"pulseaudio"
"network"
"bluetooth"
"clock#calendar"
"clock"
"backlight"
"battery"
"custom/weather"
"tray"
];
# Module config
"sway/workspaces" = {
format = "{icon}";
format-icons = {
"1" = "󰫃 ";
"2" = "󰫄 ";
"3" = "󰫅 ";
"4" = "󰫆 ";
"5" = "󰫇 ";
"6" = "󰫈 ";
default = "󰋙 ";
urgent = "󰁡 ";
};
"sway/window" = {
"format" = "{title}";
"max-length" = 50;
"rewrite" = {
"(.*) - GNU Emacs at (.*)" = " $1 [$2]";
"(alacritty.*)" = " $1";
"(foot.*)" = " $1";
"(.*) - mpv" = "󰦟 $1";
"swayimg: (.*)" = "󰋩 $1";
"(btm)" = " Resource Usage [$1]";
"(cava)" = "󰝚 Music Visualiser [$1]";
"(.*) - Thunar" = "󰝰 $1";
"Mozilla Firefox" = "󰈹 $1";
"(.*) Mozilla Firefox" = "󰈹 $1";
"Nyxt - (.*)" = "󰀹 $1";
"(.*) - Chromium" = "󰊯 $1";
"(Signal.*)" = "󰭹 $1";
"((?:.*)WebCord.*)" = "󰙯 $1";
"(Cartridges.*)" = "󰊗 $1";
"([Ss]team.*)" = "󰓓 $1";
"(Prism Launcher.*)" = "󰍳 Minecraft ($1)";
"(X2Go Client)" = "󰢹 $1";
"(NoMachine|Nxplayer.bin) (.*)" = "󰢹 $1 $2";
};
};
mpris = {
"format" = "{status_icon} {player_icon} {artist} - {title}";
"tooltip-format" = "{player_icon} ({player}) {dynamic}";
"title-len" = 64;
"interval" = 1;
"dynamic-order" = [
"album"
"artist"
"title"
"position"
"length"
];
"player-icons" = {
"default" = "󰲸 ";
"emms" = " ";
"firefox" = "󰈹 ";
"mpv" = "󰦟 ";
};
"status-icons" = {
"playing" = "󰐊";
"paused" = "󰏤";
"stopped" = "󰓛";
};
"ignored-players" = [];
};
pulseaudio = {
scroll-step = 5;
format = "{format_source}{icon}{volume}%";
format-muted = "{format_source} 󰝟 ";
format-source = "󰍬 ";
format-source-muted = "󰍭 ";
format-icons = {
car = "󰄍 ";
default = ["󰕿 " "󰖀 " "󰕾 "];
hands-free = "󰥰 ";
headset = "󰋎 ";
phone = "󰏲 ";
portable = "󰏳 ";
headphone = "󰋋 ";
};
on-click = "${pkgs.pavucontrol}/bin/pavucontrol";
on-click-right = "${pkgs.pamixer}/bin/pamixer -t";
on-scroll-up = "${pkgs.pamixer}/bin/pamixer -i 5";
on-scroll-down = "${pkgs.pamixer}/bin/pamixer -d 5";
};
disk = {
format = "󰋊 {percentage_used}%";
path = config.home.homeDirectory;
};
cpu = {
format = "󰻠 {usage}%";
tooltip = false;
};
memory = {format = "󰍛 {}%";};
temperature = {
critical-threshold = 80;
format = "{icon} {temperatureC}°C";
format-icons = ["󱃃" "󰔏" "󱃂"];
};
network = {
format-icons = ["󰤟 " "󰤢 " "󰤥 " "󰤨 "];
format-wifi = "{icon}";
format-ethernet = "󰈁 ";
tooltip-format = "{essid} ({signalStrength}%)";
format-linked = "󰈂 ";
format-disconnected = "󰈂 ";
};
bluetooth = {
format = "󰂯";
format-disabled = "󰂲";
format-off = "󰂲";
format-on = "󰂯";
format-connected = "󰂱";
tooltip-format = "{status} | {device_alias}";
on-click = "${pkgs.bluez}/bin/bluetoothctl power on";
on-click-right = "${pkgs.bluez}/bin/bluetoothctl power off";
};
"clock#calendar" = {
# format = "{:󰃭 %Y-%m-%d}";
format = "{:%Y-%m-%d}"; # TEMP, see https://github.com/Alexays/Waybar/issues/3021
tooltip-format = "<tt><small>{calendar}</small></tt>";
calendar = {
mode = "month";
mode-mon-col = 3;
weeks-pos = "left";
on-scroll = 1;
on-click-right = "mode";
format = {
months = "<span color='#ffead3'><b>{}</b></span>";
days = "<span color='#ecc6d9'><b>{}</b></span>";
weeks = "<span color='#99ffdd'><b>W{}</b></span>";
weekdays = "<span color='#ffcc66'><b>{}</b></span>";
today = "<span color='#ff6699'><b><u>{}</u></b></span>";
};
};
actions = {
on-click-right = "mode";
on-scroll-up = "shift_up";
on-scroll-down = "shift_down";
};
};
clock = {
# format = "{:󰥔 %R}";
format = "{:%R}"; # TEMP, see https://github.com/Alexays/Waybar/issues/3021
};
backlight = {
format = "{icon}";
tooltip-format = "{percent}%";
format-icons = [" " " " " " " " " " " " " " " " " "];
};
battery = {
states = {
warning = 30;
critical = 20;
};
format = "{icon}";
format-charging = "󰂄 ";
format-plugged = "󰚥 ";
tooltip-format = "{capacity}% {time}";
format-icons = ["󱃍 " "󰁺 " "󰁻 " "󰁼 " "󰁽 " "󰁾 " "󰁿 " "󰂀 " "󰂁 " "󰂂 " "󰁹 "];
};
"custom/notification" = let
makoctl = "${pkgs.mako}/bin/makoctl";
jq = "${pkgs.jq}/bin/jq";
in {
exec = "( ${makoctl} list | ${jq} -e '.data[] | length > 0' >/dev/null && echo '󱅫 ' ) || echo '󰂚 ' ";
format = "{}";
on-click = "${makoctl} dismiss -a";
interval = 3;
};
"custom/weather" = let
date-format = "%Y-%m-%d";
custom-indicator = "{ICON}{temp_C}({FeelsLikeC})";
in {
format = "{}°";
tooltip = true;
interval = 900; # Every 15 minutes
exec = ''${pkgs.wttrbar}/bin/wttrbar --location Didcot --date-format "${date-format}" --custom-indicator "${custom-indicator}"'';
return-type = "json";
};
tray = {
icon-size = builtins.floor fonts.sizes.popups;
show-passive-items = true;
spacing = 5;
# show-special = false;
# sort-by-number = true;
all-outputs = false;
persistent-workspaces = {
"1" = [];
"2" = [];
"3" = [];
"4" = [];
"5" = [];
"6" = [];
};
};
# TEMP FIX
alt = lib.mkIf (hostname == "Vanguard") {
inherit (main) layer position "sway/workspaces";
name = "alt";
"modules-left" = [];
"modules-center" = ["sway/workspaces"];
"modules-right" = [];
"sway/window" = {
"format" = "{title}";
"max-length" = 50;
"rewrite" = {
"(.*) - GNU Emacs at (.*)" = " $1 [$2]";
"(alacritty.*)" = " $1";
"(foot.*)" = " $1";
"(.*) - mpv" = "󰦟 $1";
"swayimg: (.*)" = "󰋩 $1";
"(btm)" = " Resource Usage [$1]";
"(cava)" = "󰝚 Music Visualiser [$1]";
"(.*) - Thunar" = "󰝰 $1";
"Mozilla Firefox" = "󰈹 $1";
"(.*) Mozilla Firefox" = "󰈹 $1";
"Nyxt - (.*)" = "󰀹 $1";
"(.*) - Chromium" = "󰊯 $1";
"(Signal.*)" = "󰭹 $1";
"((?:.*)WebCord.*)" = "󰙯 $1";
"(Cartridges.*)" = "󰊗 $1";
"([Ss]team.*)" = "󰓓 $1";
"(Prism Launcher.*)" = "󰍳 Minecraft ($1)";
"(X2Go Client)" = "󰢹 $1";
"(NoMachine|Nxplayer.bin) (.*)" = "󰢹 $1 $2";
};
};
mpris = {
"format" = "{status_icon} {player_icon} {artist} - {title}";
"tooltip-format" = "{player_icon} ({player}) {dynamic}";
"title-len" = 64;
"interval" = 1;
"dynamic-order" = [
"album"
"artist"
"title"
"position"
"length"
];
"player-icons" = {
"default" = "󰲸 ";
"emms" = " ";
"firefox" = "󰈹 ";
"mpv" = "󰦟 ";
};
"status-icons" = {
"playing" = "󰐊";
"paused" = "󰏤";
"stopped" = "󰓛";
};
"ignored-players" = [];
};
pulseaudio = {
scroll-step = 5;
format = "{format_source}{icon}{volume}%";
format-muted = "{format_source} 󰝟 ";
format-source = "󰍬 ";
format-source-muted = "󰍭 ";
format-icons = {
car = "󰄍 ";
default = ["󰕿 " "󰖀 " "󰕾 "];
hands-free = "󰥰 ";
headset = "󰋎 ";
phone = "󰏲 ";
portable = "󰏳 ";
headphone = "󰋋 ";
};
on-click = "${pkgs.pavucontrol}/bin/pavucontrol";
on-click-right = "${pkgs.pamixer}/bin/pamixer -t";
on-scroll-up = "${pkgs.pamixer}/bin/pamixer -i 5";
on-scroll-down = "${pkgs.pamixer}/bin/pamixer -d 5";
};
disk = {
format = "󰋊 {percentage_used}%";
path = config.home.homeDirectory;
};
cpu = {
format = "󰻠 {usage}%";
tooltip = false;
};
memory = {format = "󰍛 {}%";};
temperature = {
critical-threshold = 80;
format = "{icon} {temperatureC}°C";
format-icons = ["󱃃" "󰔏" "󱃂"];
};
network = {
format-icons = ["󰤟 " "󰤢 " "󰤥 " "󰤨 "];
format-wifi = "{icon}";
format-ethernet = "󰈁 ";
tooltip-format = "{essid} ({signalStrength}%)";
format-linked = "󰈂 ";
format-disconnected = "󰈂 ";
};
bluetooth = {
format = "󰂯";
format-disabled = "󰂲";
format-off = "󰂲";
format-on = "󰂯";
format-connected = "󰂱";
tooltip-format = "{status} | {device_alias}";
on-click = "${pkgs.bluez}/bin/bluetoothctl power on";
on-click-right = "${pkgs.bluez}/bin/bluetoothctl power off";
};
"clock#calendar" = {
# format = "{:󰃭 %Y-%m-%d}";
format = "{:%Y-%m-%d}"; # TEMP, see https://github.com/Alexays/Waybar/issues/3021
tooltip-format = "<tt><small>{calendar}</small></tt>";
calendar = {
mode = "month";
mode-mon-col = 3;
weeks-pos = "left";
on-scroll = 1;
on-click-right = "mode";
format = {
months = "<span color='#ffead3'><b>{}</b></span>";
days = "<span color='#ecc6d9'><b>{}</b></span>";
weeks = "<span color='#99ffdd'><b>W{}</b></span>";
weekdays = "<span color='#ffcc66'><b>{}</b></span>";
today = "<span color='#ff6699'><b><u>{}</u></b></span>";
};
};
actions = {
on-click-right = "mode";
on-scroll-up = "shift_up";
on-scroll-down = "shift_down";
};
};
clock = {
# format = "{:󰥔 %R}";
format = "{:%R}"; # TEMP, see https://github.com/Alexays/Waybar/issues/3021
};
backlight = {
format = "{icon}";
tooltip-format = "{percent}%";
format-icons = [" " " " " " " " " " " " " " " " " "];
};
battery = {
states = {
warning = 30;
critical = 20;
};
format = "{icon}";
format-charging = "󰂄 ";
format-plugged = "󰚥 ";
tooltip-format = "{capacity}% {time}";
format-icons = ["󱃍 " "󰁺 " "󰁻 " "󰁼 " "󰁽 " "󰁾 " "󰁿 " "󰂀 " "󰂁 " "󰂂 " "󰁹 "];
};
"custom/notification" = let
makoctl = "${pkgs.mako}/bin/makoctl";
jq = "${pkgs.jq}/bin/jq";
in {
exec = "( ${makoctl} list | ${jq} -e '.data[] | length > 0' >/dev/null && echo '󱅫 ' ) || echo '󰂚 ' ";
format = "{}";
on-click = "${makoctl} dismiss -a";
interval = 3;
};
"custom/weather" = let
date-format = "%Y-%m-%d";
custom-indicator = "{ICON}{temp_C}({FeelsLikeC})";
in {
format = "{}°";
tooltip = true;
interval = 900; # Every 15 minutes
exec = ''${pkgs.wttrbar}/bin/wttrbar --location Didcot --date-format "${date-format}" --custom-indicator "${custom-indicator}"'';
return-type = "json";
};
tray = {
icon-size = builtins.floor fonts.sizes.popups;
show-passive-items = true;
spacing = 5;
};
};
style = with config.scheme.withHashtag; let