-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsway.nix
276 lines (237 loc) · 9.67 KB
/
sway.nix
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
{ config, pkgs, lib, ... }: {
home.packages = with pkgs; [
swaylock-fancy
swayidle
xwayland # for legacy apps
# waybar # status bar
mako # notification daemon
clipman
# wf-recorder
];
wayland.windowManager.sway = {
enable = true;
checkConfig = false;
systemd.enable = true;
wrapperFeatures.base = true;
xwayland = true;
wrapperFeatures.gtk = true;
extraSessionCommands = ''
export SDL_VIDEODRIVER=wayland
# needs qt5.qtwayland in systemPackages
export QT_QPA_PLATFORM=wayland
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
# Fix for some Java AWT applications (e.g. Android Studio),
# use this if they aren't displayed properly:
export _JAVA_AWT_WM_NONREPARENTING=1
'';
config = {
modifier = "Mod4";
floating.modifier = "Mod4";
startup = [
{ command = "wal --theme /etc/nixos/dotfiles/colors.json -t -n -e"; }
# { command = "code --folder-uri ~/Dropbox/notes"; }
{ command = "obsidian"; }
{ command = "dropbox"; }
{ command = "nextcloud --background"; }
{ command = "keepassxc"; }
{ command = "ydotoold"; }
{ command = "xrandr --output DP-1 --primary"; }
{ command = "sh /etc/nixos/dotfiles/scripts/listener.sh"; }
{ command = "exec wl-paste -t text --watch clipman store"; }
# {
# command = "pulseeffects --gapplication-service";
# }
# Fixes various sway issues: https://github.com/NixOS/nixpkgs/issues/119445
{
command = "dbus-update-activation-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway";
always = true;
}
{
command =
"systemctl --user import-environment WAYLAND_DISPLAY DISPLAY DBUS_SESSION_BUS_ADDRESS SWAYSOCK";
always = true;
}
];
assigns = {
"1: web" = [{ class = "Firefox"; }];
"2: dev" = [{ class = "Code"; }];
"3: term" = [{ class = "Kitty"; }];
"4: social" = [{ class = "Signal"; }];
"999: media" = [{ class = ".obs-wrapped"; } { class = "discord"; } { app_id = "com.obsproject.Studio"; }];
};
input = {
# "type:pointer" = {
# # Disable acceleration
# accel_profile = "flat";
# # Set the dpi to speed ratio (like mouse speed settings in windows)
# pointer_accel = "-0.25";
# };
"5426:123:Razer_Razer_Viper_Ultimate_Dongle" = {
# Disable acceleration
accel_profile = "flat";
# Set the dpi to speed ratio (like mouse speed settings in windows)
pointer_accel = "-0.25";
};
"5426:122:Razer_Razer_Viper_Ultimate" = {
# Disable acceleration
accel_profile = "flat";
# Set the dpi to speed ratio (like mouse speed settings in windows)
pointer_accel = "-0.25";
};
"1133:16461:Logitech_K400_Plus" = {
accel_profile = "adaptive";
# Set the dpi to speed ratio (like mouse speed settings in windows)
pointer_accel = "1";
natural_scroll = "enabled";
};
};
output = {
"*" = {
adaptive_sync = "off";
bg = "~/wall7.jpg fill";
max_render_time = "1";
};
"DP-1" = {
mode = "2560x1440@143.912003Hz";
pos = "1440 590";
max_render_time = "1";
};
"DP-2" = {
mode = "2560x1440@143.912003Hz";
transform = "270";
pos = "0 0";
};
"HDMI-A-1" = {
scale = "1";
};
};
focus = { followMouse = false; };
gaps = {
inner = 12;
smartGaps = true;
smartBorders = "on";
};
window = { hideEdgeBorders = "smart"; };
fonts = {
names = [ "Roboto" ];
style = "Regular";
};
workspaceAutoBackAndForth = true;
keybindings =
let
modifier = config.wayland.windowManager.sway.config.modifier;
in
lib.mkOptionDefault {
"${modifier}+Return" = "exec kitty";
"${modifier}+t" = "exec kitty";
# "${modifier}+b" = "exec kitty";
"${modifier}+1" = "workspace 1: web";
"${modifier}+2" = "workspace 2: dev";
"${modifier}+3" = "workspace 3: term";
"${modifier}+4" = "workspace 4: social";
"${modifier}+5" = "workspace 5: misc";
"${modifier}+6" = "workspace 6: temp";
# "${modifier}+Escape" = "workspace 999: media";
"${modifier}+Shift+1" = "move container to workspace 1: web";
"${modifier}+Shift+2" = "move container to workspace 2: dev";
"${modifier}+Shift+3" = "move container to workspace 3: term";
"${modifier}+Shift+4" = "move container to workspace 4: social";
"${modifier}+Shift+5" = "move container to workspace 5: misc";
"${modifier}+Shift+6" = "move container to workspace 6: temp";
# "${modifier}+Shift+Escape" = "move container to workspace 999: media";
"XF86AudioLowerVolume" =
"exec /etc/nixos/dotfiles/scripts/volume.sh down";
"XF86AudioRaiseVolume" =
"exec /etc/nixos/dotfiles/scripts/volume.sh up";
"${modifier}+XF86AudioLowerVolume" =
"exec /etc/nixos/dotfiles/scripts/brightness.sh down";
"${modifier}+XF86AudioRaiseVolume" =
"exec /etc/nixos/dotfiles/scripts/brightness.sh up";
"XF86AudioMute" = "exec /etc/nixos/dotfiles/scripts/volume.sh mute";
"${modifier}+w" = "kill";
"${modifier}+l" = "exec swaylock-fancy -e -t ''";
# Launchers
"${modifier}+p" =
"exec /etc/nixos/dotfiles/scripts/launcher.sh default";
"${modifier}+g" = "exec /etc/nixos/dotfiles/scripts/launcher.sh gopass";
"${modifier}+b" = "exec /etc/nixos/dotfiles/scripts/launcher.sh clipboard";
"Ctrl+Shift+space" = "exec clipman clear --all";
# Umlauts
"${modifier}+a" = ''exec /etc/nixos/dotfiles/scripts/key.sh "a" "ä"'';
"${modifier}+Shift+a" =
''exec /etc/nixos/dotfiles/scripts/key.sh "a" "Ä"'';
"${modifier}+o" = ''exec /etc/nixos/dotfiles/scripts/key.sh "o" "ö"'';
"${modifier}+Shift+o" =
''exec /etc/nixos/dotfiles/scripts/key.sh "o" "Ö"'';
"${modifier}+u" = ''exec /etc/nixos/dotfiles/scripts/key.sh "u" "ü"'';
"${modifier}+Shift+u" =
''exec /etc/nixos/dotfiles/scripts/key.sh "u" "Ü"'';
"${modifier}+s" = ''exec /etc/nixos/dotfiles/scripts/key.sh "s" "ß"'';
# Screenshots
"${modifier}+Shift+i" =
"exec /etc/nixos/dotfiles/scripts/screen.sh area";
"${modifier}+Shift+d" =
"exec /etc/nixos/dotfiles/scripts/screen.sh annotate";
"${modifier}+Shift+w" =
"exec /etc/nixos/dotfiles/scripts/screen.sh window";
"${modifier}+Shift+p" =
"exec /etc/nixos/dotfiles/scripts/screen.sh color";
"${modifier}+Shift+v" =
"exec /etc/nixos/dotfiles/scripts/screen.sh record_area";
# Screenshots
"${modifier}+Shift+s" =
"exec /etc/nixos/dotfiles/scripts/screenshare.sh";
# Scratchpad
"${modifier}+n" = "[class=obsidian] scratchpad show";
"${modifier}+Shift+n" = "scratchpad show";
"${modifier}+k" = "[app_id=org.keepassxc.KeePassXC] scratchpad show";
# "${modifier}+Shift+n" = "move scratchpad";
# Layout modifiers
"${modifier}+m" = "layout toggle tabbed split";
"${modifier}+c" = "layout toggle split";
"${modifier}+f" = "fullscreen";
"${modifier}+Shift+f" = "floating toggle";
# "${modifier}+Shift+s" = "sticky toggle";
};
bars = [{ command = "waybar"; }];
};
extraConfig = ''
include "~/.cache/wal/colors-sway"
client.unfocused $color8 $color8 $foreground $color0 $color8
client.focused_inactive $color8 $color8 $foreground $color0 $color8
client.focused $color0 $background $foreground $color0 $color15
title_align center
titlebar_border_thickness 0
titlebar_padding 8
default_border pixel 0
# client.unfocused $color8 $background $foreground $color0 $color8
# client.focused_inactive $color8 $color8 $foreground $color0 $color8
# client.focused $color0 $background $foreground $color0 $color15
# title_align left
# titlebar_border_thickness 0
# titlebar_padding 0 16 16 16
# default_border normal 0
set $gnome-schema org.gnome.desktop.interface
exec_always {
gsettings set $gnome-schema gtk-theme 'Pop-dark'
gsettings set $gnome-schema icon-theme 'Papirus-Dark'
gsettings set $gnome-schema cursor-theme 'Adwaita'
}
for_window [title="Notes"] move scratchpad, urgent disable
for_window [class="obsidian"] move scratchpad, urgent disable
for_window [app_id="org.keepassxc.KeePassXC"] move scratchpad, urgent disable
for_window [title=".*\(Private Browsing\).*"] move to workspace 999: media
for_window [title="Wine System Tray"] kill
for_window [title="Picture-in-Picture"] floating enable, move absolute position 0 942, sticky enable, move to workspace 999: media
for_window [title="Windowed Projector (Preview)"] fullscreen enable, move to workspace screenshare
workspace 1: web output DP-1
workspace 2: dev output DP-1
workspace 3: term output DP-1
workspace 4: social output DP-1
workspace 5: misc output DP-1
workspace 6: temp output DP-1
workspace 999: media output DP-2
workspace screenshare output DP-1
'';
};
}