163 lines
5.6 KiB
Nix
163 lines
5.6 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";
|
|
# "i" = "In";
|
|
# "u" = "Out";
|
|
};
|
|
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;
|
|
binding = key: modifiers: action: {
|
|
inherit key modifiers action;
|
|
};
|
|
spawnBinding = key: modifiers: app: {
|
|
inherit key modifiers;
|
|
action = {
|
|
type = "Spawn";
|
|
data = app;
|
|
};
|
|
};
|
|
systemBinding = key: modifiers: action: {
|
|
inherit key modifiers;
|
|
action = {
|
|
type = "System";
|
|
data = action;
|
|
};
|
|
};
|
|
in {
|
|
imports = [
|
|
../util/cosmic.nix
|
|
];
|
|
config.cosmic = {
|
|
enable = true;
|
|
defaultKeybindings = false;
|
|
# otherSettings = {
|
|
# "com.system76.CosmicPanel.Dock" = {
|
|
# option.opacity = 0.8;
|
|
# };
|
|
# };
|
|
keybindings =
|
|
winManagementBindings
|
|
++ [
|
|
# System bindings appear broken?
|
|
(binding "q" ["Super" "Shift"] "Close")
|
|
(binding "w" ["Super"] "ToggleStacking")
|
|
(binding "s" ["Super"] "ToggleOrientation")
|
|
(binding "space" ["Super"] "ToggleWindowFloating")
|
|
(binding "space" ["Super" "Shift"] "Maximize")
|
|
(binding "minus" ["Super"] "Minimize")
|
|
(binding "r" ["Super"] {
|
|
type = "Resizing";
|
|
data = "Outwards";
|
|
})
|
|
(binding "r" ["Super" "Shift"] {
|
|
type = "Resizing";
|
|
data = "Inwards";
|
|
})
|
|
(binding "tab" ["Super"] "NextOutput")
|
|
(binding "tab" ["Super" "Shift"] "MoveToNextOutput")
|
|
(binding "grave" ["Super"] "PreviousOutput")
|
|
(binding "grave" ["Super" "Shift"] "MoveToPreviousOutput")
|
|
(spawnBinding "equal" ["Super"] "keepassxc")
|
|
(systemBinding "f" ["Super"] "WebBrowser")
|
|
(systemBinding "e" ["Super"] "HomeFolder")
|
|
# broken at the moment
|
|
# (systemBinding "return" ["Super"] "Terminal")
|
|
(spawnBinding "return" ["Super"] "kitty")
|
|
(systemBinding "s" ["Super" "Shift"] "Screenshot")
|
|
(systemBinding null ["Super"] "Launcher")
|
|
(systemBinding "d" ["Super"] "AppLibrary")
|
|
(systemBinding "XF86AudioRaiseVolume" [] "VolumeRaise")
|
|
(systemBinding "XF86AudioLowerVolume" [] "VolumeLower")
|
|
(systemBinding "XF86AudioMute" [] "Mute")
|
|
(spawnBinding "XF86AudioNext" [] "playerctl next")
|
|
(spawnBinding "XF86AudioPrev" [] "playerctl previous")
|
|
(spawnBinding "XF86AudioPlay" [] "playerctl play-pause")
|
|
(spawnBinding "XF86AudioStop" [] "playerctl stop")
|
|
(systemBinding "XF86MonBrightnessUp" [] "BrightnessUp")
|
|
(systemBinding "XF86MonBrightnessDown" [] "BrightnessDown")
|
|
(spawnBinding "e" ["Super" "Shift"] "wlogout")
|
|
|
|
# old, pre-System bindings
|
|
# (binding "q" ["Super" "Shift"] "Close")
|
|
# (binding "w" ["Super"] "ToggleStacking")
|
|
# (binding "s" ["Super"] "ToggleOrientation")
|
|
# (binding "space" ["Super"] "ToggleWindowFloating")
|
|
# (binding "space" ["Super" "Shift"] "Maximize")
|
|
# (binding "minus" ["Super"] "Minimize")
|
|
# (binding "r" ["Super"] {
|
|
# type = "Resizing";
|
|
# data = "Outwards";
|
|
# })
|
|
# (binding "r" ["Super" "Shift"] {
|
|
# type = "Resizing";
|
|
# data = "Inwards";
|
|
# })
|
|
# (binding "tab" ["Super"] "NextOutput")
|
|
# (binding "tab" ["Super" "Shift"] "MoveToNextOutput")
|
|
# (binding "grave" ["Super"] "PreviousOutput")
|
|
# (binding "grave" ["Super" "Shift"] "MoveToPreviousOutput")
|
|
# (spawnBinding "f" ["Super"] "firefox")
|
|
# (spawnBinding "e" ["Super"] "nautilus")
|
|
# (spawnBinding "equal" ["Super"] "keepassxc")
|
|
# (spawnBinding "return" ["Super"] "kitty")
|
|
# (spawnBinding "s" ["Super" "Shift"] "cosmic-screenshot")
|
|
# (spawnBinding null ["Super"] "cosmic-launcher")
|
|
# (spawnBinding "d" ["Super"] "cosmic-app-library")
|
|
# (spawnBinding "XF86AudioRaiseVolume" [] "amixer sset Master 5%+")
|
|
# (spawnBinding "XF86AudioLowerVolume" [] "amixer sset Master 5%-")
|
|
# (spawnBinding "XF86AudioMute" [] "amixer sset Master toggle")
|
|
# (spawnBinding "XF86AudioNext" [] "playerctl next")
|
|
# (spawnBinding "XF86AudioPrev" [] "playerctl previous")
|
|
# (spawnBinding "XF86AudioPlay" [] "playerctl play-pause")
|
|
# (spawnBinding "XF86AudioStop" [] "playerctl stop")
|
|
# (
|
|
# spawnBinding "XF86MonBrightnessUp" []
|
|
# "busctl --user call com.system76.CosmicSettingsDaemon /com/system76/CosmicSettingsDaemon com.system76.CosmicSettingsDaemon IncreaseDisplayBrightness"
|
|
# )
|
|
# (
|
|
# spawnBinding "XF86MonBrightnessDown" []
|
|
# "busctl --user call com.system76.CosmicSettingsDaemon /com/system76/CosmicSettingsDaemon com.system76.CosmicSettingsDaemon DecreaseDisplayBrightness"
|
|
# )
|
|
# (spawnBinding "e" ["Super" "Shift"] "wlogout")
|
|
];
|
|
};
|
|
}
|