Add script to disable internal laptop screen on reload if lid is closed

This commit is contained in:
Evie Litherland-Smith 2023-06-26 16:40:16 +01:00
parent e2413aaecd
commit dfd32d66ef
2 changed files with 14 additions and 4 deletions

View file

@ -102,6 +102,7 @@
bind = SUPER, F, exec, thunar
bind = SUPER, M, fullscreen, 1
bind = SUPER, A, layoutmsg, togglesplit
bindl = SUPER SHIFT, C, exec, hyprctl reload
bind = , XF86AudioMute, exec, pamixer -t
binde = , XF86AudioRaiseVolume, exec, pamixer -i 2
@ -164,8 +165,8 @@
bind = SUPER, N, workspace, empty
bind = SUPER SHIFT, N, movetoworkspace, empty
bind = SUPER, C, togglespecialworkspace
bind = SUPER SHIFT, C, movetoworkspace, special
bind = SUPER, -, togglespecialworkspace
bind = SUPER SHIFT, -, movetoworkspace, special
bind = SUPER, tab, workspace, previous
bind = SUPER SHIFT, tab, movetoworkspace, previous

View file

@ -1,4 +1,10 @@
{pkgs, ...}: {
{pkgs, ...}: let
laptop-state = pkgs.writeShellScriptBin "check-laptop-lid-state" ''
grep closed /proc/acpi/button/lid/LID0/state &&\
hyprctl keyword monitor "eDP-1,disable" ||\
hyprctl keyword monitor "eDP-1,preferred,auto,1.0"
'';
in {
imports = [./default.nix];
home-manager.users.elitherl = {
home.packages = with pkgs; [
@ -7,11 +13,13 @@
nomachine-client
teams-for-linux
zoom-us
laptop-state
];
wayland.windowManager.hyprland.extraConfig = ''
source=./common.conf
monitor = eDP-1,preferred,auto,1.0
bindl=,switch:Lid Switch,exec,hyprctl keyword monitor "eDP-1,disable"
monitor = DP-3,preferred,auto,auto
monitor = DP-4,preferred,auto,auto,transform,1
@ -28,6 +36,7 @@
exec-once = firefox
exec-once = teams-for-linux
exec = ${laptop-state}/bin/check-laptop-lid-state
'';
programs.waybar.settings = {
main."output" = "!DP-4";