add normal theme support for slim and slimlock

This commit is contained in:
Arseniy Seroka 2014-02-05 16:44:59 +04:00
parent b9fe0b8fb1
commit d573ea576f
3 changed files with 65 additions and 5 deletions

View File

@ -5,7 +5,10 @@ with pkgs.lib;
let
dmcfg = config.services.xserver.displayManager;
cfg = dmcfg.slim;
slimPackage = cfg.package;
slimConfig = pkgs.writeText "slim.cfg"
''
@ -32,7 +35,7 @@ let
ln -s * default
'';
};
in if cfg.theme == null then "${pkgs.slim}/share/slim/themes" else unpackedTheme;
in if cfg.theme == null then "${slimPackage}/share/slim/themes" else unpackedTheme;
in
@ -79,6 +82,22 @@ in
the focus is placed on the password.
'';
};
package = mkOption {
type = types.package;
default = pkgs.slim;
description = ''
Configure slim package.
'';
example = ''
pkgs.slim.override {
theme = pkgs.fetchurl {
url = http://download.berlios.de/slim/slim-wave.tar.gz;
sha256 = "0ndr419i5myzcylvxb89m9grl2xyq6fbnyc3lkd711mzlmnnfxdy";
};
};
'';
};
autoLogin = mkOption {
type = types.bool;
@ -106,7 +125,7 @@ in
{ SLIM_CFGFILE = slimConfig;
SLIM_THEMESDIR = slimThemesDir;
};
execCmd = "exec ${pkgs.slim}/bin/slim";
execCmd = "exec ${slimPackage}/bin/slim";
};
# Allow null passwords so that the user can login as root on the
@ -116,7 +135,7 @@ in
# Allow slimlock to work.
security.pam.services.slimlock = {};
environment.systemPackages = [ pkgs.slim ];
environment.systemPackages = [ slimPackage ];
};

View File

@ -1,5 +1,20 @@
{ stdenv, fetchurl, cmake, pkgconfig, xorg, libjpeg, libpng
, fontconfig, freetype, pam, dbus_libs }:
, fontconfig, freetype, pam, dbus_libs, makeWrapper, pkgs, theme ? null }:
let
slimThemesDir =
let
unpackedTheme = pkgs.stdenv.mkDerivation {
name = "slim-theme";
buildCommand = ''
ensureDir $out
cd $out
unpackFile ${theme}
ln -s * default
'';
};
in if theme == null then "$out/share/slim/themes" else unpackedTheme;
in
stdenv.mkDerivation rec {
name = "slim-1.3.6";
@ -29,9 +44,13 @@ stdenv.mkDerivation rec {
buildInputs =
[ cmake pkgconfig libjpeg libpng fontconfig freetype
pam dbus_libs
xorg.libX11 xorg.libXext xorg.libXrandr xorg.libXrender xorg.libXmu xorg.libXft
xorg.libX11 xorg.libXext xorg.libXrandr xorg.libXrender xorg.libXmu xorg.libXft makeWrapper
];
postInstall = ''
wrapProgram $out/bin/slimlock --set SLIM_THEMESDIR "${slimThemesDir}" --set SLIM_CFGFILE "$out/etc/slim.cfg"
'';
NIX_CFLAGS_LINK = "-lXmu";
meta = {

View File

@ -23,3 +23,25 @@ diff -ru -x '*~' slim-1.3.6-orig/app.cpp slim-1.3.6/app.cpp
themeName = cfg->getOption("current_theme");
string::size_type pos;
if ((pos = themeName.find(",")) != string::npos) {
--- slim-1.3.6-orig/slimlock.cpp 2014-02-05 01:58:01.576560731 +0400
+++ slim-1.3.6/slimlock.cpp 2014-02-05 02:11:16.587634246 +0400
@@ -106,13 +106,17 @@
unsigned int cfg_passwd_timeout;
// Read user's current theme
cfg = new Cfg;
- cfg->readConf(CFGFILE);
+ char *cfgfile = getenv("SLIM_CFGFILE");
+ if (!cfgfile) cfgfile = CFGFILE;
+ cfg->readConf(cfgfile);
cfg->readConf(SLIMLOCKCFG);
string themebase = "";
string themefile = "";
string themedir = "";
themeName = "";
- themebase = string(THEMESDIR) + "/";
+ char *themesdir = getenv("SLIM_THEMESDIR");
+ if (!themesdir) themesdir = THEMESDIR;
+ themebase = string(themesdir) + "/";
themeName = cfg->getOption("current_theme");
string::size_type pos;
if ((pos = themeName.find(",")) != string::npos) {