Skip to content

Commit

Permalink
ok
Browse files Browse the repository at this point in the history
  • Loading branch information
sandptel committed Jan 26, 2025
1 parent 09f424b commit f086605
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 17 deletions.
Empty file added 2
Empty file.
4 changes: 2 additions & 2 deletions config/hypr/UserConfigs/WindowRules.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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)$
Expand Down Expand Up @@ -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)$
Expand Down
Empty file added config/hypr/scripts/2
Empty file.
64 changes: 52 additions & 12 deletions config/hypr/scripts/WaybarCava.sh
Original file line number Diff line number Diff line change
@@ -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"

Expand Down Expand Up @@ -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
15 changes: 15 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
};
Expand Down Expand Up @@ -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 = {
Expand All @@ -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";
Expand All @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion hosts/default/config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion hosts/default/home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions hosts/default/users.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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"
];
Expand Down Expand Up @@ -50,6 +52,8 @@ playerctl
neofetch
firefox
# obs-studio
gcc
gdb
rustup
gcc
glib
Expand Down
3 changes: 2 additions & 1 deletion modules/intel-drivers.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions nixos-dots.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ matugen
nwg-drawer
checkupdates
wpgtk
tmux
# gnome-tweaks
# airshipper
pywalfox-native
Expand Down

0 comments on commit f086605

Please sign in to comment.