blob: 5a69d755a36e6b473c435ae0ce509582779a409b (
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
|
{ config, lib, pkgs, ... }:
let
isEnabled = config.my.home.wm.windowManager == "sway";
terminal = config.my.home.terminal.program;
modifier = "Mod4"; # `Super` key
in {
config = lib.mkIf isEnabled {
home.packages = with pkgs; [
wlogout
brightnessctl
pulseaudio
grim
slurp
polkit_gnome
xsettingsd
swaylock
swayidle
wl-clipboard
];
home.sessionVariables = {
MOZ_ENABLE_WAYLAND = true;
XDG_CURRENT_DESKTOP = "sway";
XDG_SESSION_TYPE = "wayland";
};
wayland.windowManager.sway = {
enable = true;
config = {
# FIXME: this should be a variable
terminal = "alacritty";
modifier = modifier;
menu = ''${pkgs.wofi}/bin/wofi -S drun -p "app:" -L 10'';
bars = [ ];
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%";
"${modifier}+Escape" = "exec ${pkgs.wlogout}/bin/wlogout";
"${modifier}+s" =
"exec ${pkgs.grim}/bin/grim $(xdg-user-dir DOCUMENTS)/screenshots/$(date +'%Y-%m-%d-%H%M%S_screenshot.png')";
"${modifier}+Shift+s" =
"exec ${pkgs.slurp}/bin/slurp | ${pkgs.grim}/bin/grim -g - $(xdg-user-dir DOCUMENTS)/screenshots/$(date +'%Y-%m-%d-%H%M%S_screenshot.png')";
};
window.commands = [{
command = "floating enable";
criteria.app_id = "pavucontrol";
}];
input = {
"*" = {
"xkb_layout" = "us,fr";
# map capslock to ctrl, and switch layout using shift+caps
"xkb_options" = "ctrl:nocaps,grp:shift_caps_toggle";
};
};
assigns = {
"1" = [{ app_id = "emacs"; }];
"2" = [{ app_id = "Alacritty"; }];
"3" = [{ app_id = "firefox"; }];
"4" = [{ class = "Element"; }];
};
output = {
"*" = {
scale = "1.5";
bg = "#2E3440 solid_color";
};
# This is for aptos
"eDP-1" = { scale = "1.3"; };
};
startup = [{
command = ''
exec "systemctl --user import-environment; systemctl --user start sway-session.target"'';
}];
};
};
};
}
|