Skip to content

Commit 19eaca5

Browse files
authored
feat: add hyprland compositor option for desktop environment (#23)
* feat: add hyprland * feat: add devenv * chore: add devenv to trusted substituters * fix: allow wheel group to use trusted substituters * feat: configured waybar * feat: configured wofi
1 parent 658bf4a commit 19eaca5

6 files changed

Lines changed: 306 additions & 14 deletions

File tree

users/southcity/features/appearance/stylix/default.nix

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414
package = pkgs.capitaine-cursors-themed;
1515
};
1616

17+
stylix.iconTheme = {
18+
enable = true;
19+
dark = "Gruvbox-Plus-Dark";
20+
light = "Gruvbox-Plus-Light";
21+
package = pkgs.gruvbox-plus-icons;
22+
};
23+
1724
stylix.fonts = {
1825
serif = {
1926
name = "Noto Serif";

users/southcity/features/hyprland/default.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
./dunst.nix
44
./hyprland.nix
55
./hyprpolkit.nix
6+
./waybar.nix
7+
./wofi.nix
68
];
79
}

users/southcity/features/hyprland/hyprland.nix

Lines changed: 99 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,124 @@
33
enable = true;
44

55
settings = {
6+
# variables
7+
"$mod" = "SUPER";
8+
"$terminal" = "kitty";
9+
"$fileManager" = "nautilus";
10+
"$browser" = "firefox";
11+
"$menu" = "wofi --show drun";
12+
613
monitor = [
14+
# rotate vertical monitor
715
"DP-1, prefered, auto, 1, transform, 3"
16+
# default option as fallback
817
", prefered, auto, 1"
918
];
1019
env = [
11-
# Nvidia env vars
20+
# nvidia
1221
"LIBVA_DRIVER_NAME,nvidia"
1322
"__GLX_VENDOR_LIBRARY_NAME,nvidia"
1423
"NVD_BACKEND,direct"
1524
];
25+
bind = [
26+
# window management
27+
"$mod, C, killactive"
28+
"$mod, V, togglefloating"
29+
"$mod, P, pseudo"
30+
"$mod, M, exit"
31+
32+
# application shortcuts
33+
"$mod, Q, exec, $terminal"
34+
"$mod, R, exec, $menu"
35+
"$mod, B, exec, $browser"
36+
"$mod, E, exec, $fileManager"
37+
38+
# shift focus
39+
"$mod, H, movefocus, l"
40+
"$mod, J, movefocus, d"
41+
"$mod, K, movefocus, u"
42+
"$mod, L, movefocus, r"
43+
44+
# select workspaces
45+
"$mod, 1, workspace, 1"
46+
"$mod, 2, workspace, 2"
47+
"$mod, 3, workspace, 3"
48+
"$mod, 4, workspace, 4"
49+
"$mod, 5, workspace, 5"
50+
"$mod, 6, workspace, 6"
51+
"$mod, 7, workspace, 7"
52+
"$mod, 8, workspace, 8"
53+
"$mod, 9, workspace, 9"
54+
"$mod, 0, workspace, 10"
55+
56+
# move window to workspaces
57+
"$mod SHIFT, 1, movetoworkspace, 1"
58+
"$mod SHIFT, 2, movetoworkspace, 2"
59+
"$mod SHIFT, 3, movetoworkspace, 3"
60+
"$mod SHIFT, 4, movetoworkspace, 4"
61+
"$mod SHIFT, 5, movetoworkspace, 5"
62+
"$mod SHIFT, 6, movetoworkspace, 6"
63+
"$mod SHIFT, 7, movetoworkspace, 7"
64+
"$mod SHIFT, 8, movetoworkspace, 8"
65+
"$mod SHIFT, 9, movetoworkspace, 9"
66+
"$mod SHIFT, 0, movetoworkspace, 10"
67+
68+
# special workspace
69+
"$mod, S, togglespecialworkspace, magic"
70+
"$mod SHIFT, S, movetoworkspace, special:magic"
71+
72+
# move workspace with scroll
73+
"$mod, mouse_down, workspace, e+1"
74+
"$mod, mouse_up, workspace, e-1"
75+
];
1676
bindm = [
17-
"SUPER, mouse:272, movewindow"
18-
"SUPER, mouse:273, resizewindow"
77+
# move windows with mouse
78+
"$mod, mouse:272, movewindow"
79+
"$mod, mouse:273, resizewindow"
1980
];
20-
bind = [
21-
"SUPER, B, exec, firefox"
22-
"SUPER, Q, exec, kitty"
81+
windowrule = [
82+
# supress maximize requests from apps
83+
"suppressevent maximize, class:."
84+
85+
# fix for dragging issues with xwayland
86+
"nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0"
87+
88+
# wofi
89+
"float,class:wofi"
90+
91+
# bevy windows
92+
"float,class:daedalus"
2393
];
2494
general = {
25-
border_size = 4;
95+
gaps_in = 5;
96+
gaps_out = 20;
97+
98+
border_size = 2;
99+
100+
layout = "dwindle";
26101
};
27102
decoration = {
28-
rounding = 4;
103+
rounding = 10;
104+
rounding_power = 2;
105+
106+
shadow = {
107+
enabled = true;
108+
range = 4;
109+
render_power = 3;
110+
};
111+
112+
blur = {
113+
enabled = true;
114+
size = 3;
115+
passes = 1;
116+
};
29117
};
30118
cursor = {
31119
no_hardware_cursors = 1;
32120
};
121+
ecosystem = {
122+
no_update_news = true;
123+
};
33124
};
34125
};
35126
}
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
{ config, lib, ... }:
2+
3+
let
4+
# use same margin as defined by hyprland config
5+
marginInline = config.wayland.windowManager.hyprland.settings.general.gaps_out;
6+
marginBlock = config.wayland.windowManager.hyprland.settings.general.gaps_in * 2;
7+
in
8+
{
9+
# if stylix is enabled, apply customizations to default css
10+
stylix.targets.waybar = lib.mkIf config.stylix.enable {
11+
addCss = false;
12+
};
13+
14+
programs.waybar = {
15+
enable = true;
16+
systemd.enable = true;
17+
18+
settings.mainBar = {
19+
layer = "top";
20+
position = "top";
21+
spacing = 8;
22+
23+
margin-top = marginBlock;
24+
margin-left = marginInline;
25+
margin-right = marginInline;
26+
margin-bottom = marginBlock - marginInline;
27+
28+
modules-left = [
29+
"custom/nixos"
30+
"hyprland/workspaces"
31+
];
32+
modules-center = [
33+
"clock"
34+
];
35+
modules-right = [
36+
"pulseaudio"
37+
"group/hardware"
38+
"custom/power"
39+
];
40+
41+
"custom/nixos" = {
42+
format = "";
43+
on-click = "wofi --show drun";
44+
tooltip = false;
45+
};
46+
47+
"custom/power" = {
48+
format = "󰐥";
49+
on-click = "wofi-power-menu";
50+
tooltip = false;
51+
};
52+
53+
"group/hardware" = {
54+
orientation = "inherit";
55+
drawer = {
56+
transition-left-to-right = false;
57+
click-to-reveal = true;
58+
};
59+
modules = [ "cpu" "memory" "temperature" ];
60+
};
61+
62+
"hyprland/workspaces" = {
63+
disable-scroll = true;
64+
all-outputs = true;
65+
warp-on-scroll = false;
66+
format = "{name}";
67+
format-icons = {
68+
urgent = "";
69+
active = "";
70+
default = "";
71+
};
72+
};
73+
74+
pulseaudio = {
75+
format = "{icon} {volume}%";
76+
format-bluetooth = "{icon} {volume}%  {format_source}";
77+
format-bluetooth-muted = " {icon} {format_source}";
78+
format-muted = " {format_source}";
79+
format-source = " {volume}%";
80+
format-source-muted = "";
81+
format-icons = {
82+
headphone = "";
83+
hands-free = "";
84+
headset = "";
85+
phone = "";
86+
portable = "";
87+
car = "";
88+
default = [
89+
""
90+
""
91+
""
92+
];
93+
};
94+
on-click = "pavucontrol";
95+
};
96+
97+
cpu = {
98+
format = " {usage}%";
99+
tooltip = true;
100+
};
101+
102+
memory = {
103+
format = " {}%";
104+
tooltip = true;
105+
};
106+
107+
temperature = {
108+
interval = 10;
109+
critical-threshold = 100;
110+
format-critical = " {temperatureC}";
111+
format = " {temperatureC}°C";
112+
};
113+
114+
clock = {
115+
format = "{:%H:%M | %e %B}";
116+
tooltip-format = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
117+
};
118+
};
119+
120+
style = ''
121+
window#waybar {
122+
background: transparent;
123+
color: @base06;
124+
}
125+
126+
.modules-left,
127+
.modules-center,
128+
.modules-right {
129+
background: @base00;
130+
border: 1px solid @base03;
131+
border-radius: 12px;
132+
padding: 0 16px;
133+
}
134+
135+
.modules-left:hover,
136+
.modules-center:hover,
137+
.modules-right:hover {
138+
border-color: @base0D;
139+
}
140+
141+
.module {
142+
padding: 0 8px;
143+
}
144+
145+
#custom-nixos,
146+
#custom-power,
147+
#custom-reboot,
148+
#custom-lock {
149+
font-size: 24px;
150+
}
151+
'';
152+
};
153+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{ pkgs, ... }:
2+
{
3+
programs.wofi = {
4+
enable = true;
5+
package = pkgs.wofi;
6+
7+
settings = {
8+
normal_window = true;
9+
allow_images = true;
10+
allow_markup = true;
11+
12+
dmenu-parse_action = true;
13+
};
14+
};
15+
16+
# custom wofi menus
17+
home.packages = [
18+
(pkgs.writeShellApplication {
19+
name = "wofi-power-menu";
20+
runtimeInputs = [
21+
pkgs.wofi
22+
];
23+
text = ''
24+
options="\
25+
img:${pkgs.gruvbox-plus-icons}/share/icons/Gruvbox-Plus-Dark/apps/scalable/system-log-out.svg:text:Logout
26+
img:${pkgs.gruvbox-plus-icons}/share/icons/Gruvbox-Plus-Dark/apps/scalable/system-reboot.svg:text:Reboot
27+
img:${pkgs.gruvbox-plus-icons}/share/icons/Gruvbox-Plus-Dark/apps/scalable/system-shutdown.svg:text:Shutdown"
28+
29+
picked=$(echo "$options" | wofi --show dmenu)
30+
31+
case "$picked" in
32+
Logout)
33+
hyprctl dispatch exit
34+
;;
35+
Reboot)
36+
systemctl reboot
37+
;;
38+
Shutdown)
39+
systemctl poweroff
40+
;;
41+
esac
42+
'';
43+
})
44+
];
45+
}

users/southcity/personal.nix

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,5 @@
2727
"discord"
2828
"spotify"
2929
];
30-
31-
# Not handled by stylix
32-
gtk.iconTheme = {
33-
name = "Gruvbox-Plus-Dark";
34-
package = pkgs.gruvbox-plus-icons;
35-
};
3630
};
3731
}

0 commit comments

Comments
 (0)