~magic_rb/dotfiles

77c18a2791723b35c1974b56ec5b9b5f1247c14f — Magic_RB 8 months ago 58ea879
Add notifications to xmonad actions

Signed-off-by: Magic_RB <magic_rb@redalder.org>
2 files changed, 27 insertions(+), 5 deletions(-)

M home-manager/modules/xmonad/default.nix
M home-manager/modules/xmonad/xmonad.hs
M home-manager/modules/xmonad/default.nix => home-manager/modules/xmonad/default.nix +24 -2
@@ 51,11 51,24 @@ in {
      name = "xmonad.hs";
      file = ./xmonad.hs;
      substitutes = {
        "screenshot" = "${pkgs.magic_rb.screenshot}/bin/screenshot";
        "screenshot" = lib.getExe pkgs.magic_rb.screenshot;
        "emacs-rofi" = lib.getExe pkgs.emacs-rofi;
        "notify" = lib.getExe pkgs.libnotify;
        "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"
          ''
            _options="toggle-mic\ntoggle-radio"
            _options="toggle-mic\ntoggle-radio\nscreenshot-all\nscreenshot-select\nscreenshot-focused"

            _option="$(echo -e $_options | emacs-rofi "command: " 90 30 | awk '{print $1}' | tr -d '\r\n')"
            if [ ''${#_option} -gt 0 ]


@@ 72,6 85,15 @@ in {
                    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
                  ;;
                *)
                  ;;
              esac

M home-manager/modules/xmonad/xmonad.hs => home-manager/modules/xmonad/xmonad.hs +3 -3
@@ 111,8 111,8 @@ myKeymap c =

    -- , ("M-b", spawn ("pkill xmobar && " ++ xmobarCmd))
    , ("<Print>", spawn "sleep 0.1 ; @screenshot@ select")
    , ("S-<Print>", spawn "@screenshot@ screen")
    , ("C-S-<Print>", spawn "@screenshot@ focused")
    , ("S-<Print>", spawn "@screenshot@ screen && sleep 0.1 && @notify@ -t 5000 \"snap\"")
    , ("C-S-<Print>", spawn "@screenshot@ focused && sleep 0.1 && @notify@ -t 5000 \"snap\"")

    -- Toggle the status bar gap
    -- Use this binding with avoidStruts from Hooks.ManageDocks.


@@ 124,7 124,7 @@ myKeymap c =
    , ("M-S-k", kill)

    -- Restart xmonad
    , ("M-k", spawn "xmonad --recompile; xmonad --restart")
    , ("M-k", spawn "@reload@")

    -- float keys
     , ("M-g", withFocused (keysResizeWindow (-10,  0) (0, 0)))