feat: replace wofi by anyrun - wayland

This commit is contained in:
Ryan Yin
2023-07-30 04:19:03 +08:00
parent 5e2bec4ac5
commit 1e98f591f5
11 changed files with 156 additions and 122 deletions

View File

@@ -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;
}
'';
};
}

View File

@@ -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";
};
};
};

View File

@@ -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

View File

@@ -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

View File

@@ -1,6 +0,0 @@
#1e1e2e
#262636
#d9e0ee
#89b4fa
#f38ba8
#cba6f7

View File

@@ -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

View File

@@ -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;
}