infra/nix/home-manager/profiles/gnome-desktop.nix

101 lines
2.8 KiB
Nix
Raw Permalink Normal View History

2024-11-15 10:17:56 +01:00
{ pkgs, ... }:
{
2024-11-15 10:17:56 +01:00
imports = [ ../profiles/wayland-desktop.nix ];
services = {
gnome-keyring.enable = false;
blueman-applet.enable = true;
flameshot.enable = true;
pasystray.enable = true;
};
# TODO: remove this comment once i'm sure everything works
# xdg.configFile."autostart/gnome-keyring-ssh.desktop".text = ''
# [Desktop Entry]
# Type=Application
# Hidden=true
# '';
2024-06-01 21:46:09 +02:00
services.gpg-agent.pinentryPackage = pkgs.pinentry-gnome3;
2024-11-15 10:17:56 +01:00
dconf.settings =
let
manualKeybindings = [
{
binding = "Print";
command = "flameshot gui";
name = "flameshot";
}
2024-11-15 10:17:56 +01:00
{
binding = "<Super>t";
command = "alacritty";
name = "alacritty";
}
];
2024-11-15 10:17:56 +01:00
numWorkspaces = 10;
customKeybindingBaseName = "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom";
customKeybindingsNames = builtins.genList (i: "/${customKeybindingBaseName}${toString i}/") (
(builtins.length manualKeybindings) + numWorkspaces # for sending to the workspace
);
2024-11-15 10:17:56 +01:00
workspacesKeyBindingsOffset = builtins.length manualKeybindings;
2024-11-15 10:17:56 +01:00
# with this we can make use of all number keys [0-9]
mapToNumber =
i:
if i < 10 then
i
else if i == 10 then
0
else
throw "i exceeds 10: ${i}";
in
{
"org/gnome/settings-daemon/plugins/media-keys" = {
custom-keybindings = customKeybindingsNames;
screenreader = "@as []";
2024-11-15 10:17:56 +01:00
screensaver = [ "<Alt><Super>l" ];
};
# disable the builtin <Super>[1-9] functionality
2024-11-15 10:17:56 +01:00
"org/gnome/shell/keybindings" = builtins.listToAttrs (
(builtins.genList (i: {
name = "switch-to-application-${toString (i + 1)}";
value = [ ];
}) numWorkspaces)
2023-11-23 17:52:21 +01:00
++ [
{
name = "toggle-overview";
2024-11-15 10:17:56 +01:00
value = [ ];
}
2024-11-15 10:17:56 +01:00
]
);
# remap it to switching to the workspaces
2024-11-15 10:17:56 +01:00
"org/gnome/desktop/wm/keybindings" = builtins.listToAttrs (
builtins.genList (i: {
name = "switch-to-workspace-${toString (i + 1)}";
2024-11-15 10:17:56 +01:00
value = [ "<Super>${toString (mapToNumber (i + 1))}" ];
}) numWorkspaces
);
}
2024-11-15 10:17:56 +01:00
// builtins.listToAttrs (
builtins.genList (i: {
name = "${customKeybindingBaseName}${toString i}";
value = builtins.elemAt manualKeybindings i;
2024-11-15 10:17:56 +01:00
}) (builtins.length manualKeybindings)
)
// builtins.listToAttrs (
builtins.genList (i: {
name = "${customKeybindingBaseName}${toString (workspacesKeyBindingsOffset + i)}";
value = {
binding = "<Control><Super>${toString (mapToNumber (i + 1))}";
command = "wmctrl -r :ACTIVE: -t ${toString i}";
name = "Send to workspace ${toString (i + 1)}";
};
2024-11-15 10:17:56 +01:00
}) numWorkspaces
);
}