2017-10-17 00:32:48 +02:00
|
|
|
# Configuration for the desktop environment
|
|
|
|
|
2017-11-15 18:34:39 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
2017-10-17 00:32:48 +02:00
|
|
|
|
2018-03-04 22:08:07 +01:00
|
|
|
let emacs = import ./emacs.nix { inherit pkgs; };
|
2018-04-22 12:43:42 +02:00
|
|
|
screenLock = pkgs.writeShellScriptBin "screen-lock" ''
|
|
|
|
find ${pkgs.wallpapers} -name "*.png" | shuf -n1 | xargs i3lock -f -t -i
|
|
|
|
'';
|
2017-10-17 00:32:48 +02:00
|
|
|
in {
|
|
|
|
# Configure basic X-server stuff:
|
2017-10-21 00:33:39 +02:00
|
|
|
services.xserver = {
|
|
|
|
enable = true;
|
2018-08-10 22:16:46 +02:00
|
|
|
layout = "us,no";
|
2018-01-12 22:56:46 +01:00
|
|
|
xkbOptions = "caps:super, grp:shifts_toggle, parens:swap_brackets";
|
2018-05-05 12:22:26 +02:00
|
|
|
exportConfiguration = true;
|
2017-10-17 00:32:48 +02:00
|
|
|
|
2017-11-15 18:34:39 +01:00
|
|
|
# Give EXWM permission to control the session.
|
|
|
|
displayManager.sessionCommands = "${pkgs.xorg.xhost}/bin/xhost +SI:localuser:$USER";
|
2017-10-20 23:22:10 +02:00
|
|
|
};
|
|
|
|
|
2018-04-22 12:43:42 +02:00
|
|
|
# Add a shell script with random screen lock wallpaper selection
|
|
|
|
environment.systemPackages = [ screenLock ];
|
2018-01-04 23:22:07 +01:00
|
|
|
|
|
|
|
# Apparently when you have house guests they complain about your screen tearing!
|
|
|
|
services.compton.enable = true;
|
|
|
|
services.compton.backend = "xrender";
|
|
|
|
|
2017-11-15 18:34:39 +01:00
|
|
|
# Configure desktop environment:
|
|
|
|
services.xserver.windowManager.session = lib.singleton {
|
|
|
|
name = "exwm";
|
|
|
|
start = ''
|
2018-09-16 16:52:16 +02:00
|
|
|
${emacs}/bin/emacs --eval '(progn (server-start) (exwm-enable))'
|
2017-11-15 18:34:39 +01:00
|
|
|
'';
|
|
|
|
};
|
2017-10-17 00:32:48 +02:00
|
|
|
|
|
|
|
# Configure Redshift for Oslo
|
2017-10-21 00:33:39 +02:00
|
|
|
services.redshift = {
|
|
|
|
enable = true;
|
|
|
|
latitude = "59.911491";
|
|
|
|
longitude = "10.757933";
|
|
|
|
};
|
2017-10-17 00:32:48 +02:00
|
|
|
|
|
|
|
# Configure fonts
|
|
|
|
fonts = {
|
|
|
|
fonts = with pkgs; [
|
2018-07-22 15:22:41 +02:00
|
|
|
corefonts
|
2017-10-21 00:33:54 +02:00
|
|
|
font-awesome-ttf
|
2017-10-17 00:32:48 +02:00
|
|
|
input-fonts
|
2017-10-21 00:33:54 +02:00
|
|
|
noto-fonts-cjk
|
|
|
|
noto-fonts-emoji
|
|
|
|
powerline-fonts
|
2018-04-23 15:32:57 +02:00
|
|
|
helvetica-neue-lt-std
|
2017-10-17 00:32:48 +02:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
# Configure random setting of wallpapers
|
|
|
|
systemd.user.services.feh-wp = {
|
|
|
|
description = "Randomly set wallpaper via feh";
|
|
|
|
serviceConfig = {
|
2017-10-21 00:33:39 +02:00
|
|
|
Type = "oneshot";
|
2018-03-04 22:08:07 +01:00
|
|
|
WorkingDirectory = "${pkgs.wallpapers}/share/wallpapers";
|
2017-10-21 00:33:39 +02:00
|
|
|
|
|
|
|
# Manually shuffle because feh's --randomize option can't be restricted to
|
|
|
|
# just certain file types.
|
2017-10-17 00:32:48 +02:00
|
|
|
ExecStart = "${pkgs.bash}/bin/bash -c '${pkgs.fd}/bin/fd -atf | shuf | head -n1 | ${pkgs.findutils}/bin/xargs ${pkgs.feh}/bin/feh --bg-fill'";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.user.timers.feh-wp = {
|
|
|
|
description = "Set a random wallpaper every hour";
|
2017-10-21 00:33:39 +02:00
|
|
|
wantedBy = [ "graphical-session.target" ];
|
|
|
|
partOf = [ "graphical-session.target" ];
|
2017-10-17 00:32:48 +02:00
|
|
|
|
|
|
|
timerConfig = {
|
2017-10-21 00:33:39 +02:00
|
|
|
OnActiveSec = "1second";
|
2017-10-17 00:32:48 +02:00
|
|
|
OnUnitActiveSec = "1hour";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|