141 lines
5.4 KiB
Nix
141 lines
5.4 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.programs.xmonad;
|
|
|
|
xmonadConfig = with pkgs; callPackage ./buildXmonad.nix {inherit (pkgs.haskellPackages) xmonad-masser; } cfg.dhallConfigPath cfg.packages;
|
|
|
|
in {
|
|
options = {
|
|
programs.xmonad = {
|
|
enable = mkEnableOption "Enable xmonad";
|
|
dhallConfigPath = mkOption {
|
|
type = types.path;
|
|
};
|
|
packages = mkOption {
|
|
type = types.attrsOf types.package;
|
|
default = {};
|
|
};
|
|
};
|
|
};
|
|
config = mkIf cfg.enable {
|
|
home.packages = with pkgs; [
|
|
source-code-pro
|
|
dmenu
|
|
zenity
|
|
rofi
|
|
haskellPackages.xmobar
|
|
xorg.xmodmap
|
|
xorg.xev
|
|
xorg.xset
|
|
xorg.xbacklight
|
|
xclip
|
|
xcalib
|
|
i3lock
|
|
];
|
|
xsession = {
|
|
enable = true;
|
|
windowManager.xmonad = {
|
|
enable = true;
|
|
enableContribAndExtras = true;
|
|
extraPackages = h: [h.xmonad-contrib h.xmonad-masser];
|
|
config =
|
|
|
|
let toAppKey = k: _: "${k} :: FilePath";
|
|
toApp = k: v: ''Application {_applicationName = "${k}", _applicationAction = "${v}"}'';
|
|
applications = concatStringsSep "\n , " (mapAttrsToList toApp cfg.applications);
|
|
orNothingStr = x: if null == x then "Nothing" else ''Just "${x}"'';
|
|
quoted = x: ''"${x}"'';
|
|
toTopic = k: v: ''TopicRule {_topicRuleName = "${k}", _topicRuleHome = ${orNothingStr v.home}, _topicRuleAction = ${orNothingStr v.action}, _topicRuleClasses = [${concatStringsSep ", " (map quoted v.classes)}]}'';
|
|
topics = concatStringsSep "\n , " (mapAttrsToList toTopic cfg.topics);
|
|
toSearch = k: v: ''Search {_searchName="${k}", _searchKey="${v.key}", _searchUrl="${v.url}"}'';
|
|
searches = concatStringsSep "\n , " (mapAttrsToList toSearch cfg.searches);
|
|
in pkgs.writeText "xmonad.hs"
|
|
''
|
|
{-# LANGUAGE OverloadedStrings #-}
|
|
{-# LANGUAGE NamedFieldPuns #-}
|
|
module Main where
|
|
-- This is autogenerated file, don't touch
|
|
|
|
import XMonad.Config.MasseR
|
|
|
|
main :: IO ()
|
|
main = masser
|
|
'';
|
|
};
|
|
initExtra = ''
|
|
${pkgs.autorandr}/bin/autorandr --cycle
|
|
'';
|
|
};
|
|
home.file.".xmonad/xmonad.dhall".source = xmonadConfig + "/source.dhall";
|
|
# programs.xmonad =
|
|
# let
|
|
# musicToggle = pkgs.writeScript "musictoggle" ''
|
|
# ${pkgs.mpc_cli}/bin/mpc toggle
|
|
# '';
|
|
# # musicCurrent = with pkgs; writeScript "musiccurrent" ''
|
|
# # export PATH=${lib.makeBinPath [sp gawk]}
|
|
# # sp current | awk '/^Title/ {$1 = ""; print $0}'
|
|
# # '';
|
|
# musicCurrent = with pkgs; writeScript "musiccurrent" ''
|
|
# export PATH=${lib.makeBinPath [mpc_cli]}
|
|
# mpc --format "%title%" current
|
|
# '';
|
|
# xmobarConf = pkgs.writeText "xmobar" ''
|
|
# Config {
|
|
# font = "xft:Inconsolata-9"
|
|
# , bgColor = "#3F3F3F"
|
|
# , fgColor = "#DCDCCC"
|
|
# , position = Top
|
|
# , lowerOnStart = True
|
|
# , pickBroadest = True
|
|
# , commands = [
|
|
# Run MultiCpu ["-t", "CPU: <total>%"] 30
|
|
# , Run Memory ["-t", "Mem: <usedbar> (<cache>M)"] 3600
|
|
# , Run Date "%a %b %_d %Y %H:%M:%S" "date" 20
|
|
# , Run StdinReader
|
|
# , Run Battery [ "--template" , "Batt: <acstatus>"
|
|
# , "--Low" , "10" -- units: %
|
|
# , "--High" , "80" -- units: %
|
|
# , "--low" , "darkred"
|
|
# , "--normal" , "darkorange"
|
|
# , "--high" , "darkgreen"
|
|
#
|
|
# , "--" -- battery specific options
|
|
# -- discharging status
|
|
# , "-o" , "<left>% (<timeleft>)"
|
|
# -- AC "on" status
|
|
# , "-O" , "<fc=#dAA520>Charging</fc>"
|
|
# -- charged status
|
|
# , "-i" , "<fc=#006000>Charged</fc>"
|
|
# ] 120
|
|
# , Run DynNetwork [ "--template" , "<dev>: <tx>kB/s|<rxbar>kB/s"
|
|
# , "--Low" , "1000" -- units: B/s
|
|
# , "--High" , "500000" -- units: B/s
|
|
# , "--normal" , "darkorange"
|
|
# , "--high" , "darkred"
|
|
# ] 30
|
|
# ]
|
|
# , sepChar = "%"
|
|
# , alignSep = "}{"
|
|
# , template = "%StdinReader% }{%dynnetwork% | %battery% | %multicpu% | %memory% | <fc=#FFFFCC>%date%</fc>"
|
|
# }
|
|
# '';
|
|
# # browser = "${pkgs.qutebrowser}/bin/qutebrowser";
|
|
# chromiumApp = name: url: pkgs.writeScriptBin "${name}" ''
|
|
# ${pkgs.chromium}/bin/chromium --user-data-dir=~/.config/chromium-${name} --app=${url}
|
|
# '';
|
|
# custom_teams = chromiumApp "teams" "https://teams.microsoft.com";
|
|
# flowdock = chromiumApp "flowdock" "https://flowdock.com/app";
|
|
# wiki = chromiumApp "wiki" "https://wiki.relexsolutions.com";
|
|
# xmonadConfig = with pkgs; callPackage ./buildXmonad.nix {} cfg.dhallConfigPath cfg.packages;
|
|
# in
|
|
# {
|
|
# enable = true;
|
|
# configPackage = xmonadConfig;
|
|
# };
|
|
};
|
|
}
|