feat: support new monitor
This commit is contained in:
parent
b234bdbd06
commit
271cbb359b
6 changed files with 139 additions and 58 deletions
|
@ -17,9 +17,14 @@
|
||||||
gaming.enable = true;
|
gaming.enable = true;
|
||||||
personal.enable = true;
|
personal.enable = true;
|
||||||
};
|
};
|
||||||
programs.hyprland.nvidiaSupport = true;
|
programs.hyprland = {
|
||||||
programs.hyprland.keyboardLayouts = [ "us" "de" ];
|
nvidiaSupport = true;
|
||||||
|
monitors = [ "HDMI-A-1,3840x2160,auto,1.2" ",preferred,auto,1" ];
|
||||||
|
extraConfig = "exec=hyprctl keyword monitor HDMI-A-1,3840x2160@120,auto,1.2";
|
||||||
|
keyboardLayouts = [ "us" "de" ];
|
||||||
|
};
|
||||||
services.mullvad.enable = true;
|
services.mullvad.enable = true;
|
||||||
|
services.wallpaper.enable = true;
|
||||||
programs.ledger.enable = true;
|
programs.ledger.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ let
|
||||||
recurse (readlink $path)
|
recurse (readlink $path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for arg in $argv
|
for arg in $argv
|
||||||
recurse (which $arg)
|
recurse (which $arg)
|
||||||
end
|
end
|
||||||
|
@ -188,11 +188,14 @@ in
|
||||||
wget
|
wget
|
||||||
];
|
];
|
||||||
|
|
||||||
fonts.packages = with pkgs; [
|
fonts = {
|
||||||
(nerdfonts.override {
|
enableDefaultPackages = true;
|
||||||
fonts = [ "FiraCode" ];
|
packages = with pkgs; [
|
||||||
})
|
(nerdfonts.override {
|
||||||
];
|
fonts = [ "FiraCode" ];
|
||||||
|
})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
mtr.enable = true;
|
mtr.enable = true;
|
||||||
|
|
|
@ -17,7 +17,7 @@ in
|
||||||
#
|
#
|
||||||
|
|
||||||
# See https://wiki.hyprland.org/Configuring/Monitors/
|
# See https://wiki.hyprland.org/Configuring/Monitors/
|
||||||
monitor=,preferred,auto,1
|
${concatLines (map (x: "monitor=${x}") cfg.monitors)}
|
||||||
|
|
||||||
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
|
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
|
||||||
|
|
||||||
|
@ -110,6 +110,13 @@ in
|
||||||
workspace_swipe = on
|
workspace_swipe = on
|
||||||
}
|
}
|
||||||
|
|
||||||
|
misc {
|
||||||
|
# disable_hypr_chan = true
|
||||||
|
vrr = 1
|
||||||
|
mouse_move_enables_dpms = true
|
||||||
|
key_press_enables_dpms = true
|
||||||
|
}
|
||||||
|
|
||||||
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
|
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
|
||||||
# Firefox Sharing Indicator
|
# Firefox Sharing Indicator
|
||||||
${mkRules ["float" "move 49% 40" "noborder" "nofullscreenrequest"] ["title:^(.*Sharing Indicator.*)$"]}
|
${mkRules ["float" "move 49% 40" "noborder" "nofullscreenrequest"] ["title:^(.*Sharing Indicator.*)$"]}
|
||||||
|
@ -207,5 +214,9 @@ in
|
||||||
bindm = $mainMod, mouse:272, movewindow
|
bindm = $mainMod, mouse:272, movewindow
|
||||||
bindm = $mainMod, mouse:273, resizewindow
|
bindm = $mainMod, mouse:273, resizewindow
|
||||||
|
|
||||||
exec-once=${getExe config.my.programs.wallpaper.package} -r
|
# Toggle waybar
|
||||||
|
bindr = $mainMod, SUPER_L, exec, pkill -USR1 waybar
|
||||||
|
|
||||||
|
# Extra Config
|
||||||
|
${cfg.extraConfig}
|
||||||
''
|
''
|
||||||
|
|
|
@ -31,6 +31,15 @@ in
|
||||||
description = "list of keyboard layouts";
|
description = "list of keyboard layouts";
|
||||||
default = [ "de" "us" ];
|
default = [ "de" "us" ];
|
||||||
};
|
};
|
||||||
|
monitors = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
description = "monitor settings";
|
||||||
|
default = [ ",preferred,auto,1" ];
|
||||||
|
};
|
||||||
|
extraConfig = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
@ -70,6 +79,7 @@ in
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
mainBar = {
|
mainBar = {
|
||||||
|
start_hidden = true;
|
||||||
layer = "top";
|
layer = "top";
|
||||||
position = "top";
|
position = "top";
|
||||||
height = 20;
|
height = 20;
|
||||||
|
@ -81,46 +91,50 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
# lock screen after timeout
|
# lock screen after timeout
|
||||||
home-manager.users.moritz = {
|
home-manager.users.moritz.programs.swaylock = {
|
||||||
services.swayidle = {
|
enable = true;
|
||||||
enable = true;
|
settings = {
|
||||||
events = [
|
color = "000000";
|
||||||
{
|
|
||||||
event = "before-sleep";
|
|
||||||
command = "${getExe pkgs.swaylock} -fF";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
event = "lock";
|
|
||||||
command = "${getExe pkgs.swaylock} -fF";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
timeouts =
|
|
||||||
let
|
|
||||||
lockTimeout = 10;
|
|
||||||
in
|
|
||||||
[
|
|
||||||
{
|
|
||||||
timeout = lockTimeout * 60 - 10;
|
|
||||||
command = "${pkgs.libnotify}/bin/notify-send 'Locking screen!'";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
timeout = lockTimeout * 60;
|
|
||||||
command = "${hyprland}/bin/hyprctl dispatch dpms off";
|
|
||||||
resumeCommand = "${hyprland}/bin/hyprctl dispatch dpms on";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
timeout = lockTimeout * 60 + 10;
|
|
||||||
command = "${pkgs.systemd}/bin/loginctl lock-session";
|
|
||||||
}
|
|
||||||
] ++ optional
|
|
||||||
(!cfg.nvidiaSupport) # TODO https://github.com/hyprwm/Hyprland/issues/1728
|
|
||||||
{
|
|
||||||
timeout = 30 * 60;
|
|
||||||
command = "${pkgs.systemd}/bin/systemctl suspend-and-hibernate";
|
|
||||||
};
|
|
||||||
systemdTarget = "hyprland-session.target";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
home-manager.users.moritz.services.swayidle = {
|
||||||
|
enable = true;
|
||||||
|
events = [
|
||||||
|
{
|
||||||
|
event = "before-sleep";
|
||||||
|
command = "${getExe pkgs.swaylock} -fF";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
event = "lock";
|
||||||
|
command = "${getExe pkgs.swaylock} -fF";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
timeouts =
|
||||||
|
let
|
||||||
|
lockTimeout = 10;
|
||||||
|
in
|
||||||
|
[
|
||||||
|
{
|
||||||
|
timeout = lockTimeout * 60 - 10;
|
||||||
|
command = "${pkgs.libnotify}/bin/notify-send 'Locking screen!'";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
timeout = lockTimeout * 60;
|
||||||
|
command = "${hyprland}/bin/hyprctl dispatch dpms off";
|
||||||
|
resumeCommand = "${hyprland}/bin/hyprctl dispatch dpms on";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
timeout = lockTimeout * 60 + 10;
|
||||||
|
command = "${pkgs.systemd}/bin/loginctl lock-session";
|
||||||
|
}
|
||||||
|
] ++ optional
|
||||||
|
(!cfg.nvidiaSupport) # TODO https://github.com/hyprwm/Hyprland/issues/1728
|
||||||
|
{
|
||||||
|
timeout = 30 * 60;
|
||||||
|
command = "${pkgs.systemd}/bin/systemctl suspend-and-hibernate";
|
||||||
|
};
|
||||||
|
systemdTarget = "hyprland-session.target";
|
||||||
|
};
|
||||||
|
|
||||||
# adds pam module for swaylock
|
# adds pam module for swaylock
|
||||||
security.pam.services.swaylock = { };
|
security.pam.services.swaylock = { };
|
||||||
|
@ -184,17 +198,30 @@ in
|
||||||
alsa.support32Bit = true;
|
alsa.support32Bit = true;
|
||||||
pulse.enable = true;
|
pulse.enable = true;
|
||||||
};
|
};
|
||||||
xserver = {
|
greetd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
displayManager = {
|
settings =
|
||||||
lightdm.enable = true;
|
let
|
||||||
autoLogin = {
|
hyprlandCommand = getExe' hyprland "Hyprland";
|
||||||
enable = true;
|
in
|
||||||
user = "moritz";
|
{
|
||||||
|
initial_session = {
|
||||||
|
command = hyprlandCommand;
|
||||||
|
user = "moritz";
|
||||||
|
};
|
||||||
|
default_session = {
|
||||||
|
command = ''
|
||||||
|
${pkgs.greetd.tuigreet}/bin/tuigreet \
|
||||||
|
--time \
|
||||||
|
--asterisks \
|
||||||
|
--user-menu \
|
||||||
|
--remember \
|
||||||
|
--power-shutdown 'systemctl poweroff' \
|
||||||
|
--power-reboot 'systemctl reboot' \
|
||||||
|
--cmd ${hyprlandCommand}
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
defaultSession = "hyprland";
|
|
||||||
sessionPackages = [ hyprland ]; # can't set the defaultSession otherwise
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
security.rtkit.enable = true;
|
security.rtkit.enable = true;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
WALLPAPERS_PATH="$HOME/.config/wallpapers"
|
WALLPAPERS_PATH="$HOME/.config/wallpapers"
|
||||||
WALLPAPERS=$(find "$WALLPAPERS_PATH" -type f,l)
|
WALLPAPERS=$(find "$WALLPAPERS_PATH" -type f,l)
|
||||||
|
DEBUG=0
|
||||||
|
|
||||||
function help() {
|
function help() {
|
||||||
echo "Usage:"
|
echo "Usage:"
|
||||||
|
@ -22,7 +23,11 @@ function setWallpaperX {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setWallpaperWayland {
|
function setWallpaperWayland {
|
||||||
swaybg --mode fill -i "$1" 2>/dev/null &
|
if [[ $DEBUG -eq 1 ]]; then
|
||||||
|
swaybg --mode fill -i "$1" &
|
||||||
|
else
|
||||||
|
swaybg --mode fill -i "$1" 2>/dev/null &
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function setWallpaper() {
|
function setWallpaper() {
|
||||||
|
@ -53,6 +58,10 @@ while [[ $# -gt 0 ]]; do
|
||||||
shift # past argument
|
shift # past argument
|
||||||
shift # past value
|
shift # past value
|
||||||
;;
|
;;
|
||||||
|
-v | --verbose)
|
||||||
|
DEBUG=1
|
||||||
|
shift # past argument
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
POSITIONAL+=("$1") # save it in an array for later
|
POSITIONAL+=("$1") # save it in an array for later
|
||||||
shift # past argument
|
shift # past argument
|
||||||
|
|
26
modules/services/wallpaper.nix
Normal file
26
modules/services/wallpaper.nix
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{ lib, config, ... }:
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.my.services.wallpaper;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.my.services.wallpaper = {
|
||||||
|
enable = mkEnableOption "wallpaper changer";
|
||||||
|
frequency = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "30m";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
systemd.user.services.wallpaper = {
|
||||||
|
script = "${getExe config.my.programs.wallpaper.package} -r -v";
|
||||||
|
wantedBy = [ "graphical-session.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
Restart = "always";
|
||||||
|
RuntimeMaxSec = cfg.frequency;
|
||||||
|
ExitType = "cgroup";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue