From f60f4bee7af763803f7456ec1226cfd34ddb18b7 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 5 Jun 2024 23:27:36 +0100 Subject: [PATCH] waybar ricing and alacritty transparency --- home/common/core/nixvim/theme.nix | 2 +- .../optional/desktop/common/alacritty.nix | 15 +- .../optional/desktop/hyprland/default.nix | 32 +-- .../wayland/swww-wallpaper-changer.nix | 50 ++-- .../optional/desktop/wayland/waybar.nix | 242 +++++++++--------- pkgs/sddm-theme/default.nix | 9 +- 6 files changed, 171 insertions(+), 179 deletions(-) diff --git a/home/common/core/nixvim/theme.nix b/home/common/core/nixvim/theme.nix index 82e5781..7dd7112 100644 --- a/home/common/core/nixvim/theme.nix +++ b/home/common/core/nixvim/theme.nix @@ -8,7 +8,7 @@ dimInactive = true; terminalColors = true; theme = "wave"; - transparent = false; + transparent = true; undercurl = true; }; }; diff --git a/home/common/optional/desktop/common/alacritty.nix b/home/common/optional/desktop/common/alacritty.nix index 20ecd39..075811c 100644 --- a/home/common/optional/desktop/common/alacritty.nix +++ b/home/common/optional/desktop/common/alacritty.nix @@ -1,7 +1,4 @@ -{ config, pkgs, lib, ... }: -let - user = config.home.username; -in +{ config, pkgs, ... }: { programs.alacritty = { enable = true; @@ -38,9 +35,13 @@ in }; }; - window.padding = { - x = 5; - y = 5; + window = { + padding = { + x = 5; + y = 5; + }; + blur = true; + opacity = 0.9; }; shell.program = "${pkgs.zsh}/bin/zsh"; diff --git a/home/common/optional/desktop/hyprland/default.nix b/home/common/optional/desktop/hyprland/default.nix index 3a711a6..524fd37 100644 --- a/home/common/optional/desktop/hyprland/default.nix +++ b/home/common/optional/desktop/hyprland/default.nix @@ -1,8 +1,7 @@ -{ - lib, - config, - pkgs, - ... +{ lib +, config +, pkgs +, ... }: { imports = [ @@ -12,20 +11,21 @@ wayland.windowManager.hyprland = { enable = true; systemd = { - variables = ["--all"]; - enable = true; - # Same as default, but stop graphical-session too - extraCommands = lib.mkBefore [ - "systemctl --user stop graphical-session.target" - "systemctl --user start hyprland-session.target" - ]; + variables = [ "--all" ]; + enable = true; + # Same as default, but stop graphical-session too + extraCommands = lib.mkBefore [ + "systemctl --user stop graphical-session.target" + "systemctl --user start hyprland-session.target" + ]; }; extraConfig = let monitor = "${toString (builtins.map (m: "monitor=${ m.name },${ toString( m.width ) }x${ toString( m.height ) }@${ toString( m.refreshRate ) },${ toString( m.x ) }x${ toString( m.y ) },${ toString( m.scale ) }\n") config.monitors)}"; active = "rgba(${config.colorScheme.colors.base08}ee)"; inactive = "rgba(${config.colorScheme.colors.base0C}ee)"; - in '' + in + '' ${monitor} $terminal = alacritty @@ -155,7 +155,7 @@ bindm = $mainMod, mouse:272, movewindow bindm = $mainMod, mouse:273, resizewindow - exec-once=bash ~/.config/hypr/start.sh + exec-once=swww-wallpaper-changer ''; - }; - } + }; +} diff --git a/home/common/optional/desktop/wayland/swww-wallpaper-changer.nix b/home/common/optional/desktop/wayland/swww-wallpaper-changer.nix index d0b135f..af7d4b4 100644 --- a/home/common/optional/desktop/wayland/swww-wallpaper-changer.nix +++ b/home/common/optional/desktop/wayland/swww-wallpaper-changer.nix @@ -1,37 +1,19 @@ +{ pkgs, ... }: { - pkgs, - ... -}: -{ - systemd.user.services.wallpaper-changer = { - Unit = { - Description = "Script to change wallpaper using swww"; - PartOf = [ "hyprland-session.target" ]; - After = [ "hyprland-session.target" ]; # or "wayland.target", depending on your system setup - }; - Install = { - WantedBy = [ "default.target" ]; - }; - Service = { - Type = [ "simple" ]; - ExecStart = "${pkgs.writeShellScript "swww-wallpaper-changer" '' - export WAYLAND_DISPLAY="wayland-1" - wallpaper_dir="$HOME/.local/share/bg/" - [ -d "$wallpaper_dir" ] || mkdir -p "$wallpaper_dir" + home.packages = with pkgs; [ + (writeShellScriptBin "swww-wallpaper-changer" '' + export WAYLAND_DISPLAY="wayland-1" + wallpaper_dir="$HOME/.local/share/bg/" + [ -d "$wallpaper_dir" ] || mkdir -p "$wallpaper_dir" + ${swww}/bin/swww-daemon & - # Allow some time for desktop to start - sleep 3 - echo "starting daemon..." - ${pkgs.swww}/bin/swww-daemon & - - while true; do - find "$wallpaper_dir" -type f -follow \( -iname \*.jpg -o -iname \*.png -o -iname \*.gif -o -iname \*.bmp \) | shuf | while read -r file; do - ${pkgs.swww}/bin/swww img "$file" --transition-step 10 --transition-fps 60 - [ $? != 0 ] && echo "swww failed, reloading daemon" && ${pkgs.swww}/bin/swww-daemon & - sleep 600 - done - done - ''}"; - }; - }; + while true; do + find "$wallpaper_dir" -type f -follow \( -iname \*.jpg -o -iname \*.png -o -iname \*.gif -o -iname \*.bmp \) | shuf | while read -r file; do + ${swww}/bin/swww img "$file" --transition-step 10 --transition-fps 60 + [ $? != 0 ] && echo "swww failed, exiting" && exit 1 + sleep 600 + done + done + '') + ]; } diff --git a/home/common/optional/desktop/wayland/waybar.nix b/home/common/optional/desktop/wayland/waybar.nix index f0175b6..d32118e 100644 --- a/home/common/optional/desktop/wayland/waybar.nix +++ b/home/common/optional/desktop/wayland/waybar.nix @@ -1,8 +1,7 @@ -{ - lib, - config, - pkgs, - ... +{ lib +, config +, pkgs +, ... }: { # Let it try to start a few more times systemd.user.services.waybar = { @@ -12,121 +11,132 @@ enable = true; systemd.enable = true; - settings = { - primary = { - mode = "dock"; - height = 30; - margin = "6"; - spacing = 5; - modules-left = [ - "custom/menu" - "wlr/workspaces"]; - modules-center = [ - "clock" - ]; - modules-right = [ - "cpu" - "memory" - "network" - "pulseaudio" - "battery" - "tray" - "custom/exit" - "custom/hostname" - ]; - "wlr/workspaces" = { - "format" = "{icon}"; - "on-click" = "activate"; - "format-icons"= { - "1" = ""; - "2" = ""; - "3" = ""; - "4" = ""; - "5" = ""; - "urgent" = ""; - "active" = ""; - "default" = ""; - }; - }; - "clock" = { - "format" = "{:%m/%d %H:%M}"; - "tooltip-format" = "{:%B %Y}\n{calendar}"; - "on-click" = "calendar"; - }; - "cpu"= { - "interval" = 10; - "format" = " {}%"; - "max-length" = 10; - "on-click" = ""; - }; - "memory" = { - "interval" = 30; - "format" = " {}%"; - "format-alt" = " {used:0.1f}G"; - "max-length" = 10; - }; + settings = { + primary = { + mode = "dock"; + height = 30; + margin = "6"; + spacing = 5; + modules-left = [ + "custom/menu" + "hyprland/workspaces" + "hyprland/window" + ]; - "network" = { - "format-wifi" = "直 {signalStrength}%"; - "format-ethernet" = " wired"; - "format-disconnected" = "睊"; - "on-click" = "bash ~/.config/waybar/scripts/rofi-wifi-menu.sh"; - }; + modules-center = [ + "clock" + ]; - "battery" = { - "bat" = "BAT0"; - "adapter" = "ADP0"; - "interval" = 60; - "states" = { - "warning" = 30; - "critical" = 15; - }; - "max-length" = 20; - "format" = "{icon} {capacity}%"; - "format-warning" = "{icon} {capacity}%"; - "format-critical" = "{icon} {capacity}%"; - "format-charging" = " {capacity}%"; - "format-plugged" = " {capacity}%"; - "format-alt" = "{icon} {time}"; - "format-full" = " {capacity}%"; - "format-icons" = [" " " " " " " " " "]; - }; - - "tray" = { - "spacing" = 10; - }; - - "custom/menu" = { - "format" = ""; - "on-click" = "rofi -show drun"; - }; - - "custom/hostname" = { - "exec" = "echo $USER@$(hostname)"; - "on-click" = "alacritty"; - }; - - "custom/exit" = { - "format" = ""; - "on-click" = "wlogout"; - }; - - "pulseaudio" = { - "format" = "{icon} {volume}%"; - "format-muted" = " 0%"; - "format-icons" = { - "headphone" = ""; - "headset" = ""; - "portable" = ""; - "default" = [ "" "" "" ]; - }; - "on-click" = "pavucontrol"; - }; + modules-right = [ + "cpu" + "memory" + "network" + "pulseaudio" + "battery" + "tray" + "custom/exit" + "custom/hostname" + "custom/ip" + ]; + "hyprland/window" = { + "format" = "{}"; + "rewrite" = { + "(.*) — Mozilla Firefox" = "$1"; + }; + "separate-outputs" = true; }; + + "hyprland/workspaces" = { + "format" = "{name}"; + "on-click" = "activate"; + "format-icons" = { + "urgent" = ""; + "active" = ""; + "default" = ""; + }; + }; + + "clock" = { + "format" = "{:%y-%m-%d %H:%M:%S}"; + "tooltip-format" = "{:%B %Y}\n{calendar}"; + "on-click" = "calendar"; + }; + + "cpu" = { + "interval" = 10; + "format" = " {}%"; + "max-length" = 10; + "on-click" = ""; + }; + + "memory" = { + "interval" = 30; + "format" = " {}%"; + "format-alt" = " {used:0.1f}G"; + "max-length" = 10; + }; + + "network" = { + "format-wifi" = "直 {signalStrength}%"; + "format-ethernet" = " wired ({ipaddr})"; + "format-disconnected" = "睊"; + }; + + "battery" = { + "bat" = "BAT0"; + "adapter" = "ADP0"; + "interval" = 60; + "states" = { + "warning" = 30; + "critical" = 15; + }; + "max-length" = 20; + "format" = "{icon} {capacity}%"; + "format-warning" = "{icon} {capacity}%"; + "format-critical" = "{icon} {capacity}%"; + "format-charging" = " {capacity}%"; + "format-plugged" = " {capacity}%"; + "format-alt" = "{icon} {time}"; + "format-full" = " {capacity}%"; + "format-icons" = [ " " " " " " " " " " ]; + }; + + "tray" = { + "spacing" = 10; + }; + + "custom/menu" = { + "format" = " Nixos"; + "on-click" = "wofi --show drun"; + }; + + "custom/hostname" = { + "exec" = "echo $USER@$(hostname)"; + "on-click" = "$TERMINAL"; + }; + + "custom/exit" = { + "format" = ""; + "on-click" = "wlogout"; + }; + + "pulseaudio" = { + "format" = "{icon} {volume}%"; + "format-muted" = " 0%"; + "format-icons" = { + "headphone" = ""; + "headset" = ""; + "portable" = ""; + "default" = [ "" "" "" ]; + }; + "on-click" = "pavucontrol"; + }; + + }; }; - style = '' + style = '' * { font-family: JetBrainsMono Nerd Font; font-size: 12pt; @@ -213,8 +223,8 @@ border-radius: 10px; } - ''; - }; + ''; + }; } diff --git a/pkgs/sddm-theme/default.nix b/pkgs/sddm-theme/default.nix index 0bf4421..526225a 100644 --- a/pkgs/sddm-theme/default.nix +++ b/pkgs/sddm-theme/default.nix @@ -1,16 +1,15 @@ -{ pkgs ? import { }, stdenv, fetchFromGitHub }: -pkgs.stdenv.mkDerivation rec { +{ pkgs ? import { }, fetchFromGitHub }: +pkgs.stdenv.mkDerivation { pname = "sddm-theme"; version = "1.6"; dontBuild = true; -# nativeBuildInputs = with pkgs; [ -# sddm -# ]; + installPhase = '' mkdir -p $out/share/sddm/themes cp -aR $src $out/share/sddm/themes/sugar-candy touch $out/share/sddm/themes/balls ''; + src = fetchFromGitHub { owner = "Kangie"; repo = "sddm-sugar-candy";