~sumner/home-manager-config

4aae1d0a24c6c42bcb60020d016b404a7b90a6ca — Sumner Evans 2 months ago 9b1e656
display: use autorandr
A modules/window-manager/autorandr.nix => modules/window-manager/autorandr.nix +55 -0
@@ 0,0 1,55 @@
{ config, lib, pkgs, ... }: with lib; let
  cfg = config.xorg;
  fingerprints = {
    ThinkPad_Internal = "00ffffffffffff0030aeba4000000000001c0104a5221378e238d5975e598e271c505400000001010101010101010101010101010101243680a070381f403020350058c210000019502b80a070381f403020350058c2100000190000000f00d10930d10930190a0030e4e705000000fe004c503135365746432d535044420094";
    ThinkVision = "00ffffffffffff0030aedd61000000002a1e0104a51f12783aee95a3544c99260f5054bdcf84a94081008180818c9500950fa94ab300023a801871382d40582c450035ae1000001e000000fc004d31340a202020202020202020000000fd00324b1e5a14000a202020202020000000ff0056393036503548410affffffff0101020314b4499011040302011f121365030c0010007c2e90a0601a1e4030203600dc0b1100001cab22a0a050841a3030203600dc0b1100001c662156aa51001e30468f3300dc0b1100001e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022";
  };

  configs = {
    ThinkPad_Internal = {
      enable = true;
      primary = true;
      position = "0x0";
      mode = "1920x1080";
      rate = "60.00";
    };
    ThinkVision = {
      enable = true;
      mode = "1920x1080";
      rate = "60.00";
    };
  };
in
{
  config = mkIf cfg.enable {
    programs.autorandr = {
      enable = true;
      hooks = {
        postswitch = {
          "change-background" = "systemctl restart --user wallpaper";
          "notify-dbus" = ''${pkgs.libnotify}/bin/notify-send "Profile changed to $AUTORANDR_CURRENT_PROFILE"'';
        };
      };
      profiles = {
        ThinkPad = {
          fingerprint = {
            eDP-1 = fingerprints.ThinkPad_Internal;
          };
          config = {
            eDP-1 = configs.ThinkPad_Internal;
          };
        };
        ThinkVision = {
          fingerprint = {
            eDP-1 = fingerprints.ThinkPad_Internal;
            DP-1 = fingerprints.ThinkVision;
          };
          config = {
            eDP-1 = configs.ThinkPad_Internal;
            DP-1 = configs.ThinkVision // { position = "1920x0"; };
          };
        };
      };
    };
  };
}

M modules/window-manager/bin/inactive-windows-transparency.py => modules/window-manager/bin/inactive-windows-transparency.py +0 -0
M modules/window-manager/common.nix => modules/window-manager/common.nix +1 -1
@@ 113,7 113,7 @@
          "${modifier}+Shift+q" = "kill";

          # RESTART SWAY IN-PLACE (PRESERVES YOUR LAYOUT/SESSION, CAN BE USED TO UPGRADE SWAY)
          "${modifier}+Shift+R" = "reload";
          "${modifier}+Shift+R" = "restart";

          # LAUNCHERS
          "${modifier}+d" = "exec ${pkgs.rofi}/bin/rofi -show run";

M modules/window-manager/default.nix => modules/window-manager/default.nix +1 -0
@@ 7,6 7,7 @@
in
{
  imports = [
    ./autorandr.nix
    ./i3status-rust.nix
    ./rofi.nix
    ./wallpaper.nix

M modules/window-manager/xorg.nix => modules/window-manager/xorg.nix +4 -6
@@ 15,7 15,7 @@ in
    extrai3wmConfig = mkOption {
      type = types.attrsOf types.anything;
      description = "Extra config for i3wm";
      default = { };
      default = {};
    };
    remapEscToCaps = mkOption {
      type = types.bool;


@@ 33,7 33,7 @@ in
        common.i3SwayConfig
        {
          config.startup = [
            { command = "${config.home.homeDirectory}/bin/display-configuration.sh"; }
            { command = "${pkgs.autorandr}/bin/autorandr --change"; always = true; }
          ];

          config.keybindings = {


@@ 159,8 159,7 @@ in
          }
        );
      in
      mapAttrs
        (
        mapAttrs (
          name: value: {
            Unit = {
              Description = "Run ${name} on startup.";


@@ 170,7 169,6 @@ in
            Service.Restart = "always";
            Install.WantedBy = [ "graphical-session.target" ];
          }
        )
        startupServices;
        ) startupServices;
  };
}