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;
|
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:
|
displayHyprlandSetting = display:
|
||||||
"monitor = " + specificDisplay display +
|
"monitor = " + specificDisplay display +
|
||||||
", " + resToString display.resolution +
|
", " + resToString display.resolution +
|
||||||
", " + display.position +
|
", " + positionToHyprlandString display.position +
|
||||||
", " + toString display.scaling;
|
", " + toString display.scaling;
|
||||||
|
|
||||||
swaybgJob = displays:
|
swaybgJob = displays:
|
||||||
|
|
@ -35,6 +35,23 @@ let
|
||||||
then display.name
|
then display.name
|
||||||
else "desc:" + display.description;
|
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, ... }:
|
resolutionType = types.submodule ({ x, y, freq, ... }:
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
|
|
@ -74,9 +91,11 @@ let
|
||||||
type = resolutionType;
|
type = resolutionType;
|
||||||
default = { };
|
default = { };
|
||||||
};
|
};
|
||||||
position = mkOption {
|
position.x = mkOption {
|
||||||
description = "XxY";
|
default = "";
|
||||||
default = "auto";
|
};
|
||||||
|
position.y = mkOption {
|
||||||
|
default = "";
|
||||||
};
|
};
|
||||||
wallpaper = mkOption {
|
wallpaper = mkOption {
|
||||||
description = "path to wallpaper";
|
description = "path to wallpaper";
|
||||||
|
|
@ -85,10 +104,14 @@ let
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
resIsSet = res:
|
||||||
|
!(res.x == 0 || res.y == 0 || res.freq == 0);
|
||||||
|
|
||||||
resToString = res:
|
resToString = res:
|
||||||
if res.x == 0 || res.y == 0 || res.freq == 0
|
if resIsSet res
|
||||||
then "preferred"
|
then "preferred"
|
||||||
else "${toString res.x}x${toString res.y}@${toString res.freq}";
|
else "${toString res.x}x${toString res.y}@${toString res.freq}";
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.displays =
|
options.displays =
|
||||||
|
|
@ -107,6 +130,8 @@ in
|
||||||
(renderDisplaysForHyprland cfg.displays);
|
(renderDisplaysForHyprland cfg.displays);
|
||||||
|
|
||||||
systemd.user.services.swaybg = swaybgJob 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
|
handbrake
|
||||||
monero-gui
|
monero-gui
|
||||||
xmrig
|
xmrig
|
||||||
|
krita
|
||||||
];
|
];
|
||||||
}];
|
}];
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ with lib;
|
||||||
let
|
let
|
||||||
scripts = config.programs.scripts;
|
scripts = config.programs.scripts;
|
||||||
|
|
||||||
hotkeyType = types.submodule ({...}: {
|
hotkeyType = types.submodule ({ ... }: {
|
||||||
options = {
|
options = {
|
||||||
key = mkOption {
|
key = mkOption {
|
||||||
description = "the key";
|
description = "the key";
|
||||||
|
|
@ -19,7 +19,7 @@ let
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
scriptType = types.submodule ({...}: {
|
scriptType = types.submodule ({ ... }: {
|
||||||
options = {
|
options = {
|
||||||
name = mkOption {
|
name = mkOption {
|
||||||
description = "name of the executable";
|
description = "name of the executable";
|
||||||
|
|
@ -30,7 +30,7 @@ let
|
||||||
hotkeys = mkOption {
|
hotkeys = mkOption {
|
||||||
type = types.listOf hotkeyType;
|
type = types.listOf hotkeyType;
|
||||||
description = "keys that run this script";
|
description = "keys that run this script";
|
||||||
default = [];
|
default = [ ];
|
||||||
};
|
};
|
||||||
install = mkOption {
|
install = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
|
|
@ -42,13 +42,18 @@ let
|
||||||
scriptToPackage = script:
|
scriptToPackage = script:
|
||||||
pkgs.writeShellScriptBin script.name script.text;
|
pkgs.writeShellScriptBin script.name script.text;
|
||||||
|
|
||||||
|
scriptExec = { script, hotkey }:
|
||||||
|
"${scriptToPackage script}/bin/${script.name} ${hotkey.args}";
|
||||||
|
|
||||||
installScripts = scripts:
|
installScripts = scripts:
|
||||||
(map scriptToPackage (filter ( s: s.install ) scripts));
|
(map scriptToPackage (filter (s: s.install) scripts));
|
||||||
|
|
||||||
bindScript = script: concatStrings (
|
bindScript = script: concatStrings (
|
||||||
map ( hotkey: ''
|
map
|
||||||
bind = ${hotkey.modifier}, ${hotkey.key}, exec, ${scriptToPackage script}/bin/${script.name} ${hotkey.args}
|
(hotkey: ''
|
||||||
'' ) script.hotkeys);
|
bind = ${hotkey.modifier}, ${hotkey.key}, exec, ${scriptExec {inherit script hotkey;}}
|
||||||
|
'')
|
||||||
|
script.hotkeys);
|
||||||
|
|
||||||
bindScripts = scripts:
|
bindScripts = scripts:
|
||||||
"# === USER SCRIPTS MODULE ===\n"
|
"# === USER SCRIPTS MODULE ===\n"
|
||||||
|
|
@ -59,7 +64,7 @@ in
|
||||||
options.programs = {
|
options.programs = {
|
||||||
scripts = mkOption {
|
scripts = mkOption {
|
||||||
type = types.listOf scriptType;
|
type = types.listOf scriptType;
|
||||||
default = [];
|
default = [ ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, pkgs, ...}:
|
{ config, pkgs, ... }:
|
||||||
let
|
let
|
||||||
my-deps = {
|
my-deps = {
|
||||||
notify-send = "${pkgs.libnotify}/bin/notify-send";
|
notify-send = "${pkgs.libnotify}/bin/notify-send";
|
||||||
|
|
@ -37,8 +37,8 @@ in
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
hotkeys = [
|
hotkeys = [
|
||||||
{key = "W";}
|
{ key = "W"; }
|
||||||
{modifier = ""; key = "XF86AudioPlay";}
|
{ modifier = ""; key = "XF86AudioPlay"; }
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
@ -47,7 +47,7 @@ in
|
||||||
items="$(rbw list)"
|
items="$(rbw list)"
|
||||||
echo "$items" | ${ my-deps.menu } | xargs -I_ rbw get _ | wl-copy
|
echo "$items" | ${ my-deps.menu } | xargs -I_ rbw get _ | wl-copy
|
||||||
'';
|
'';
|
||||||
hotkeys = [ { key = "P"; } ];
|
hotkeys = [{ key = "P"; }];
|
||||||
install = false;
|
install = false;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
@ -56,7 +56,7 @@ in
|
||||||
items="$(rbw list)"
|
items="$(rbw list)"
|
||||||
echo "$items" | ${ my-deps.menu } | xargs -I_ rbw code _ | wl-copy
|
echo "$items" | ${ my-deps.menu } | xargs -I_ rbw code _ | wl-copy
|
||||||
'';
|
'';
|
||||||
hotkeys = [ { modifier = "SUPER_SHIFT"; key = "P"; } ];
|
hotkeys = [{ modifier = "SUPER_SHIFT"; key = "P"; }];
|
||||||
install = false;
|
install = false;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
@ -72,7 +72,7 @@ in
|
||||||
cat "$FILE" | wl-copy -t image/png
|
cat "$FILE" | wl-copy -t image/png
|
||||||
'';
|
'';
|
||||||
hotkeys = [
|
hotkeys = [
|
||||||
{modifier = "SUPER_SHIFT"; key = "S";}
|
{ modifier = "SUPER_SHIFT"; key = "S"; }
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
@ -82,8 +82,8 @@ in
|
||||||
${my-deps.notify-send} "Brightness" -h int:value:$(light) -a brightness-down -t 1000
|
${my-deps.notify-send} "Brightness" -h int:value:$(light) -a brightness-down -t 1000
|
||||||
'';
|
'';
|
||||||
hotkeys = [
|
hotkeys = [
|
||||||
{modifier = ""; key = "XF86MonBrightnessDown"; args = "10";}
|
{ modifier = ""; key = "XF86MonBrightnessDown"; args = "10"; }
|
||||||
{modifier = "SHIFT"; key = "XF86MonBrightnessDown"; args = "1";}
|
{ modifier = "SHIFT"; key = "XF86MonBrightnessDown"; args = "1"; }
|
||||||
];
|
];
|
||||||
install = false;
|
install = false;
|
||||||
}
|
}
|
||||||
|
|
@ -94,8 +94,8 @@ in
|
||||||
${my-deps.notify-send} "Brightness" -h int:value:$(light) -a brightness-up -t 1000
|
${my-deps.notify-send} "Brightness" -h int:value:$(light) -a brightness-up -t 1000
|
||||||
'';
|
'';
|
||||||
hotkeys = [
|
hotkeys = [
|
||||||
{modifier = ""; key = "XF86MonBrightnessUp"; args = "10";}
|
{ modifier = ""; key = "XF86MonBrightnessUp"; args = "10"; }
|
||||||
{modifier = "SHIFT"; key = "XF86MonBrightnessUp"; args = "1";}
|
{ modifier = "SHIFT"; key = "XF86MonBrightnessUp"; args = "1"; }
|
||||||
];
|
];
|
||||||
install = false;
|
install = false;
|
||||||
}
|
}
|
||||||
|
|
@ -108,7 +108,7 @@ in
|
||||||
${my-deps.xargs} -I_ ${my-deps.hyprctl} dispatch focuswindow title:"_"
|
${my-deps.xargs} -I_ ${my-deps.hyprctl} dispatch focuswindow title:"_"
|
||||||
'';
|
'';
|
||||||
hotkeys = [
|
hotkeys = [
|
||||||
{key = "TAB";}
|
{ key = "TAB"; }
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
@ -168,8 +168,8 @@ in
|
||||||
${my-deps.amixer} sset Master 5%+ && ${my-deps.amixer} sset Master unmute
|
${my-deps.amixer} sset Master 5%+ && ${my-deps.amixer} sset Master unmute
|
||||||
'';
|
'';
|
||||||
hotkeys = [
|
hotkeys = [
|
||||||
{key = "bracketright";}
|
{ key = "bracketright"; }
|
||||||
{modifier = ""; key = "XF86AudioRaiseVolume";}
|
{ modifier = ""; key = "XF86AudioRaiseVolume"; }
|
||||||
];
|
];
|
||||||
install = false;
|
install = false;
|
||||||
}
|
}
|
||||||
|
|
@ -179,8 +179,8 @@ in
|
||||||
${ my-deps.amixer } sset Master 5%-
|
${ my-deps.amixer } sset Master 5%-
|
||||||
'';
|
'';
|
||||||
hotkeys = [
|
hotkeys = [
|
||||||
{key = "bracketleft";}
|
{ key = "bracketleft"; }
|
||||||
{modifier = ""; key = "XF86AudioLowerVolume";}
|
{ modifier = ""; key = "XF86AudioLowerVolume"; }
|
||||||
];
|
];
|
||||||
install = false;
|
install = false;
|
||||||
}
|
}
|
||||||
|
|
@ -190,8 +190,8 @@ in
|
||||||
${my-deps.playerctl} next
|
${my-deps.playerctl} next
|
||||||
'';
|
'';
|
||||||
hotkeys = [
|
hotkeys = [
|
||||||
{modifier = "SUPER_SHIFT"; key = "period";}
|
{ modifier = "SUPER_SHIFT"; key = "period"; }
|
||||||
{modifier = ""; key = "XF86AudioNext";}
|
{ modifier = ""; key = "XF86AudioNext"; }
|
||||||
];
|
];
|
||||||
install = false;
|
install = false;
|
||||||
}
|
}
|
||||||
|
|
@ -201,8 +201,8 @@ in
|
||||||
${my-deps.playerctl} previous
|
${my-deps.playerctl} previous
|
||||||
'';
|
'';
|
||||||
hotkeys = [
|
hotkeys = [
|
||||||
{modifier = "SUPER_SHIFT"; key = "comma";}
|
{ modifier = "SUPER_SHIFT"; key = "comma"; }
|
||||||
{modifier = ""; key = "XF86AudioPrev";}
|
{ modifier = ""; key = "XF86AudioPrev"; }
|
||||||
];
|
];
|
||||||
install = false;
|
install = false;
|
||||||
}
|
}
|
||||||
|
|
@ -210,7 +210,7 @@ in
|
||||||
name = "terminal";
|
name = "terminal";
|
||||||
text = my-deps.terminal;
|
text = my-deps.terminal;
|
||||||
hotkeys = [
|
hotkeys = [
|
||||||
{key = "RETURN";}
|
{ key = "RETURN"; }
|
||||||
];
|
];
|
||||||
install = false;
|
install = false;
|
||||||
}
|
}
|
||||||
|
|
@ -218,7 +218,7 @@ in
|
||||||
name = "fileman";
|
name = "fileman";
|
||||||
text = my-deps.fileman;
|
text = my-deps.fileman;
|
||||||
hotkeys = [
|
hotkeys = [
|
||||||
{key = "O";}
|
{ key = "O"; }
|
||||||
];
|
];
|
||||||
install = false;
|
install = false;
|
||||||
}
|
}
|
||||||
|
|
@ -233,7 +233,7 @@ in
|
||||||
esac
|
esac
|
||||||
'';
|
'';
|
||||||
hotkeys = [
|
hotkeys = [
|
||||||
{key = "Z";}
|
{ key = "Z"; }
|
||||||
];
|
];
|
||||||
install = false;
|
install = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue