diff --git a/hosts/configuration.nix b/hosts/configuration.nix index 183ffb8..06a28e2 100644 --- a/hosts/configuration.nix +++ b/hosts/configuration.nix @@ -6,6 +6,11 @@ { + # max cores used per derivation + nix.settings.cores = 8; + # max derivations that can be built at once + # nix.settings.max-jobs = 2; + networking.networkmanager.enable = true; security.pam.services.kwallet = { diff --git a/modules/hyprland/default.nix b/modules/hyprland/default.nix index 127c51e..4bc4741 100644 --- a/modules/hyprland/default.nix +++ b/modules/hyprland/default.nix @@ -5,7 +5,6 @@ let hostname = osConfig.networking.hostName; monitor_config = import ./monitors.nix { hostname = hostname; }; - workspace_config = import ./workspaces.nix { hostname = hostname; }; in { @@ -13,6 +12,7 @@ in imports = [ ./ewwbar.nix ./keybinds.nix + ./displays.nix ]; home.packages = with pkgs; [ @@ -33,7 +33,6 @@ in extraConfig = lib.strings.concatStrings [ monitor_config - # workspace_config '' '' @@ -41,20 +40,6 @@ in settings = { - workspace = [ - "1,monitor:DP-2" - "3,monitor:DP-2" - "5,monitor:DP-2" - "7,monitor:DP-2" - "9,monitor:DP-2" - - "2,monitor:DP-3" - "4,monitor:DP-3" - "6,monitor:DP-3" - "8,monitor:DP-3" - "10,monitor:DP-3" - ]; - "$mod" = "SUPER"; exec-once = [ diff --git a/modules/hyprland/displays.nix b/modules/hyprland/displays.nix index 4da97ec..aa1fc11 100644 --- a/modules/hyprland/displays.nix +++ b/modules/hyprland/displays.nix @@ -1,23 +1,26 @@ -{ hostname ? "undefined" }: +{ osConfig, ...}: -let - monitor_config = if (hostname == "NicksNixDesktop") then - '' - monitor=DP-2, 2560x1440@144, 1920x0, 1 - monitor=DP-3, 1920x1080@60, 0x360,1 +let - env = LIBVA_DRIVER_NAME,nvidia - env = XDG_SESSION_TYPE,wayland - env = GBM_BACKEND,nvidia-drm - env = WLR_NO_HARDWARE_CURSORS,1 + hostname = osConfig.networking.hostName; +in +{ + wayland.windowManager.hyprland.settings = { + workspace = if (hostname == "NicksNixDesktop") then [ + "1,monitor:DP-2" + "3,monitor:DP-2" + "5,monitor:DP-2" + "7,monitor:DP-2" + "9,monitor:DP-2" - '' - else if (hostname == "NicksNixLaptop") then '' - - '' else '' - - ''; - -in monitor_config + "2,monitor:DP-3" + "4,monitor:DP-3" + "6,monitor:DP-3" + "8,monitor:DP-3" + "10,monitor:DP-3" + ] else [ + ]; + }; +} diff --git a/modules/hyprland/eww-config/eww.scss b/modules/hyprland/eww-config/eww.scss index d2abe6d..634e466 100644 --- a/modules/hyprland/eww-config/eww.scss +++ b/modules/hyprland/eww-config/eww.scss @@ -1,54 +1,43 @@ * { - all: unset; //Unsets everything so you can style everything from scratch + all: unset; //Unsets everything so you can style everything from scratch } //Global Styles -.bar { - background-color: #3a3a3a; - color: #b0b4bc; - padding: 10px; +.bar-main { + color: #b0b4bc; + margin: 15px; + padding: 10px; + margin-bottom: 0px; + padding-bottom: 0px; } -// Styles on classes (see eww.yuck for more information) - -.sidestuff slider { - all: unset; - color: #ffd5cd; +.bar-section { + background-color: rgba(200, 200, 200, 0.5); + border-radius: 15; } -.metric scale trough highlight { - all: unset; - background-color: #D35D6E; - color: #000000; - border-radius: 10px; +.sep { + color: rgba(200, 200, 200, 0.5); } -.metric scale trough { - all: unset; - background-color: #4e4e4e; - border-radius: 50px; - min-height: 3px; - min-width: 50px; - margin-left: 10px; - margin-right: 20px; + +.time { + font-weight: bold; + padding-right: 20px; } -.metric scale trough highlight { - all: unset; - background-color: #D35D6E; - color: #000000; - border-radius: 10px; + +.alert { + color: #aa5555; + padding: 5px; } -.metric scale trough { - all: unset; - background-color: #4e4e4e; - border-radius: 50px; - min-height: 3px; - min-width: 50px; - margin-left: 10px; - margin-right: 20px; + +.regular { + color: #b0b4bc; + padding: 5px; } -.label-ram { - font-size: large; -} -.workspaces button:hover { - color: #D35D6E; + +.active-workspace { + background-color: rgba(150, 150, 150, 0.4); + border-radius: 10; + padding-left: 10px; + padding-right: 10px; } diff --git a/modules/hyprland/eww-config/eww.yuck b/modules/hyprland/eww-config/eww.yuck index 85ef210..2c5af91 100644 --- a/modules/hyprland/eww-config/eww.yuck +++ b/modules/hyprland/eww-config/eww.yuck @@ -1,38 +1,140 @@ (defwidget bar [] (centerbox :orientation "h" - (workspaces) + (workspaces :names active-workspaces :current-idx current-workspace) (music) - (sidestuff))) + (info))) -(defwidget sidestuff [] - (box :class "sidestuff" :orientation "h" :space-evenly false :halign "end" - (metric :label "🔊" - :value volume - :onchange "amixer -D pulse sset Master {}%") - (metric :label "" - :value {EWW_RAM.used_mem_perc} - :onchange "") - (metric :label "💾" - :value {round((1 - (EWW_DISK["/"].free / EWW_DISK["/"].total)) * 100, 0)} - :onchange "") - time)) +(deflisten active-workspaces :initial "[]" "bash ./scripts/get-workspaces") +(deflisten current-workspace :initial "1" "bash ./scripts/get-active-workspace") +(defwidget workspaces [names current-idx] + (box + :halign "start" + :hexpand false + :space-evenly true + :spacing "12" + :css "* {margin-left: 20px; margin-right: 20px;}" + (box + :class {replace(captures(names, "\"[0-9]\"")[captures(current-idx, "[0-9]")[0][0]][0], "\"", "") == "1" ? "active-workspace" : "regular"} + (label :text {names =~ `"1"` ? "" : ""})) + (box + :class {replace(captures(names, "\"[0-9]\"")[captures(current-idx, "[0-9]")[0][0]][0], "\"", "") == "2" ? "active-workspace" : "regular"} + (label :text {names =~ `"2"` ? "" : ""})) + (box + :class {replace(captures(names, "\"[0-9]\"")[captures(current-idx, "[0-9]")[0][0]][0], "\"", "") == "3" ? "active-workspace" : "regular"} + (label :text {names =~ `"3"` ? "" : ""})) + (box + :class {replace(captures(names, "\"[0-9]\"")[captures(current-idx, "[0-9]")[0][0]][0], "\"", "") == "4" ? "active-workspace" : "regular"} + (label :text {names =~ `"4"` ? "" : ""})) + (box + :class {replace(captures(names, "\"[0-9]\"")[captures(current-idx, "[0-9]")[0][0]][0], "\"", "") == "5" ? "active-workspace" : "regular"} + (label :text {names =~ `"5"` ? "" : ""})) + (box + :class {replace(captures(names, "\"[0-9]\"")[captures(current-idx, "[0-9]")[0][0]][0], "\"", "") == "6" ? "active-workspace" : "regular"} + (label :text {names =~ `"6"` ? "" : ""})) + (box + :class {replace(captures(names, "\"[0-9]\"")[captures(current-idx, "[0-9]")[0][0]][0], "\"", "") == "7" ? "active-workspace" : "regular"} + (label :text {names =~ `"7"` ? "" : ""})) + (box + :class {replace(captures(names, "\"[0-9]\"")[captures(current-idx, "[0-9]")[0][0]][0], "\"", "") == "8" ? "active-workspace" : "regular"} + (label :text {names =~ `"8"` ? "" : ""})) + (box + :class {replace(captures(names, "\"[0-9]\"")[captures(current-idx, "[0-9]")[0][0]][0], "\"", "") == "9" ? "active-workspace" : "regular"} + (label :text {names =~ `"9"` ? "" : ""})))) -(deflisten workspaces :initial "[]" "bash ./scripts/get-workspaces") -(deflisten current_workspace :initial "1" "bash ./scripts/get-active-workspace") -(defwidget workspaces [] - (eventbox :onscroll "bash ./scripts/change-active-workspace {} ${current_workspace}" :class "workspaces-widget" - (box :space-evenly true - (label :text "${workspaces}${current_workspace}" :visible false) - (for workspace in workspaces - (eventbox :onclick "hyprctl dispatch workspace ${workspace.id}" - (box :class "workspace-entry ${workspace.id == current_workspace ? "current" : ""} ${workspace.windows > 0 ? "occupied" : "empty"}" - (label :text "${workspace.id}") - ) - ) - ) - ) - ) - ) +(defwidget info [] + (box + :class "side-stuff" + :halign "end" + :space-evenly false + :spacing "25" + (box + :space-evenly false + :spacing "10" + (_volume :volume volume) + (_battery :status {EWW_BATTERY.BAT0.status} :battery {EWW_BATTERY.BAT0.capacity})) + (_network :strength net-strength :name net-name) + (sep) + (buttons))) + +(defvar eww "eww -c $HOME/.config/eww") + +(defwidget revealer-on-hover [toggle togglename ?transition ?duration] + (eventbox + :onhover "${eww} update ${togglename}=true" + :onhoverlost "${eww} update ${togglename}=false" + (box + :space-evenly false + (children :nth 0) + (revealer + :reveal toggle + :transition {transition ?: "slideright"} + :duration {duration ?: "300ms"} + (children :nth 1))))) + +(defvar volume-visible false) +(defwidget _volume [volume] + (box + :hexpand false + :class {volume > 100 ? "alert" : "regular"} + (revealer-on-hover + :toggle volume-visible + :togglename "volume-visible" + (label :text {volume <= 0 ? "󰝟 " : + volume < 33 ? "󰕿 " : + volume < 66 ? "󰖀 " : + volume < 99 ? "󰕾 " : "󱄡 "}) + (label :text "${volume}%")))) + + +(defvar battery-visible false) +(defwidget _battery [status battery] + (box + :hexpand false + :class {battery < 20 ? "alert" : "regular"} + (revealer-on-hover + :toggle battery-visible + :togglename "battery-visible" + (label :text {status == 'Charging' ? "󰂄" : + battery < 20 ? "󰁻" : + battery < 40 ? "󰁽" : + battery < 60 ? "󰁿" : + battery < 80 ? "󰂁" : "󰁹"}) + (label :text "${battery}%")))) + +(defvar network-visible false) +(defwidget _network [strength name] + (box + :hexpand false + :vexpand true + :class "regular" + (revealer-on-hover + :toggle network-visible + :togglename "network-visible" + :ransition "slidedown" + (label :text {strength == "" ? "󰤮 " : + strength < 26 ? "󰤟 " : + strength < 51 ? "󰤢 " : + strength < 76 ? "󰤥 " : "󰤨 "}) + (label :text "${name} (${strength})")))) + +(defwidget buttons [] + (box + :halign "end" + :hexpand false + :space-evenly true + :spacing "15" + (box (button :onclick `hyprctl dispatch exit` "󰍃 ")) + (box (button :onclick `reboot` " ")) + (box (button :onclick `shutdown now` " ")))) + +(defwidget sep [] (box :hexpand false (label :class "sep" :text "|"))) + +(defpoll net-strength :interval "5s" :initial `N/A` + `nmcli -t -f SIGNAL,ACTIVE device wifi | awk -F':' '{if($2=="yes")print$1}'`) +(defpoll net-name :interval "60s" :initial "N/A" "nmcli -t -f NAME c show --active | head -n 1") + +(deflisten music :initial "" + "playerctl --follow metadata --format '{{ artist }} - {{ title }}' || true") (defwidget music [] (box :class "music" @@ -41,23 +143,6 @@ :halign "center" {music != "" ? "🎵${music}" : ""})) - -(defwidget metric [label value onchange] - (box :orientation "h" - :class "metric" - :space-evenly false - (box :class "label" label) - (scale :min 0 - :max 101 - :active {onchange != ""} - :value value - :onchange onchange))) - - - -(deflisten music :initial "" - "playerctl --follow metadata --format '{{ artist }} - {{ title }}' || true") - (defpoll volume :interval "1s" "scripts/getvol") @@ -66,6 +151,7 @@ (defwindow bar :monitor 0 + :exclusive true :windowtype "dock" :geometry (geometry :x "0%" :y "0%" diff --git a/modules/hyprland/monitors.nix b/modules/hyprland/monitors.nix new file mode 100644 index 0000000..2a7d5ab --- /dev/null +++ b/modules/hyprland/monitors.nix @@ -0,0 +1,22 @@ +{ hostname ? "undefined" }: + +# Yes, this is less efficient, but I wanted to save this solution to the issue for future reference +let + monitor_config = if (hostname == "NicksNixDesktop") then + '' + monitor=DP-2, 2560x1440@144, 1920x0, 1 + monitor=DP-3, 1920x1080@60, 0x360,1 + + env = LIBVA_DRIVER_NAME,nvidia + env = XDG_SESSION_TYPE,wayland + env = GBM_BACKEND,nvidia-drm + env = WLR_NO_HARDWARE_CURSORS,1 + '' + else if (hostname == "NicksNixLaptop") then '' + + '' else '' + + ''; + +in monitor_config +