Merge pull request #219 from ryan4yin/anyrun

polish: anyrun - update config & css style
This commit is contained in:
Ryan Yin
2025-09-10 21:48:09 +08:00
committed by GitHub
parent e14c197e8f
commit 4c04c8e3a3
3 changed files with 131 additions and 63 deletions

5
flake.lock generated
View File

@@ -35,14 +35,15 @@
"locked": {
"lastModified": 1755604323,
"narHash": "sha256-PKxVhfjd2AlzTopuVEx5DJMC4R7LnM5NIoMmirKMsKI=",
"owner": "Kirottu",
"owner": "anyrun-org",
"repo": "anyrun",
"rev": "af1ffe4f17921825ff2a773995604dce2b2df3cd",
"type": "github"
},
"original": {
"owner": "Kirottu",
"owner": "anyrun-org",
"repo": "anyrun",
"rev": "af1ffe4f17921825ff2a773995604dce2b2df3cd",
"type": "github"
}
},

View File

@@ -16,12 +16,10 @@
nixConfig = {
# substituers will be appended to the default substituters when fetching packages
extra-substituters = [
"https://anyrun.cachix.org"
# "https://nix-gaming.cachix.org"
# "https://nixpkgs-wayland.cachix.org"
];
extra-trusted-public-keys = [
"anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s="
# "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4="
# "nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
];
@@ -79,9 +77,10 @@
# community wayland nixpkgs
# nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland";
# anyrun - a wayland launcher
anyrun = {
url = "github:Kirottu/anyrun";
url = "github:/anyrun-org/anyrun/af1ffe4f17921825ff2a773995604dce2b2df3cd";
inputs.nixpkgs.follows = "nixpkgs";
};

View File

@@ -7,78 +7,146 @@
programs.anyrun = {
enable = true;
config = {
plugins = with anyrun.packages.${pkgs.system}; [
applications
randr
rink
shell
symbols
translate
];
# The horizontal position.
# when using `fraction`, it sets a fraction of the width or height of the screen
x.fraction = 0.5; # at the middle of the screen
# The vertical position.
y.fraction = 0.05; # at the top of the screen
# The width of the runner.
width.fraction = 0.3; # 30% of the screen
width.fraction = 0.3;
y.absolute = 15;
hidePluginInfo = true;
hideIcons = false;
ignoreExclusiveZones = false;
layer = "overlay";
hidePluginInfo = false;
closeOnClick = true;
showResultsImmediately = true;
maxEntries = null;
# https://github.com/anyrun-org/anyrun/tree/master/plugins
plugins = with anyrun.packages.${pkgs.system}; [
applications # Launch applications
dictionary # Look up word definitions using the Free Dictionary API.
nix-run # search & run graphical apps from nixpkgs via `nix run`, without installing it.
# randr # quickly change monitor configurations on the fly
rink # A simple calculator plugin
symbols # Look up unicode symbols and custom user defined symbols.
translate # ":zh <text to translate>" Quickly translate text using the Google Translate API.
niri-focus # Search for & focus the window via title/appid on Niri
];
};
# custom css for anyrun, based on catppuccin-mocha
extraConfigFiles."applications.ron".text = ''
Config(
// Also show the Desktop Actions defined in the desktop files, e.g. "New Window" from LibreWolf
desktop_actions: true,
max_entries: 5,
// The terminal used for running terminal based desktop entries, if left as `None` a static list of terminals is used
// to determine what terminal to use.
terminal: Some(Terminal(
// The main terminal command
command: "alacritty",
// What arguments should be passed to the terminal process to run the command correctly
// {} is replaced with the command in the desktop entry
args: "-e {}",
)),
)
'';
extraConfigFiles."symbols.ron".text = ''
Config(
// The prefix that the search needs to begin with to yield symbol results
prefix: "",
// Custom user defined symbols to be included along the unicode symbols
symbols: {
// "name": "text to be copied"
"shrug": "¯\\_()_/¯",
},
max_entries: 3,
)
'';
# https://github.com/anyrun-org/anyrun/discussions/179
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;
/* GTK Vars */
@define-color bg-color #313244;
@define-color fg-color #cdd6f4;
@define-color primary-color #89b4fa;
@define-color secondary-color #cba6f7;
@define-color border-color @primary-color;
@define-color selected-bg-color @primary-color;
@define-color selected-fg-color @bg-color;
* {
transition: 200ms ease;
font-family: "Maple Mono NF CN";
font-size: 1.3rem;
all: unset;
font-family: JetBrainsMono Nerd Font;
}
#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 output 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;
border-radius: 16px;
background-color: alpha(@bg-color, 0.8);
border: 0.5px solid alpha(@fg-color, 0.25);
}
entry#entry {
font-size: 1.25rem;
background: transparent;
box-shadow: none;
border: none;
border-radius: 16px;
padding: 16px 24px;
min-height: 40px;
caret-color: @primary-color;
}
list#main {
background-color: transparent;
}
#plugin {
background-color: transparent;
padding-bottom: 4px;
}
#match {
font-size: 1.1rem;
padding: 2px 4px;
}
#match:selected,
#match:hover {
background-color: @selected-bg-color;
color: @selected-fg-color;
}
#match:selected label#info,
#match:hover label#info {
color: @selected-fg-color;
}
#match:selected label#match-desc,
#match:hover label#match-desc {
color: alpha(@selected-fg-color, 0.9);
}
#match label#info {
color: transparent;
color: @fg-color;
}
label#match-desc {
font-size: 1rem;
color: @fg-color;
}
label#plugin {
font-size: 16px;
}
'';
};