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 =
|
imports =
|
||||||
[
|
[
|
||||||
(modulesPath + "/installer/scan/not-detected.nix")
|
(modulesPath + "/installer/scan/not-detected.nix")
|
||||||
|
./displays.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" "sdhci_pci" ];
|
boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" "sdhci_pci" ];
|
||||||
|
|
|
||||||
|
|
@ -8,14 +8,32 @@ let
|
||||||
+ concatStringsSep "\n" (map displayHyprlandSetting displays);
|
+ concatStringsSep "\n" (map displayHyprlandSetting displays);
|
||||||
|
|
||||||
displayHyprlandSetting = display:
|
displayHyprlandSetting = display:
|
||||||
"monitor = " + display.name +
|
"monitor = " + specificDisplay display +
|
||||||
", " + resToString display.resolution +
|
", " + resToString display.resolution +
|
||||||
", " + display.position +
|
", " + display.position +
|
||||||
", " + toString display.scaling +
|
", " + toString display.scaling;
|
||||||
(if ( display.wallpaper != "" ) then ''
|
|
||||||
|
|
||||||
exec-once = ${pkgs.swaybg}/bin/swaybg -o ${display.name} -i ${display.wallpaper} &
|
swaybgJob = displays:
|
||||||
'' else "");
|
{
|
||||||
|
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, ... }:
|
resolutionType = types.submodule ({ x, y, freq, ... }:
|
||||||
{
|
{
|
||||||
|
|
@ -43,6 +61,10 @@ let
|
||||||
name = mkOption {
|
name = mkOption {
|
||||||
description = "name of the display";
|
description = "name of the display";
|
||||||
};
|
};
|
||||||
|
description = mkOption {
|
||||||
|
description = "description of display from hyprctl monitors";
|
||||||
|
default = "";
|
||||||
|
};
|
||||||
scaling = mkOption {
|
scaling = mkOption {
|
||||||
type = types.float;
|
type = types.float;
|
||||||
default = 1.0;
|
default = 1.0;
|
||||||
|
|
@ -83,6 +105,8 @@ in
|
||||||
{
|
{
|
||||||
wayland.windowManager.hyprland.extraConfig = mkIf (cfg.displays != [ ])
|
wayland.windowManager.hyprland.extraConfig = mkIf (cfg.displays != [ ])
|
||||||
(renderDisplaysForHyprland cfg.displays);
|
(renderDisplaysForHyprland cfg.displays);
|
||||||
|
|
||||||
|
systemd.user.services.swaybg = swaybgJob cfg.displays;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -7,14 +7,15 @@ in
|
||||||
options.roles = {
|
options.roles = {
|
||||||
laptop = {
|
laptop = {
|
||||||
enable = mkEnableOption "is a laptop";
|
enable = mkEnableOption "is a laptop";
|
||||||
|
displays = mkEnableOption "laptop display defaults";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
displays = {
|
displays = mkIf cfg.displays {
|
||||||
enable = true;
|
enable = true;
|
||||||
displays = [{
|
displays = [{
|
||||||
name = "eDP-1";
|
name = "eDP-1";
|
||||||
scaling = 1.2;
|
scaling = 1.2;
|
||||||
}];
|
}];
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ with lib;
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf config.roles.work.enable {
|
config = mkIf config.roles.work.enable {
|
||||||
|
|
||||||
roles.email = {
|
roles.email = {
|
||||||
enable = true;
|
enable = true;
|
||||||
email = "tristan.beedell@cryoserver.com";
|
email = "tristan.beedell@cryoserver.com";
|
||||||
|
|
@ -58,6 +58,7 @@ with lib;
|
||||||
userSettings = {
|
userSettings = {
|
||||||
"aws.telemetry" = false;
|
"aws.telemetry" = false;
|
||||||
"gitlens.telemetry.enabled" = false;
|
"gitlens.telemetry.enabled" = false;
|
||||||
|
"redhat.telemetry.enabled" = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ in
|
||||||
neofetch
|
neofetch
|
||||||
|
|
||||||
inkscape
|
inkscape
|
||||||
|
libsForQt5.okular
|
||||||
pavucontrol
|
pavucontrol
|
||||||
qpwgraph
|
qpwgraph
|
||||||
element-desktop
|
element-desktop
|
||||||
|
|
@ -392,9 +393,9 @@ in
|
||||||
open = "$set -f; ${pkgs.ranger}/bin/rifle -p 0 \"$fx\"";
|
open = "$set -f; ${pkgs.ranger}/bin/rifle -p 0 \"$fx\"";
|
||||||
open-with = ''''${{
|
open-with = ''''${{
|
||||||
set -f
|
set -f
|
||||||
${pkgs.ranger}/bin/rifle -l $fx
|
${pkgs.ranger}/bin/rifle -l "$fx"
|
||||||
read -p "Open with: " method
|
read -p "Open with: " method
|
||||||
${pkgs.ranger}/bin/rifle -p $method $fx
|
${pkgs.ranger}/bin/rifle -p "$method" "$fx"
|
||||||
}}'';
|
}}'';
|
||||||
bulk-rename = ''''${{
|
bulk-rename = ''''${{
|
||||||
old="$(mktemp)"
|
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";
|
command = "${pkgs.gopls}/bin/gopls";
|
||||||
filetypes = [ "go" ];
|
filetypes = [ "go" ];
|
||||||
};
|
};
|
||||||
|
nix = {
|
||||||
|
command = "${pkgs.rnix-lsp}/bin/rnix-lsp";
|
||||||
|
filetypes = [ "nix" ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue