From 0b271bc907a9d7894f053b835fcc422b547bc3af Mon Sep 17 00:00:00 2001
From: zuma <lucien@shenanigans.cc>
Date: Sun, 9 Feb 2025 22:05:34 +0100
Subject: [PATCH] Added Waybar and Wallpaper Daemon

---
 commons/programs/hyprland.nix     |  22 +++-
 commons/programs/waybar.nix       | 187 ++++++++++++++++++++++++++++++
 commons/programs/zsh.nix          |   1 +
 hosts/t0urn3s0l/configuration.nix |  87 ++++++++------
 hosts/t0urn3s0l/home.nix          |   9 ++
 5 files changed, 270 insertions(+), 36 deletions(-)
 create mode 100644 commons/programs/waybar.nix

diff --git a/commons/programs/hyprland.nix b/commons/programs/hyprland.nix
index 65e9267..4859801 100644
--- a/commons/programs/hyprland.nix
+++ b/commons/programs/hyprland.nix
@@ -2,7 +2,6 @@
   wayland.windowManager.hyprland = {
     enable = true;
 
-
     settings = {
       "$mod" = "SUPER"; # Windows key on classic keyboards
 
@@ -22,6 +21,8 @@
 
 	"$mod, code:65, exec, rofi -show run"
 
+        "$mod, V, toggleFloating"
+
 	# Move to workspace
 	"$mod, code:10, workspace, 1"
 	"$mod, code:11, workspace, 2"
@@ -47,11 +48,19 @@
 	# Move to adjacent workspaces
 	"$mod, code:113, workspace, -1"
 	"$mod, code:114, workspace, +1"
+
+        # Function keys
+        ", code:121, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
+        ", code:122, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"
+        ", code:123, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+"
+        ", code:198, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"
+        ", code:232, exec, brightnessctl s 5%-"
+        ", code:233, exec, brightnessctl s 5%+"
         ];
 
       bindm = [
-        "$mod, mouse:272, moveWindow"
-	"$mod, mouse:273, moveWindow"
+        "$mod, mouse:272, moveactive"
+        "$mod, mouse:273, resizeactive"
       ];
 
       cursor = {
@@ -122,6 +131,13 @@
       gestures = {
         workspace_swipe = "on";
       };
+
+      exec-once = [
+        # Set Hyprland cursor the same as GTK apps
+        "hyprctl setcursor \"Bibata-Modern-Classic\" 24"
+        "swww-daemon"
+        "waybar"
+      ];
     };
   };
 }
