From f50ce8853f2336cdb1b351a2234b6ee842606792 Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Fri, 15 Sep 2023 21:46:19 -0400 Subject: [PATCH 1/5] Migrate Hyprland config to Home Manager --- modules/home-manager/nixos.nix | 188 +++++++++++++++++++++++++++++++++ 1 file changed, 188 insertions(+) diff --git a/modules/home-manager/nixos.nix b/modules/home-manager/nixos.nix index ee7d36d..1823229 100644 --- a/modules/home-manager/nixos.nix +++ b/modules/home-manager/nixos.nix @@ -1,9 +1,17 @@ { pkgs, ... }: { + home.file.".config/hypr/frappe.conf".source = (pkgs.fetchFromGitHub { + owner = "catppuccin"; + repo = "hyprland"; + rev = "99a88fd21fac270bd999d4a26cf0f4a4222c58be"; + hash = "sha256-07B5QmQmsUKYf38oWU3+2C6KO4JvinuTwmW1Pfk8CT8="; + } + "/themes/frappe.conf"); + programs = { waybar = { enable = true; }; }; + services.dunst = { enable = true; settings = { @@ -29,5 +37,185 @@ }; }; }; + + wayland.windowManager.hyprland = { + enable = true; + settings = { + # Catppuccin Theme + source = "~/.config/hypr/frappe.conf"; + + # See https://wiki.hyprland.org/Configuring/Monitors/ + monitor = ",preferred,auto,auto"; + + exec-once = [ + "waybar & dunst & ulauncher" + + # start polkit-kde-agent + "/nix/store/$(ls -la /nix/store | grep polkit-kde-agent | grep '^d' | awk '{print $9}')/libexec/polkit-kde-authentication-agent-1" + ]; + + # Some default env vars. + env = "XCURSOR_SIZE,24"; + + input = { + follow_mouse = 1; + + kb_layout = "us"; + kb_variant = ""; + kb_model = ""; + kb_options = ""; + kb_rules = ""; + + touchpad = { + natural_scroll = "no"; + }; + + # -1.0 - 1.0, 0 means no modification. + sensitivity = 0; + }; + + general = { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + border_size = 2; + "col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg"; + "col.inactive_border" = "rgba(595959aa)"; + gaps_in = 5; + gaps_out = 20; + layout = "dwindle"; + }; + + decoration = { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + blur = { + enabled = true; + size = 3; + passes = 1; + }; + "col.shadow" = "rgba(1a1a1aee)"; + drop_shadow = "yes"; + rounding = 10; + shadow_range = 4; + shadow_render_power = 3; + }; + + animations = { + enabled = "yes"; + + # Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more + + bezier = "myBezier, 0.05, 0.9, 0.1, 1.05"; + + animation = [ + "windows, 1, 7, myBezier" + "windowsOut, 1, 7, default, popin 80%" + "border, 1, 10, default" + "borderangle, 1, 8, default" + "fade, 1, 7, default" + "workspaces, 1, 6, default" + ]; + }; + + dwindle = { + # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more + + # master switch for pseudotiling. + # Enabling is bound to mainMod + P in the keybinds section below + pseudotile = "yes"; + + preserve_split = "yes"; # you probably want this + }; + + master = { + # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more + new_is_master = true; + }; + + gestures = { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + workspace_swipe = "off"; + }; + + # Example per-device config + # See https://wiki.hyprland.org/Configuring/Keywords/#executing for more + "device:epic-mouse-v1" = { + sensitivity = "-0.5"; + }; + + # Example windowrule v1 + # windowrule = float, ^(kitty)$ + # Example windowrule v2 + # windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ + # See https://wiki.hyprland.org/Configuring/Window-Rules/ for more + + # See https://wiki.hyprland.org/Configuring/Keywords/ for more + "$mainMod" = "SUPER"; + + # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more + bind = [ + "$mainMod, T, exec, tilix" + "$mainMod, Return, exec, xfce4-terminal" + "$mainMod, F, exec, firefox" + "$mainMod, S, exec, slack" + "$mainMod, C, killactive," + "$mainMod, M, exit," + "$mainMod, E, exec, nautilus" + "$mainMod, V, togglefloating," + "$mainMod, space, exec, ulauncher-toggle" + "$mainMod, P, pseudo," # dwindle + "$mainMod, J, togglesplit," # dwindle + + # Move focus with mainMod + arrow keys + "$mainMod, left, movefocus, l" + "$mainMod, right, movefocus, r" + "$mainMod, up, movefocus, u" + "$mainMod, down, movefocus, d" + + # Switch workspaces with mainMod + [0-9] + "$mainMod, 1, workspace, 1" + "$mainMod, 2, workspace, 2" + "$mainMod, 3, workspace, 3" + "$mainMod, 4, workspace, 4" + "$mainMod, 5, workspace, 5" + "$mainMod, 6, workspace, 6" + "$mainMod, 7, workspace, 7" + "$mainMod, 8, workspace, 8" + "$mainMod, 9, workspace, 9" + "$mainMod, 0, workspace, 10" + + # Move active window to a workspace with mainMod + SHIFT + [0-9] + "$mainMod SHIFT, 1, movetoworkspace, 1" + "$mainMod SHIFT, 2, movetoworkspace, 2" + "$mainMod SHIFT, 3, movetoworkspace, 3" + "$mainMod SHIFT, 4, movetoworkspace, 4" + "$mainMod SHIFT, 5, movetoworkspace, 5" + "$mainMod SHIFT, 6, movetoworkspace, 6" + "$mainMod SHIFT, 7, movetoworkspace, 7" + "$mainMod SHIFT, 8, movetoworkspace, 8" + "$mainMod SHIFT, 9, movetoworkspace, 9" + "$mainMod SHIFT, 0, movetoworkspace, 10" + + # Scroll through existing workspaces with mainMod + scroll + "$mainMod, mouse_down, workspace, e+1" + "$mainMod, mouse_up, workspace, e-1" + + # Laptop keys along the top + ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" + ", XF86MonBrightnessUp, exec, brightnessctl set +5%" + ", XF86MonBrightnessDown, exec, brightnessctl set 5%-" + ]; + + binde = [ + # Example volume button that allows press and hold, volume limited to 100% + ", XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 5%+" + ", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" + ]; + + bindm = [ + # Move/resize windows with mainMod + LMB/RMB and dragging + "$mainMod, mouse:272, movewindow" + "$mainMod, mouse:273, resizewindow" + ]; + }; # end settings + }; # end hyprland } From 34c13a62964a1f0a211f1dff4675a3cd4ee4a3cd Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Fri, 15 Sep 2023 21:52:42 -0400 Subject: [PATCH 2/5] Add Tilix theme file --- modules/home-manager/nixos.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/home-manager/nixos.nix b/modules/home-manager/nixos.nix index 1823229..f7e5e8c 100644 --- a/modules/home-manager/nixos.nix +++ b/modules/home-manager/nixos.nix @@ -1,10 +1,18 @@ { pkgs, ... }: { - home.file.".config/hypr/frappe.conf".source = (pkgs.fetchFromGitHub { + home.file = { + ".config/hypr/frappe.conf".source = (pkgs.fetchFromGitHub { owner = "catppuccin"; repo = "hyprland"; rev = "99a88fd21fac270bd999d4a26cf0f4a4222c58be"; hash = "sha256-07B5QmQmsUKYf38oWU3+2C6KO4JvinuTwmW1Pfk8CT8="; } + "/themes/frappe.conf"); + ".config/tilix/schemes/Catppuccin-Frappe.json".source = (pkgs.fetchFromGitHub { + owner = "catppuccin"; + repo = "tilix"; + rev = "3fd05e03419321f2f2a6aad6da733b28be1765ef"; + hash = "sha256-SI7QxQ+WBHzeuXbTye+s8pi4tDVZOV4Aa33mRYO276k="; + } + "/src/Catppuccin-Frappe.json"); + }; programs = { waybar = { From af22b1f7203d1f02dea863dbe03a1e80f9f8dd30 Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Fri, 15 Sep 2023 22:56:38 -0400 Subject: [PATCH 3/5] Manage waybar settings --- modules/home-manager/files/waybar/config | 99 ++++++++++++ modules/home-manager/files/waybar/style.css | 164 ++++++++++++++++++++ modules/home-manager/nixos.nix | 13 +- 3 files changed, 273 insertions(+), 3 deletions(-) create mode 100644 modules/home-manager/files/waybar/config create mode 100644 modules/home-manager/files/waybar/style.css diff --git a/modules/home-manager/files/waybar/config b/modules/home-manager/files/waybar/config new file mode 100644 index 0000000..81f163a --- /dev/null +++ b/modules/home-manager/files/waybar/config @@ -0,0 +1,99 @@ +{ + "layer": "top", // Waybar at top layer + // "position": "bottom", // Waybar position (top|bottom|left|right) + "height": 30, // Waybar height (to be removed for auto height) + // "width": 1280, // Waybar width + "spacing": 4, // Gaps between modules (4px) + // Choose the order of the modules + "modules-left": ["hyprland/workspaces"], + "modules-center": ["hyprland/window"], + "modules-right": ["idle_inhibitor", "pulseaudio", "network", "cpu", "memory", "backlight", "keyboard-state", "battery", "clock", "tray"], + "keyboard-state": { + "numlock": true, + "capslock": true, + "format": "{name} {icon}", + "format-icons": { + "locked": "", + "unlocked": "" + } + }, + "idle_inhibitor": { + "format": "{icon}", + "format-icons": { + "activated": "", + "deactivated": "" + } + }, + "tray": { + // "icon-size": 21, + "spacing": 10 + }, + "clock": { + // "timezone": "America/New_York", + "tooltip-format": "{:%Y %B}\n{calendar}", + "format-alt": "{:%Y-%m-%d}" + }, + "cpu": { + "format": "{usage}% ", + "tooltip": false + }, + "memory": { + "format": "{}% " + }, + "temperature": { + // "thermal-zone": 2, + // "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input", + "critical-threshold": 80, + // "format-critical": "{temperatureC}°C {icon}", + "format": "{temperatureF}°F {icon}", + "format-icons": ["", "", ""] + }, + "backlight": { + // "device": "acpi_video1", + "format": "{percent}% {icon}", + "format-icons": ["", "", "", "", "", "", "", "", ""] + }, + "battery": { + "states": { + // "good": 95, + "warning": 30, + "critical": 15 + }, + "format": "{capacity}% {icon}", + "format-charging": "{capacity}% ", + "format-plugged": "{capacity}% ", + "format-alt": "{time} {icon}", + // "format-good": "", // An empty format will hide the module + // "format-full": "", + "format-icons": ["", "", "", "", ""] + }, + "network": { + // "interface": "wlp2*", // (Optional) To force the use of this interface + "format-wifi": "{essid} ({signalStrength}%) ", + "format-ethernet": "{ipaddr}/{cidr} ", + "tooltip-format": "{ifname} via {gwaddr} ", + "format-linked": "{ifname} (No IP) ", + "format-disconnected": "Disconnected ⚠", + "format-alt": "{ifname}: {ipaddr}/{cidr}" + }, + "pulseaudio": { + // "scroll-step": 1, // %, can be a float + "format": "{volume}% {icon} {format_source}", + "format-bluetooth": "{volume}% {icon} {format_source}", + "format-bluetooth-muted": " {icon} {format_source}", + "format-muted": " {format_source}", + "format-source": "{volume}% ", + "format-source-muted": "", + "format-icons": { + "headphone": "", + "hands-free": "", + "headset": "", + "phone": "", + "portable": "", + "car": "", + "default": ["", "", ""] + }, + "on-click": "pavucontrol" + } +} + diff --git a/modules/home-manager/files/waybar/style.css b/modules/home-manager/files/waybar/style.css new file mode 100644 index 0000000..cfc08a9 --- /dev/null +++ b/modules/home-manager/files/waybar/style.css @@ -0,0 +1,164 @@ +@import "frappe.css"; +* { + /* `otf-font-awesome` is required to be installed for icons */ + font-family: FontAwesome, Roboto, Helvetica, Arial, sans-serif; + font-size: 13px; + color: @text; +} + +window#waybar { + background-color: shade(@base, 0.9); + border-bottom: 3px solid alpha(@crust, 0.3); + transition-property: background-color; + transition-duration: .5s; +} + +window#waybar.hidden { + opacity: 0.2; +} + +button { + /* Use box-shadow instead of border so the text isn't offset */ + box-shadow: inset 0 -3px transparent; + /* Avoid rounded borders under each button name */ + border: none; + border-radius: 0; +} + +/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ +button:hover { + background: inherit; + box-shadow: inset 0 -3px #ffffff; +} + +#workspaces button { + padding: 0 5px; + background-color: transparent; +} + +#workspaces button:hover { + background: rgba(0, 0, 0, 0.2); +} + +#workspaces button.focused { + background-color: #64727D; + box-shadow: inset 0 -3px #ffffff; +} + +#workspaces button.urgent { + background-color: #eb4d4b; +} + +#mode { + background-color: #64727D; + border-bottom: 3px solid #ffffff; +} + +#clock, +#battery, +#cpu, +#memory, +#disk, +#temperature, +#backlight, +#network, +#pulseaudio, +#wireplumber, +#custom-media, +#tray, +#mode, +#idle_inhibitor, +#scratchpad, +#mpd { + padding: 0 10px; +} + +#window, +#workspaces { + margin: 0 4px; +} + +/* If workspaces is the leftmost module, omit left margin */ +.modules-left > widget:first-child > #workspaces { + margin-left: 0; +} + +/* If workspaces is the rightmost module, omit right margin */ +.modules-right > widget:last-child > #workspaces { + margin-right: 0; +} + +#battery.charging, #battery.plugged { + color: #26A65B; +} + +@keyframes blink { + to { + background-color: #ffffff; + color: #000000; + } +} + +#battery.critical:not(.charging) { + background-color: #f53c3c; + color: #ffffff; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +label:focus { + background-color: #000000; +} + +#temperature.critical { + background-color: #eb4d4b; +} + +#tray { + background-color: #2980b9; +} + +#tray > .passive { + -gtk-icon-effect: dim; +} + +#tray > .needs-attention { + -gtk-icon-effect: highlight; + background-color: #eb4d4b; +} + +#idle_inhibitor.activated { + background-color: #ecf0f1; + color: #2d3436; +} + +#language { + padding: 0 5px; + margin: 0 5px; + min-width: 16px; +} + +#keyboard-state { + padding: 0 0px; + margin: 0 5px; + min-width: 16px; +} + +#keyboard-state > label { + padding: 0 5px; +} + +#keyboard-state > label.locked { + background: rgba(0, 0, 0, 0.2); +} + +#scratchpad { + background: rgba(0, 0, 0, 0.2); +} + +#scratchpad.empty { + background-color: transparent; +} diff --git a/modules/home-manager/nixos.nix b/modules/home-manager/nixos.nix index f7e5e8c..2523ae6 100644 --- a/modules/home-manager/nixos.nix +++ b/modules/home-manager/nixos.nix @@ -12,12 +12,19 @@ rev = "3fd05e03419321f2f2a6aad6da733b28be1765ef"; hash = "sha256-SI7QxQ+WBHzeuXbTye+s8pi4tDVZOV4Aa33mRYO276k="; } + "/src/Catppuccin-Frappe.json"); + ".config/waybar/config".source = ./files/waybar/config; + ".config/waybar/frappe.css".source = (pkgs.fetchFromGitHub { + owner = "catppuccin"; + repo = "waybar"; + rev = "f74ab1eecf2dcaf22569b396eed53b2b2fbe8aff"; + hash = "sha256-WLJMA2X20E5PCPg0ZPtSop0bfmu+pLImP9t8A8V4QK8="; + } + "/themes/frappe.css"); + ".config/waybar/style.css".source = ./files/waybar/style.css; }; programs = { - waybar = { - enable = true; - }; + # Using file in ./files/waybar/ to configure waybar + waybar.enable = true; }; services.dunst = { From 5a830a9f8a3f03d046e2e5442feca2acb5495f8e Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Fri, 15 Sep 2023 22:56:55 -0400 Subject: [PATCH 4/5] fix ordering --- modules/nixos/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index c4b8901..4e76cd7 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -108,8 +108,8 @@ in { tilix ulauncher vivaldi - xfce.xfce4-terminal wmctrl + xfce.xfce4-terminal ]; programs = { From f1f5e0b21e7fa855b7219a1fd74c00704e4c4591 Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Fri, 15 Sep 2023 23:17:55 -0400 Subject: [PATCH 5/5] Add custom Tilix theme --- .../files/tilix/Beanbag-Mathias.json | 35 +++++++++++++++++++ modules/home-manager/nixos.nix | 1 + 2 files changed, 36 insertions(+) create mode 100644 modules/home-manager/files/tilix/Beanbag-Mathias.json diff --git a/modules/home-manager/files/tilix/Beanbag-Mathias.json b/modules/home-manager/files/tilix/Beanbag-Mathias.json new file mode 100644 index 0000000..8c9e83f --- /dev/null +++ b/modules/home-manager/files/tilix/Beanbag-Mathias.json @@ -0,0 +1,35 @@ +{ + "name": "Beanbag-Mathias", + "comment": "Inspired by colors from EndeavourOS", + "background-color": "#07042B", + "badge-color": "#FFFFFF", + "bold-color": "#FFFFFF", + "cursor-background-color": "#FF7F7F", + "cursor-foreground-color": "#07042B", + "foreground-color": "#E3E3EA", + "highlight-background-color": "#000000", + "highlight-foreground-color": "#FFFFFF", + "palette": [ + "#000000", + "#E52222", + "#A6E32D", + "#FC951E", + "#C48DFF", + "#FA2573", + "#67D9F0", + "#F2F2F2", + "#555555", + "#FF5555", + "#55FF55", + "#FFFF55", + "#5555FF", + "#FF55FF", + "#55FFFF", + "#FFFFFF" + ], + "use-badge-color": false, + "use-bold-color": false, + "use-cursor-color": true, + "use-highlight-color": false, + "use-theme-colors": false + diff --git a/modules/home-manager/nixos.nix b/modules/home-manager/nixos.nix index 2523ae6..b51ce23 100644 --- a/modules/home-manager/nixos.nix +++ b/modules/home-manager/nixos.nix @@ -6,6 +6,7 @@ rev = "99a88fd21fac270bd999d4a26cf0f4a4222c58be"; hash = "sha256-07B5QmQmsUKYf38oWU3+2C6KO4JvinuTwmW1Pfk8CT8="; } + "/themes/frappe.conf"); + ".config/tilix/schemes/Beanbag-Mathias.json".source = ./files/tilix/Beanbag-Mathias.json; ".config/tilix/schemes/Catppuccin-Frappe.json".source = (pkgs.fetchFromGitHub { owner = "catppuccin"; repo = "tilix";