monitor gen working for sway

This commit is contained in:
TheWanderingCrow 2025-07-11 18:08:19 -04:00
parent 0c25456570
commit 8b60957c58
8 changed files with 138 additions and 22 deletions

View file

@ -3,7 +3,16 @@
config,
pkgs,
...
}: {
}: let
monitorConfig =
(
map (m:
if m.enabled
then "output ${m.name} mode ${toString m.width}x${toString m.height}@${toString m.refreshRate}Hz pos ${toString m.x} ${toString m.y} bg ${toString m.background} stretch"
else "output ${m.name} disable")
)
config.monitors;
in {
imports = [
./waybar.nix
../swww
@ -33,6 +42,6 @@
wayland.windowManager.sway = {
enable = true;
config = null;
extraConfig = builtins.readFile ./sway.conf;
extraConfig = builtins.readFile ./sway.conf + lib.strings.concatStringsSep "\n" monitorConfig;
};
}

View file

@ -1,12 +1,3 @@
output HDMI-A-1 mode 1920x1080@74.973Hz
output HDMI-A-1 pos 0 0
output HDMI-A-1 transform 270
output DP-1 mode 2560x1440@169.831Hz
output DP-1 pos 1080 215
# Backgrounds
# Assign specific workspaces to specific outputs
workspace 1 output HDMI-A-1 # Firefox
workspace 2 output HDMI-A-1 # Comms

View file

@ -0,0 +1,47 @@
# This module just provides a customized .desktop file with gamescope args dynamically created based on the
# host's monitors configuration
{
pkgs,
config,
lib,
...
}: let
monitor = lib.head (lib.filter (m: m.primary) config.monitors);
steam-session = let
gamescope = lib.concatStringsSep " " [
(lib.getExe pkgs.gamescope)
"--output-width ${toString monitor.width}"
"--output-height ${toString monitor.height}"
"--framerate-limit ${toString monitor.refreshRate}"
"--prefer-output ${monitor.name}"
"--adaptive-sync"
"--expose-wayland"
"--steam"
"--hdr-enabled"
];
steam = lib.concatStringsSep " " [
"steam"
#"steam://open/bigpicture"
];
in
pkgs.writeTextDir "share/applications/steam-session.desktop" ''
[Desktop Entry]
Name=Steam Session
Exec=${gamescope} -- ${steam}
Icon=steam
Type=Application
'';
in {
home.packages = [
steam-session
pkgs.vintagestory
pkgs.mudlet
pkgs.r2modman
pkgs.prismlauncher
];
nixpkgs.config.permittedInsecurePackages = [
"dotnet-runtime-7.0.20" # VintageStory dep
];
}