summary refs log tree commit diff stats
path: root/user/settings/i3.nix
blob: 5443d1d693b78dacbe7fc6875141507159b59cc9 (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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
{
  config,
  pkgs,
  lib,
  ...
}: {
  xdg.configFile.i3status = {
    recursive = true;
    source = ../i3/i3status;
  };
  xsession.windowManager.i3 = let
    mod = "Mod4";
    mode_system = "System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown";
    locker = "${pkgs.xautolock}/bin/xautolock -locknow";
  in {
    enable = true;
    config = {
      modifier = mod;
      assigns = {
        "1" = [{class = "^Ripcord$";}];
        "3" = [{class = "^Firefox Developer Edition$";}];
        "8" = [{class = "^Emacs$";}];
        "9" = [{class = "\.exe$";}];
        "10" = [{class = "^Barrier$";}];
      };
      floating = {
        criteria = [
          {class = "Pinentry$";}
          # https://github.com/ValveSoftware/steam-for-linux/issues/1040
          {
            class = "^Steam$";
            title = "^Friends$";
          }
          {
            class = "^Steam$";
            title = "Steam - News";
          }
          {
            class = "^Steam$";
            title = ".* - Chat";
          }
          {
            class = "^Steam$";
            title = "^Settings$";
          }
          {
            class = "^Steam$";
            title = ".* - event started";
          }
          {
            class = "^Steam$";
            title = ".* CD key";
          }
          {
            class = "^Steam$";
            title = "^Steam - Self Updater$";
          }
          {
            class = "^Steam$";
            title = "^Screenshot Uploader$";
          }
          {
            class = "^Steam$";
            title = "^Steam Guard - Computer Authorization Required$";
          }
          {title = "^Steam Keyboard$";}
        ];
      };
      window = {
        titlebar = false;
      };
      keybindings = {
        "${mod}+Return" = "exec --no-startup-id ${config.home.sessionVariables.TERMINAL}";
        # kill focused window
        "${mod}+w" = "kill";
        "${mod}+Shift+w" = "kill";

        "${mod}+Mod1+r" = "exec rofi -show run";
        "${mod}+space" = "exec \"rofi -show drun\"";

        # change focus
        "${mod}+h" = "focus left";
        "${mod}+j" = "focus down";
        "${mod}+k" = "focus up";
        "${mod}+l" = "focus right";

        "${mod}+grave" = "workspace 0";
        "${mod}+1" = "workspace 1";
        "${mod}+2" = "workspace 2";
        "${mod}+3" = "workspace 3";
        "${mod}+4" = "workspace 4";
        "${mod}+5" = "workspace 5";
        "${mod}+6" = "workspace 6";
        "${mod}+7" = "workspace 7";
        "${mod}+8" = "workspace 8";
        "${mod}+9" = "workspace 9";
        "${mod}+0" = "workspace 10";

        # move focused window
        "${mod}+Shift+h" = "move left";
        "${mod}+Shift+j" = "move down";
        "${mod}+Shift+k" = "move up";
        "${mod}+Shift+l" = "move right";

        "${mod}+Shift+grave" = "move container to workspace 0";
        "${mod}+Shift+1" = "move container to workspace 1";
        "${mod}+Shift+2" = "move container to workspace 2";
        "${mod}+Shift+3" = "move container to workspace 3";
        "${mod}+Shift+4" = "move container to workspace 4";
        "${mod}+Shift+5" = "move container to workspace 5";
        "${mod}+Shift+6" = "move container to workspace 6";
        "${mod}+Shift+7" = "move container to workspace 7";
        "${mod}+Shift+8" = "move container to workspace 8";
        "${mod}+Shift+9" = "move container to workspace 9";
        "${mod}+Shift+0" = "move container to workspace 10";

        # move workspace
        "${mod}+Mod1+h" = "move workspace to output left";
        "${mod}+Mod1+j" = "move workspace to output down";
        "${mod}+Mod1+k" = "move workspace to output up";
        "${mod}+Mod1+l" = "move workspace to output right";

        # split in horizontal orientation
        "${mod}+b" = "split h";

        # split in vertical orientation
        "${mod}+v" = "split v";

        "${mod}+F11" = "fullscreen toggle";
        "${mod}+f" = "fullscreen toggle";

        # change container layout (stacked, tabbed, toggle split)
        "${mod}+Shift+s" = "layout stacking";
        "${mod}+Shift+t" = "layout tabbed";
        "${mod}+Shift+v" = "layout toggle split";

        # toggle tiling / floating
        "${mod}+Shift+f" = "floating toggle";

        # change focus between tiling / floating windows
        "${mod}+Tab" = "focus mode_toggle";

        # focus the parent container
        "${mod}+a" = "focus parent";

        # focus the child container
        "${mod}+d" = "focus child";

        "${mod}+Shift+c" = "reload";
        "${mod}+Shift+p" = "restart";

        "${mod}+Shift+r" = "mode resize";
        "${mod}+Shift+o" = "exec ${locker}";
        "${mod}+Pause" = "mode \"${mode_system}\"";
        "${mod}+Escape" = "mode \"${mode_system}\"";
        "${mod}+Shift+q" = "mode \"${mode_system}\"";
      };

      modes = {
        resize = {
          "h" = "resize shrink width 10 px or 10 ppt";
          "j" = "resize grow height 10 px or 10 ppt";
          "k" = "resize shrink height 10 px or 10 ppt";
          "l" = "resize grow width 10 px or 10 ppt";

          "Left" = "resize shrink width 10 px or 10 ppt";
          "Down" = "resize grow height 10 px or 10 ppt";
          "Up" = "resize shrink height 10 px or 10 ppt";
          "Right" = "resize grow width 10 px or 10 ppt";

          "Return" = "mode default";
          "Escape" = "mode default";
        };
        "${mode_system}" = {
          "l" = "exec --no-startup-id ${locker}, mode default";
          "e" = "exec --no-startup-id i3-msg exit, mode default";
          "s" = "exec --no-startup-id systemctl suspend, mode default";
          "h" = "exec --no-startup-id systemctl hibernate, mode default";
          "r" = "exec --no-startup-id systemctl reboot, mode default";
          "Shift+s" = "exec --no-startup-id systemctl poweroff -i, mode default";
          "Return" = "mode default";
          "Escape" = "mode default";
        };
      };

      bars = [
        {
          position = "top";
          hiddenState = "show";
          statusCommand = "${pkgs.i3status}/bin/i3status -c ~/.config/i3status/config";
          extraConfig = ''
            font -xos4-terminus-medium-r-normal--12-120-72-72-c-60-iso10646-1
          '';
        }
      ];
    };

    extraConfig = ''
      font -xos4-terminus-medium-r-normal--12-120-72-72-c-60-iso10646-1
    '';
  };
}