dotfiles/home-manager/modules/xmonad/default.nix

104 lines
2.8 KiB
Nix
Raw Normal View History

# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
2021-01-24 17:43:50 +01:00
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.magic_rb.programs.xmonad;
in {
options.magic_rb.programs.xmonad = {
enable = mkEnableOption "Enable xmonad config";
2021-01-24 17:43:50 +01:00
enableDunst = mkOption {
description = "Enable dunst";
type = types.bool;
default = true;
};
enablePicom = mkOption {
description = "Enable picom";
type = types.bool;
default = true;
};
enableKeynav = mkOption {
description = "Enable keynav";
type = types.bool;
default = true;
};
picomExperimentalBackends = mkOption {
description = "Enable experimental backends in picom";
type = types.bool;
default = true;
};
};
config = mkIf cfg.enable {
home.packages = with pkgs; [
powerline-fonts
font-awesome
dejavu_fonts
];
home.file.".keynavrc".source = ./keynavrc;
home.file.".xmonad/xmonad.hs".source = pkgs.writeSubstitutedFile {
name = "xmonad.hs";
file = ./xmonad.hs;
substitutes = {
"screenshot" = "${pkgs.magic_rb.screenshot}/bin/screenshot";
"emacs-rofi" = lib.getExe pkgs.emacs-rofi;
"auxmenu" = pkgs.writeShellScript "auxmenu"
''
_options="toggle-mic\ntoggle-radio"
_option="$(echo -e $_options | emacs-rofi "command: " 90 30 | awk '{print $1}' | tr -d '\r\n')"
if [ ''${#_option} -gt 0 ]
then
case $_option in
toggle-mic)
wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
;;
toggle-radio)
if [ "$(nmcli radio wifi)" = "enabled" ]
then
nmcli radio wifi off
else
nmcli radio wifi on
fi
;;
*)
;;
esac
fi
'';
"dmenu_run" = "${pkgs.dmenu}/bin/dmenu_run";
"polybar" = pkgs.writeShellScript "polybar"
''
monitors=$(polybar --list-monitors | cut -f 1 -d':')
MONITOR=''${monitors[$1]} ${lib.getExe pkgs.polybarFull} -c ${./polybar.ini} top
'';
"dunst" = lib.getExe pkgs.dunst;
"dunstConfig" = ./dunstrc;
"picom" = lib.getExe pkgs.picom;
"picomConfig" = ./picom.conf;
"picomArgs" =
if cfg.picomExperimentalBackends
then "--experimental-backends"
else "";
"keynav" = lib.getExe pkgs.keynav;
"lightLocker" = lib.getExe pkgs.lightlocker;
"lightLockerCommand" = "${pkgs.lightlocker}/bin/light-locker-command";
"brightnessctl" = lib.getExe pkgs.brightnessctl;
};
2021-01-24 17:43:50 +01:00
};
2021-02-26 10:24:58 +01:00
};
2021-01-24 17:43:50 +01:00
}