diff --git a/README.md b/README.md index 133edad6..ac6ccdfb 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Nix allows for easy-to-manage, collaborative, reproducible deployments. This mea | **Window Manager** | [Hyprland][Hyprland] | [i3][i3] | | **Terminal Emulator** | [Kitty][Kitty] | [Kitty][Kitty] | | **Bar** | [Waybar][Waybar] | [i3block][i3block] | -| **Application Launcher** | [wofi][wofi] | [rofi][rofi] | +| **Application Launcher** | [anyrun][anyrun] | [rofi][rofi] | | **Notification Daemon** | [Mako][Mako] | [Dunst][Dunst] | | **Display Manager** | [GDM][GDM] | [GDM][GDM] | | **Color Scheme** | [Catppuccin][Catppuccin] | [Catppuccin][Catppuccin] | @@ -184,7 +184,7 @@ Other dotfiles that inspired me: [Waybar]: https://github.com/Alexays/Waybar [i3block]: https://github.com/vivien/i3blocks [rofi]: https://github.com/davatorium/rofi -[wofi]: https://hg.sr.ht/~scoopta/wofi +[anyrun]: https://github.com/Kirottu/anyrun [Dunst]: https://github.com/dunst-project/dunst [Fcitx5]: https://github.com/fcitx/fcitx5 [Btop]: https://github.com/aristocratos/btop diff --git a/flake.lock b/flake.lock index 5a56519c..1e6a2715 100644 --- a/flake.lock +++ b/flake.lock @@ -21,6 +21,27 @@ "type": "github" } }, + "anyrun": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1690204837, + "narHash": "sha256-YrvbqM9WXr3/cgFVwc1EjIaQq4aI4DdrB1fhHfAW/d4=", + "owner": "Kirottu", + "repo": "anyrun", + "rev": "da97c9287f01f7d85ecf5e4ab8819bde3ae0e79a", + "type": "github" + }, + "original": { + "owner": "Kirottu", + "repo": "anyrun", + "type": "github" + } + }, "astronvim": { "flake": false, "locked": { @@ -204,6 +225,27 @@ } }, "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "anyrun", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1685662779, + "narHash": "sha256-cKDDciXGpMEjP1n6HlzKinN0H+oLmNpgeCTzYnsA2po=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "71fb97f0d875fd4de4994dfb849f2c75e17eb6c3", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { "inputs": { "nixpkgs-lib": [ "nixpkgs-wayland", @@ -386,7 +428,7 @@ }, "nix-eval-jobs": { "inputs": { - "flake-parts": "flake-parts", + "flake-parts": "flake-parts_2", "nixpkgs": "nixpkgs_4", "treefmt-nix": "treefmt-nix" }, @@ -607,6 +649,7 @@ "root": { "inputs": { "agenix": "agenix", + "anyrun": "anyrun", "astronvim": "astronvim", "catppuccin-alacritty": "catppuccin-alacritty", "catppuccin-bat": "catppuccin-bat", diff --git a/flake.nix b/flake.nix index ed346e7b..b01fb6f6 100644 --- a/flake.nix +++ b/flake.nix @@ -190,6 +190,11 @@ hyprland.url = "github:hyprwm/Hyprland/v0.27.2"; # community wayland nixpkgs nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland"; + # anyrun - a wayland launcher + anyrun ={ + url = "github:Kirottu/anyrun"; + inputs.nixpkgs.follows = "nixpkgs"; + }; # generate iso/qcow2/docker/... image from nixos configuration nixos-generators = { @@ -265,10 +270,12 @@ nixConfig = { experimental-features = ["nix-command" "flakes"]; + builders-use-substitutes = true; substituters = [ # replace official cache with a mirror located in China "https://mirrors.ustc.edu.cn/nix-channels/store" "https://cache.nixos.org" + "https://anyrun.cachix.org" ]; # nix community's cache server @@ -280,6 +287,7 @@ "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA=" + "anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s=" ]; }; } diff --git a/home/linux/hyprland/anyrun.nix b/home/linux/hyprland/anyrun.nix new file mode 100644 index 00000000..5ec0b80a --- /dev/null +++ b/home/linux/hyprland/anyrun.nix @@ -0,0 +1,87 @@ +{ pkgs, anyrun, ... }: + +{ + imports = [ + anyrun.homeManagerModules.default + ]; + + programs.anyrun = { + enable = true; + config = { + plugins = with anyrun.packages.${pkgs.system}; [ + applications + randr + rink + shell + symbols + translate + ]; + + width.fraction = 0.3; + y.absolute = 15; + hidePluginInfo = true; + closeOnClick = true; + }; + + # custom css for anyrun, based on catppuccin-mocha + extraCss = '' + @define-color bg-col rgba(30, 30, 46, 0.7); + @define-color bg-col-light rgba(150, 220, 235, 0.7); + @define-color border-col rgba(30, 30, 46, 0.7); + @define-color selected-col rgba(150, 205, 251, 0.7); + @define-color fg-col #D9E0EE; + @define-color fg-col2 #F28FAD; + + * { + transition: 200ms ease; + font-family: "JetBrainsMono Nerd Font"; + font-size: 1.3rem; + } + + #window { + background: transparent; + } + + #plugin, + #main { + border: 3px solid @border-col; + color: @fg-col; + background-color: @bg-col; + } + /* anyrun's input window - Text */ + #entry { + color: @fg-col; + background-color: @bg-col; + } + + /* anyrun's ouput matches entries - Base */ + #match { + color: @fg-col; + background: @bg-col; + } + + /* anyrun's selected entry - Red */ + #match:selected { + color: @fg-col2; + background: @selected-col; + } + + #match { + padding: 3px; + border-radius: 16px; + } + + #entry, #plugin:hover { + border-radius: 16px; + } + + box#main { + background: rgba(30, 30, 46, 0.7); + border: 1px solid @border-col; + border-radius: 15px; + padding: 5px; + } + ''; + }; + +} diff --git a/home/linux/hyprland/default.nix b/home/linux/hyprland/default.nix index ef884b77..293b56d7 100644 --- a/home/linux/hyprland/default.nix +++ b/home/linux/hyprland/default.nix @@ -1,5 +1,6 @@ {pkgs, catppuccin-hyprland, ...}: { imports = [ + ./anyrun.nix ./wayland-apps.nix ]; @@ -26,10 +27,9 @@ # https://github.com/catppuccin/gtk name = "Catppuccin-Macchiato-Compact-Pink-dark"; package = pkgs.catppuccin-gtk.override { + # https://github.com/NixOS/nixpkgs/blob/nixos-23.05/pkgs/data/themes/catppuccin-gtk/default.nix accents = [ "pink" ]; - size = "compact"; - tweaks = [ "rimless" "black" ]; - variant = "macchiato"; + variant = "mocha"; }; }; }; diff --git a/home/linux/hyprland/hypr-conf/hyprland.conf b/home/linux/hyprland/hypr-conf/hyprland.conf index e07252f7..600cc195 100644 --- a/home/linux/hyprland/hypr-conf/hyprland.conf +++ b/home/linux/hyprland/hypr-conf/hyprland.conf @@ -3,6 +3,9 @@ # color-scheme: cappuccin-mocha source=~/.config/hypr/themes/mocha.conf +env = _JAVA_AWT_WM_NONREPARENTING,1 +env = QT_WAYLAND_DISABLE_WINDOWDECORATION,1 + #-- Output ---------------------------------------------------- # Configure your Display resolution, offset, scale and Monitors here, use `hyprctl monitors` to get the info. @@ -109,7 +112,7 @@ $browser = firefox # -- Terminal -- bind=SUPER,Return,exec,$term -# -- Wofi -- +# -- App Launcher -- bind=SUPER,D,exec,$app_launcher # -- Hyprland -- @@ -201,6 +204,10 @@ exec-once=cp ~/.config/fcitx5/profile-bak ~/.config/fcitx5/profile # restore exec-once=fcitx5 -d --replace # start fcitx5 daemon bind=ALT,E,exec,pkill fcitx5 -9;sleep 1;fcitx5 -d --replace; sleep 1;fcitx5-remote -r +# fix xwayland apps +windowrulev2 = rounding 0, xwayland:1, floating:1 +windowrulev2 = center, class:^(.*jetbrains.*)$, title:^(Confirm Exit|Open Project|win424|win201|splash)$ +windowrulev2 = size 640 400, class:^(.*jetbrains.*)$, title:^(splash)$ # -- Fix input method in vscode exec-once = hyprctl setcursor "Bibata-Modern-Ice" 24 @@ -208,6 +215,7 @@ exec-once = hyprctl setcursor "Bibata-Modern-Ice" 24 # xwayland 窗口先渲染到 200% 再降到 hyprland config 里 monitor 设置的值,看上去和原生没啥区别 # 相比较一开始的方案输入法字体大小也正确了.唯一有点问题的可能是 xwayland 窗口下的鼠标指针大小不对 exec-once = xprop -root -f _XWAYLAND_GLOBAL_OUTPUT_SCALE 32c -set _XWAYLAND_GLOBAL_OUTPUT_SCALE 2 + exec-once = xrdb -merge ~/.Xresources # env = GDK_SCALE,2 env = XCURSOR_SIZE,48 diff --git a/home/linux/hyprland/hypr-conf/scripts/menu b/home/linux/hyprland/hypr-conf/scripts/menu index d497b6d3..33ddb986 100755 --- a/home/linux/hyprland/hypr-conf/scripts/menu +++ b/home/linux/hyprland/hypr-conf/scripts/menu @@ -1,13 +1,7 @@ #!/usr/bin/env bash -## launch wofi with alt config - -CONFIG="$HOME/.config/hypr/wofi/config" -STYLE="$HOME/.config/hypr/wofi/style.css" -COLORS="$HOME/.config/hypr/wofi/colors" - -if [[ ! $(pidof wofi) ]]; then - wofi --show drun --prompt 'Search...' --conf ${CONFIG} --style ${STYLE} --color ${COLORS} +if [[ ! $(pidof anyrun) ]]; then + anyrun else - pkill wofi + pkill anyrun fi diff --git a/home/linux/hyprland/hypr-conf/wofi/colors b/home/linux/hyprland/hypr-conf/wofi/colors deleted file mode 100644 index d0c68887..00000000 --- a/home/linux/hyprland/hypr-conf/wofi/colors +++ /dev/null @@ -1,6 +0,0 @@ -#1e1e2e -#262636 -#d9e0ee -#89b4fa -#f38ba8 -#cba6f7 diff --git a/home/linux/hyprland/hypr-conf/wofi/config b/home/linux/hyprland/hypr-conf/wofi/config deleted file mode 100644 index 4288fa20..00000000 --- a/home/linux/hyprland/hypr-conf/wofi/config +++ /dev/null @@ -1,39 +0,0 @@ -## Wofi Config - -## General -show=drun -prompt=Apps -normal_window=true -layer=top -term=alacritty - -## Geometry -width=500px -height=305px -location=0 -orientation=vertical -halign=fill -line_wrap=off -dynamic_lines=false - -## Images -allow_markup=true -allow_images=true -image_size=24 - -## Search -exec_search=false -hide_search=false -parse_search=false -insensitive=false - -## Other -hide_scroll=true -no_actions=true -sort_order=default -gtk_dark=true -filter_rate=100 - -## Keys -key_expand=Tab -key_exit=Escape diff --git a/home/linux/hyprland/hypr-conf/wofi/style.css b/home/linux/hyprland/hypr-conf/wofi/style.css deleted file mode 100644 index 3f06015c..00000000 --- a/home/linux/hyprland/hypr-conf/wofi/style.css +++ /dev/null @@ -1,60 +0,0 @@ -/** ********** Fonts ********** **/ -* { - font-family: "JetBrains Mono", "Iosevka Nerd Font", sans-serif; - font-size: 12px; -} - -#window { - background-color: --wofi-color0; - color: --wofi-color2; - border: 2px solid --wofi-color1; - border-radius: 0px; -} - -#outer-box { - padding: 20px; -} - -#input { - background-color: --wofi-color1; - border: 0px solid --wofi-color3; - padding: 8px 12px; -} - -#scroll { - margin-top: 20px; -} - -#inner-box { -} - -#img { - padding-right: 8px; -} - -#text { - color: --wofi-color2; -} - -#text:selected { - color: --wofi-color0; -} - -#entry { - padding: 6px; -} - -#entry:selected { - background-color: --wofi-color3; - color: --wofi-color0; -} - -#unselected { -} - -#selected { -} - -#input, #entry:selected { - border-radius: 4px; -} diff --git a/modules/nixos/hyprland.nix b/modules/nixos/hyprland.nix index c31175d1..ca330c29 100644 --- a/modules/nixos/hyprland.nix +++ b/modules/nixos/hyprland.nix @@ -62,7 +62,6 @@ slurp # selecting a region to screenshot # TODO replace by `flameshot gui --raw | wl-copy` - wofi # A rofi inspired launcher for wlroots compositors such as sway/hyprland mako # the notification daemon, the same as dunst yad # a fork of zenity, for creating dialogs