dotfiles/home-manager/modules/xmonad/default.nix
Magic_RB 3060a2d6b9
Rework xmonad with polybar and add emacs-rofi
Signed-off-by: Magic_RB <magic_rb@redalder.org>
2023-05-28 12:49:08 +02:00

104 lines
2.8 KiB
Nix

# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.magic_rb.programs.xmonad;
in {
options.magic_rb.programs.xmonad = {
enable = mkEnableOption "Enable xmonad config";
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;
};
};
};
}