From 4d1544625dc15ba34e2c0b320dc959b610d565ad Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Wed, 6 Mar 2024 15:23:14 +0100 Subject: [PATCH] waybar doesn't show on displays in vnc mode --- common/waybar-vnc.nix | 88 +++++++++++++++++++++++++++++++++++++++++++ flake.nix | 10 +++++ 2 files changed, 98 insertions(+) create mode 100644 common/waybar-vnc.nix diff --git a/common/waybar-vnc.nix b/common/waybar-vnc.nix new file mode 100644 index 0000000..78d4e40 --- /dev/null +++ b/common/waybar-vnc.nix @@ -0,0 +1,88 @@ +{ config, pkgs, inputs, ... }: + +{ + home.packages = with pkgs; [ + waybar + font-awesome + ]; + programs.waybar = { + enable = true; + settings = { + mainBar = { + layer = "top"; + position = "top"; + height = 28; + output = [ + "HEADLESS-2" + ]; + modules-left = [ "hyprland/workspaces" "tray" "custom/pronouns" "custom/spotify" ]; + modules-center = [ "hyprland/window" "clock" ]; + modules-right = [ "custom/vpn" "wireplumber" "network" "cpu" "memory" "temperature" "custom/poweroff" ]; + "clock" = { + tooltip-format = "{:%Y %B}\n\n{calendar}"; + interval = 1; + format = "{:%H:%M:%S}"; + format-alt = ":%Y-%m-%d %H:%M:%S}"; + on-click-middle = "gnome-clocks"; + calendar = { + weeks-pos = "left"; + format = { + today = "{}"; + weeks = "{}"; + }; + }; + }; + "tray".spacing = 10; + "cpu" = { + format = "cpu: {usage}%"; + tooltip = false; + }; + "memory" = { + format = "mem: {}%"; + }; + "wireplumber" = { + format = "{volume}%"; + }; + "custom/vpn" = { + format = "VPN"; + exec = "echo '{\"class\": \"connected\"}'"; + exec-if = "test -d /proc/sys/net/ipv4/conf/tun0"; + return-type = "json"; + interval = 5; + }; + "temperature" = { + thermal-zone = 2; + hwmon-path = "/sys/class/hwmon/hwmon2/temp1_input"; + critical-threshold = 80; + format = "{temperatureC}°C {icon}"; + format-icons = ["" "" ""]; + }; + "custom/poweroff" = { + format = ""; + on-click = "wofi-power"; + on-click-right = "swaylock"; + }; + "network" = { + 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}"; + }; + "custom/pronouns" = { + format = "{}"; + exec = "${config.xdg.configHome}/waybar/pronouns"; + interval = 5; + }; + "hyprland/workspaces" = { + format = "{name}"; + on-click = "activate"; + sort-by = "id"; + }; + }; + }; + style = ../styles/waybar.css; + }; + +} diff --git a/flake.nix b/flake.nix index 2d7d372..02d0995 100644 --- a/flake.nix +++ b/flake.nix @@ -40,6 +40,16 @@ inputs.home-manager.nixosModules.default ]; }; + vnc = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs; + inherit nix-colors; + }; + modules = [ + ./hosts/vnc/configuration.nix + inputs.home-manager.nixosModules.default + ]; + }; }; };