about summary refs log tree commit diff
path: root/users/fcuny/desktop/sway/default.nix
blob: 2aa5731b2f18a62da2cbfb99ce1145e8bc8b7d70 (plain) (blame)
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
{ config, lib, pkgs, ... }:

{
  imports = [
    ./i3status.nix
    ./sway-idle.nix
    ./wofi.nix
    ./gammastep.nix
  ];

  home.packages = [
    pkgs.pavucontrol
    pkgs.wev
    pkgs.wf-recorder
    pkgs.wofi
  ];

  home.sessionVariables = {
    MOZ_ENABLE_WAYLAND = true;
    XDG_CURRENT_DESKTOP = "sway";
    XDG_SESSION_TYPE = "wayland";
  };

  wayland.windowManager.sway = {
    enable = true;
    systemdIntegration = true;
    extraSessionCommands = ''
      export XDG_SESSION_TYPE=wayland
      export XDG_CURRENT_DESKTOP=sway
      export MOZ_ENABLE_WAYLAND=1
    '';
    config = rec {
      modifier = "Mod4";
      terminal = "${config.programs.alacritty.package}/bin/alacritty";
      menu = "${pkgs.wofi}/bin/wofi -S run";
      bars = [
        {
          fonts = {
            names = [
              "Source Code Pro"
              "Font Awesome 5 Free"
            ];
            size = 9.0;
            style = "Bold";
          };
          extraConfig = ''
            position top
          '';
          statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ~/.config/i3status-rust/config-default.toml";
          colors = {
            background = "#000000";
            statusline = "#88C0D0";
            separator = "#3B4252";
            focusedWorkspace = {
              border = "#88C0D0";
              background = "#88C0D0";
              text = "#2E3440";
            };
            activeWorkspace = {
              border = "#4C566ADD";
              background = "#4C566ADD";
              text = "#D8DEE9";
            };
            inactiveWorkspace = {
              border = "#000000";
              background = "#000000";
              text = "#E5E9F0";
            };
            urgentWorkspace = {
              border = "#B48EAD";
              background = "#B48EAD";
              text = "#ECEFF4";
            };
            bindingMode = {
              border = "#BF616A";
              background = "#BF616A";
              text = "#E5E9F0";
            };
          };
        }
      ];
      fonts = {
        names = [ "Source Code Pro" ];
        size = 10.0;
      };
      keybindings = lib.mkOptionDefault {
        "XF86AudioRaiseVolume" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +5%";
        "XF86AudioLowerVolume" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -5%";
        "XF86AudioMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle";
        "XF86AudioMicMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle";
        "XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-";
        "XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set +5%";
      };
      input = {
        "*" = {
          "xkb_layout" = "us,fr";
          # map capslock to ctrl, and switch layout using shift+caps
          "xkb_options" = "ctrl:nocaps,grp:shift_caps_toggle";
        };
      };
      output = {
        "*" = {
          scale = "1.5";
        };
        # This is for aptos
        "eDP-1" = {
          scale = "1.3";
        };
      };
    };
  };
}