mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-28 19:16:14 +01:00
6013c57702
Signed-off-by: Magic_RB <magic_rb@redalder.org>
148 lines
4.4 KiB
Nix
148 lines
4.4 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" = lib.getExe pkgs.magic_rb.screenshot;
|
|
"emacs-rofi" = lib.getExe pkgs.emacs-rofi;
|
|
"notify" = lib.getExe pkgs.libnotify;
|
|
"playerctl" = lib.getExe pkgs.playerctl;
|
|
"reload" = pkgs.writeShellScript "xmonad-reload"
|
|
''
|
|
${lib.getExe pkgs.libnotify} -t 5000 "recompiling xmonad"
|
|
|
|
if xmonad --recompile
|
|
then
|
|
${lib.getExe pkgs.libnotify} -t 5000 "compilation succeeded"
|
|
xmonad --restart
|
|
else
|
|
${lib.getExe pkgs.libnotify} -t 5000 "compilation failed"
|
|
fi
|
|
'';
|
|
"auxmenu" = pkgs.writeShellScript "auxmenu"
|
|
''
|
|
export SUDO_ASKPASS=${pkgs.x11_ssh_askpass}/libexec/x11-ssh-askpass
|
|
|
|
_options="toggle-mic\ntoggle-radio\nscreenshot-all\nscreenshot-select\nscreenshot-focused\nsuspend\nreboot\nkexec\npoweroff\nlogout\nnmtui"
|
|
|
|
_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
|
|
;;
|
|
screenshot-all)
|
|
${lib.getExe pkgs.magic_rb.screenshot} screen
|
|
;;
|
|
screenshot-select)
|
|
${lib.getExe pkgs.magic_rb.screenshot} select
|
|
;;
|
|
screenshot-focused)
|
|
${lib.getExe pkgs.magic_rb.screenshot} focused
|
|
;;
|
|
suspend)
|
|
systemctl suspend
|
|
;;
|
|
reboot)
|
|
systemctl reboot
|
|
;;
|
|
poweroff)
|
|
systemctl poweroff
|
|
;;
|
|
kexec)
|
|
sudo -A kexec -l /run/current-system/kernel --initrd=/run/current-system/initrd --reuse-cmdline
|
|
systemctl kexec
|
|
;;
|
|
logout)
|
|
loginctl terminate-session $XDG_SESSION_ID
|
|
;;
|
|
nmtui)
|
|
alacritty -e nmtui
|
|
;;
|
|
*)
|
|
;;
|
|
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;
|
|
};
|
|
};
|
|
};
|
|
}
|