From 1a95061a213d8d2e7a57eda2b40ee90618fc05a2 Mon Sep 17 00:00:00 2001 From: Gabriella Bere Date: Thu, 22 Aug 2024 11:54:25 +0100 Subject: [PATCH] add waybar and alacritty with a few defaults for testing --- hosts/gabbielaptop/configuration.nix | 2 + hosts/gabbielaptop/home.nix | 73 +++++++++++++++++++++++++++- 2 files changed, 74 insertions(+), 1 deletion(-) diff --git a/hosts/gabbielaptop/configuration.nix b/hosts/gabbielaptop/configuration.nix index 4c36a95..4cf6693 100644 --- a/hosts/gabbielaptop/configuration.nix +++ b/hosts/gabbielaptop/configuration.nix @@ -62,6 +62,8 @@ # Enable the Hyprland WM functionality for NixOS (xdg portals etc.) programs.hyprland.enable = true; + programs.waybar.enable = true; + # Configure keymap in X11 services.xserver.xkb.layout = "gb"; diff --git a/hosts/gabbielaptop/home.nix b/hosts/gabbielaptop/home.nix index 671aab9..519b74b 100644 --- a/hosts/gabbielaptop/home.nix +++ b/hosts/gabbielaptop/home.nix @@ -20,7 +20,8 @@ home.packages = [ # # Adds the 'hello' command to your environment. It prints a friendly # # "Hello, world!" when run. - pkgs.wayland +# pkgs.wayland + # # It is sometimes useful to fine-tune packages, for example, by applying # # overrides. You can do that directly here, just don't forget the # # parentheses. Maybe you want to install Nerd Fonts with a limited number of @@ -80,4 +81,74 @@ # Autostart using systemd # systemd.enable = true; }; + # Hyprland configuration + wayland.windowManager.hyprland.settings = { + "$mod" = "SUPER"; + bind = + [ + "$mod, F, exec, firefox" + ", Print, exec, grimblast copy area" + "$mod, 1, exec, alacritty" + ] + ++ ( + # workspaces + # binds $mod + [shift +] {1..10} to [move to] workspace {1..10} + builtins.concatLists (builtins.genList ( + x: let + ws = let + c = (x + 1) / 10; + in + builtins.toString (x + 1 - (c * 10)); + in [ + "$mod, ${ws}, workspace, ${toString (x + 1)}" + "$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}" + ] + ) + 10) + ); + exec-once = waybar + }; + programs.waybar = { + enable = true; + settings = { + mainBar = { + layer = "top"; + position = "top"; + height = 30; + output = [ + "eDP-1" + "HDMI-A-1" + ]; + modules-left = [ "hyprland/workspaces" "hyprland/mode" "wlr/taskbar" ]; + modules-center = [ "hyprland/window" "custom/hello-from-waybar" ]; + modules-right = [ "mpd" "custom/mymodule#with-css-id" "temperature" ]; + + "custom/hello-from-waybar" = { + format = "hello {}"; + max-length = 40; + interval = "once"; + exec = pkgs.writeShellScript "hello-from-waybar" '' + echo "from within waybar" + ''; + }; + }; + }; + + programs.alacritty = { + enable = true; + package = pkgs.alacritty; + settings = { + window.dimensions = { + lines = 3; + columns = 200; + }; + keyboard.bindings = [ + { + key = "K"; + mods = "Control"; + chars = "\\u000c"; + } + ]; + } + }; }