2024-02-18 23:06:36 +03:00
|
|
|
{ config, pkgs, lib, ... }:
|
2022-10-12 01:41:32 +03:00
|
|
|
|
2024-02-18 23:06:36 +03:00
|
|
|
let
|
2024-04-16 02:51:46 +03:00
|
|
|
cfg = config.local.window-manager.xmonad;
|
|
|
|
themeCfg = config.local.themes."${config.local.theme.name}";
|
2024-02-18 23:06:36 +03:00
|
|
|
|
|
|
|
projectType = with lib; types.submodule {
|
|
|
|
options = {
|
|
|
|
name = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
};
|
2024-02-27 19:08:53 +03:00
|
|
|
workdir = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
};
|
|
|
|
windowCount = mkOption {
|
|
|
|
type = types.ints.positive;
|
|
|
|
default = 1;
|
|
|
|
};
|
|
|
|
terminalCommands = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [ ];
|
|
|
|
};
|
|
|
|
spawnPrograms = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [ ];
|
2024-02-18 23:06:36 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-02-27 19:08:53 +03:00
|
|
|
mkXmonadProjectSpawnProgram = program:
|
|
|
|
"spawn \"${program}\"";
|
|
|
|
|
|
|
|
mkXmonadProjectTerminalCommand = command:
|
|
|
|
"spawn $ terminal' workdir $ Just \"${command}\"";
|
|
|
|
|
|
|
|
|
|
|
|
mkXmonadProject = { name, workdir, windowCount, spawnPrograms, terminalCommands }:
|
2024-02-18 23:06:36 +03:00
|
|
|
''
|
|
|
|
Project {
|
|
|
|
projectName = "${name}",
|
2024-02-27 19:08:53 +03:00
|
|
|
projectStartHook =
|
|
|
|
do
|
|
|
|
let workdir = "${workdir}"
|
2024-04-16 17:59:16 +03:00
|
|
|
${lib.concatMapStringsSep "\n" mkXmonadProjectSpawnProgram spawnPrograms}
|
|
|
|
${lib.concatMapStringsSep "\n" mkXmonadProjectTerminalCommand terminalCommands}
|
2024-02-27 19:08:53 +03:00
|
|
|
replicateM_ ${toString windowCount} $ spawn $ terminal workdir
|
2024-02-18 23:06:36 +03:00
|
|
|
}
|
|
|
|
'';
|
|
|
|
|
2024-04-16 17:59:16 +03:00
|
|
|
xmonadProjects = lib.concatMapStringsSep " , " mkXmonadProject cfg.projects;
|
2024-02-18 23:06:36 +03:00
|
|
|
in
|
2022-10-12 01:41:32 +03:00
|
|
|
{
|
2024-04-16 02:51:46 +03:00
|
|
|
options.local.window-manager.xmonad = with lib; {
|
|
|
|
enable = mkEnableOption "xmonad window manager";
|
|
|
|
projects = mkOption {
|
|
|
|
type = types.listOf projectType;
|
|
|
|
default = [ ];
|
2024-02-18 23:06:36 +03:00
|
|
|
};
|
2024-04-16 02:51:46 +03:00
|
|
|
};
|
2022-10-12 01:41:32 +03:00
|
|
|
|
2024-04-16 02:51:46 +03:00
|
|
|
config = lib.mkIf cfg.enable {
|
2024-02-18 23:06:36 +03:00
|
|
|
home.packages = with pkgs; [
|
|
|
|
xclip # access x clipboard from a console
|
|
|
|
dmenu # menu for x window system
|
|
|
|
nitrogen # wallpaper manager
|
|
|
|
];
|
2022-10-12 01:41:32 +03:00
|
|
|
|
2024-02-18 23:06:36 +03:00
|
|
|
xsession = {
|
2022-10-12 01:41:32 +03:00
|
|
|
enable = true;
|
2024-02-18 23:06:36 +03:00
|
|
|
|
|
|
|
windowManager.xmonad = {
|
|
|
|
enable = true;
|
|
|
|
enableContribAndExtras = true;
|
|
|
|
|
|
|
|
haskellPackages = pkgs.unstable.haskellPackages;
|
|
|
|
extraPackages = (hp: [
|
|
|
|
hp.dbus
|
|
|
|
hp.monad-logger
|
|
|
|
]);
|
|
|
|
|
|
|
|
config = pkgs.substituteAll {
|
|
|
|
src = ./xmonad_config.hs;
|
2024-02-19 00:19:37 +03:00
|
|
|
projects = "\n " + xmonadProjects;
|
2024-02-18 23:06:36 +03:00
|
|
|
inherit (themeCfg.bar) background mainText inactiveText;
|
|
|
|
inherit (themeCfg.window) activeBorder inactiveBorder;
|
|
|
|
inherit (themeCfg.highlights) critical warning success;
|
|
|
|
inherit (themeCfg.syntax) mark1 mark2 mark3;
|
|
|
|
kdbBrightnessScriptPath = "${./scripts/kdb_brightness.sh}";
|
|
|
|
};
|
2022-10-28 15:26:00 +03:00
|
|
|
};
|
2022-10-12 01:41:32 +03:00
|
|
|
|
2024-02-18 23:06:36 +03:00
|
|
|
initExtra = ''
|
|
|
|
${pkgs.nitrogen}/bin/nitrogen --restore &
|
|
|
|
'';
|
|
|
|
};
|
2022-10-17 17:43:12 +03:00
|
|
|
|
2024-02-18 23:06:36 +03:00
|
|
|
services.flameshot = {
|
|
|
|
enable = true;
|
2022-10-17 17:43:12 +03:00
|
|
|
|
2024-02-18 23:06:36 +03:00
|
|
|
# See: https://github.com/flameshot-org/flameshot/blob/master/flameshot.example.ini
|
|
|
|
settings = {
|
|
|
|
General = {
|
|
|
|
disabledTrayIcon = true;
|
|
|
|
savePathFixed = true;
|
|
|
|
showDesktopNotification = false;
|
|
|
|
showSidePanelButton = true;
|
|
|
|
};
|
2022-10-17 17:43:12 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2022-10-12 01:41:32 +03:00
|
|
|
}
|