l: refactor xresources

This commit is contained in:
lassulus 2017-11-29 15:39:14 +01:00
parent 5014ba291d
commit 613ee4c9ba
4 changed files with 26 additions and 95 deletions

View File

@ -7,9 +7,9 @@ in {
./mpv.nix ./mpv.nix
./power-action.nix ./power-action.nix
./copyq.nix ./copyq.nix
./xresources.nix
./livestream.nix ./livestream.nix
./dns-stuff.nix ./dns-stuff.nix
./urxvt.nix
{ {
hardware.pulseaudio = { hardware.pulseaudio = {
enable = true; enable = true;
@ -41,6 +41,11 @@ in {
default = "-*-clean-*-*-*-*-*-*-*-*-*-*-iso10646-1"; default = "-*-clean-*-*-*-*-*-*-*-*-*-*-iso10646-1";
}; };
}; };
config.services.xresources.resources.X = ''
*.font: ${config.lass.fonts.regular}
*.boldFont: ${config.lass.fonts.bold}
*.italicFont: ${config.lass.fonts.italic}
'';
} }
]; ];
@ -134,5 +139,6 @@ in {
}; };
services.urxvtd.enable = true; services.urxvtd.enable = true;
services.xresources.enable = true;
lass.screenlock.enable = true; lass.screenlock.enable = true;
} }

View File

@ -1,40 +1,32 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
with import <stockholm/lib>;
let
inherit (config.users.extraUsers) mainUser;
in
{ {
imports = [ services.urxvtd.enable = true;
../3modules/urxvtd.nix
../3modules/xresources.nix
];
services.urxvtd = {
enable = true;
users = [ mainUser.name ];
urxvtPackage = pkgs.rxvt_unicode_with-plugins;
};
services.xresources.enable = true;
services.xresources.resources.urxvt = '' services.xresources.resources.urxvt = ''
URxvt*scrollBar: false URxvt*SaveLines: 4096
URxvt*urgentOnBell: true URxvt*scrollBar: false
URxvt*font: -*-clean-*-*-*-*-*-*-*-*-*-*-iso10646-* URxvt*urgentOnBell: true
URxvt*boldFont: -*-clean-*-*-*-*-*-*-*-*-*-*-iso10646-*
URxvt.perl-ext-common: default,clipboard,url-select,keyboard-select URxvt.perl-ext-common: default,clipboard,url-select,keyboard-select
URxvt.url-select.launcher: browser-select
${optionalString (hasAttr "browser" config.lass)
"URxvt.url-select.launcher: ${config.lass.browser.select}/bin/browser-select"
}
URxvt.url-select.underline: true URxvt.url-select.underline: true
URxvt.keysym.M-u: perl:url-select:select_next URxvt.keysym.M-u: perl:url-select:select_next
URxvt.keysym.M-Escape: perl:keyboard-select:activate URxvt.keysym.M-Escape: perl:keyboard-select:activate
URxvt.keysym.M-s: perl:keyboard-select:search URxvt.keysym.M-s: perl:keyboard-select:search
URxvt.intensityStyles: false URxvt.intensityStyles: false
URxvt*background: #000000 URxvt*background: #000000
URxvt*foreground: #ffffff URxvt*foreground: #ffffff
!change unreadable blue !change unreadable blue
URxvt*color4: #268bd2 URxvt*color4: #268bd2
URxvt*color0: #232342
''; '';
} }

View File

@ -1,63 +0,0 @@
{ config, pkgs, ... }:
with import <stockholm/lib>;
let
xresources = pkgs.writeText "Xresources" ''
URxvt*scrollBar: false
URxvt*urgentOnBell: true
URxvt*SaveLines: 4096
URxvt.font: ${config.lass.fonts.regular}
URxvt.boldFont: ${config.lass.fonts.bold}
URxvt.italicFont: ${config.lass.fonts.italic}
! ref https://github.com/muennich/urxvt-perls
URxvt.perl-lib: ${pkgs.urxvt_perls}/lib/urxvt/perl
URxvt.perl-ext-common: default,clipboard,url-select,keyboard-select
${optionalString (hasAttr "browser" config.lass)
"URxvt.url-select.launcher: ${config.lass.browser.select}/bin/browser-select"
}
URxvt.url-select.underline: true
URxvt.keysym.M-u: perl:url-select:select_next
URxvt.keysym.M-Escape: perl:keyboard-select:activate
URxvt.keysym.M-s: perl:keyboard-select:search
URxvt.intensityStyles: false
URxvt*background: #000000
URxvt*foreground: #d0d7d0
URxvt*cursorColor: #f042b0
URxvt*cursorColor2: #f0b000
URxvt*cursorBlink: off
URxvt*.pointerBlank: true
URxvt*.pointerBlankDelay: 987654321
URxvt*.pointerColor: #f042b0
URxvt*.pointerColor2: #050505
URxvt*color0: #232342
'';
in {
systemd.services.xresources = {
description = "xresources";
wantedBy = [ "multi-user.target" ];
after = [ "display-manager.service" ];
environment = {
DISPLAY = ":0";
};
restartIfChanged = true;
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.xorg.xrdb}/bin/xrdb -merge ${xresources}";
Restart = "on-failure";
User = "lass";
};
};
}

View File

@ -4,16 +4,13 @@
#prefix with Attribute Name #prefix with Attribute Name
#ex: urxvt #ex: urxvt
#
#
with builtins; with builtins;
with lib; with lib;
let let
inherit (import ../../tv/4lib { inherit pkgs lib; }) shell-escape; inherit (pkgs) writeScript writeText;
inherit (pkgs) writeScript;
in in
@ -46,12 +43,11 @@ in
config = config =
let let
cfg = config.services.xresources; cfg = config.services.xresources;
xres = concatStringsSep "\n" (attrValues cfg.resources); xres = writeText "xresources" (concatStringsSep "\n" (attrValues cfg.resources));
in mkIf cfg.enable { in mkIf cfg.enable {
services.xserver.displayManager.sessionCommands = '' services.xserver.displayManager.sessionCommands = ''
echo ${shell-escape xres} | xrdb -merge xrdb -merge ${xres}
''; '';
}; };
} }