aboutsummaryrefslogtreecommitdiff
path: root/gui/niri.nix
diff options
context:
space:
mode:
Diffstat (limited to 'gui/niri.nix')
-rw-r--r--gui/niri.nix100
1 files changed, 96 insertions, 4 deletions
diff --git a/gui/niri.nix b/gui/niri.nix
index 06802b8..7d348c7 100644
--- a/gui/niri.nix
+++ b/gui/niri.nix
@@ -13,15 +13,107 @@
size = 16;
};
- #home.file.".config/niri/config.kdl".source = config.lib.file.mkOutOfStoreSymlink ./conf/niri.kdl;
+ home.file.".config/niri/config.kdl".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/dotfiles/home/gui/conf/niri.kdl";
- services.screen-locker = {
- enable = true;
- lockCmd = "${pkgs.swaylock}/bin/swaylock -c #000000";
+ services.screen-locker.enable = false;
+ services.swayidle = {
+ enable = true;
+ timeouts = [
+ {
+ timeout = 300;
+ command = "${pkgs.swaylock}/bin/swaylock -c 000000";
+ }
+ {
+ timeout = 300;
+ command = "${pkgs.niri}/bin/niri-msg 'output * --dpms off'";
+ resumeCommand = "${pkgs.niri}/bin/niri-msg 'output * --dpms on'";
+ }
+ ];
+ events = [
+ {
+ event = "before-sleep";
+ command = "${pkgs.swaylock}/bin/swaylock -c 000000";
+ }
+ ];
};
+ programs.waybar = {
+ enable = true;
+ systemd.enable = true;
+ settings = {
+ top = {
+ start_hidden = true;
+ on-sigusr1 = "show";
+ on-sigusr2 = "hide";
+
+ layer = "top";
+ exclusive = false;
+ passthrough = false;
+ gtk-layer-shell = true;
+ position = "top";
+
+ margin = "30 30 0 30";
+ height = 48;
+
+ modules-left = [
+ "tray"
+ ];
+ modules-right = [
+ "battery"
+ "pulseaudio"
+ "backlight"
+ "clock"
+ ];
+
+ "tray" = {
+ icon-size = 32;
+ spacing = 5;
+ };
+ "battery" = {
+ format = "🔋 {capacity}%";
+ };
+ "pulseaudio" = {
+ format = "🔈 {volume}%";
+ format-muted = "🔇 {volume}%";
+ on-click = "pactl set-sink-mute @DEFAULT_SINK@ toggle";
+ };
+ "backlight" = {
+ format = "💡 {percent}%";
+ };
+ "clock" = {
+ format = "{:%Y-%m-%d %H:%M}";
+ tooltip-format = "<tt>{calendar}</tt>";
+ calendar = {
+ mode = "year";
+ mode-mon-col = 3;
+ weeks-pos = "left";
+ };
+ };
+ };
+ };
+ };
+ home.file.".config/waybar/style.css".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/dotfiles/home/gui/conf/waybar.css";
+
home.packages = with pkgs; [
wdisplays
wayvnc
+
+ (pkgs.writeShellScriptBin "niri-event-handler-waybar-toggle" ''
+ #!/bin/sh
+ ${pkgs.niri}/bin/niri msg --json event-stream | while read -r event; do
+ event_type=$(echo "$event" | ${pkgs.jq}/bin/jq -r 'keys[0]')
+ if [[ "$event_type" == "OverviewOpenedOrClosed" ]]; then
+ is_open=$(echo "$event" | ${pkgs.jq}/bin/jq -r '.OverviewOpenedOrClosed.is_open')
+ case "$is_open" in
+ "true")
+ pkill -SIGUSR1 waybar
+ ;;
+ "false")
+ pkill -SIGUSR2 waybar
+ ;;
+ esac
+ fi
+ done
+ '')
];
}