From 41aefd9ea174e05e9c338d54fe12f25075b3056a Mon Sep 17 00:00:00 2001 From: Ray Andrew Date: Sun, 3 Nov 2024 17:12:24 -0600 Subject: [PATCH] add notification service --- src/home/gui/default.nix | 1 + src/home/wm/sway.nix | 51 ++++++++++++++++++++++++++++++++++++ src/nixos/displaymanager.nix | 26 +++++++++++++++++- src/nixos/touchpad.nix | 9 +++++-- 4 files changed, 84 insertions(+), 3 deletions(-) diff --git a/src/home/gui/default.nix b/src/home/gui/default.nix index 2b9bdd9..5d0b568 100644 --- a/src/home/gui/default.nix +++ b/src/home/gui/default.nix @@ -29,6 +29,7 @@ home.packages = with pkgs; [ xclip wl-clipboard + libnotify ]; gtk = { diff --git a/src/home/wm/sway.nix b/src/home/wm/sway.nix index 4b7d2b0..fae9172 100644 --- a/src/home/wm/sway.nix +++ b/src/home/wm/sway.nix @@ -33,12 +33,61 @@ in services.swayosd = { enable = true; }; + programs.swaylock = { + enable = true; + }; + services.swayidle = + let + swaylock = lib.getExe' config.programs.swaylock.package "swaylock"; + notify = lib.getExe' pkgs.libnotify "notify-send"; + swaymsg = lib.getExe' config.wayland.windowManager.sway.package "swaymsg"; + in + { + enable = true; + timeouts = [ + { + timeout = 295; + command = "${notify} 'Locking in 5 seconds' -t 5000"; + } + { + timeout = 300; + command = swaylock; + } + { + timeout = 360; + command = "${swaymsg} 'output * dpms off'"; + resumeCommand = "${swaymsg} 'output * dpms on'"; + } + ]; + events = [ + { + event = "before-sleep"; + command = swaylock; + } + ]; + }; + services.mako = { + enable = true; + defaultTimeout = 4500; + ignoreTimeout = true; + }; wayland.windowManager.sway = { enable = true; extraConfig = commonOptions.extraConfig; config = lib.mkMerge [ commonOptions.config { + input = { + "type:touchpad" = { + natural_scroll = "enabled"; + dwt = "enabled"; + dwtp = "disabled"; + middle_emulation = "enabled"; + accel_profile = "flat"; + tap = "enabled"; + tap_button_map = "lmr"; + }; + }; keybindings = { "${commonOptions.modifier}+Shift+e" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'"; "XF86AudioRaiseVolume" = "exec --no-startup-id '${swayosd} --output-volume=raise'"; @@ -53,5 +102,7 @@ in ]; }; stylix.targets.sway.enable = true; + stylix.targets.swaylock.enable = true; + stylix.targets.mako.enable = true; }; } diff --git a/src/nixos/displaymanager.nix b/src/nixos/displaymanager.nix index 4a70897..4137183 100644 --- a/src/nixos/displaymanager.nix +++ b/src/nixos/displaymanager.nix @@ -1,11 +1,17 @@ -{ config, ... }: +{ config, pkgs, ... }: { services = { xserver = { enable = true; + # dpi = 192; displayManager = { gdm.enable = true; # lightdm.enable = true; + # sessionCommands = '' + # ${pkgs.xorg.xrdb}/bin/xrdb -merge <