summaryrefslogtreecommitdiffstats
path: root/hosts/nepsis/x11.nix
blob: e6c329b669aae080067800cdb00d31ecb0b5a5a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
{
  config,
  pkgs,
  username,
  ...
}: {
  imports = [
  ];

  environment.systemPackages = with pkgs; [
    st
    dmenu
    sxhkd
    slstatus
    scrolling-title
    surf
    surf_search
    sent
    libnotify
    betterlockscreen
    lock-screen
  ];

  programs.i3lock = {
    enable = true;
    package = pkgs.i3lock-color;
  };

  security.pam.services.betterlockscreen = {};

  services.xserver = {
    enable = true;
    autorun = true;

    # Just works
    enableTearFree = true;

    # Overlay to use my-dwm
    windowManager.dwm.enable = true;

    # TODO: Remember what this is for
    desktopManager.runXdgAutostartIfNone = false;

    xautolock = let
      xautolock-notify = pkgs.writeShellScript "xautolock-notify" ''
        exec ${pkgs.libnotify}/bin/notify-send 'Locking in 10 seconds'
      '';
      xautolock-lock = pkgs.writeShellScript "xautolock-lock" ''
        exec ${pkgs.betterlockscreen}/bin/betterlockscreen -l dimblur
      '';
    in {
      enable = true;
      enableNotifier = true;
      notifier = "${xautolock-notify}";
      locker = "${xautolock-lock}";
    };

    # Wallpaper
    displayManager = {
      setupCommands = "";
      sessionCommands = ''
        #!/bin/sh
        ${pkgs.xrandr}/bin/xrandr --output DP-3 --primary --mode 2560x1440 --rate 180 --pos 0x0 --output DP-2 --mode 1920x1080 --rate 160 --pos 2560x360
        ${pkgs.feh}/bin/feh --no-fehbg --bg-fill ${../../Daniel_in_the_Lions_Den_by_Briton_Riviere.jpg}
      '';
    };

    # Replace CAPS lock with ESC
    xkb = {
      layout = "us";
      options = "caps:escape";
    };

    # Keyboard on Desktop
    config = ''
      Section "InputClass"
        Identifier "Kinesis Advantage 360"
        MatchIsKeyboard "on"
        MatchVendor "Kinesis"
        Option "XkbModel" "kinesis"
        Option "XkbLayout" "us"
      EndSection
    '';
  };

  # TODO: Figure out a way to have multi monitors with diff screens.
  # Currently, one monitor will have a smaller display, which is visually distracting
  # doesn't extend full length of screen
  services.displayManager.ly = {
    enable = true;
    settings = {
      animation = "colormix";
      clock = "%c";
      vi_mode = true;
      vi_default_mode = "insert";
      numlock = true;
      bigclock = "en";
      bigclock_seconds = true;
    };
    x11Support = true;
  };

  # Notifications
  services.dunst = {
    enable = true;
  };

  # Transparent terminals
  services.picom = {
    enable = true;
  };

  systemd.user.services.sxhkd = {
    description = "Simple X Hot Key Daemon (sxhkd)";

    path = with pkgs; [
      dmenu
      st

      pamixer

      maim
      xdotool
      xclip

      lock-screen

      sfeed

      rmpc
      mpc

      surf
      librewolf
      surf_search
    ];

    environment = {
      SFEED_PLUMBER = "surf";
      SFEED_URL_FILE = "/home/${username}/.local/share/sfeed/sfeed_read_url_file";
    };

    serviceConfig = {
      ExecStart = "${pkgs.sxhkd}/bin/sxhkd";
      Restart = "on-failure";
    };
    wantedBy = ["graphical-session.target"];
  };

  systemd.user.services.slstatus = {
    description = "slstatus bar";
    wantedBy = ["graphical-session.target"];

    path = with pkgs; [
      pamixer
      scrolling-title
    ];

    serviceConfig = {
      ExecStart = "${pkgs.slstatus}/bin/slstatus";

      Restart = "always";
      RestartSec = "1s";
    };
  };
}