add sway displays
This commit is contained in:
parent
7d549912c6
commit
954c85f23b
5 changed files with 81 additions and 43 deletions
|
|
@ -85,4 +85,11 @@
|
|||
|
||||
hardware.keyboard.zsa.enable = true;
|
||||
|
||||
services.tlp = {
|
||||
settings = {
|
||||
# power limit poor old radeon gpu
|
||||
RADEON_DPM_PERF_LEVEL_ON_AC = "low";
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ let
|
|||
displayHyprlandSetting = display:
|
||||
"monitor = " + specificDisplay display +
|
||||
", " + resToString display.resolution +
|
||||
", " + display.position +
|
||||
", " + positionToHyprlandString display.position +
|
||||
", " + toString display.scaling;
|
||||
|
||||
swaybgJob = displays:
|
||||
|
|
@ -35,6 +35,23 @@ let
|
|||
then display.name
|
||||
else "desc:" + display.description;
|
||||
|
||||
positionToHyprlandString = { x, y }:
|
||||
if (x == "" || y == "") then "auto" else x + "x" + y;
|
||||
|
||||
renderDisplaysForSway = displays:
|
||||
listToAttrs (map displaySwaySetting displays);
|
||||
|
||||
displaySwaySetting = display: {
|
||||
name = display.name;
|
||||
value = let res = display.resolution; in
|
||||
{
|
||||
mode = mkIf (resIsSet res)
|
||||
"${toString res.x}x${toString res.y}@${toString res.freq}Hz";
|
||||
bg = display.wallpaper + " fill";
|
||||
scale = toString display.scaling;
|
||||
};
|
||||
};
|
||||
|
||||
resolutionType = types.submodule ({ x, y, freq, ... }:
|
||||
{
|
||||
options = {
|
||||
|
|
@ -74,9 +91,11 @@ let
|
|||
type = resolutionType;
|
||||
default = { };
|
||||
};
|
||||
position = mkOption {
|
||||
description = "XxY";
|
||||
default = "auto";
|
||||
position.x = mkOption {
|
||||
default = "";
|
||||
};
|
||||
position.y = mkOption {
|
||||
default = "";
|
||||
};
|
||||
wallpaper = mkOption {
|
||||
description = "path to wallpaper";
|
||||
|
|
@ -85,10 +104,14 @@ let
|
|||
};
|
||||
});
|
||||
|
||||
resIsSet = res:
|
||||
!(res.x == 0 || res.y == 0 || res.freq == 0);
|
||||
|
||||
resToString = res:
|
||||
if res.x == 0 || res.y == 0 || res.freq == 0
|
||||
if resIsSet res
|
||||
then "preferred"
|
||||
else "${toString res.x}x${toString res.y}@${toString res.freq}";
|
||||
|
||||
in
|
||||
{
|
||||
options.displays =
|
||||
|
|
@ -107,6 +130,8 @@ in
|
|||
(renderDisplaysForHyprland cfg.displays);
|
||||
|
||||
systemd.user.services.swaybg = swaybgJob cfg.displays;
|
||||
wayland.windowManager.sway.config.output = mkIf (cfg.displays != [ ])
|
||||
(renderDisplaysForSway cfg.displays);
|
||||
}
|
||||
];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ with lib;
|
|||
handbrake
|
||||
monero-gui
|
||||
xmrig
|
||||
krita
|
||||
];
|
||||
}];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -42,13 +42,18 @@ let
|
|||
scriptToPackage = script:
|
||||
pkgs.writeShellScriptBin script.name script.text;
|
||||
|
||||
scriptExec = { script, hotkey }:
|
||||
"${scriptToPackage script}/bin/${script.name} ${hotkey.args}";
|
||||
|
||||
installScripts = scripts:
|
||||
(map scriptToPackage (filter (s: s.install) scripts));
|
||||
|
||||
bindScript = script: concatStrings (
|
||||
map ( hotkey: ''
|
||||
bind = ${hotkey.modifier}, ${hotkey.key}, exec, ${scriptToPackage script}/bin/${script.name} ${hotkey.args}
|
||||
'' ) script.hotkeys);
|
||||
map
|
||||
(hotkey: ''
|
||||
bind = ${hotkey.modifier}, ${hotkey.key}, exec, ${scriptExec {inherit script hotkey;}}
|
||||
'')
|
||||
script.hotkeys);
|
||||
|
||||
bindScripts = scripts:
|
||||
"# === USER SCRIPTS MODULE ===\n"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue