sway: Add hack for mayushii’s external monitor
This commit is contained in:
parent
0bbe240018
commit
fa773ca8cf
|
@ -26,6 +26,15 @@ let
|
||||||
wallpaper = if nixosConfig.sbruder.unfree.allowAssets then wallpaperUnfree else wallpaperFree;
|
wallpaper = if nixosConfig.sbruder.unfree.allowAssets then wallpaperUnfree else wallpaperFree;
|
||||||
|
|
||||||
cfg = config.wayland.windowManager.sway.config;
|
cfg = config.wayland.windowManager.sway.config;
|
||||||
|
|
||||||
|
# Due to various issues in sway and drm,
|
||||||
|
# https://github.com/swaywm/sway/issues/5759 and
|
||||||
|
# https://gitlab.freedesktop.org/drm/amd/-/issues/1376,
|
||||||
|
# my external monitor often does not turn on after it has been turned off (DPMS).
|
||||||
|
# This hack fixes this, by not using kanshi for mayushi
|
||||||
|
# and instead disabling the internal display based on the lid switch state.
|
||||||
|
# Taken from https://github.com/swaywm/sway/wiki#clamshell-mode
|
||||||
|
clamshellHack = nixosConfig.networking.hostName == "mayushii";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = lib.optionals nixosConfig.sbruder.gui.enable [
|
imports = lib.optionals nixosConfig.sbruder.gui.enable [
|
||||||
|
@ -47,7 +56,15 @@ in
|
||||||
|
|
||||||
menu = "${pkgs.dmenu-wayland}/bin/dmenu-wl_path | ${pkgs.dmenu-wayland}/bin/dmenu-wl -nb '#002b36' -nf '#839496' -sb '#859900' -sf '#073642' | ${pkgs.findutils}/bin/xargs swaymsg exec --";
|
menu = "${pkgs.dmenu-wayland}/bin/dmenu-wl_path | ${pkgs.dmenu-wayland}/bin/dmenu-wl -nb '#002b36' -nf '#839496' -sb '#859900' -sf '#073642' | ${pkgs.findutils}/bin/xargs swaymsg exec --";
|
||||||
|
|
||||||
output."*".bg = "${wallpaper} fill";
|
output = {
|
||||||
|
"*".bg = "${wallpaper} fill";
|
||||||
|
} // (lib.optionalAttrs clamshellHack {
|
||||||
|
"Acer Technologies Acer B277K 0x0000F36C" = {
|
||||||
|
position = "1920,0";
|
||||||
|
scale = "2";
|
||||||
|
mode = "3840x2160";
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
input = {
|
input = {
|
||||||
"type:keyboard" = {
|
"type:keyboard" = {
|
||||||
|
@ -246,7 +263,18 @@ in
|
||||||
dbus-update-activation-environment --systemd ${environmentVariables} && \
|
dbus-update-activation-environment --systemd ${environmentVariables} && \
|
||||||
systemctl --user start sway-session.target
|
systemctl --user start sway-session.target
|
||||||
''
|
''
|
||||||
);
|
) + (lib.optionalString clamshellHack ''
|
||||||
|
bindswitch --reload --locked lid:on output eDP-1 disable
|
||||||
|
bindswitch --reload --locked lid:off output eDP-1 enable
|
||||||
|
|
||||||
|
exec_always ${pkgs.writeShellScript "sway-lid-switch-toggle-output" /* bash */ ''
|
||||||
|
if grep -q open /proc/acpi/button/lid/LID/state; then
|
||||||
|
swaymsg output eDP-1 enable
|
||||||
|
else
|
||||||
|
swaymsg output eDP-1 disable
|
||||||
|
fi
|
||||||
|
''}
|
||||||
|
'');
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.user.targets.sway-session = {
|
systemd.user.targets.sway-session = {
|
||||||
|
|
|
@ -6,27 +6,9 @@ let
|
||||||
else { };
|
else { };
|
||||||
|
|
||||||
machineConfigs = {
|
machineConfigs = {
|
||||||
mayushii = {
|
# mayushii is handled separately in sway’s main configuration.
|
||||||
standalone.outputs = lib.singleton {
|
# See it for more details.
|
||||||
criteria = "eDP-1";
|
# mayushii = { };
|
||||||
mode = "1920x1080";
|
|
||||||
position = "0,0";
|
|
||||||
status = "enable";
|
|
||||||
};
|
|
||||||
home.outputs = [
|
|
||||||
{
|
|
||||||
criteria = "eDP-1";
|
|
||||||
position = "1920,0";
|
|
||||||
status = "disable";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
criteria = "Acer Technologies Acer B277K 0x0000F36C";
|
|
||||||
mode = "3840x2160";
|
|
||||||
position = "0,0";
|
|
||||||
scale = 2.0;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
sayuri = {
|
sayuri = {
|
||||||
home.outputs = lib.singleton {
|
home.outputs = lib.singleton {
|
||||||
criteria = "Acer Technologies Acer B277K 0x0000F36C";
|
criteria = "Acer Technologies Acer B277K 0x0000F36C";
|
||||||
|
|
Loading…
Reference in a new issue