fish 4.0; use comic code; add swhkd

This commit is contained in:
EdenQwQ 2025-03-05 16:08:57 +08:00
parent 03adcc38d4
commit 5e51149369
14 changed files with 125 additions and 8 deletions

17
flake.lock generated
View file

@ -620,6 +620,22 @@
"type": "github"
}
},
"nixpkgs-fish": {
"locked": {
"lastModified": 1741006659,
"narHash": "sha256-kL+uKjZYg3ildMMuFzqPyGd6E9nNrV6NwnocHgPcumk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "52eebd2541779e42ae67471622aeb18bbb47991d",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "fish",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1738452942,
@ -838,6 +854,7 @@
"niri": "niri",
"nixd": "nixd",
"nixpkgs": "nixpkgs_4",
"nixpkgs-fish": "nixpkgs-fish",
"nixvim": "nixvim",
"nur": "nur",
"stylix": "stylix",

View file

@ -67,5 +67,6 @@
nh.url = "github:viperML/nh";
treefmt-nix.url = "github:numtide/treefmt-nix";
agenix.url = "github:ryantm/agenix";
nixpkgs-fish.url = "github:NixOS/nixpkgs/fish";
};
}

View file

@ -30,11 +30,17 @@
maplocalleader = " ";
have_nerd_font = true;
};
highlightOverride = {
highlightOverride = with config.lib.stylix.colors.withHashtag; {
CursorLineNr = {
bg = "#${config.lib.stylix.colors.base01}";
fg = "#${config.lib.stylix.colors.base06}";
bg = base01;
fg = base06;
};
Comment.italic = true;
Comment.fg = base03;
Boolean.italic = true;
Boolean.fg = base0E;
String.italic = true;
String.fg = base0B;
# LineNrAbove = {
# bg = "#${config.lib.stylix.colors.base00}";
# fg = "#${config.lib.stylix.colors.base06}";

View file

@ -1,8 +1,9 @@
{ pkgs, ... }:
{ pkgs, inputs, ... }:
{
programs = {
fish = {
enable = true;
package = inputs.nixpkgs-fish.legacyPackages.${pkgs.system}.fish;
shellAbbrs = {
nixu = "nh os switch --ask";
homeu = "nh home switch --ask";

View file

@ -181,7 +181,7 @@
symbol = ' '
[custom.flake]
command = "nix flake metadata --quiet --json | jq .description --raw-output"
command = "cat flake.nix | grep description | cut -d\" -f2"
style = "bg:overlay fg:pine"
format = " [](fg:overlay)[ $symbol$output ]($style)[](fg:overlay)"
disabled = false

View file

@ -12,6 +12,7 @@
window_padding_width = "10 20 10 20";
cursor_trail = 1;
cursor_trail_start_threshold = 0;
font_family = lib.mkForce "Comic Code";
};
extraConfig = ''
map ctrl+shift+p kitten hints --type path --program @

View file

@ -22,7 +22,6 @@ in
fonts = {
monospace.name = "Comic Mono";
monospace.package = pkgs.comic-mono;
sizes.terminal = 13;
sansSerif.name = "LXGW WenKai";
sansSerif.package = pkgs.lxgw-wenkai;
serif.name = "LXGW WenKai";

View file

@ -9,13 +9,13 @@
refresh = 60.0;
};
position = {
x = 1067;
x = 1000;
y = 0;
};
rotation = 0;
};
"HDMI-A-1" = {
scale = 1.5;
scale = 1.6;
mode = {
width = 2560;
height = 1600;

View file

@ -4,5 +4,6 @@
./doas.nix
./niri.nix
./ai.nix
./swhkd.nix
];
}

18
os/programs/swhkd.nix Normal file
View file

@ -0,0 +1,18 @@
{ pkgs, ... }:
let
swhkd = import ../../pkgs/swhkd/swhkd.nix {
inherit (pkgs)
lib
rustPlatform
fetchFromGitHub
makeWrapper
pkg-config
;
};
in
{
environment.systemPackages = [
swhkd
];
systemd.packages = [ swhkd ];
}

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
<action id="com.github.swhkd.pkexec">
<message>Authentication is required to run Simple Wayland Hotkey Daemon</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/swhkd</annotate>
</action>
</policyconfig>

7
pkgs/swhkd/hotkeys.sh Normal file
View file

@ -0,0 +1,7 @@
#! @runtimeShell@
PATH="$PATH:@path@"
@psmisc@/bin/killall swhks
@out@/bin/swhks & /run/wrappers/bin/pkexec @out@/bin/swhkd -c "$HOME"/.config/swhkd/swhkdrc

43
pkgs/swhkd/swhkd.nix Normal file
View file

@ -0,0 +1,43 @@
{
lib,
rustPlatform,
fetchFromGitHub,
makeWrapper,
pkg-config,
}:
rustPlatform.buildRustPackage {
pname = "swhkd";
version = "1.3.0-unstable-2025-02-08";
src = fetchFromGitHub {
owner = "waycrate";
repo = "swhkd";
rev = "d7182b6854ea1873c388f38714b923570cb71f86";
hash = "sha256-+cxF/aWy2OLs1s+vQIXXsTx4hVAfJGenEdxOSgsmcqk=";
};
useFetchCargoVendor = true;
cargoHash = "sha256-LBbmFyddyw7vV5voctXq3L4U3Ddbh428j5XbI+td/dg=";
nativeBuildInputs = [
makeWrapper
pkg-config
];
postInstall = ''
cp ${./com.github.swhkd.pkexec.policy} ./com.github.swhkd.pkexec.policy
install -D -m0444 -t "$out/share/polkit-1/actions" ./com.github.swhkd.pkexec.policy
substituteInPlace "$out/share/polkit-1/actions/com.github.swhkd.pkexec.policy" \
--replace /usr/bin/swhkd \
"$out/bin/swhkd"
'';
meta = with lib; {
description = "A drop-in replacement for sxhkd that works with wayland";
homepage = "https://github.com/waycrate/swhkd";
license = licenses.bsd2;
maintainers = with maintainers; [ EdenQwQ ];
};
}

10
pkgs/swhkd/swhkd.service Normal file
View file

@ -0,0 +1,10 @@
[Unit]
Description=swhkd hotkey daemon
BindsTo=default.target
[Service]
Type=simple
ExecStart=@out@
[Install]
WantedBy=default.target