From 19cf4d851f292bc70d42021425c7f7ea35caf464 Mon Sep 17 00:00:00 2001 From: winston Date: Wed, 22 Feb 2023 03:24:38 +0100 Subject: [PATCH] feat: various wayland tweaks --- flake.nix | 5 +++- home/apps/neovim.nix | 1 + home/apps/waybar/config | 51 ++++++++++++++++++++++++++++++++++++++ home/apps/waybar/style.css | 36 +++++++++++++++++++++++++++ home/apps/wayland.nix | 25 +++++++++++++++++++ home/default.nix | 2 +- 6 files changed, 118 insertions(+), 2 deletions(-) create mode 100644 home/apps/waybar/config create mode 100644 home/apps/waybar/style.css diff --git a/flake.nix b/flake.nix index f76cfb5..d0a8ce1 100644 --- a/flake.nix +++ b/flake.nix @@ -62,7 +62,10 @@ ({config, ...}: { config = { - nixpkgs.overlays = [overlays]; + nixpkgs.overlays = [ + overlays + hyprland.outputs.overlays.default + ]; nixpkgs.config.allowUnfree = true; home-manager = { useGlobalPkgs = true; diff --git a/home/apps/neovim.nix b/home/apps/neovim.nix index c72239e..5222cba 100644 --- a/home/apps/neovim.nix +++ b/home/apps/neovim.nix @@ -59,6 +59,7 @@ proselint rustc rustfmt + shellcheck shfmt tree-sitter alejandra diff --git a/home/apps/waybar/config b/home/apps/waybar/config new file mode 100644 index 0000000..2c642fd --- /dev/null +++ b/home/apps/waybar/config @@ -0,0 +1,51 @@ +// vim:ft=jsonc +{ + "layer": "top", + "position": "top", + "height": 32, + "spacing": 4, + "modules-left": ["wlr/workspaces"], + "modules-center": [ + "hyprland/window" + ], + "modules-right": [ + "tray", + "idle_inhibitor", + "pulseaudio", + "clock" + ], + "wlr/workspaces": { + "format": "{icon}", + "on-click": "activate", + "format-icons": { + "1": "Ⅰ", + "2": "Ⅱ", + "3": "Ⅲ", + "4": "Ⅳ", + "5": "Ⅴ", + "6": "Ⅵ", + "7": "Ⅶ", + "8": "Ⅷ", + "9": "Ⅸ", + "10": "Ⅹ" + }, + "sort-by-number": true + }, + "idle_inhibitor": { + "format": "{icon}", + "format-icons": { + "activated": "", + "deactivated": "鈴" + } + }, + "tray": { + "spacing": 10 + }, + "pulseaudio": { + "format": "{icon} {volume}%", + "format-icons": { + "default": ["", "", ""] + }, + "on-click": "pavucontrol" + } +} diff --git a/home/apps/waybar/style.css b/home/apps/waybar/style.css new file mode 100644 index 0000000..b8a016d --- /dev/null +++ b/home/apps/waybar/style.css @@ -0,0 +1,36 @@ +* { + font-family: Symbols Nerd Font, Berkeley Mono; + font-size: 16px; + color: #cdd6f4; +} + +window#waybar { + background-color: #000; +} + +#workspaces button { + padding: 0 5px; + border-radius: 0; +} + +#workspaces button:hover { + background: #313244; +} + +#workspaces button.active { + color: #f5c2e7; + background: #585b70; + box-shadow: inset 0 -3px #f5c2e7; +} + +#workspaces button.urgent { + background-color: #f38ba8; +} + +#clock, +#network, +#pulseaudio, +#tray, +#idle_inhibitor { + padding: 0 10px; +} diff --git a/home/apps/wayland.nix b/home/apps/wayland.nix index c87abf4..77ff3d7 100644 --- a/home/apps/wayland.nix +++ b/home/apps/wayland.nix @@ -1,6 +1,7 @@ { config, flakePath, + inputs, lib, pkgs, ... @@ -8,11 +9,29 @@ inherit (pkgs.stdenv.hostPlatform) isLinux; nvidiaPrefix = "GDM_BACKEND=nvidia-drm LIBVA_DRIVER_NAME=nvidia __GLX_VENDOR_LIBRARY_NAME=nvidia WLR_NO_HARDWARE_CURSORS=1"; waylandPrefix = "XDG_SESSION_TYPE=wayland NIXOS_OZONE_WL=1"; + waybarLauncher = pkgs.writeShellScriptBin "waybar-launcher" (let + killall = lib.getExe pkgs.killall; + inotifywait = pkgs.inotify-tools + "/bin/inotifywait"; + in '' + #!/bin/sh + trap "${killall} .waybar-wrapped" EXIT + while true; do + waybar & + ${inotifywait} -e create,modify "$HOME/.config/waybar/config" "$HOME/.config/waybar/style.css" + ${killall} .waybar-wrapped + done + ''); in { home.shellAliases = lib.mkIf isLinux { "Hyprland" = "${nvidiaPrefix} ${waylandPrefix} Hyprland"; "sway" = "${nvidiaPrefix} ${waylandPrefix} sway"; }; + + programs.waybar = lib.mkIf isLinux { + enable = true; + package = pkgs.waybar-hyprland; + }; + wayland = lib.mkIf isLinux { windowManager = { sway = { @@ -41,6 +60,11 @@ in { }; }; xdg = lib.mkIf isLinux { + configFile."waybar" = { + source = config.lib.file.mkOutOfStoreSymlink "${flakePath}/home/apps/waybar"; + recursive = true; + }; + configFile."hypr/hyprland.conf".text = let playerctl = lib.getExe pkgs.playerctl; wpctl = pkgs.wireplumber + "/bin/wpctl"; @@ -119,6 +143,7 @@ in { bind = ,XF86AudioNext,exec,${playerctl} next bind = ,XF86AudioPrev,exec,${playerctl} previous bind = ,XF86AudioPause,exec,${playerctl} play-pause + exec-once = ${waybarLauncher}/bin/waybar-launcher ''; }; } diff --git a/home/default.nix b/home/default.nix index c63c565..b6ac5d6 100644 --- a/home/default.nix +++ b/home/default.nix @@ -50,7 +50,7 @@ in { nur.repos.nekowinston.org-stats (nerdfonts.override {fonts = ["NerdFontsSymbolsOnly"];}) - wezterm + unstable.wezterm ] ++ lib.optionals isLinux [ _1password-gui