diff --git a/commons/programs/waybar.nix b/commons/programs/waybar.nix
new file mode 100644
index 0000000..fc706b5
--- /dev/null
+++ b/commons/programs/waybar.nix
@@ -0,0 +1,187 @@
+{ ... }:
+{
+  programs.waybar = {
+    enable = true;
+    settings = [
+      {
+        layer = "top";
+        position = "top";
+        modules-left = [
+          "hyprland/workspaces"
+        ];
+        modules-center = [ "hyprland/window" ];
+        modules-right = [
+          "custom/exit"
+          "pulseaudio"
+          "network"
+          "battery"
+          "tray"
+          "clock"
+        ];
+
+        "hyprland/workspaces" = {
+          format = "{name}";
+          format-icons = {
+            default = " ";
+            active = " ";
+            urgent = " ";
+          };
+        };
+        "clock" = {
+          format = ''  {:L%H:%M}'';
+          tooltip = true;
+          tooltip-format = "<big>{:%A, %d.%B %Y }</big>\n<tt><small>{calendar}</small></tt>";
+        };
+        "hyprland/window" = {
+          max-length = 22;
+          separate-outputs = false;
+          icon = true;
+          icon-size = 18;
+        };
+        "network" = {
+          format-icons = [
+            "󰤯 "
+            "󰤟 "
+            "󰤢 "
+            "󰤥 "
+            "󰤨 "
+          ];
+          format-ethernet = " {bandwidthDownOctets}";
+          format-wifi = "{icon} {essid}";
+          format-disconnected = "󰤮 ";
+          tooltip = true;
+          tooltip-format = "ip : {ipaddr}\nstrength : {signaldBm}dBm";
+          on-click = "nm-connection-editor";
+        };
+        "tray" = {
+          spacing = 12;
+        };
+        "pulseaudio" = {
+          format = "{icon} {volume}% {format_source}";
+          format-bluetooth = "{volume}% {icon} {format_source}";
+          format-bluetooth-muted = " {icon} {format_source}";
+          format-muted = " {format_source}";
+          format-source = " {volume}%";
+          format-source-muted = " ";
+          format-icons = {
+            headphone = " ";
+            hands-free = " ";
+            headset = " ";
+            phone = " ";
+            portable = " ";
+            car = " ";
+            default = [
+              " "
+              " "
+              " "
+            ];
+          };
+          on-click = "pavucontrol";
+        };
+        "custom/exit" = {
+          tooltip = false;
+          format = " ";
+          on-click = "shutdown now";
+        };
+        "battery" = {
+          states = {
+            warning = 30;
+            critical = 15;
+          };
+          format = "{icon} {capacity}%";
+          format-charging = "󰂄 {capacity}%";
+          format-plugged = "󱘖 {capacity}%";
+          format-icons = [
+            "󰁺"
+            "󰁻"
+            "󰁼"
+            "󰁽"
+            "󰁾"
+            "󰁿"
+            "󰂀"
+            "󰂁"
+            "󰂂"
+            "󰁹"
+          ];
+          tooltip = false;
+        };
+      }
+    ];
+
+    style = ''
+      * {
+        border: none;
+        font-family: Ubuntu Nerd Font;
+        font-size: 13px;
+        border-radius: 0px;
+        background: transparent;
+        min-height: 0px;
+        color: white;
+      }
+
+      tooltip {
+        color: white;
+        background: black;
+      }
+
+      window#waybar {
+        margin: 5px 0 0 0;
+        background: linear-gradient(180deg, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 100%);
+        color: black;
+      }
+
+      #window {
+        font-weight: bold;
+      }
+
+      #workspaces button {
+        padding: 0 5px;
+        background: transparent;
+        color: white;
+        border-top: 2px solid transparent;
+      }
+
+      #workspaces button.focused {
+        background: #64727D;
+        border-bottom: 3px solid white;
+      }
+
+      #workspaces button.active {
+        border-bottom: 1px solid white;
+      }
+
+      #clock, #battery, #network, #pulseaudio, #tray {
+        padding: 0 3px;
+        margin: 0 2px;
+      }
+
+      #clock {
+        font-weight: bold;
+      }
+
+      #battery {
+      }
+
+      #battery.charging {
+      }
+
+      #cpu {
+      }
+
+      #memory {
+      }
+
+      #network {
+      }
+
+      #pulseaudio {
+      }
+
+      #pulseaudio.muted {
+      }
+
+      #tray {
+      }
+    '';
+  };
+}
diff --git a/commons/programs/zsh.nix b/commons/programs/zsh.nix
index 1184ba1..f1cccdd 100644
--- a/commons/programs/zsh.nix
+++ b/commons/programs/zsh.nix
@@ -4,6 +4,7 @@
     enableCompletion = true;
     shellAliases = {
       update = "sudo nixos-rebuild switch --flake /home/zuma/nix_files#t0urn3s0l";
+      connect-h4ppy = "mosh --ssh=\"ssh -p 72\" globuzma@87.231.223.91";
     };
     oh-my-zsh = {
       enable = true;
diff --git a/hosts/t0urn3s0l/configuration.nix b/hosts/t0urn3s0l/configuration.nix
index 51d5780..21b7f0b 100644
--- a/hosts/t0urn3s0l/configuration.nix
+++ b/hosts/t0urn3s0l/configuration.nix
@@ -1,7 +1,3 @@
-# Edit this configuration file to define what should be installed on
-# your system.  Help is available in the configuration.nix(5) man page
-# and in the NixOS manual (accessible by running ‘nixos-help’).
-
 { config, pkgs, inputs, ... }:
 
 {
@@ -18,10 +14,6 @@
   networking.hostName = "t0urn3s0l"; # Define your hostname.
   # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.
 
-  # Configure network proxy if necessary
-  # networking.proxy.default = "http://user:password@proxy:port/";
-  # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
-
   # Enable Nix Flakes
   nix.settings.experimental-features = ["nix-command" "flakes"];
   
@@ -137,33 +129,55 @@
   # List packages installed in system profile. To search, run:
   # $ nix search wget
   environment.systemPackages = with pkgs; [
-     # GUIs
-     gnome-keyring # Keyring for secrets
-     seahorse # To edit said secrets
-     networkmanagerapplet # To get wifi to work -> Go into wifi connection and select store password for all users
-     bitwarden-desktop # For my sweet passwords
-     rofi-wayland # Application launcher
-     xfce.thunar # GUI Filebrowser
-     xfce.xfconf # needed by xfce.thunar
-     kitty # Hyprland default terminal
-     firefox # Web browser
-     cinny-desktop # Matrix Client
-     eog # Image viewer
-     dracula-theme # Dark theme
-     dracula-icon-theme # Dark Icon theme
-     mpv # Video player
-     pavucontrol # Volume control
+    # GUIs
+    gnome-keyring # Keyring for secrets
+    seahorse # To edit said secrets
+    networkmanagerapplet # To get wifi to work -> Go into wifi connection and select store password for all users
+    bitwarden-desktop # For my sweet passwords
+    rofi-wayland # Application launcher
+    xfce.thunar # GUI Filebrowser
+    xfce.xfconf # needed by xfce.thunar
+    kitty # Hyprland default terminal
+    firefox # Web browser
+    cinny-desktop # Matrix Client
+    eog # Image viewer (Eye Of Gnome)
+    dracula-theme # Dark theme
+    dracula-icon-theme # Dark Icon theme
+    mpv # Video player
+    vlc # Media player a bit more fancy than mpv
+    pavucontrol # Volume control
+    zotero # For research articles
+    gimp # Image Editing
+    qbittorrent # Torrent downloader for ... Linux isos.
+    evince # PDF viewer 
+    gparted # Partitioner tool
+    obsidian # PKB and more than that
+    waybar # A bar.
+    bibata-cursors # Pretty cursors
+    kdenlive # Video editing software
 
-     # Shell apps
-     zsh # Favorite shell so far
-     starship # Shell prompt that goes fast
-     neovim # <3
-     git # <3 bis
-     btop # HTOP on steroids
-     lshw # List all your hardware
+    # Shell stuff
+    zsh # Favorite shell so far
+    starship # Shell prompt that goes fast
+    neovim # <3
+    git # <3 bis
+    btop # HTOP on steroids
+    lshw # List all your hardware
+    neofetch # To show off
+    brightnessctl # To control brightness
+    p7zip # For all my zip needs 
+    cmatrix # Always need it to show off
+    exfat # Needed to format Nikon SD Card
+    gptfdisk # Tools for partitioning
+    mosh # Mobile shell, great ssh replacement for unstable connection
+    ffmpeg # Video and sound editiing
+    pywal16 # Generate 16 palette from image
+    wev # Utility to find which key you pressed
 
-     # Utilities
-     wl-clipboard # Clipboard manager
+    # Utilities
+    wl-clipboard # Clipboard manager
+    swww # Wallpaper engine
+    pulseaudio-dlna # To play sound on sound system
   ];
 
   services.gvfs.enable = true; # Enable Trash so that if I delete my nix files without having saved them I can backup .........
@@ -173,6 +187,12 @@
   services.gnome.gnome-keyring.enable = true;
   security.pam.services.hyprland.enableGnomeKeyring = true;
 
+  fonts.packages = with pkgs; [
+    nerd-fonts.fira-code
+    nerd-fonts.ubuntu
+    nerd-fonts.droid-sans-mono
+  ];
+
   # Some programs need SUID wrappers, can be configured further or are
   # started in user sessions.
   # programs.mtr.enable = true;
@@ -185,6 +205,7 @@
 
   # Enable the OpenSSH daemon.
   # services.openssh.enable = true;
+  programs.ssh.startAgent = true;
 
   # Open ports in the firewall.
   # networking.firewall.allowedTCPPorts = [ ... ];
diff --git a/hosts/t0urn3s0l/home.nix b/hosts/t0urn3s0l/home.nix
index 6fd358d..19508b1 100644
--- a/hosts/t0urn3s0l/home.nix
+++ b/hosts/t0urn3s0l/home.nix
@@ -11,6 +11,7 @@
     ../../commons/programs/zsh.nix
     ../../commons/programs/neovim.nix
     ../../commons/programs/kitty.nix
+    ../../commons/programs/waybar.nix
   ];
 
   qt = {
@@ -35,5 +36,13 @@
     };
   };
 
+  home.pointerCursor = {
+    gtk.enable = true;
+
+    package = pkgs.bibata-cursors;
+    name = "Bibata-Modern-Classic";
+    size = 24;
+  };
+
   programs.home-manager.enable = true;
 }