diff --git a/config/hyprland/hyprland.conf b/config/hyprland/hyprland.conf
index 5ccbd13a..770f56ce 100644
--- a/config/hyprland/hyprland.conf
+++ b/config/hyprland/hyprland.conf
@@ -31,7 +31,7 @@ wsbind = 10, HDMI-A-2
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
# Execute your favorite apps at launch
-exec-once = waybar
+# exec-once = waybar
exec-once = dunst
exec-once = hyprpaper
exec-once = kdeconnect-indicator # TODO: Only shows sometimes?
@@ -47,6 +47,7 @@ exec-once = hyprctl setcursor Bibata-Modern-Classic 16
# Source a file (multi-file configs)
# source = ~/.config/hypr/myColors.conf
source = ~/.config/hypr/polkit.conf # NOTE: This needs to be sourced, because NixOS fills in the polkit executable path
+source = ~/.config/hypr/waybar-reload.conf
# Some default env vars.
env = XCURSOR_SIZE,24
@@ -164,11 +165,13 @@ $mainMod = SUPER
bind = $mainMod, Q, killactive
bind = $mainMod, V, togglefloating
bind = $mainMod, F, fullscreen
-bind = $mainMod, C, exec, clipman pick -t rofi # TODO: Generate this in a include file from nixos, depending on the menu option
+bind = $mainMod, C, exec, clipman pick -t rofi # TODO: Theme + Generate this in a include file from nixos, depending on the menu option
# Launch apps
bind = $mainMod, A, exec, rofi -show drun -theme ~/NixFlake/config/rofi/launcher.rasi
bind = $mainMod, T, exec, kitty
+bind = $mainMod, E, exec, kitty fish -c "nnncd -a -P p"
+bind = $mainMod, P, exec, hyprpicker -a
# bind = $mainMod, E, exec, dolphin
# Move windows in/out of groups
diff --git a/home/christoph/default.nix b/home/christoph/default.nix
index 673fde3b..324c1a5e 100644
--- a/home/christoph/default.nix
+++ b/home/christoph/default.nix
@@ -304,6 +304,8 @@ rec {
nil # nix language server
parted # partition manager
libnotify
+ procps # pgrep, pkill
+ inotifyTools # inotifywait etc.
# Xooooorg/Desktop environment stuff
# xclip
@@ -349,6 +351,7 @@ rec {
digital # Digital circuit simulator
okteta # hex editor
kdiff3 # diff/patch tool
+ font-manager
# Office
# sioyek # Scientific pdf reader # HM program
@@ -549,6 +552,7 @@ rec {
];
bookmarks = {
+ c = "~/.config";
d = "~/Documents";
D = "~/Downloads";
n = "~/Notes";
diff --git a/home/modules/hyprland.nix b/home/modules/hyprland.nix
index 30e844e2..5d63f8d0 100644
--- a/home/modules/hyprland.nix
+++ b/home/modules/hyprland.nix
@@ -19,7 +19,35 @@ in {
};
};
- config = mkIf cfg.enable {
+ config = let
+ # Taken from https://github.com/Ruixi-rebirth/flakes/blob/main/modules/programs/wayland/waybar/workspace-patch.nix
+ hyprctl = "${pkgs.hyprland}/bin/hyprctl";
+ workspaces-patch = pkgs.writeTextFile {
+ name = "waybar-hyprctl.diff";
+ text = ''
+ diff --git a/src/modules/wlr/workspace_manager.cpp b/src/modules/wlr/workspace_manager.cpp
+ index 6a496e6..a689be0 100644
+ --- a/src/modules/wlr/workspace_manager.cpp
+ +++ b/src/modules/wlr/workspace_manager.cpp
+ @@ -511,7 +511,9 @@ auto Workspace::handle_clicked(GdkEventButton *bt) -> bool {
+ if (action.empty())
+ return true;
+ else if (action == "activate") {
+ - zext_workspace_handle_v1_activate(workspace_handle_);
+ + // zext_workspace_handle_v1_activate(workspace_handle_);
+ + const std::string command = "${hyprctl} dispatch workspace " + name_;
+ + system(command.c_str());
+ } else if (action == "close") {
+ zext_workspace_handle_v1_remove(workspace_handle_);
+ } else {
+ '';
+ };
+
+ waybar-hyprland = pkgs.waybar.overrideAttrs (oldAttrs: {
+ mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ];
+ patches = (oldAttrs.patches or [ ]) ++ [ workspaces-patch ];
+ });
+ in mkIf cfg.enable {
assertions = [
{
assertion = nixosConfig.programs.hyprland.enable;
@@ -48,6 +76,22 @@ in {
# Polkit
home.file.".config/hypr/polkit.conf".text = ''exec-once = ${pkgs.libsForQt5.polkit-kde-agent}/libexec/polkit-kde-agent-1 &'';
+ home.file.".config/hypr/waybar-reload.conf".text = let
+ waybar-reload = pkgs.writeScript "waybar-reload" ''
+ #! ${pkgs.bash}/bin/bash
+
+ trap "${pkgs.procps}/bin/pkill waybar" EXIT
+
+ while true; do
+ ${waybar-hyprland}/bin/waybar -c $HOME/NixFlake/config/waybar/config -s $HOME/NixFlake/config/waybar/style.css &
+ ${pkgs.inotifyTools}/bin/inotifywait -e create,modify $HOME/NixFlake/config/waybar/config $HOME/NixFlake/config/waybar/style.css
+ ${pkgs.procps}/bin/pkill waybar
+ done
+ '';
+ in ''
+ exec-once = ${waybar-reload}
+ '';
+
home.file.".config/hypr/hyprpaper.conf".text = ''
preload = ~/NixFlake/wallpapers/${cfg.theme}.png
wallpaper = HDMI-A-1, ~/NixFlake/wallpapers/${cfg.theme}.png
@@ -55,25 +99,33 @@ in {
'';
home.activation = {
- # NOTE: Keep the hyprland config symlinked, to allow easy changes with hotreload
- # TODO: Can I simplify mkLink to include the hm.dag.entryAfter and the name?
- # Like mkLink linkHyprlandConfig "source" "target"
- linkHyprlandConfig = hm.dag.entryAfter ["writeBoundary"] (mkLink "~/NixFlake/config/hyprland/hyprland.conf" "~/.config/hypr/hyprland.conf");
+ # NOTE: Keep the hyprland/waybar config symlinked, to allow easy changes with hotreload
+ # TODO: Don't symlink at all, why not just tell Hyprland where the config is? Much easier
+ # TODO: Use this approach for every program that supports it, makes things much easier,
+ # as everything can just stay in ~/NixFlake/config
+ linkHyprlandConfig = hm.dag.entryAfter ["writeBoundary"]
+ (mkLink "~/NixFlake/config/hyprland/hyprland.conf" "~/.config/hypr/hyprland.conf");
+
+ # linkWaybarConfig = hm.dag.entryAfter ["writeBoundary"]
+ # (mkLink "~/NixFlake/config/waybar/config" "~/.config/waybar/config");
+ # linkWaybarStyle = hm.dag.entryAfter ["writeBoundary"]
+ # (mkLink "~/NixFlake/config/waybar/style.css" "~/.config/waybar/style.css");
+ # linkWaybarColors = hm.dag.entryAfter ["writeBoundary"]
+ # (mkLink "~/NixFlake/config/waybar/colors" "~/.config/waybar/colors");
};
home.packages = with pkgs; [
- # TODO: Check which of these belong in the global config
hyprpaper # Wallpaper setter
hyprpicker # Color picker
+
wl-clipboard
clipman # Clipboard manager (wl-paste)
+
imv # Image viewer
slurp # Region selector for screensharing
grim # Grab images from compositor
ncpamixer # ncurses pavucontrol
- # wofi
- cava # TODO: Hyprland cava module
- font-manager
+
xfce.thunar
libsForQt5.polkit-kde-agent
];
@@ -99,186 +151,13 @@ in {
# extraConfig = '''';
};
- waybar = let
- # Taken from https://github.com/Ruixi-rebirth/flakes/blob/main/modules/programs/wayland/waybar/workspace-patch.nix
- hyprctl = "${pkgs.hyprland}/bin/hyprctl";
- workspaces-patch = pkgs.writeTextFile {
- name = "waybar-hyprctl.diff";
- text = ''
- diff --git a/src/modules/wlr/workspace_manager.cpp b/src/modules/wlr/workspace_manager.cpp
- index da83cb7..4c33ac3 100644
- --- a/src/modules/wlr/workspace_manager.cpp
- +++ b/src/modules/wlr/workspace_manager.cpp
- @@ -450,7 +450,8 @@ auto Workspace::handle_clicked(GdkEventButton *bt) -> bool {
- if (action.empty())
- return true;
- else if (action == "activate") {
- - zext_workspace_handle_v1_activate(workspace_handle_);
- + const std::string command = "${hyprctl} dispatch workspace " + name_;
- + system(command.c_str());
- } else if (action == "close") {
- zext_workspace_handle_v1_remove(workspace_handle_);
- } else {
- '';
- };
-
- wrapico = icon: "${icon} ";
- in {
+ waybar = {
enable = true;
- package = pkgs.waybar.overrideAttrs (oldAttrs: {
- mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ];
- patches = (oldAttrs.patches or [ ]) ++ [ workspaces-patch ];
- });
+ package = waybar-hyprland;
systemd = {
enable = false; # Gets started by hyprland
};
-
- # TODO: These icons do not fit at all, need to use a different icon font.
- settings = [{
- "output" = "HDMI-A-1"; # Only bar on main monitor, multiple wireplumber widgets result in crash
- "layer" = "top";
- "position" = "top";
- "height" = 34; # 34 fits with VictorMono Nerd Font size 15
- "spacing" = 4;
-
- "modules-left" = [
- # TODO: Launcher (opens wofi), with NixOS icon
- "custom/launcher"
- "user"
- "hyprland/window"
- ];
-
- "modules-center" = [
- "wlr/workspaces"
- ];
-
- "modules-right" = [
- # "cava" # Unknown? Maybe needs git version
- # "wireplumber"
- "pulseaudio"
- "network"
- "cpu"
- "memory"
- "temperature"
- "clock"
- "tray"
- ];
-
- "custom/launcher" = {
- "interval" = "once";
- "format" = (wrapico "");
- "on-click" = "wofi --show drun --columns 2 -I"; # TODO: Wofi Theme
- "tooltip" = false;
- };
-
- "wlr/workspaces" = {
- "format" = "{name}"; # TODO: "{icon}""
- "on-click" = "activate";
- "sort-by-coordinates" = false;
- "sort-by-name" = true;
- "sort-by-number" = false;
- "all-outputs" = false;
-
- # TODO: This doesn't work? But I think I like it more without this anyway
- # "persistent_workspaces" = {
- # # In [] the output can be specified, by I only use one bar, so not required
- # "1" = ["HDMI-A-1"];
- # "2" = ["HDMI-A-1"];
- # "3" = ["HDMI-A-1"];
- # "4" = ["HDMI-A-1"];
- # "5" = ["HDMI-A-1"];
- # "6" = ["HDMI-A-1"];
- # "7" = ["HDMI-A-1"];
- # "8" = ["HDMI-A-1"];
- # "9" = ["HDMI-A-1"];
- # # "0" = [];
- # };
- };
-
- # NOTE: This was wireplumber originally, but that is really unstable
- "pulseaudio" = {
- "format" = (wrapico "") + "{volume}%";
- "format-muted" = (wrapico "");
- "on-click" = "kitty ncpamixer";
- };
-
- "network" = {
- "interface" = "enp0s31f6";
- "format" = (wrapico "") + "{ipaddr}"; # Other Icon:
- "format-disconnected" = (wrapico ""); # Other Icon:
- "tooltip-format" = "{ifname} via {gwaddr}"; # TODO: gwaddr does not show?
- };
-
- "cpu" = {
- "format" = (wrapico "") + "{load}%";
- };
-
- "memory" = {
- "format" = (wrapico "") + "{percentage}%";
- };
-
- "temperature" = {
- "thermal-zone" = 3; # Zone 3 is "x86_pkg_temp"
- "format" = (wrapico "") + "{temperatureC}°C";
- };
-
- "clock" = {
- "format" = (wrapico "") + "{:%H:%M}";
- "timezone" = "Europe/Berlin";
- "tooltip-format" = "{calendar}";
- };
-
- "tray" = {
- "icon-size" = 20;
- "spacing" = 5;
- "show-passive-items" = true;
- };
- }];
-
- # Taken from https://github.com/MathisP75/hyppuccin/blob/main/waybar/desktop-bar/style.css
- style = ''
- window#waybar {
- border-radius: 0px;
- margin: 16px 16px;
- }
-
- window#waybar.hidden {
- opacity: 0.2;
- }
-
- #workspaces button {
- border-radius: 8px;
- padding: 0px 10px 0px 10px;
- margin: 7px 5px 10px 5px;
- }
-
- #custom-launcher,
- #clock,
- #cpu,
- #temperature,
- #network,
- #wireplumber,
- #memory {
- padding: 0px 20px;
- margin: 7px 0px 10px 0px;
- border-radius: 8px;
- }
-
- #window,
- #custom-launcher {
- padding: 0px 25px 0px 20px;
- margin: 7px 0px 10px 20px;
- }
-
- #wireplumber {
- padding: 0px 20px 0px 17px;
- }
-
- #network {
- padding: 0px 15px 0px 20px;
- }
- '';
};
};
};