parent
442297ec85
commit
d239f2ad5e
|
@ -28,4 +28,15 @@ in
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
# TODO: Remove patch once mako > 1.4.1 is released and in nixpkgs
|
||||||
|
mako = super.mako.overrideAttrs (o: o // {
|
||||||
|
patches = [
|
||||||
|
# Adds makoctl set
|
||||||
|
(super.fetchpatch {
|
||||||
|
url = "https://github.com/emersion/mako/commit/782ef66b04d5d927fe19254be175e0b5ddff343f.patch";
|
||||||
|
sha256 = "1qjaxhf11fyysmi9l8vwrz2vag3lcbllx8y8v2fgg3p52a7cwdjs";
|
||||||
|
})
|
||||||
|
];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,3 +151,8 @@ window#waybar {
|
||||||
#tray {
|
#tray {
|
||||||
padding: 0 5px;
|
padding: 0 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#custom-notification_inhibitor.active {
|
||||||
|
background-color: @base3@;
|
||||||
|
color: @base03@;
|
||||||
|
}
|
||||||
|
|
|
@ -22,6 +22,8 @@ let
|
||||||
wallpaper = if nixosConfig.sbruder.unfree.allowAssets then wallpaperUnfree else wallpaperFree;
|
wallpaper = if nixosConfig.sbruder.unfree.allowAssets then wallpaperUnfree else wallpaperFree;
|
||||||
|
|
||||||
cfg = config.wayland.windowManager.sway.config;
|
cfg = config.wayland.windowManager.sway.config;
|
||||||
|
|
||||||
|
makoInhibitStateFile = "${config.xdg.dataHome}/mako/inhibit-state";
|
||||||
in
|
in
|
||||||
lib.mkIf nixosConfig.sbruder.gui.enable {
|
lib.mkIf nixosConfig.sbruder.gui.enable {
|
||||||
wayland.windowManager.sway = {
|
wayland.windowManager.sway = {
|
||||||
|
@ -319,6 +321,7 @@ lib.mkIf nixosConfig.sbruder.gui.enable {
|
||||||
"tray"
|
"tray"
|
||||||
"custom/redshift"
|
"custom/redshift"
|
||||||
"idle_inhibitor"
|
"idle_inhibitor"
|
||||||
|
"custom/notification_inhibitor"
|
||||||
"backlight"
|
"backlight"
|
||||||
"mpd"
|
"mpd"
|
||||||
"pulseaudio"
|
"pulseaudio"
|
||||||
|
@ -359,6 +362,37 @@ lib.mkIf nixosConfig.sbruder.gui.enable {
|
||||||
deactivated = " ";
|
deactivated = " ";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
"custom/notification_inhibitor" = {
|
||||||
|
exec = pkgs.writeShellScript "notification-inhibitor-watch-state" ''
|
||||||
|
set -euo pipefail
|
||||||
|
(echo; ${pkgs.inotify-tools}/bin/inotifywait -m -e close_write ${lib.escapeShellArg makoInhibitStateFile} 2>/dev/null) \
|
||||||
|
| (while read line; do
|
||||||
|
if [ "$(cat ${lib.escapeShellArg makoInhibitStateFile})" = "1" ]; then
|
||||||
|
echo '{"alt": "active", "class": "active"}'
|
||||||
|
else
|
||||||
|
echo '{"alt": "inactive", "class": "inactive"}'
|
||||||
|
fi
|
||||||
|
done)
|
||||||
|
'';
|
||||||
|
return-type = "json";
|
||||||
|
format = "{icon}";
|
||||||
|
format-icons = {
|
||||||
|
active = "${lrm}ﮖ ";
|
||||||
|
inactive = "${lrm}ﮗ ";
|
||||||
|
};
|
||||||
|
tooltip = false;
|
||||||
|
on-click = pkgs.writeShellScript "toggle-notification-inhibit" ''
|
||||||
|
set -e
|
||||||
|
current_state="$(cat ${lib.escapeShellArg makoInhibitStateFile})"
|
||||||
|
if [ "$current_state" = "0" ]; then
|
||||||
|
${pkgs.mako}/bin/makoctl set invisible=true
|
||||||
|
echo 1 > ${lib.escapeShellArg makoInhibitStateFile}
|
||||||
|
else
|
||||||
|
${pkgs.mako}/bin/makoctl set invisible=false
|
||||||
|
echo 0 > ${lib.escapeShellArg makoInhibitStateFile}
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
};
|
||||||
backlight = {
|
backlight = {
|
||||||
format = "{percent}% {icon}";
|
format = "{percent}% {icon}";
|
||||||
format-icons = [ " " " " " " " " " " " " " " ];
|
format-icons = [ " " " " " " " " " " " " " " ];
|
||||||
|
@ -515,6 +549,11 @@ lib.mkIf nixosConfig.sbruder.gui.enable {
|
||||||
Install.WantedBy = [ "sway-session.target" ];
|
Install.WantedBy = [ "sway-session.target" ];
|
||||||
|
|
||||||
Service = {
|
Service = {
|
||||||
|
ExecStartPre = toString (pkgs.writeShellScript "reset-mako-inhibit-state" ''
|
||||||
|
set -e
|
||||||
|
mkdir -p "$(dirname ${lib.escapeShellArg makoInhibitStateFile})"
|
||||||
|
echo 0 > ${lib.escapeShellArg makoInhibitStateFile}
|
||||||
|
'');
|
||||||
ExecStart = "${pkgs.mako}/bin/mako";
|
ExecStart = "${pkgs.mako}/bin/mako";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue