wlogout returns, cosmic config probably finalised
This commit is contained in:
parent
05d0f6a949
commit
4ae5e113fe
8 changed files with 136 additions and 64 deletions
33
flake.lock
generated
33
flake.lock
generated
|
@ -501,29 +501,13 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_4": {
|
||||
"locked": {
|
||||
"lastModified": 1715534503,
|
||||
"narHash": "sha256-5ZSVkFadZbFP1THataCaSf0JH2cAH3S29hU9rrxTEqk=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2057814051972fa1453ddfb0d98badbea9b83c06",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nur": {
|
||||
"locked": {
|
||||
"lastModified": 1715719537,
|
||||
"narHash": "sha256-owPav2+iP7rOiZUzQHsKJ/bwqt7Bz5x7wTHY9ska0Bw=",
|
||||
"lastModified": 1715777889,
|
||||
"narHash": "sha256-Ano+4M2xb91QjQ8Ymx4aAIZ1XjhPULSpwd/S2yEvDds=",
|
||||
"owner": "nix-community",
|
||||
"repo": "NUR",
|
||||
"rev": "2c670e2861a7c0e6405b3b19843a49082b773222",
|
||||
"rev": "2d6fba7ccd75b46ef12b797fd888f4d9ad80cbc6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -569,7 +553,10 @@
|
|||
"nix-std": "nix-std",
|
||||
"nixd": "nixd",
|
||||
"nixos-cosmic": "nixos-cosmic",
|
||||
"nixpkgs": "nixpkgs_4",
|
||||
"nixpkgs": [
|
||||
"nixos-cosmic",
|
||||
"nixpkgs"
|
||||
],
|
||||
"nur": "nur",
|
||||
"rust-overlay": "rust-overlay_2"
|
||||
}
|
||||
|
@ -609,11 +596,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1715652909,
|
||||
"narHash": "sha256-aCLEDvzL1j51Rf2mCFOqK1mieMO3pAn5ItCIdr5h2LA=",
|
||||
"lastModified": 1715739484,
|
||||
"narHash": "sha256-5zlSuCM54jH6tXi8OILZ7opT+lBYUkGU9eOMEvJh9HU=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "1d8fcbbfcfd3476c2665384a46ee9d07ef2b4dd9",
|
||||
"rev": "3d27c65641a61d36f1c7616d6150524cd9a2a5f7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
description = "nixos config";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
# nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
nixpkgs.follows = "nixos-cosmic/nixpkgs";
|
||||
|
||||
nur.url = "github:/nix-community/NUR";
|
||||
|
||||
|
@ -44,7 +45,7 @@
|
|||
|
||||
nixos-cosmic = {
|
||||
url = "github:lilyinstarlight/nixos-cosmic";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
# inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[
|
||||
{
|
||||
"label" : "lock",
|
||||
"action" : "gtklock",
|
||||
"action" : "loginctl lock-session",
|
||||
"text" : "Lock",
|
||||
"keybind" : "l"
|
||||
},
|
||||
|
@ -13,7 +13,7 @@
|
|||
},
|
||||
{
|
||||
"label" : "suspend",
|
||||
"action" : "gtklock & systemctl suspend",
|
||||
"action" : "loginctl lock-session & systemctl suspend",
|
||||
"text" : "Suspend",
|
||||
"keybind" : "s"
|
||||
},
|
||||
|
@ -35,4 +35,4 @@
|
|||
"text" : "Windows",
|
||||
"keybind" : "w"
|
||||
}
|
||||
]
|
||||
]
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
./creative.nix
|
||||
./chat.nix
|
||||
../programs/firefox.nix
|
||||
../programs/wlogout.nix
|
||||
];
|
||||
home.packages = with pkgs; [
|
||||
gnome.file-roller
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
...
|
||||
}: let
|
||||
palette-hex = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette;
|
||||
palette-shex = pkgs.lib.nix-rice.palette.toRGBShortHex pkgs.rice.palette;
|
||||
in {
|
||||
programs.wlogout = {
|
||||
enable = true;
|
||||
|
@ -29,7 +28,7 @@ in {
|
|||
normal.black
|
||||
(builtins.path {
|
||||
name = "winlogo";
|
||||
path = ../winlogo.png;
|
||||
path = ../icons/winlogo.png;
|
||||
sha256 = "7c1ff96b553c7a7ca3a7b7cf8efe830ab7feea92355aed288a10ee7347c24108";
|
||||
})
|
||||
]
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
dates = "daily";
|
||||
options = "--delete-older-than 3d";
|
||||
};
|
||||
optimise.automatic = true;
|
||||
};
|
||||
|
||||
imports = [
|
||||
|
|
|
@ -1,31 +1,105 @@
|
|||
{...}: {
|
||||
{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;
|
||||
keybindings = [
|
||||
{
|
||||
modifiers = ["Super"];
|
||||
key = "a";
|
||||
action = {
|
||||
type = "Spawn";
|
||||
data = "echo ok!";
|
||||
};
|
||||
}
|
||||
{
|
||||
key = "b";
|
||||
action = {
|
||||
type = "Move";
|
||||
data = "Down";
|
||||
};
|
||||
}
|
||||
];
|
||||
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 "period" ["Super"] "NextOutput")
|
||||
(genBinding "period" ["Super" "Shift"] "MoveToNextOutput")
|
||||
(genBinding "comma" ["Super"] "PreviousOutput")
|
||||
(genBinding "comma" ["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")
|
||||
];
|
||||
};
|
||||
services.displayManager.cosmic-greeter.enable = true;
|
||||
services.system76-scheduler.enable = true;
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
# Maximize,
|
||||
# Spawn(String),
|
||||
let
|
||||
inherit (lib) concatStrings concatStringsSep mapAttrsToList concatLists foldlAttrs concatMapAttrs mapAttrs' nameValuePair boolToString;
|
||||
inherit (lib) filterAttrs concatStrings concatStringsSep mapAttrsToList concatLists foldlAttrs concatMapAttrs mapAttrs' nameValuePair boolToString;
|
||||
inherit (builtins) typeOf toString stringLength;
|
||||
|
||||
# build up serialisation machinery from here for various types
|
||||
|
@ -60,16 +60,21 @@ let
|
|||
${concatStringsSep ",\n" (concatLists (map _assoc a))}
|
||||
}'';
|
||||
# attrset -> struct
|
||||
__struct = k: v: (concatStringsSep "=" [k (serialise.${typeOf v} v)]);
|
||||
_struct = s:
|
||||
_struct_kv = k: v:
|
||||
if v == null
|
||||
then ""
|
||||
else (concatStringsSep ":" [k (serialise.${typeOf v} v)]);
|
||||
_struct_concat = s:
|
||||
foldlAttrs (
|
||||
acc: k: v:
|
||||
if stringLength acc > 0
|
||||
then concatStringsSep ", " [acc (__struct k v)]
|
||||
else __struct k v
|
||||
then concatStringsSep ", " [acc (_struct_kv k v)]
|
||||
else _struct_kv k v
|
||||
) ""
|
||||
s;
|
||||
struct = s: "(${_struct s})";
|
||||
_struct_filt = s:
|
||||
_struct_concat (filterAttrs (k: v: v != null) s);
|
||||
struct = s: "(${_struct_filt s})";
|
||||
toQuotedString = s: ''"${toString s}"'';
|
||||
|
||||
# make an attrset for struct serialisation
|
||||
|
@ -88,7 +93,10 @@ let
|
|||
defineBinding = binding:
|
||||
struct {
|
||||
inherit (binding) modifiers;
|
||||
key = toQuotedString binding.key;
|
||||
key =
|
||||
if isNull binding.key
|
||||
then null
|
||||
else toQuotedString binding.key;
|
||||
};
|
||||
|
||||
# map keybinding from list of attrset to hashmap of (mod,key): action
|
||||
|
@ -112,7 +120,7 @@ let
|
|||
|
||||
maybeToString = s:
|
||||
if typeOf s == "set"
|
||||
then concatStrings [s.type "(" s.data ")"]
|
||||
then concatStrings [s.type "(" (toString s.data) ")"]
|
||||
else s;
|
||||
|
||||
# set up boilerplate for keybinding config file
|
||||
|
@ -133,7 +141,8 @@ in {
|
|||
default = [];
|
||||
};
|
||||
key = mkOption {
|
||||
type = str;
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
};
|
||||
action = mkOption {
|
||||
type = either str (submodule {
|
||||
|
@ -171,12 +180,12 @@ in {
|
|||
|
||||
config.environment.etc =
|
||||
{
|
||||
"cosmic-comp/config-test.ron".text = cosmic-bindings config.services.desktopManager.cosmic.keybindings;
|
||||
"cosmic-comp/config.ron".text = cosmic-bindings config.services.desktopManager.cosmic.keybindings;
|
||||
}
|
||||
// concatMapAttrs (
|
||||
application: options:
|
||||
mapAttrs' (k: v:
|
||||
nameValuePair "xdg/cosmic-test/${application}/v${options.version}/${k}" {
|
||||
nameValuePair "xdg/cosmic/${application}/v${options.version}/${k}" {
|
||||
enable = true;
|
||||
text = serialise.${typeOf v} v;
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue