From 75c79e86aa3024253a7fd686d383fe98f187dacc Mon Sep 17 00:00:00 2001 From: notohh Date: Fri, 3 Feb 2023 09:58:36 -0500 Subject: [PATCH] feat: init waybar --- hosts/tsuki/default.nix | 21 +-- modules/home/home.nix | 1 + modules/home/waybar/default.nix | 314 +++++++++++++++++++++++++++++++- 3 files changed, 318 insertions(+), 18 deletions(-) diff --git a/hosts/tsuki/default.nix b/hosts/tsuki/default.nix index f360050..4ca12dc 100755 --- a/hosts/tsuki/default.nix +++ b/hosts/tsuki/default.nix @@ -4,7 +4,7 @@ imports = [ ./hardware-configuration.nix - ../../modules/hyprland/default.nix + ../../modules/home/wayland ]; # bootloader @@ -63,6 +63,7 @@ gdm.enable = true; gdm.wayland = true; }; + desktopManager.plasma5.enable = false; }; }; @@ -76,6 +77,7 @@ enableSSHSupport = true; pinentryFlavor = "gtk2"; }; + services.pcscd.enable = true; sound.enable = true; @@ -113,6 +115,7 @@ ]; }; }; + users = { defaultUserShell = pkgs.nushell; users.notoh = { @@ -122,19 +125,17 @@ packages = with pkgs; [ # essential firefox - neofetch bitwarden spotify-player discord-ptb mpv - # coding + # dev jetbrains.pycharm-community lazygit # utility waybar - xplr btop nvtop obs-studio @@ -144,7 +145,6 @@ etcher virt-manager imv - playerctl ani-cli trackma appimage-run @@ -168,6 +168,7 @@ pipes-rs cmatrix cava + hollywood ]; }; }; @@ -178,29 +179,19 @@ rustup cargo jre - jdk - jq nodejs polkit_gnome - wireplumber - gcc - cmake libvirt qemu_kvm python3Full python3.pkgs.pip gtk-engine-murrine - gnupg pinentry-gtk2 - - # LSPS nil rust-analyzer gopls sumneko-lua-language-server marksman - nodePackages_latest.vscode-html-languageserver-bin - nodePackages_latest.vscode-css-languageserver-bin nodePackages_latest.yaml-language-server ]; diff --git a/modules/home/home.nix b/modules/home/home.nix index 37b20cf..df21f4a 100755 --- a/modules/home/home.nix +++ b/modules/home/home.nix @@ -12,6 +12,7 @@ imports = [ ./helix ./git ./lf + ./waybar ]; systemd.user.startServices = "sd-switch"; programs.home-manager.enable = true; diff --git a/modules/home/waybar/default.nix b/modules/home/waybar/default.nix index 67351ba..3d89d46 100644 --- a/modules/home/waybar/default.nix +++ b/modules/home/waybar/default.nix @@ -1,9 +1,317 @@ +{ + pkgs, + lib, + config, + ... +}: + { programs.waybar = { enable = true; - settings = [ + settings = { + mainBar = { + output = "DP-3"; + layer = "top"; + position = "top"; + height = 35; + width = 1879; + spacing = 10; + margin-top = 8; + modules-left = [ + "image/nixos" + "user" + ]; + modules-center = [ + "hyprland/window" + ]; + modules-right = [ + "pulseaudio" + "cpu" + "memory" + "clock" + "tray" + "custom/wlogout" + ]; + "image/nixos" ={ + path = "/home/notoh/Pictures/icons/nixos.png"; + size = 24; + }; + "user" ={ + format = "{user} (up {work_H} hrs, {work_d} days ↑)"; + interval = 60; + icon = false; + }; + "hyprland/window" = { + format = " {}"; + seperate-outputs = true; + max-length = 35; + }; + "pulseaudio" = { + format = "{volume}% {icon} {format_source}"; + format-muted = " {format_source}"; + format-source = "{volume}% "; + format-source-muted = ""; + format-icons = { + "headphone" = ""; + "hands-free" = ""; + "headset" = ""; + "phone" = ""; + "portable" = ""; + "car" = ""; + "default" = ["" "" ""]; + }; + }; + "cpu" = { + format = "{usage}% "; + tooltip = "false"; + }; + "memory" = { + format = "{}% "; + }; + "clock" = { + tooltip-format = "{:%Y %B}\n{calendar}"; + format-alt = "{:%Y-%m-%d}"; + }; + "tray" = { + spacing = 0; + }; + "custom/wlogout" = { + format = ""; + interval = "once"; + on-click = "wlogout -c 5 -r 5"; + tooltip = "false"; + }; + }; + }; + style = '' +* { + /* `otf-font-awesome` is required to be installed for icons */ + font-family: FontAwesome, JetBrainsMono Nerd Font, JetBrains Mono, Helvetica, Arial, sans-serif; + font-size: 14px; + border-radius: 6px; + padding-bottom: 3px; + padding-right: 7px; + padding-left: 7px; + padding-top: 3px; + min-height: 0px; + } - - ]; +window#waybar { + background-color: rgb(30, 30, 46); + border-radius: 21px; + border-bottom: 3px solid rgb(245, 194, 231); + border-left: 3px solid rgb(245, 194, 231); + border-right: 3px solid rgb(245, 194, 231); + border-top: 3px solid rgb(245, 194, 231); + color: #ffffff; + transition-property: background-color; + transition-duration: .5s; +} + +window#waybar.hidden { + opacity: 0.2; +} + +/* +window#waybar.empty { + background-color: transparent; +} +window#waybar.solo { + background-color: #FFFFFF; +} +*/ + +window#waybar.termite { + background-color: #3F3F3F; +} + +window#waybar.chromium { + background-color: #000000; + border: none; +} + +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; + color: #ffffff; +} + +#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, +#network, +#pulseaudio, +#wireplumber, +#custom-media, +#tray, +#mode { + padding: 0 5px; + color: #ffffff; + +} + +#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; +} + +#clock { + background-color: #cba6f7; + color: black; +} + +label:focus { + background-color: #000000; +} + +#cpu { + background-color: #eba0ac; + color: #000000; +} + +#memory { + background-color: #f38ba8; + color: black; +} + +#disk { + background-color: #964B00; +} + +#network { + background-color: #2980b9; +} + +#network.disconnected { + background-color: #f53c3c; +} + +#pulseaudio { + background-color: #f9e2af; + color: #000000; +} + +#pulseaudio.muted { + background-color: #90b1b1; + color: #2a5c45; +} + +#wireplumber { + background-color: #fff0f5; + color: #000000; +} + +#wireplumber.muted { + background-color: #f53c3c; +} + +#custom-media { + background-color: #66cc99; + color: #2a5c45; + min-width: 100px; +} + +#custom-media.custom-spotify { + background-color: #66cc99; +} + +#custom-media.custom-vlc { + background-color: #ffa000; +} + +#temperature { + background-color: #fab387; + color: black; +} + +#temperature.critical { + background-color: #eb4d4b; +} + +#tray { + background-color: transparent; +} + +#tray > .passive { + -gtk-icon-effect: dim; +} + +#tray > .needs-attention { + -gtk-icon-effect: highlight; + background-color: #eb4d4b; +} + +#language { + background: #00b093; + color: #740864; + padding: 0 5px; + margin: 0 5px; + min-width: 16px; +} + +#window { + background: #f5c2e7; + color: black; + padding-left: 10px; + padding-right: 10px; +} + +#user { + background: #f5c2e7; + color: black; + padding-left: 10px; + padding-right: 10px; +} + +#custom-wlogout { + font-size: 15px; +} + + ''; }; } \ No newline at end of file