hyprland: Add script to toggle internal laptop display

The auto-left ensures that the external monitor is always on the right.
This commit is contained in:
Donovan Glover 2024-07-08 11:24:34 -04:00
parent 44a2f7e995
commit 837b37d834
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65

View File

@ -16,6 +16,7 @@ let
randomBackgroundScript = "hypr/random-bg.fish";
swapBackgroundScript = "hypr/swap-bg.fish";
setBackgroundScript = "hypr/set-bg.fish";
monitorScript = "hypr/monitor-script.fish";
in
{
home.packages = with pkgs; [
@ -280,6 +281,7 @@ in
", XF86AudioMicMute, exec, ~/.config/${muteScript} Microphone @DEFAULT_AUDIO_SOURCE@"
", XF86MonBrightnessDown, exec, brightnessctl set 5%- && ${vars.notifySend} \"Decreased brightness to\" \"$(brightnessctl get)\""
", XF86MonBrightnessUp, exec, brightnessctl set +5% && ${vars.notifySend} \"Increased brightness to\" \"$(brightnessctl get)\""
", XF86Display, exec, ~/.config/${monitorScript}"
", XF86WLAN, exec, sleep 0.2 && ${vars.notifySend} \"WiFi\" \"$(nmcli radio wifi)\""
];
};
@ -398,6 +400,19 @@ in
'';
};
xdg.configFile.${monitorScript} = {
executable = true;
text = /* fish */ ''
#!/usr/bin/env fish
if test -n "$(hyprctl monitors -j | jq -r '.[] | select(.name | contains("eDP-1"))')"
hyprctl keyword monitor eDP-1,disable
else
hyprctl keyword monitor eDP-1,preferred,auto-left,1
end
'';
};
programs.hyprlock = {
enable = true;