Compare commits

...

5 Commits

8 changed files with 91 additions and 27 deletions

View File

@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1712791164,
"narHash": "sha256-3sbWO1mbpWsLepZGbWaMovSO7ndZeFqDSdX0hZ9nVyw=",
"lastModified": 1713537308,
"narHash": "sha256-XtTSSIB2DA6tOv+l0FhvfDMiyCmhoRbNB+0SeInZkbk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1042fd8b148a9105f3c0aca3a6177fd1d9360ba5",
"rev": "5c24cf2f0a12ad855f444c30b2421d044120c66f",
"type": "github"
},
"original": {

View File

@ -23,7 +23,7 @@
config._module.args = {
inherit inputs;
inherit pkgs system;
inherit (pkgs) lib stdenv;
inherit (pkgs) lib stdenv stdenvNoCC;
};
# Local user nix env

View File

@ -0,0 +1,13 @@
(local gitsigns (require :gitsigns))
(fn on-attach [bufnr]
(vim.keymap.set :n :gV
(fn []
(gitsigns.toggle_deleted)
(gitsigns.toggle_numhl)
(gitsigns.toggle_linehl)
(gitsigns.toggle_word_diff)
(gitsigns.toggle_current_line_blame))
{:buffer bufnr}))
(gitsigns.setup {:on_attach on-attach})

View File

@ -33,7 +33,8 @@
:noice
:tsn-actions
:lightbulb
:dressing])
:dressing
:gitsigns])
(local errors {})

View File

@ -41,8 +41,8 @@ fn lPathTransformerClosure(l: *c.lua_State) !c_int {
ffi.luaPushString(l, path);
}
c.lua_call(l, 2, 1);
return 1;
c.lua_call(l, 2, 2);
return 2;
}
fn transformJdtlsURI(uri_str: []const u8, writer: anytype) !void {

View File

@ -3,5 +3,6 @@
imports = [
./cgnix
./mcdev.nix
./userstyles.nix
];
}

38
nix/userstyles.nix Normal file
View File

@ -0,0 +1,38 @@
# Module that provides an output for a stylus import file with catppuccin themes.
{ pkgs, stdenvNoCC, ... }:
let
flavor = "mocha";
accent-color = "red";
in
{
packages.userstyles = stdenvNoCC.mkDerivation {
name = "userstyles.json";
src = pkgs.fetchurl {
url = "https://github.com/catppuccin/userstyles/releases/download/all-userstyles-export/import.json";
hash = "sha256-eYU9Y95au9mI3muS4+1QJt31W7s2zVmurdKbQ1dU+pk=";
};
dontUnpack = true;
# TODO: use better language
realBuilder = "${pkgs.deno}/bin/deno";
args = [
"run"
"-A"
(pkgs.writeText "build.js" ''
const json = await import(Deno.env.get("src"), { with: { type: "json" } });
const processed = json.default.map(theme => {
if (theme.usercssData?.vars?.accentColor?.default)
theme.usercssData.vars.accentColor.default = "${accent-color}";
if (theme.usercssData?.vars?.darkFlavor?.default)
theme.usercssData.vars.darkFlavor.default = "${flavor}";
return theme;
});
Deno.writeTextFileSync(Deno.env.get("out"), JSON.stringify(processed));
'')
];
};
}

View File

