From 6cd35a3fb2ade5dd97037f024f18d1c800f0d1b2 Mon Sep 17 00:00:00 2001 From: Remy Moll Date: Tue, 4 Mar 2025 19:45:24 +0100 Subject: [PATCH] some more refinement --- .../hypr/hyprland-customization.nix | 36 ++---- modules/home-manager/hypr/hyprpaper.nix | 59 ++++++++-- modules/home-manager/kitty.nix | 14 ++- modules/home-manager/kubectl.nix | 8 ++ modules/home-manager/wofi.nix | 108 ++++++++++++++++++ users/remy.nix | 30 +---- 6 files changed, 188 insertions(+), 67 deletions(-) create mode 100644 modules/home-manager/kubectl.nix create mode 100644 modules/home-manager/wofi.nix diff --git a/modules/home-manager/hypr/hyprland-customization.nix b/modules/home-manager/hypr/hyprland-customization.nix index 1c49b99..7dd575d 100644 --- a/modules/home-manager/hypr/hyprland-customization.nix +++ b/modules/home-manager/hypr/hyprland-customization.nix @@ -15,14 +15,16 @@ settings = { "$mod" = "SUPER"; "$browser" = "firefox"; + "$launcher-cmd" = "wofi --show drun -n"; + "$ide" = "code"; # Global bindings bind = [ # Launch applications - "$mod, space, exec, walker" + "$mod, space, exec, $launcher-cmd" "$mod, return, exec, kitty" "$mod, b, exec, $browser" - "$mod, s, exec, code" + "$mod, s, exec, $ide" "$mod, e, exec, nautilus" @@ -51,7 +53,8 @@ ]; exec-once = [ - "${pkgs.hyprpaper}/bin/hyprpaper" + # "${pkgs.hyprpaper}/bin/hyprpaper" + # hyprpaper is handled as its own service "${pkgs.waybar}/bin/waybar" ]; @@ -70,7 +73,7 @@ input = { kb_layout = "de"; - kb_options = "caps:control"; + kb_options = "caps:escape"; numlock_by_default = true; # mouse input should be unchanged natural_scroll = false; @@ -98,14 +101,7 @@ # color = "#000000"; }; - # set this on a per-program basis - # blur = { - # enabled = true; - # size = 4; - # passes = 2; - # new_optimizations = true; - # ignore_opacity = true; - # }; + # blur is set on a per-program basis layerrule = [ "blur, wofi" "ignorezero, wofi" @@ -130,22 +126,6 @@ ]; }; - programs.walker = { - enable = true; - runAsService = true; - - # All options from the config.json can be used here. - config = { - search.placeholder = "Search"; - ui.fullscreen = true; - list = { - height = 200; - }; - websearch.prefix = "?"; - switcher.prefix = "/"; - }; - }; - programs.hyprlock = { enable = true; diff --git a/modules/home-manager/hypr/hyprpaper.nix b/modules/home-manager/hypr/hyprpaper.nix index c733853..55d25a7 100644 --- a/modules/home-manager/hypr/hyprpaper.nix +++ b/modules/home-manager/hypr/hyprpaper.nix @@ -1,15 +1,60 @@ { + pkgs, + lib, ... }: -{ +with lib; let + wallpapers = builtins.path { path = ../../../wallpapers; }; + + wallpaperBashArray = "(\"${strings.concatStrings (strings.intersperse "\" \"" (map (wallpaper: "${wallpaper}") wallpapers))}\")"; + wallpaperRandomizer = pkgs.writeShellScriptBin "wallpaperRandomizer" '' + wallpapers=${wallpaperBashArray} + rand=$[$RANDOM % ''${#wallpapers[@]}] + wallpaper=''${wallpapers[$rand]} + + monitor=(`hyprctl monitors | grep Monitor | awk '{print $2}'`) + hyprctl hyprpaper unload all + hyprctl hyprpaper preload $wallpaper + for m in ''${monitor[@]}; do + hyprctl hyprpaper wallpaper "$m,$wallpaper" + done + ''; +in { + home.packages = [wallpaperRandomizer]; + services.hyprpaper = { enable = true; - settings = { - # TODO: implement this correctly - # preload = builtins.attrValues (builtins.readFile ../../../wallpapers/luke-chesser-eICUFSeirc0-unsplash.jpg); - # wallpaper = [ - # ", ${builtins.attrValues (builtins.readFile ../../../wallpapers/luke-chesser-eICUFSeirc0-unsplash.jpg)}" - # ]; + + # settings = { + # ipc = "on"; + # splash = false; + # splash_offset = 2.0; + # }; + }; + + systemd.user = { + services.wallpaperRandomizer = { + Install = {WantedBy = ["graphical-session.target"];}; + + Unit = { + Description = "Set random desktop background using hyprpaper"; + After = ["graphical-session-pre.target"]; + PartOf = ["graphical-session.target"]; + }; + + Service = { + Type = "oneshot"; + ExecStart = "${wallpaperRandomizer}/bin/wallpaperRandomizer"; + IOSchedulingClass = "idle"; + }; + }; + + timers.wallpaperRandomizer = { + Unit = {Description = "Set random desktop background using hyprpaper on an interval";}; + + Timer = {OnUnitActiveSec = "6h";}; + + Install = {WantedBy = ["timers.target"];}; }; }; } \ No newline at end of file diff --git a/modules/home-manager/kitty.nix b/modules/home-manager/kitty.nix index 043aa46..7d373ab 100644 --- a/modules/home-manager/kitty.nix +++ b/modules/home-manager/kitty.nix @@ -9,10 +9,16 @@ cursor_trail = 3; }; keybindings = { - # TODO - they should not overwrite default behaviour - # "ctrl+c" = "copy_to_clipboard"; - # "ctrl+v" = "paste_from_clipboard"; + # copy and paste + "ctrl+shift+c" = "copy_to_clipboard"; + "ctrl+shift+v" = "paste_from_clipboard"; + # zoom + "ctrl+shift+plus" = "increase_font_size"; + "ctrl+shift+minus" = "decrease_font_size"; + "ctrl+shift+0" = "reset_font_size"; + # tabs + "ctrl+shift+t" = "new_tab"; + "ctrl+shift+w" = "close_tab"; }; }; - } diff --git a/modules/home-manager/kubectl.nix b/modules/home-manager/kubectl.nix new file mode 100644 index 0000000..aa02f78 --- /dev/null +++ b/modules/home-manager/kubectl.nix @@ -0,0 +1,8 @@ +{pkgs, ...}: +{ + home.packages = [ + pkgs.kubie + pkgs.kubectl + ]; + +} diff --git a/modules/home-manager/wofi.nix b/modules/home-manager/wofi.nix new file mode 100644 index 0000000..27db0ee --- /dev/null +++ b/modules/home-manager/wofi.nix @@ -0,0 +1,108 @@ +{ config, pkgs, lib, ... }: +let + accent = "#ffffff"; + background = "#000000"; + background-alt = "#000000"; + foreground = "##ffffff"; + font = "Roboto"; + rounding = 5; + font-size = 25; +in { + + home.packages = with pkgs; [ wofi-emoji ]; + + programs.wofi = { + enable = true; + + settings = { + allow_markup = true; + width = 450; + show = "drun"; + prompt = "Apps"; + normal_window = true; + layer = "top"; + term = "foot"; + height = "305px"; + orientation = "vertical"; + halign = "fill"; + line_wrap = "off"; + dynamic_lines = false; + allow_images = true; + image_size = 24; + exec_search = false; + hide_search = false; + parse_search = false; + insensitive = true; + hide_scroll = true; + no_actions = true; + sort_order = "default"; + gtk_dark = true; + filter_rate = 100; + key_expand = "Tab"; + key_exit = "Escape"; + }; + + 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; + } + ''; + }; +} \ No newline at end of file diff --git a/users/remy.nix b/users/remy.nix index da2dafa..6124563 100644 --- a/users/remy.nix +++ b/users/remy.nix @@ -9,9 +9,11 @@ with lib.hm.gvariant; ../modules/home-manager/hypr ../modules/home-manager/keepassxc.nix ../modules/home-manager/kitty.nix + ../modules/home-manager/kubectl.nix ../modules/home-manager/obsidian.nix ../modules/home-manager/owncloud-client.nix ../modules/home-manager/thunderbird.nix + ../modules/home-manager/wofi.nix ../modules/home-manager/xdg-portals.nix ]; @@ -24,38 +26,10 @@ with lib.hm.gvariant; home.username = "remy"; home.homeDirectory = "/home/remy"; - #home.file. = ; - ## Utils relevant to this user only programs.git = { enable = true; userName = "Remy Moll"; userEmail = "me@moll.re"; }; - - - # ## Gnome keyboard and mouse settings - # dconf.settings = { - # # set the keyboard layout to german - # "org/gnome/desktop/input-sources" = { - # current = mkUint32 0; - # sources = [ (mkTuple [ "xkb" "de" ]) (mkTuple [ "xkb" "ch" ]) (mkTuple [ "xkb" "us" ]) ]; - # xkb-options = [ "lv3:ralt_switch" ]; - # }; - - # "org/gnome/desktop/peripherals/keyboard" = { - # numlock-state = true; - # }; - - # "org/gnome/desktop/peripherals/mouse" = { - # natural-scroll = false; - # speed = 0.20851063829787231; - # }; - - # "org/gnome/desktop/peripherals/touchpad" = { - # tap-to-click = true; - # two-finger-scrolling-enabled = true; - # speed = 0.16872427983539096; - # }; - # }; }