From e79e8d0d3bead3b6b2b80d8f94fa4d64f5c883c2 Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Mon, 13 Oct 2025 12:05:49 +0200 Subject: [PATCH] get back wofi for now Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com> --- home/scripts/system/default.nix | 43 ++++++++++++- home/system/hyprland/bindings.nix | 4 +- home/system/wofi/default.nix | 100 ++++++++++++++++++++++++++++++ hosts/laptop/home.nix | 4 +- 4 files changed, 148 insertions(+), 3 deletions(-) create mode 100644 home/system/wofi/default.nix diff --git a/home/scripts/system/default.nix b/home/scripts/system/default.nix index e9c336b..b37dcf4 100644 --- a/home/scripts/system/default.nix +++ b/home/scripts/system/default.nix @@ -5,6 +5,47 @@ #- - `lock` - Lock the screen. (hyprlock) #- - `powermode-toggle` - Toggle between performance and balanced power mode. (powerprofilesctl) {pkgs, ...}: let + menu = + pkgs.writeShellScriptBin "menu" + # bash + '' + if pgrep wofi; then + pkill wofi + else + wofi -p "Apps" --show drun + fi + ''; + powermenu = + pkgs.writeShellScriptBin "powermenu" + # bash + '' + if pgrep wofi >/dev/null; then + pkill wofi + exit 0 + fi + + declare -A actions=( + ["󰌾 Lock"]="hyprlock" + ["󰍃 Logout"]="hyprctl dispatch exit" + [" Suspend"]="systemctl suspend" + ["󰑐 Reboot"]="systemctl reboot" + ["󰿅 Shutdown"]="systemctl poweroff" + ) + + selected_option=$( + printf '%s\n' "''${!actions[@]}" | wofi -p "Powermenu" --dmenu + ) + + if [[ -n "$selected_option" ]]; then + + action_command=''${actions["''$selected_option"]} + + if [[ -n "$action_command" ]]; then + eval "$action_command" + fi + fi + ''; + lock = pkgs.writeShellScriptBin "lock" # bash @@ -25,4 +66,4 @@ ${pkgs.swayosd}/bin/swayosd-client --custom-message="Powermode set to performance" --custom-icon="emblem-default" fi ''; -in {home.packages = [lock powermode-toggle];} +in {home.packages = [lock powermode-toggle menu powermenu];} diff --git a/home/system/hyprland/bindings.nix b/home/system/hyprland/bindings.nix index 916c9e3..d5d3c3d 100644 --- a/home/system/hyprland/bindings.nix +++ b/home/system/hyprland/bindings.nix @@ -10,8 +10,10 @@ "$mod,V, exec, uwsm app -- ${pkgs.protonvpn-gui}/bin/protonvpn-app" # Proton VPN "$mod,A, exec, uwsm app -- ${pkgs.proton-authenticator}/bin/proton-authenticator" # Proton Authenticator "$mod,L, exec, uwsm app -- ${pkgs.hyprlock}/bin/hyprlock" # Lock + # "$mod,SPACE, exec, vicinae" # Launcher FIXME: broken "$mod,X, exec, powermenu" # Powermenu - "$mod,SPACE, exec, vicinae" # Launcher + "$mod,SPACE, exec, menu" # Launcher + "$shiftMod,SPACE, exec, hyprfocus-toggle" # Toggle HyprFocus "$mod,Q, killactive," # Close window diff --git a/home/system/wofi/default.nix b/home/system/wofi/default.nix new file mode 100644 index 0000000..2adf81a --- /dev/null +++ b/home/system/wofi/default.nix @@ -0,0 +1,100 @@ +# Wofi is a launcher for Wayland, inspired by rofi. +{ + config, + pkgs, + lib, + ... +}: let + accent = "#${config.lib.stylix.colors.base0D}"; + background = "#${config.lib.stylix.colors.base00}"; + background-alt = "#${config.lib.stylix.colors.base01}"; + foreground = "#${config.lib.stylix.colors.base05}"; + font = config.stylix.fonts.serif.name; + rounding = config.theme.rounding; + font-size = config.stylix.fonts.sizes.popups; +in { + home.packages = with pkgs; [wofi-emoji]; + + programs.wofi = { + enable = true; + + settings = { + allow_markup = true; + width = 450; + show = "drun"; + prompt = "Apps"; + normal_window = true; + height = 305; + allow_images = true; + image_size = 24; + insensitive = true; + hide_scroll = true; + no_actions = true; + gtk_dark = true; + }; + + style = + lib.mkForce + # css + '' + * { + font-family: "${font}"; + font-weight: 500; + font-size: ${toString font-size}px; + } + + #window { + background-color: ${background}; + color: ${foreground}; + border-radius: ${toString rounding}px; + } + + #outer-box { + padding: 20px; + } + + #input { + background-color: ${background-alt}; + border: 0px solid ${accent}; + color: ${foreground}; + padding: 8px 12px; + } + + #scroll { + margin-top: 20px; + } + + #inner-box {} + + #img { + padding-right: 8px; + } + + #text { + color: ${foreground}; + } + + #text:selected { + color: ${foreground}; + } + + #entry { + padding: 6px; + } + + #entry:selected { + background-color: ${accent}; + color: ${foreground}; + } + + #unselected {} + + #selected {} + + #input, + #entry:selected { + border-radius: ${toString rounding}px; + } + ''; + }; +} diff --git a/hosts/laptop/home.nix b/hosts/laptop/home.nix index b56f60f..29179a0 100644 --- a/hosts/laptop/home.nix +++ b/hosts/laptop/home.nix @@ -31,7 +31,8 @@ ../../home/system/zathura ../../home/system/mime ../../home/system/udiskie - ../../home/system/vicinae + # ../../home/system/vicinae + ../../home/system/wofi # ../../home/system/hypridle ./secrets # CHANGEME: You should probably remove this line, this is where I store my secrets @@ -75,6 +76,7 @@ pnpm air duckdb + caido # Utils zip