@ -5,6 +5,17 @@ const log = std.log.scoped(.init);
const Connection = @import("Connection.zig");
const journal_prefix = "systemd-cat --level-prefix=false -- ";
fn initCommand(comptime argv: []const [:0]const u8) []const [:0]const u8 {
return &[_][:0]const u8{
"systemd-cat",
"--level-prefix=false",
"--identifier=" ++ argv[0],
"--",
} ++ argv;
}
pub fn init(alloc: std.mem.Allocator, initial: bool) !void {
const con = try Connection.init();
defer con.deinit();
@ -12,27 +23,27 @@ pub fn init(alloc: std.mem.Allocator, initial: bool) !void {
// Normal-Mode keyboard mappings
inline for (.{
// "run command" maps
.{ "Super", "Return", "spawn", opts.term_command },
.{ "Super+Control", "E", "spawn", opts.file_manager_command },
.{ "Super+Control", "B", "spawn", opts.browser_command },
.{ "Super+Control", "V", "spawn", "vinput md" },
.{ "Super+Control", "L", "spawn", "physlock" },
.{ "Super+Shift", "P", "spawn", "gpower2" },
.{ "Alt", "Space", "spawn", "rofi -show combi" },
.{ "Super+Alt", "Space", "spawn", "rofi -show emoji" },
.{ "None", "Print", "spawn", "grim -g \"$(slurp; sleep 1)\" ~/Downloads/screenshot.png" },
.{ "Shift", "Print", "spawn", "grim -g \"$(slurp; sleep 1)\" - | feh -" },
.{ "Super", "Return", "spawn", journal_prefix ++ opts.term_command },
.{ "Super+Control", "E", "spawn", journal_prefix ++ opts.file_manager_command },
.{ "Super+Control", "B", "spawn", journal_prefix ++ opts.browser_command },
.{ "Super+Control", "V", "spawn", journal_prefix ++ "vinput md" },
.{ "Super+Control", "L", "spawn", journal_prefix ++ "physlock" },
.{ "Super+Shift", "P", "spawn", journal_prefix ++ "gpower2" },
.{ "Alt", "Space", "spawn", journal_prefix ++ "rofi -show combi" },
.{ "Super+Alt", "Space", "spawn", journal_prefix ++ "rofi -show emoji" },
.{ "None", "Print", "spawn", journal_prefix ++ "grim -g \"$(slurp; sleep 1)\" ~/Downloads/screenshot.png" },
.{ "Shift", "Print", "spawn", "grim -g \"$(slurp; sleep 1)\" - | " ++ journal_prefix ++ " feh -" },
// media keys
.{ "None", "XF86Eject", "spawn", "eject -T" },
.{ "None", "XF86AudioRaiseVolume", "spawn", "pactl set-sink-volume @DEFAULT_SINK@ +5%" },
.{ "None", "XF86AudioLowerVolume", "spawn", "pactl set-sink-volume @DEFAULT_SINK@ -5%" },
.{ "None", "XF86AudioMute", "spawn", "pactl set-sink-mute @DEFAULT_SINK@ toggle" },
.{ "None", "XF86AudioMicMute", "spawn", "pactl set-source-mute @DEFAULT_SINK@ toggle" },
.{ "None", "XF86AudioMedia", "spawn", "playerctl play-pause" },
.{ "None", "XF86AudioPlay", "spawn", "playerctl play-pause" },
.{ "None", "XF86AudioPrev", "spawn", "playerctl previous" },
.{ "None", "XF86AudioNext", "spawn", "playerctl next" },
.{ "None", "XF86Eject", "spawn", journal_prefix ++ "eject -T" },
.{ "None", "XF86AudioRaiseVolume", "spawn", journal_prefix ++ "pactl set-sink-volume @DEFAULT_SINK@ +5%" },
.{ "None", "XF86AudioLowerVolume", "spawn", journal_prefix ++ "pactl set-sink-volume @DEFAULT_SINK@ -5%" },
.{ "None", "XF86AudioMute", "spawn", journal_prefix ++ "pactl set-sink-mute @DEFAULT_SINK@ toggle" },
.{ "None", "XF86AudioMicMute", "spawn", journal_prefix ++ "pactl set-source-mute @DEFAULT_SINK@ toggle" },
.{ "None", "XF86AudioMedia", "spawn", journal_prefix ++ "playerctl play-pause" },
.{ "None", "XF86AudioPlay", "spawn", journal_prefix ++ "playerctl play-pause" },
.{ "None", "XF86AudioPrev", "spawn", journal_prefix ++ "playerctl previous" },
.{ "None", "XF86AudioNext", "spawn", journal_prefix ++ "playerctl next" },
// control maps
.{ "Super+Shift", "E", "exit" },
@ -225,7 +236,7 @@ pub fn init(alloc: std.mem.Allocator, initial: bool) !void {
// TODO: wonk
// We use an arena here to prevent leaks because process.Child apparently doesn't support
// detaching.
var child = std.process.Child.init(&argv, child_arena.allocator());
var child = std.process.Child.init(initCommand(&argv), child_arena.allocator());
try child.spawn();
}
}