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
|
{
homeManager,
inputs,
moduleNameSpace,
settings-persist,
...
}:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.${moduleNameSpace}.x11.bspwm;
snip = pkgs.writeShellScript "snip" ''
case $1 in
full)
${pkgs.maim}/bin/maim | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png
;;
selection)
${pkgs.maim}/bin/maim -s | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png
;;
window)
${pkgs.maim}/bin/maim -i $(xdotool getactivewindow) | xclip -selection clipboard -t image/png
;;
esac
'';
smart-alacritty = pkgs.writeShellScript "smart-alacritty" ''
alacritty msg create-window || exec alacritty
'';
smart-ghostty = pkgs.writeShellScript "smart-ghostty" ''
ghostty +new-window || exec ghostty
'';
terminal =
if config.beeMods.terminal.default == "alacritty" then
"${smart-alacritty}"
else if config.beeMods.terminal.default == "ghostty" then
"${smart-ghostty}"
else
"st";
in
{
options.${moduleNameSpace}.x11.bspwm = {
enable = lib.mkEnableOption "bspwm setup";
};
config = lib.mkIf cfg.enable (
if homeManager then
{
xsession.windowManager.bspwm = {
enable = true;
monitors = {
"eDP" = [
"1"
"2"
"3"
"4"
"5"
"6"
"7"
"8"
"9"
];
};
rules = {
"Alacritty" = {
desktop = "^1";
follow = true;
};
"ghostty" = {
desktop = "^1";
follow = true;
};
"zen" = {
desktop = "^2";
follow = true;
};
"firefox" = {
desktop = "^2";
follow = true;
};
"vesktop" = {
desktop = "^3";
follow = true;
};
"discord" = {
desktop = "^3";
follow = true;
};
"steam" = {
desktop = "^4";
follow = true;
};
};
settings = {
border_width = 2;
window_gap = 5;
split_ratio = 0.55;
click_to_focus = "any";
pointer_modifier = "mod4";
pointer_action1 = "move";
pointer_action2 = "resize_side";
pointer_action3 = "resize_corner";
focus_follows_pointer = true;
};
extraConfig = lib.optionalString config.beeMods.matugen.enable ''
[ -f ~/.config/bspwm/colors ] && . ~/.config/bspwm/colors
'';
startupPrograms = [
"feh --no-fehbg --bg-fill $(rg wallpaper ~/.config/beeSettings | cut -d'=' -f2)"
"xsetroot -cursor_name left_ptr"
"${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"
"gnome-keyring-daemon --start --components=secrets,ssh,pkcs11"
"xrandr --output eDP --set TearFree on"
"${settings-persist}"
];
};
services.sxhkd = {
enable = true;
keybindings = {
"super + Return" = terminal;
"super + r" = "pkill -USR1 -x sxhkd; bspc wm -r";
"super + q" = "bspc node -c";
"super + m" = "bspc quit";
"super + a" = "rofi -show drun";
"super + period" = "rofi -show emoji -modi emoji";
"alt + F4" = "rofi -show power-menu -modi power-menu:rofi-power-menu";
"super + y" = "beesettings wall";
"super + comma" = "beesettings settings";
"super + b" = "zen";
"super + e" = "nautilus";
"super + F12" = "gnome-calculator";
"Print" = "${snip} full";
"super + Print" = "${snip} selection";
"super + shift + Print" = "${snip} window";
"super + {h,j,k,l}" = "bspc node -f {west,south,north,east}";
"super + shift + {h,j,k,l}" = "bspc node -s {west,south,north,east}";
"super + {Left,Down,Up,Right}" = "bspc node -v {-50 0,0 50,0 -50,50 0}";
"super + space" = "bspc node -t ~floating";
"alt + f" = "bspc node -t ~fullscreen";
"super + i" = "bspc node -g hidden=on";
"super + shift + i" = "bspc node any.hidden.local -g hidden=off";
"super + {1-9}" = "bspc desktop -f '^{1-9}'";
"super + shift + {1-9}" = "bspc node -d '^{1-9}'";
"XF86AudioRaiseVolume" = "volume-control up";
"XF86AudioLowerVolume" = "volume-control down";
"XF86AudioMute" = "volume-control mute";
"XF86AudioMicMute" = "mic-control toggle";
"XF86MonBrightnessUp" = "brightness-control up";
"XF86MonBrightnessDown" = "brightness-control down";
"XF86Audio{Play,Next,Prev,Stop}" = "playerctl {play-pause,next,previous,stop}";
"alt + h" = "bspc node -z left -50 0 || bspc node -z right -50 0";
"alt + j" = "bspc node -z bottom 0 50 || bspc node -z top 0 50";
"alt + k" = "bspc node -z top 0 -50 || bspc node -z bottom 0 -50";
"alt + l" = "bspc node -z right 50 0 || bspc node -z left 50 0";
"alt + a" = "bspc desktop -l next";
};
};
}
else
{
services.xserver = {
windowManager.bspwm.enable = true;
};
}
);
}
|