From be7c364c307eb557765c0d006641486dec32f979 Mon Sep 17 00:00:00 2001 From: foglar Date: Fri, 15 Nov 2024 16:12:59 +0100 Subject: [PATCH] Wlogout, waybar, rofi, cleanup --- flake.nix | 13 +++- nixos/desktop/hyprland/hyprland.nix | 6 +- nixos/desktop/hyprland/packages.nix | 15 +++-- nixos/desktop/hyprland/rofi.nix | 9 ++- nixos/desktop/hyprland/waybar.nix | 6 +- nixos/desktop/hyprland/wlogout.nix | 98 +++++++++++++++++++++++++++++ 6 files changed, 131 insertions(+), 16 deletions(-) diff --git a/flake.nix b/flake.nix index 9029d61..568ff00 100644 --- a/flake.nix +++ b/flake.nix @@ -3,7 +3,7 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; - #nix-stable.url = "github:nixos/nixpkgs/nixos-24.05"; + nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05"; hyprland = { url = "github:hyprwm/Hyprland"; @@ -37,6 +37,7 @@ outputs = { self, nixpkgs, + nixpkgs-stable, ... } @ inputs: let system = "x86_64-linux"; @@ -47,10 +48,18 @@ allowUnfree = true; }; }; + + pkgs-stable = import nixpkgs-stable { + inherit system; + + config = { + allowUnfree = true; + }; + }; in { nixosConfigurations = { laptop = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs system;}; + specialArgs = {inherit inputs system pkgs-stable;}; modules = [ ./nixos/configuration.nix diff --git a/nixos/desktop/hyprland/hyprland.nix b/nixos/desktop/hyprland/hyprland.nix index 6d0c2ca..6af3435 100644 --- a/nixos/desktop/hyprland/hyprland.nix +++ b/nixos/desktop/hyprland/hyprland.nix @@ -1,7 +1,7 @@ { lib, config, - pkgs, + pkgs-stable, ... }: { options = { @@ -25,7 +25,7 @@ services.dunst.enable = true; home.packages = [ - pkgs.toybox + pkgs-stable.toybox ]; stylix.targets = { @@ -216,7 +216,7 @@ "Alt, Return, fullscreen" "$mod, Escape, exec, hyprlock" #"$mod+Shift,F, exec, windowpin.sh" - #"$mod, Backspace, exec, logoutlaunch.sh" + "$mod, Backspace, exec, wlogout -b 2" "$Ctrl+Alt, W, exec, killall waybar || waybar" # toggle waybar "$mod, T, exec, $term" diff --git a/nixos/desktop/hyprland/packages.nix b/nixos/desktop/hyprland/packages.nix index 52f0314..0fc59c8 100644 --- a/nixos/desktop/hyprland/packages.nix +++ b/nixos/desktop/hyprland/packages.nix @@ -1,15 +1,13 @@ -{pkgs, lib, ...}: { +{pkgs, ...}: { home.packages = with pkgs; [ hyprlock hyprpicker hypridle - rofi - waybar - swww + #swww + playerctl kitty - kitty-themes kitty-img pavucontrol @@ -65,7 +63,12 @@ rm "$temp_screenshot" '') - #(writeShellScriptBin "keyboardswitch") + (writeShellScriptBin "keyboardswitch" '' + hyprctl switchxkblayout all next + layMain=$(hyprctl -j devices | jq '.keyboards' | jq '.[] | select (.main == true)' | awk -F '"' '{if ($2=="active_keymap") print $4}') + dunstify -a "t1" -r 91190 -t 800 "$layMain" -i ~/dotfiles/config/keyboard.svg + '') + #(writeShellScriptBin "windowpin") #(writeShellScriptBin "logoutlaunch") #(writeShellScriptBin "sysmonlaunch") diff --git a/nixos/desktop/hyprland/rofi.nix b/nixos/desktop/hyprland/rofi.nix index 942c372..d4f20fe 100644 --- a/nixos/desktop/hyprland/rofi.nix +++ b/nixos/desktop/hyprland/rofi.nix @@ -1,6 +1,7 @@ { lib, config, + pkgs, ... }: { options = { @@ -8,6 +9,10 @@ }; config = lib.mkIf config.rofi.enable { + home.packages = [ + pkgs.rofi + ]; + programs.rofi = { enable = true; cycle = true; @@ -154,7 +159,7 @@ "element-icon" = { size = mkLiteral "3em"; cursor = "inherit"; - background-color = mkLiteral "transparent"; + #background-color = mkLiteral "transparent"; #text-color = mkLiteral "inherit"; }; @@ -163,7 +168,7 @@ vertical-align = mkLiteral "0.5"; horizontal-align = mkLiteral "0.0"; cursor = "inherit"; - background-color = mkLiteral "transparent"; + #background-color = mkLiteral "transparent"; #text-color = mkLiteral "inherit"; }; diff --git a/nixos/desktop/hyprland/waybar.nix b/nixos/desktop/hyprland/waybar.nix index 7e8fb03..a01593e 100644 --- a/nixos/desktop/hyprland/waybar.nix +++ b/nixos/desktop/hyprland/waybar.nix @@ -236,11 +236,11 @@ }; "custom/power" = { - format = "{}"; + format = " {}"; rotate = 0; exec = "echo ; echo  logout"; - on-click = "wlogout"; - on-click-right = "wlogout"; + on-click = "wlogout -b 2"; + on-click-right = "wlogout -b 2"; interval = 86400; # once every day tooltip = true; }; diff --git a/nixos/desktop/hyprland/wlogout.nix b/nixos/desktop/hyprland/wlogout.nix index 164681e..621e3d8 100644 --- a/nixos/desktop/hyprland/wlogout.nix +++ b/nixos/desktop/hyprland/wlogout.nix @@ -40,6 +40,104 @@ "keybind" = "r"; } ]; + style = + let + fntSize = "40"; + BtnCol = config.lib.stylix.colors.base01; + active_rad = "40"; + y_hvr = "5"; + x_hvr = "5"; + button_rad = "20"; + y_mgn = "5"; + x_mgn = "5"; + in '' + @define-color bar-bg rgba(0, 0, 0, 0); + + @define-color main-bg #11111b; + @define-color main-fg #cdd6f4; + + @define-color wb-act-bg #a6adc8; + @define-color wb-act-fg #313244; + + @define-color wb-hvr-bg #f5c2e7; + @define-color wb-hvr-fg #313244; + * { + background-image: none; + font-size: ${fntSize}px; + } + + window { + background-color: transparent; + } + + button { + color: #${BtnCol}; + background-color: @main-bg; + outline-style: none; + border: none; + border-width: 0px; + background-repeat: no-repeat; + background-position: center; + background-size: 10%; + border-radius: 0px; + box-shadow: none; + text-shadow: none; + animation: gradient_f 20s ease-in infinite; + } + + button:focus { + background-color: @wb-act-bg; + background-size: 20%; + } + + button:hover { + background-color: @wb-hvr-bg; + background-size: 25%; + border-radius: ${active_rad}px; + animation: gradient_f 20s ease-in infinite; + transition: all 0.3s cubic-bezier(.55,0.0,.28,1.682); + } + + button:hover#lock { + border-radius: ${active_rad}px ${active_rad}px 0px ${active_rad}px; + margin : ${y_hvr}px 0px 0px ${x_hvr}px; + } + + button:hover#logout { + border-radius: ${active_rad}px 0px ${active_rad}px ${active_rad}px; + margin : 0px 0px ${y_hvr}px ${x_hvr}px; + } + + button:hover#shutdown { + border-radius: ${active_rad}px ${active_rad}px ${active_rad}px 0px; + margin : ${y_hvr}px ${x_hvr}px 0px 0px; + } + + button:hover#reboot { + border-radius: 0px ${active_rad}px ${active_rad}px ${active_rad}px; + margin : 0px ${x_hvr}px ${y_hvr}px 0px; + } + + #lock { + border-radius: ${button_rad}px 0px 0px 0px; + margin : ${y_mgn}px 0px 0px ${x_mgn}px; + } + + #logout { + border-radius: 0px 0px 0px ${button_rad}px; + margin : 0px 0px ${y_mgn}px ${x_mgn}px; + } + + #shutdown { + border-radius: 0px ${button_rad}px 0px 0px; + margin : ${y_mgn}px ${x_mgn}px 0px 0px; + } + + #reboot { + border-radius: 0px 0px ${button_rad}px 0px; + margin : 0px ${x_mgn}px ${y_mgn}px 0px; + } + ''; }; home.packages = [