autorandr: Split out
This commit is contained in:
parent
e9a8d16ece
commit
26e70acb2f
32
hm/desktop/autorandr/default.nix
Normal file
32
hm/desktop/autorandr/default.nix
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
{ pkgs, lib, config, ... }:
|
||||||
|
let
|
||||||
|
builtin_configs = [ "off" "common" "clone-largest" "horizontal" "vertical" "horizontal-reverse" "vertical-reverse" ];
|
||||||
|
autorandrmenu = { title, option, builtin ? false }: pkgs.writeShellScript "autorandrmenu"
|
||||||
|
''
|
||||||
|
shopt -s nullglob globstar
|
||||||
|
profiles="${if builtin then lib.strings.concatLines builtin_configs else ""}$(${pkgs.autorandr}/bin/autorandr | ${pkgs.gawk}/bin/awk '{ print $1 }')"
|
||||||
|
profile="$(echo "$profiles" | ${config.programs.rofi.package}/bin/rofi -dmenu -p "${title}")"
|
||||||
|
[[ -n "$profile" ]] || exit
|
||||||
|
${pkgs.autorandr}/bin/autorandr ${option} "$profile"
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
{
|
||||||
|
config = lib.mkIf config.frogeye.desktop.xorg {
|
||||||
|
frogeye.desktop.i3.bindmodes = {
|
||||||
|
"Screen setup [A] Auto [L] Load [S] Save [R] Remove [D] Default" =
|
||||||
|
{
|
||||||
|
bindings = {
|
||||||
|
"a" = "exec ${pkgs.autorandr}/bin/autorandr --change --force, mode default";
|
||||||
|
"l" = "exec ${autorandrmenu {title="Load profile"; option="--load"; builtin = true;}}, mode default";
|
||||||
|
"s" = "exec ${autorandrmenu {title="Save profile"; option="--save";}}, mode default";
|
||||||
|
"r" = "exec ${autorandrmenu {title="Remove profile"; option="--remove";}}, mode default";
|
||||||
|
"d" = "exec ${autorandrmenu {title="Default profile"; option="--default"; builtin = true;}}, mode default";
|
||||||
|
};
|
||||||
|
mod_enter = "t";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
programs.autorandr.enable = true;
|
||||||
|
services.autorandr.enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
# TODO Deterministic configs?
|
|
@ -6,6 +6,7 @@ in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./audio
|
./audio
|
||||||
|
./autorandr
|
||||||
./frobar
|
./frobar
|
||||||
./i3.nix
|
./i3.nix
|
||||||
./lock
|
./lock
|
||||||
|
@ -113,12 +114,6 @@ in
|
||||||
matching = "regex";
|
matching = "regex";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
autorandr = {
|
|
||||||
enable = true;
|
|
||||||
hooks.postswitch = {
|
|
||||||
background = "${pkgs.feh}/bin/feh --no-fehbg --bg-fill ${config.stylix.image}";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
mpv = {
|
mpv = {
|
||||||
enable = true;
|
enable = true;
|
||||||
config = {
|
config = {
|
||||||
|
@ -203,7 +198,6 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
autorandr.enable = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
home = {
|
home = {
|
||||||
|
|
|
@ -232,7 +232,7 @@ in
|
||||||
return_bindings = false;
|
return_bindings = false;
|
||||||
};
|
};
|
||||||
"${mode_pres_sec}" = {
|
"${mode_pres_sec}" = {
|
||||||
mod_enter = "Shift+p+2";
|
mod_enter = "Shift+p+2"; # Bogus, just so I don't have to implement no binding
|
||||||
bindings = {
|
bindings = {
|
||||||
"b" = "workspace 1, workspace 2, mode ${mode_pres_main}";
|
"b" = "workspace 1, workspace 2, mode ${mode_pres_main}";
|
||||||
"q" = "mode default";
|
"q" = "mode default";
|
||||||
|
@ -240,28 +240,6 @@ in
|
||||||
};
|
};
|
||||||
return_bindings = false;
|
return_bindings = false;
|
||||||
};
|
};
|
||||||
"Screen setup [A] Auto [L] Load [S] Save [R] Remove [D] Default" =
|
|
||||||
let
|
|
||||||
builtin_configs = [ "off" "common" "clone-largest" "horizontal" "vertical" "horizontal-reverse" "vertical-reverse" ];
|
|
||||||
autorandrmenu = { title, option, builtin ? false }: pkgs.writeShellScript "autorandrmenu"
|
|
||||||
''
|
|
||||||
shopt -s nullglob globstar
|
|
||||||
profiles="${if builtin then lib.strings.concatLines builtin_configs else ""}$(${pkgs.autorandr}/bin/autorandr | ${pkgs.gawk}/bin/awk '{ print $1 }')"
|
|
||||||
profile="$(echo "$profiles" | ${config.programs.rofi.package}/bin/rofi -dmenu -p "${title}")"
|
|
||||||
[[ -n "$profile" ]] || exit
|
|
||||||
${pkgs.autorandr}/bin/autorandr ${option} "$profile"
|
|
||||||
'';
|
|
||||||
in
|
|
||||||
{
|
|
||||||
bindings = {
|
|
||||||
"a" = "exec ${pkgs.autorandr}/bin/autorandr --change --force, mode default";
|
|
||||||
"l" = "exec ${autorandrmenu {title="Load profile"; option="--load"; builtin = true;}}, mode default";
|
|
||||||
"s" = "exec ${autorandrmenu {title="Save profile"; option="--save";}}, mode default";
|
|
||||||
"r" = "exec ${autorandrmenu {title="Remove profile"; option="--remove";}}, mode default";
|
|
||||||
"d" = "exec ${autorandrmenu {title="Default profile"; option="--default"; builtin = true;}}, mode default";
|
|
||||||
};
|
|
||||||
mod_enter = "t";
|
|
||||||
};
|
|
||||||
"Temperature [R] Red [D] Dust storm [C] Campfire [O] Normal [A] All nighter [B] Blue" = {
|
"Temperature [R] Red [D] Dust storm [C] Campfire [O] Normal [A] All nighter [B] Blue" = {
|
||||||
bindings = {
|
bindings = {
|
||||||
"r" = "exec ${pkgs.sct}/bin/sct 1000";
|
"r" = "exec ${pkgs.sct}/bin/sct 1000";
|
||||||
|
|
|
@ -28,6 +28,10 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
programs.autorandr.hooks.postswitch = {
|
||||||
|
background = "${pkgs.feh}/bin/feh --no-fehbg --bg-fill ${config.stylix.image}";
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
# Fix https://nix-community.github.io/home-manager/index.html#_why_do_i_get_an_error_message_about_literal_ca_desrt_dconf_literal_or_literal_dconf_service_literal
|
# Fix https://nix-community.github.io/home-manager/index.html#_why_do_i_get_an_error_message_about_literal_ca_desrt_dconf_literal_or_literal_dconf_service_literal
|
||||||
# home.packages = [ pkgs.dconf ];
|
# home.packages = [ pkgs.dconf ];
|
||||||
|
|
Loading…
Reference in a new issue