From f086605e076a914c1fedc0bbecd511f7e9ed84dc Mon Sep 17 00:00:00 2001 From: sandptel Date: Sun, 26 Jan 2025 16:24:41 +0530 Subject: [PATCH] ok --- 2 | 0 config/hypr/UserConfigs/WindowRules.conf | 4 +- config/hypr/scripts/2 | 0 config/hypr/scripts/WaybarCava.sh | 64 +++++++++++++++++++----- flake.nix | 15 ++++++ hosts/default/config.nix | 2 +- hosts/default/home.nix | 2 +- hosts/default/users.nix | 4 ++ modules/intel-drivers.nix | 3 +- nixos-dots.nix | 1 + 10 files changed, 78 insertions(+), 17 deletions(-) create mode 100644 2 create mode 100644 config/hypr/scripts/2 diff --git a/2 b/2 new file mode 100644 index 0000000..e69de29 diff --git a/config/hypr/UserConfigs/WindowRules.conf b/config/hypr/UserConfigs/WindowRules.conf index 751b8a3..0a5d1df 100644 --- a/config/hypr/UserConfigs/WindowRules.conf +++ b/config/hypr/UserConfigs/WindowRules.conf @@ -87,7 +87,7 @@ windowrulev2 = opacity 0.8 0.6, class:^(net.lutris.Lutris)$ windowrulev2 = opacity 0.8 0.05, class:^(org.pulseaudio.pavucontrol)$ windowrulev2 = opacity 0.85 0.5, class:^(obsidian)$ windowrulev2 = opacity 0.9 0.8, class:^(GitKraken)$ -windowrulev2 = opacity 0.92 0.7, class:^([Ss]potify)$ +windowrulev2 = opacity 0.91 0.90, class:^([Ss]potify)$ windowrulev2 = opacity 0.9 0.6, class:^([Rr]ofi)$ windowrulev2 = opacity 0.9 0.8, class:^(Brave-browser(-beta|-dev)?)$ windowrulev2 = opacity 0.885 0.7, class:^([Ff]irefox|org.mozilla.firefox|[Ff]irefox-esr)$ @@ -123,7 +123,7 @@ windowrulev2 = opacity 0.9 0.7, class:^([Ff]erdium)$ windowrulev2 = opacity 0.95 0.75, title:^(Picture-in-Picture)$ # windowrule v2 - size -windowrulev2 = size 80% 80%, class:^([Ss]potify)$ +windowrulev2 = size 65% 85%, class:^([Ss]potify)$ windowrulev2 = size 70% 70%, class:^(gnome-system-monitor|org.gnome.SystemMonitor|io.missioncenter.MissionCenter)$ windowrulev2 = size 60% 60%, class:^(org.pulseaudio.pavucontrol)$ windowrulev2 = size 80% 80%, class:^(net.lutris.Lutris)$ diff --git a/config/hypr/scripts/2 b/config/hypr/scripts/2 new file mode 100644 index 0000000..e69de29 diff --git a/config/hypr/scripts/WaybarCava.sh b/config/hypr/scripts/WaybarCava.sh index 565dfa5..905306b 100755 --- a/config/hypr/scripts/WaybarCava.sh +++ b/config/hypr/scripts/WaybarCava.sh @@ -1,8 +1,6 @@ #!/bin/bash -# /* ---- 👒 https://github.com/sandptel/nixos-config ---- */ ## -# Not my own work. This was added through Github PR. Credit to original author -#----- Optimized bars animation without much CPU usage increase -------- +# Optimized bars animation without much CPU usage increase bar="▁▂▃▄▅▆▇█" dict="s/;//g" @@ -31,13 +29,55 @@ data_format = ascii ascii_max_range = 7 EOF -# Kill cava if it's already running -# pkill -f "cava -p $config_file" +# Function to get the number of monitors +get_monitor_count() { + local monitors + if ! monitors=$(hyprctl monitors -j | jq '. | length'); then + printf "Error: Failed to retrieve monitor count\n" >&2 + return 1 + fi + printf "%d" "$monitors" +} -# if ( pgrep -cf "cava -p" > hyprctl monitors -j | jq '. | length' ); then -# cava -p "$config_file" | sed -u "$dict" -# printf "Started cava session with config: %s\n" "$CONFIG_FILE" -# fi -pkill -f "cava -p $config_file" -# Read stdout from cava and perform substitution in a single sed command -cava -p "$config_file" | sed -u "$dict" +# Function to manage cava sessions +start_cava_sessions() { + local monitor_count existing_sessions session_diff + + # Get monitor count + monitor_count=$(get_monitor_count) || return 1 + + # Get existing cava sessions + existing_sessions=$(pgrep -cf "cava -p $config_file") + + # Calculate session difference + session_diff=$((monitor_count - existing_sessions)) + + # Stop extra cava sessions if any + if ((session_diff < 0)); then + pkill -f "cava -p $config_file" + existing_sessions=0 + session_diff=$monitor_count + fi + + # Start new cava sessions if needed + if ((session_diff > 0)); then + for ((i = 0; i < session_diff; i++)); do + cava -p "$config_file" | sed -u "$dict" & + done + fi + + # printf "Monitor count: %d, Running cava sessions: %d\n" "$monitor_count" "$(pgrep -cf "cava -p $config_file")" +} + +# Main function +main() { + if ! command -v hyprctl &>/dev/null || ! command -v jq &>/dev/null; then + printf "Error: Required commands 'hyprctl' and 'jq' are not installed\n" >&2 + return 1 + fi + + # Start or adjust cava sessions based on monitor count + start_cava_sessions || return 1 +} + +main diff --git a/flake.nix b/flake.nix index 989e71f..742eadd 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,7 @@ inputs = { Hyprspace = { url = "github:KZDKM/Hyprspace/e2d561c933cd085d68bf0b39c4f78870ad0abbc2"; + # url = "github:KZDKM/Hyprspace"; # Hyprspace uses latest Hyprland. We declare this to keep them in sync. inputs.hyprland.follows = "hyprland"; }; @@ -38,6 +39,7 @@ # inputs.nixpkgs.follows = "nixpkgs"; }; hyprland.url = "github:hyprwm/Hyprland/cef5e6dd7ca7008456cf63a76776550974de1612"; # hyprland development + # hyprland.url = "github:hyprwm/Hyprland"; # hyprland development # distro-grub-themes.url = "github:AdisonCavani/distro-grub-themes"; nixos-grub-themes.url = "github:jeslie0/nixos-grub-themes"; grub2-themes = { @@ -62,6 +64,7 @@ }; hypr-dynamic-cursors = { url = "github:VirtCode/hypr-dynamic-cursors/37c770dfb0667179174b26ba5b45618f1c2dd10b"; + # url = "github:VirtCode/hypr-dynamic-cursors"; inputs.hyprland.follows = "hyprland"; # to make sure that the plugin is built for the correct version of hyprland }; nixos-boot.url = "github:Melkor333/nixos-boot"; @@ -73,16 +76,28 @@ outputs = inputs @ { self , nixpkgs + , home-manager , ... }: let system = "x86_64-linux"; host = "default"; username = "roronoa"; + lib=nixpkgs.lib; + config = { allowUnfree = true; }; #defaultPackage.x86_64-linux = wezterm.packages.x86_64-linux.default; pkgs = import nixpkgs { system = "x86_64-linux"; config.allowUnfree = true; }; in { + # packages.x86_64-linux.homeConfigurations = pkgs.callPackage ./hosts/default/home.nix { inherit lib config; }; + # homeConfigurations= { + # "roronoa" = home-manager.lib.homeManagerConfiguration { + # # Note: I am sure this could be done better with flake-utils or something + # pkgs = import nixpkgs { system = "x86_64-linux"; }; + + # modules = [ ./hosts/default/home.nix ]; # Defined later + # }; + # }; nixosConfigurations = { "${host}" = nixpkgs.lib.nixosSystem { specialArgs = { diff --git a/hosts/default/config.nix b/hosts/default/config.nix index 8856ad1..e077f98 100644 --- a/hosts/default/config.nix +++ b/hosts/default/config.nix @@ -46,7 +46,7 @@ nixpkgs.config.allowUnsupportedSystem = true; ./starship.nix ./hardware.nix ./users.nix - # ./power.nix + ./power.nix # ./greetd.nix # ./nixvim.nix # ../../modules/amd-drivers.nix diff --git a/hosts/default/home.nix b/hosts/default/home.nix index 4b61983..8059976 100644 --- a/hosts/default/home.nix +++ b/hosts/default/home.nix @@ -8,7 +8,7 @@ inputs.hyprland.homeManagerModules.default ./matugen.nix ./spicetify.nix - ./tmux.nix + # ./tmux.nix # ./nixvim.nix # inputs.hellwal.homeManagerModules.default # inputs.matugen.homeManagerModules.default diff --git a/hosts/default/users.nix b/hosts/default/users.nix index 6375075..b22decd 100644 --- a/hosts/default/users.nix +++ b/hosts/default/users.nix @@ -4,6 +4,8 @@ let inherit (import ./variables.nix) gitUsername; in { +services.tftpd.enable = true; +services.tftpd.path = "/srv/tftp"; nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "spotify" ]; @@ -50,6 +52,8 @@ playerctl neofetch firefox # obs-studio +gcc +gdb rustup gcc glib diff --git a/modules/intel-drivers.nix b/modules/intel-drivers.nix index 1ae9cf8..afb0777 100644 --- a/modules/intel-drivers.nix +++ b/modules/intel-drivers.nix @@ -34,7 +34,8 @@ in boot.initrd.kernelModules = [ "i915" ]; services.xserver.videoDrivers = [ "i915" - "intel" + "modesetting" + # "intel" ]; # All these mean the same thing defined above as hardware.graphics is the new hardawre.opengl diff --git a/nixos-dots.nix b/nixos-dots.nix index be9bef8..fab575a 100644 --- a/nixos-dots.nix +++ b/nixos-dots.nix @@ -24,6 +24,7 @@ matugen nwg-drawer checkupdates wpgtk +tmux # gnome-tweaks # airshipper pywalfox-native