diff --git a/users/modules/cli/scripts/askpass.nix b/users/modules/cli/scripts/askpass.nix index c830fe4..d845816 100644 --- a/users/modules/cli/scripts/askpass.nix +++ b/users/modules/cli/scripts/askpass.nix @@ -1,3 +1,3 @@ {pkgs, ...}: pkgs.writeShellScriptBin "askpass" '' - ${pkgs.wofi}/bin/wofi -d -P -L 1 -p "$(printf $1 | sed s/://)"'' + ${pkgs.rofi}/bin/rofi -dmenu -password -no-fixed-num-lines -p $(printf \"$*\" | sed 's/://')'' diff --git a/users/modules/cli/scripts/rofi-emoji.nix b/users/modules/cli/scripts/rofi-emoji.nix deleted file mode 100644 index 74d4eae..0000000 --- a/users/modules/cli/scripts/rofi-emoji.nix +++ /dev/null @@ -1,18 +0,0 @@ -{pkgs, ...}: -pkgs.writeShellScriptBin "rofi-emoji" '' - SELECTED_EMOJI=$(grep -v "#" ~/.config/emoji | ${pkgs.wofi}/bin/wofi --dmenu -p "Select emoji" -i | awk '{print $1}' | tr -d '\n') - if [ "$XDG_SESSION_TYPE" = "wayland" ]; then - printf "%s" "$SELECTED_EMOJI" | ${pkgs.wl-clipboard-rs}/bin/wl-copy - else - printf "%s" "$SELECTED_EMOJI" | ${pkgs.xclip}/bin/xclip -sel clip - fi - - if [ "$XDG_SESSION_TYPE" = "wayland" ] - then EMOJI=$(${pkgs.wl-clipboard-rs}/bin/wl-paste) - else EMOJI=$(${pkgs.xclip}/bin/xclip -o) - fi - - test -z "$EMOJI" && notify-send "No emoji copied" -u low && exit - EMOJI="$EMOJI copied to clipboard" - ${pkgs.libnotify}/bin/notify-send -u low "$EMOJI" -'' diff --git a/users/modules/cli/scripts/ytplay.nix b/users/modules/cli/scripts/ytplay.nix index 274cece..fedf6a0 100644 --- a/users/modules/cli/scripts/ytplay.nix +++ b/users/modules/cli/scripts/ytplay.nix @@ -1,6 +1,6 @@ {pkgs, ...}: pkgs.writeShellScriptBin "ytplay" '' - URL=$(${pkgs.wofi}/bin/wofi --dmenu -i -p "Video URL") + URL=$(rofi -dmenu -i -p "Video URL") if [ -z "$URL" ]; then echo "You need to provide a URL" exit 1 @@ -9,7 +9,7 @@ pkgs.writeShellScriptBin "ytplay" '' grep -E "webm.*[0-9]+x[0-9]" | \ awk '{print $3 " " $1}' | \ sort -gu | \ - ${pkgs.wofi}/bin/wofi --dmenu -i -p "Resolution") + rofi -dmenu -i -p "Resolution") mapfile -t RESOLUTION <<< "$RESOLUTION_CHOICE" RESOLUTION_CODE=''${RESOLUTION[0]} ${pkgs.mpv}/bin/mpv --ytdl-format="''${RESOLUTION_CODE}+bestaudio/best" "$URL" diff --git a/users/modules/desktop/default.nix b/users/modules/desktop/default.nix index 74861cb..d2fb2c5 100644 --- a/users/modules/desktop/default.nix +++ b/users/modules/desktop/default.nix @@ -14,10 +14,10 @@ in { ./kitty.nix ./obs.nix ./qt.nix + ./rofi ./swaync.nix ./waybar.nix ./wlsunset.nix - ./wofi.nix ]; options.home.desktop.fullDesktop = mkEnableOption "Enable options for graphical environments"; @@ -28,5 +28,6 @@ in { kitty.enable = mkDefault cfg.fullDesktop; obs.enable = mkDefault cfg.fullDesktop; qt.enable = mkDefault cfg.fullDesktop; + rofi.enable = mkDefault cfg.fullDesktop; }; } diff --git a/users/modules/desktop/hyprland.nix b/users/modules/desktop/hyprland.nix index 0eb5a55..2250b69 100644 --- a/users/modules/desktop/hyprland.nix +++ b/users/modules/desktop/hyprland.nix @@ -6,7 +6,6 @@ }: with lib; let cfg = config.home.desktop.hyprland; - rofi-emoji = import ../cli/scripts/rofi-emoji.nix {inherit pkgs;}; laptops = ["gampo"]; in { imports = [ @@ -34,13 +33,13 @@ in { config = mkIf cfg.enable { home.desktop = { + rofi.enable = mkDefault true; swaync.enable = mkDefault true; waybar = { enable = mkDefault true; battery = mkDefault (builtins.elem cfg.host laptops); }; wlsunset.enable = mkDefault true; - wofi.enable = mkDefault true; }; wayland.windowManager.hyprland = { enable = true; @@ -112,7 +111,7 @@ in { $right = r $up = s $down = t - $menu = ${pkgs.wofi}/bin/wofi --show drun + $menu = rofi -combi-modi drun,calc -show combi bind = SUPER, Return, exec, ${pkgs.kitty}/bin/kitty ${pkgs.tmux}/bin/tmux bind = SUPER, Space, submap, leader @@ -159,10 +158,12 @@ in { bind = , escape, submap, reset bind = CTRL, g, submap, reset submap = rofi - bind = , e, exec, ${rofi-emoji}/bin/rofi-emoji + bind = , e, exec, rofi -show emoji bind = , e, submap, reset bind = , r, exec, $menu bind = , r, submap, reset + bind = , s, exec, rofi -show ssh + bind = , r, submap, reset bind = , y, exec, ytplay bind = , y, submap, reset bind = , escape, submap, reset @@ -273,13 +274,15 @@ in { }; services = { blueman-applet.enable = true; - hyprpaper = { + hyprpaper = let + img = "/home/phundrak/Pictures/Wallpapers/nord/Nordic6.jpg"; + in { enable = true; settings = { ipc = "on"; splash = false; - preload = "/home/phundrak/Pictures/Wallpapers/nord/Nordic6.jpg"; - wallpaper = ", /home/phundrak/Pictures/Wallpapers/nord/Nordic6.jpg"; + preload = img; + wallpaper = ", ${img}"; }; }; }; diff --git a/users/modules/desktop/rofi/default.nix b/users/modules/desktop/rofi/default.nix new file mode 100644 index 0000000..c735dac --- /dev/null +++ b/users/modules/desktop/rofi/default.nix @@ -0,0 +1,107 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.home.desktop.rofi; + inherit (config.lib.formats.rasi) mkLiteral; +in { + options.home.desktop.rofi = { + enable = mkEnableOption "Enable Rofi"; + }; + config = mkIf cfg.enable { + home.packages = with pkgs; [rofi-bluetooth rofi-systemd rofi-mpd]; + programs.rofi = { + enable = true; + plugins = with pkgs; [ + rofi-calc + rofi-emoji + ]; + terminal = "${pkgs.kitty}/bin/kitty"; + location = "center"; + modes = ["drun" "emoji" "calc" "combi"]; + extraConfig.show-icons = true; + theme = { + "*" = { + font = "Cascadia Code 14"; + blur = true; + padding = mkLiteral "10px"; + background-color = mkLiteral "transparent"; + border-radius = mkLiteral "0px"; + }; + window = { + width = mkLiteral "1050px"; + height = mkLiteral "625px"; + location = mkLiteral "center"; + blur = true; + border = mkLiteral "2px"; + border-radius = mkLiteral "3px"; + border-color = mkLiteral "#61afef"; + background-color = mkLiteral "transparent"; + padding = mkLiteral "0px"; + margin = mkLiteral "30px 50px"; + }; + mainbox = { + orientation = mkLiteral "horizontal"; + children = map mkLiteral ["borderbox"]; + spacing = mkLiteral "0px"; + padding = mkLiteral "0px"; + }; + borderbox = { + orientation = mkLiteral "horizontal"; + children = map mkLiteral ["imagebox" "contentbox"]; + padding = mkLiteral "0px"; + spacing = mkLiteral "0px"; + border-radius = mkLiteral "3px"; + }; + contentbox = { + orientation = mkLiteral "vertical"; + children = map mkLiteral ["entry" "listview"]; + spacing = mkLiteral "0px"; + padding = mkLiteral "0px"; + expand = true; + }; + imagebox = { + background-image = mkLiteral "url(\"${./image.jpg}\")"; + background-repeat = false; + size = mkLiteral "200px 625px"; + }; + element = { + border-radius = mkLiteral "0px"; + }; + "element-text, element-icon" = { + padding = mkLiteral "6px 8px"; + spacing = mkLiteral "2px"; + text-color = mkLiteral "#fab387"; + }; + "element selected" = { + background-color = mkLiteral "#191919"; + text-color = mkLiteral "#e5c07b"; + border-radius = mkLiteral "3px"; + }; + prompt = { + enabled = false; + background-color = mkLiteral "transparent"; + text-color = mkLiteral "#61afef"; + padding = mkLiteral "5px 10px"; + }; + entry = { + padding = mkLiteral "8px"; + expand = false; + font = "Cascadia Code 14"; + text-color = mkLiteral "#fab387"; + border-radius = mkLiteral "0px 3px 0px 0px"; + background-color = mkLiteral "#292e36"; + }; + listview = { + lines = mkLiteral "1"; + background-color = mkLiteral "rgba(46, 52, 64, 0.8)"; + border-radius = mkLiteral "0px 0px 3px 0px"; + padding = mkLiteral "5px"; + }; + }; + }; + }; +} diff --git a/users/modules/desktop/rofi/image.jpg b/users/modules/desktop/rofi/image.jpg new file mode 100644 index 0000000..7b1a509 Binary files /dev/null and b/users/modules/desktop/rofi/image.jpg differ diff --git a/users/modules/desktop/wofi.nix b/users/modules/desktop/wofi.nix deleted file mode 100644 index 93d8f24..0000000 --- a/users/modules/desktop/wofi.nix +++ /dev/null @@ -1,76 +0,0 @@ -{ - lib, - config, - ... -}: -with lib; let - cfg = config.home.desktop.wofi; -in { - options.home.desktop.wofi.enable = mkEnableOption "Enable wofi support"; - config.programs.wofi = mkIf cfg.enable { - inherit (cfg) enable; - settings = { - modi = "ssh,drun,combi"; - sidebar-mode = false; - width = 50; - line-margin = 10; - lines = 6; - columns = 2; - display-ssh = ""; - display-run = ""; - display-drun = ""; - display-window = ""; - display-combi = ""; - show-icons = true; - }; - # from https://github.com/alxndr13/wofi-nord-theme - style = '' - * { - font-family: "Hack", monospace; - } - - window { - background-color: #3B4252; - } - - #input { - margin: 5px; - border-radius: 0px; - border: none; - background-color: #3B4252; - color: white; - } - - #inner-box { - background-color: #383C4A; - } - - #outer-box { - margin: 2px; - padding: 10px; - background-color: #383C4A; - } - - #scroll { - margin: 5px; - } - - #text { - padding: 4px; - color: white; - } - - #entry:nth-child(even){ - background-color: #404552; - } - - #entry:selected { - background-color: #4C566A; - } - - #text:selected { - background: transparent; - } - ''; - }; -}