121 lines
3.8 KiB
Nix
121 lines
3.8 KiB
Nix
{
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}: let
|
|
inherit (lib) range mapAttrsToList;
|
|
inherit (builtins) toString;
|
|
workspaceRange = range 1 6;
|
|
makeWorkspaceBinding = modifiers: action:
|
|
map (i: {
|
|
inherit modifiers;
|
|
key = toString i;
|
|
action = {
|
|
type = action;
|
|
data = i;
|
|
};
|
|
})
|
|
workspaceRange;
|
|
focusWsBindings = makeWorkspaceBinding ["Super"] "Workspace";
|
|
moveWsBindings = makeWorkspaceBinding ["Super" "Shift"] "SendToWorkspace";
|
|
|
|
hjkl = {
|
|
"h" = "Left";
|
|
"j" = "Down";
|
|
"k" = "Up";
|
|
"l" = "Right";
|
|
};
|
|
makeDirBinding = modifiers: action:
|
|
mapAttrsToList (
|
|
key: dir: {
|
|
inherit key modifiers;
|
|
action = {
|
|
type = action;
|
|
data = dir;
|
|
};
|
|
}
|
|
)
|
|
hjkl;
|
|
focusBindings = makeDirBinding ["Super"] "Focus";
|
|
moveBindings = makeDirBinding ["Super" "Shift"] "Move";
|
|
winManagementBindings =
|
|
focusWsBindings
|
|
++ moveWsBindings
|
|
++ focusBindings
|
|
++ moveBindings;
|
|
genBinding = key: modifiers: action: {
|
|
inherit key modifiers action;
|
|
};
|
|
genSpawnBinding = key: modifiers: app: {
|
|
inherit key modifiers;
|
|
action = {
|
|
type = "Spawn";
|
|
data = app;
|
|
};
|
|
};
|
|
in {
|
|
imports = [
|
|
../../util/cosmic.nix
|
|
];
|
|
services.desktopManager.cosmic = {
|
|
enable = true;
|
|
otherSettings = {
|
|
"com.system76.CosmicPanel.Dock" = {
|
|
option.opacity = 0.8;
|
|
};
|
|
};
|
|
keybindings =
|
|
winManagementBindings
|
|
++ [
|
|
(genBinding "q" ["Super" "Shift"] "Close")
|
|
(genBinding "w" ["Super"] "ToggleStacking")
|
|
(genBinding "s" ["Super"] "ToggleOrientation")
|
|
(genBinding "space" ["Super"] "ToggleWindowFloating")
|
|
(genBinding "space" ["Super" "Shift"] "Maximize")
|
|
(genBinding "minus" ["Super"] "Minimize")
|
|
(genBinding "r" ["Super"] {
|
|
type = "Resizing";
|
|
data = "Outwards";
|
|
})
|
|
(genBinding "r" ["Super" "Shift"] {
|
|
type = "Resizing";
|
|
data = "Inwards";
|
|
})
|
|
(genBinding "tab" ["Super"] "NextOutput")
|
|
(genBinding "tab" ["Super" "Shift"] "MoveToNextOutput")
|
|
(genBinding "grave" ["Super"] "PreviousOutput")
|
|
(genBinding "grave" ["Super" "Shift"] "MoveToPreviousOutput")
|
|
(genSpawnBinding "f" ["Super"] "firefox")
|
|
(genSpawnBinding "e" ["Super"] "nautilus")
|
|
(genSpawnBinding "equal" ["Super"] "keepassxc")
|
|
(genSpawnBinding "return" ["Super"] "kitty")
|
|
(genSpawnBinding "s" ["Super" "Shift"] "cosmic-screenshot")
|
|
(genSpawnBinding null ["Super"] "cosmic-launcher")
|
|
(genSpawnBinding "d" ["Super"] "cosmic-app-library")
|
|
(genSpawnBinding "XF86AudioRaiseVolume" [] "amixer sset Master 5%+")
|
|
(genSpawnBinding "XF86AudioLowerVolume" [] "amixer sset Master 5%-")
|
|
(genSpawnBinding "XF86AudioMute" [] "amixer sset Master toggle")
|
|
(genSpawnBinding "XF86AudioNext" [] "playerctl next")
|
|
(genSpawnBinding "XF86AudioPrev" [] "playerctl previous")
|
|
(genSpawnBinding "XF86AudioPlay" [] "playerctl play-pause")
|
|
(genSpawnBinding "XF86AudioStop" [] "playerctl stop")
|
|
(
|
|
genSpawnBinding "XF86MonBrightnessUp" []
|
|
"busctl --user call com.system76.CosmicSettingsDaemon /com/system76/CosmicSettingsDaemon com.system76.CosmicSettingsDaemon IncreaseDisplayBrightness"
|
|
)
|
|
(
|
|
genSpawnBinding "XF86MonBrightnessDown" []
|
|
"busctl --user call com.system76.CosmicSettingsDaemon /com/system76/CosmicSettingsDaemon com.system76.CosmicSettingsDaemon DecreaseDisplayBrightness"
|
|
)
|
|
(genSpawnBinding "e" ["Super" "Shift"] "wlogout")
|
|
];
|
|
};
|
|
environment.cosmic.excludePackages = with pkgs; [
|
|
cosmic-store
|
|
cosmic-files
|
|
cosmic-edit
|
|
cosmic-term
|
|
];
|
|
services.displayManager.cosmic-greeter.enable = true;
|
|
services.system76-scheduler.enable = true;
|
|
}
|