swaybg systemd service
This commit is contained in:
parent
3ffd1c7822
commit
a5f9c29669
6 changed files with 64 additions and 10 deletions
22
hardware/displays.nix
Normal file
22
hardware/displays.nix
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
displays = {
|
||||
enable = true;
|
||||
displays = [
|
||||
{
|
||||
name = "DP-1";
|
||||
description = "HP Inc. HP 24x 1CR9500W9Q";
|
||||
resolution = { x = 1920; y = 1080; freq = 144; };
|
||||
position = "0x0";
|
||||
}
|
||||
{
|
||||
name = "eDP-1";
|
||||
description = "BOE 0x07D8";
|
||||
scaling = 1.2;
|
||||
position = "0x1080";
|
||||
wallpaper = "/home/tristan/Pictures/backgrounds/nix-wallpaper-watersplash.png";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@
|
|||
imports =
|
||||
[
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
./displays.nix
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" "sdhci_pci" ];
|
||||
|
|
|
|||
|
|
@ -8,14 +8,32 @@ let
|
|||
+ concatStringsSep "\n" (map displayHyprlandSetting displays);
|
||||
|
||||
displayHyprlandSetting = display:
|
||||
"monitor = " + display.name +
|
||||
"monitor = " + specificDisplay display +
|
||||
", " + resToString display.resolution +
|
||||
", " + display.position +
|
||||
", " + toString display.scaling +
|
||||
(if ( display.wallpaper != "" ) then ''
|
||||
", " + toString display.scaling;
|
||||
|
||||
exec-once = ${pkgs.swaybg}/bin/swaybg -o ${display.name} -i ${display.wallpaper} &
|
||||
'' else "");
|
||||
swaybgJob = displays:
|
||||
{
|
||||
Unit = {
|
||||
Description = "SwayBG";
|
||||
};
|
||||
Service = {
|
||||
ExecStart = "${pkgs.swaybg}/bin/swaybg " +
|
||||
concatStringsSep " " (map swaybgCmd displays);
|
||||
};
|
||||
Install = {
|
||||
WantedBy = ["graphical-session.target"];
|
||||
};
|
||||
};
|
||||
|
||||
swaybgCmd = display:
|
||||
if (display.wallpaper != "") then "-o ${display.name} -i ${display.wallpaper}" else "";
|
||||
|
||||
specificDisplay = display:
|
||||
if display.description == ""
|
||||
then display.name
|
||||
else "desc:" + display.description;
|
||||
|
||||
resolutionType = types.submodule ({ x, y, freq, ... }:
|
||||
{
|
||||
|
|
@ -43,6 +61,10 @@ let
|
|||
name = mkOption {
|
||||
description = "name of the display";
|
||||
};
|
||||
description = mkOption {
|
||||
description = "description of display from hyprctl monitors";
|
||||
default = "";
|
||||
};
|
||||
scaling = mkOption {
|
||||
type = types.float;
|
||||
default = 1.0;
|
||||
|
|
@ -83,6 +105,8 @@ in
|
|||
{
|
||||
wayland.windowManager.hyprland.extraConfig = mkIf (cfg.displays != [ ])
|
||||
(renderDisplaysForHyprland cfg.displays);
|
||||
|
||||
systemd.user.services.swaybg = swaybgJob cfg.displays;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,11 +7,12 @@ in
|
|||
options.roles = {
|
||||
laptop = {
|
||||
enable = mkEnableOption "is a laptop";
|
||||
displays = mkEnableOption "laptop display defaults";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
displays = {
|
||||
displays = mkIf cfg.displays {
|
||||
enable = true;
|
||||
displays = [{
|
||||
name = "eDP-1";
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ with lib;
|
|||
userSettings = {
|
||||
"aws.telemetry" = false;
|
||||
"gitlens.telemetry.enabled" = false;
|
||||
"redhat.telemetry.enabled" = false;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ in
|
|||
neofetch
|
||||
|
||||
inkscape
|
||||
libsForQt5.okular
|
||||
pavucontrol
|
||||
qpwgraph
|
||||
element-desktop
|
||||
|
|
@ -392,9 +393,9 @@ in
|
|||
open = "$set -f; ${pkgs.ranger}/bin/rifle -p 0 \"$fx\"";
|
||||
open-with = ''''${{
|
||||
set -f
|
||||
${pkgs.ranger}/bin/rifle -l $fx
|
||||
${pkgs.ranger}/bin/rifle -l "$fx"
|
||||
read -p "Open with: " method
|
||||
${pkgs.ranger}/bin/rifle -p $method $fx
|
||||
${pkgs.ranger}/bin/rifle -p "$method" "$fx"
|
||||
}}'';
|
||||
bulk-rename = ''''${{
|
||||
old="$(mktemp)"
|
||||
|
|
@ -858,6 +859,10 @@ color body red default "([a-z][a-z0-9+-]*://(((([a-z0-9_.!~*'();:&=+$,-]|%[0-9a-
|
|||
command = "${pkgs.gopls}/bin/gopls";
|
||||
filetypes = [ "go" ];
|
||||
};
|
||||
nix = {
|
||||
command = "${pkgs.rnix-lsp}/bin/rnix-lsp";
|
||||
filetypes = [ "nix" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue