1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

hyprshell: add module (#7409)

This commit is contained in:
Aguirre Matteo 2025-07-10 19:23:15 +00:00 committed by GitHub
parent 50330593f3
commit d81cb050f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 193 additions and 0 deletions

View file

@ -0,0 +1,96 @@
{
lib,
pkgs,
config,
...
}:
let
inherit (lib)
types
mkIf
mkEnableOption
mkPackageOption
mkOption
;
cfg = config.services.hyprshell;
jsonFormat = pkgs.formats.json { };
in
{
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
options.services.hyprshell = {
enable = mkEnableOption "hyprshell";
package = mkPackageOption pkgs "hyprshell" { nullable = true; };
settings = mkOption {
type = jsonFormat.type;
default = { };
description = ''
Configuration settings for hyprshell. All the avaiblable
options can be found here: <https://github.com/H3rmt/hyprshell/blob/hyprshell-release/CONFIGURE.md#config-options>
'';
};
style = mkOption {
type = with types; either path lines;
default = "";
description = ''
CSS file for customizing hyprshell. All the available
options can be found here: <https://github.com/H3rmt/hyprshell/blob/hyprshell-release/CONFIGURE.md#css>
'';
};
systemd = {
enable = mkEnableOption "the hyprshell Systemd service" // {
default = true;
};
target = mkOption {
type = types.str;
default = config.wayland.systemd.target;
description = "The Systemd target that will start the hyprshell service";
};
args = mkOption {
type = types.str;
default = "";
example = "-vv";
description = "Arguments to pass to the hyprshell service";
};
};
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.hyprshell" pkgs lib.platforms.linux)
{
assertion = if (cfg.package == null) then (if cfg.systemd.enable then false else true) else true;
message = "Can't set programs.hyprshell.systemd.enable with the package set to null.";
}
];
home.packages = mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."hyprshell/config.json" = mkIf (cfg.settings != { }) {
source = jsonFormat.generate "hyprshell-config" cfg.settings;
};
xdg.configFile."hyprshell/style.css" = mkIf (cfg.style != "") {
source = if lib.isString cfg.style then pkgs.writeText "hyprshell-style" cfg.style else cfg.style;
};
systemd.user.services.hyprshell = mkIf (cfg.systemd.enable && (cfg.package != null)) {
Unit = {
Description = "Starts Hyprshell daemon";
After = [ cfg.systemd.target ];
};
Service = {
Type = "simple";
ExecStart = "${lib.getExe cfg.package} run ${cfg.systemd.args}";
Restart = "on-failure";
};
Install.WantedBy = [ cfg.systemd.target ];
};
};
}

View file

@ -0,0 +1,9 @@
{
"kill_bind": "ctrl+shift+alt, h",
"layerrules": true,
"version": 1,
"windows": {
"items_per_row": 5,
"scale": 8.5
}
}

View file

@ -0,0 +1,5 @@
{ lib, pkgs, ... }:
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
hyprshell-example = ./example-config.nix;
}

View file

@ -0,0 +1,26 @@
{
services.hyprshell = {
enable = true;
settings = {
layerrules = true;
kill_bind = "ctrl+shift+alt, h";
version = 1;
windows = {
scale = 8.5;
items_per_row = 5;
};
};
style = ./style.css;
};
nmt.script = ''
assertFileExists home-files/.config/hyprshell/config.json
assertFileExists home-files/.config/hyprshell/style.css
assertFileContent home-files/.config/hyprshell/config.json \
${./config.json}
assertFileContent home-files/.config/hyprshell/style.css \
${./style.css}
'';
}

View file

@ -0,0 +1,57 @@
:root {
--border-color: rgba(90, 90, 120, 0.4);
--border-color-active: rgba(239, 9, 9, 0.9);
--bg-color: rgba(20, 20, 20, 0.9);
--bg-color-hover: rgba(40, 40, 50, 1);
--border-radius: 12px;
--border-size: 3px;
--border-style: solid;
--border-style-secondary: dashed;
--text-color: rgba(245, 245, 245, 1);
--window-padding: 2px;
}
.window {
}
.monitor {
}
.workspace {
}
.client {
}
.client-image {
}
.launcher {
}
.launcher-input {
}
.launcher-results {
}
.launcher-item {
}
.launcher-exec {
}
.launcher-key {
}
.launcher-plugins {
}
.launcher-plugin {
}