From bd2af79f22fe75c98ac3ee8a77fd9aa8ac53cd9f Mon Sep 17 00:00:00 2001
From: gytic <149968794+gytic@users.noreply.github.com>
Date: Mon, 28 Jul 2025 11:12:30 +0200
Subject: [PATCH 1/4] docs: showcase how to enable experimental features
---
README.md | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 88e033f..e28565c 100644
--- a/README.md
+++ b/README.md
@@ -91,7 +91,9 @@ Some have been lightly edited. Originals were created by [aconfuseddragon](https
3. **Build and switch to the system configuration**:
```bash
- sudo nixos-rebuild switch --flake .#default
+ sudo nixos-rebuild switch --flake .#default \
+ --extra-experimental-features flakes \
+ --extra-experimental-features pipe-operators
```
4. **Apply user settings with Home Manager**:
@@ -107,6 +109,13 @@ NixOS-95 relys on multiple experimental nix features. These are:
2. [pipe-operators](https://nix.dev/manual/nix/2.26/language/operators#pipe-operators)
They are needed to activate the configuration.
+To enable them in your config set:
+```nix
+nix.settings.experimental-features = [
+ "flakes" "pipe-operators"
+];
+```
+
### Rebuild Notes
Due to how **Home Manager** and XFCE handle theming, changes may not fully apply on the first attempt.
--
2.51.2
From d5458a9fcf1f42265ceabf1db33b994a514b4784 Mon Sep 17 00:00:00 2001
From: gytic <149968794+gytic@users.noreply.github.com>
Date: Mon, 28 Jul 2025 15:24:12 +0200
Subject: [PATCH 2/4] feat(keybinds): add options to specify keybinds
this adds two new options:
nixos95.keybinds.commands -> specify normal shortcuts
nixos95.keybinds.xfwm4 -> specify xfwm4 related shortcuts
---
nixos95/dotfiles/xfce4-keyboard-shortcuts.xml | 197 ------------------
nixos95/keybinds.nix | 109 +++++++++-
nixos95/taskbar.nix | 5 +-
nixos95/util/lib.nix | 6 +
4 files changed, 110 insertions(+), 207 deletions(-)
delete mode 100644 nixos95/dotfiles/xfce4-keyboard-shortcuts.xml
create mode 100644 nixos95/util/lib.nix
diff --git a/nixos95/dotfiles/xfce4-keyboard-shortcuts.xml b/nixos95/dotfiles/xfce4-keyboard-shortcuts.xml
deleted file mode 100644
index f5582e2..0000000
--- a/nixos95/dotfiles/xfce4-keyboard-shortcuts.xml
+++ /dev/null
@@ -1,197 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/nixos95/keybinds.nix b/nixos95/keybinds.nix
index 06b92ed..0ae9207 100644
--- a/nixos95/keybinds.nix
+++ b/nixos95/keybinds.nix
@@ -2,17 +2,110 @@
* For now this just hard copies the config file.
* This can be improved by allowing users to define there own keybinds
*/
-{ config, lib, ... }: let
- cfg = config.nixos95;
-in lib.mkIf cfg.enable {
+{ config, lib, pkgs, ... }: let
+ cfg = config.nixos95.keybinds;
+ t = lib.types;
+ slib = pkgs.callPackage ./util/lib.nix { };
+in {
- home-manager.users.${cfg.user} = {
+ options.nixos95.keybinds = {
+ commands = lib.mkOption {
+ description = ''
+ Keyboard shortcuts that should be made available.
- xdg.configFile = {
- "xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml" = {
- force = true;
- source = ./dotfiles/xfce4-keyboard-shortcuts.xml;
+ Each keyboard shortcut is defined as a set with the follwoing schema:
+ {
+ enable = bool; [optional; default = true]
+ key = string; [key sequence to triggger the command]
+ # to specify which command to execute use on of the following:
+ pkg = package; [use mainProgramm of a nix package; e.g. pkgs.firefox]
+ exe = string; [provide a program name directly; e.g. firefox]
+ }
+
+ > Modifier keys must be surrounded by angle brackets
+ '';
+ type = t.listOf t.attrs;
+ default = [
+ {
+ key = "r";
+ exe = "xfce4-appfinder --collapsed";
+ }
+ {
+ key = "XF86WWW";
+ exe = "exo-open --launch WebBrowser";
+ }
+ {
+ key = "XF86Mail";
+ exe = "exo-open --launch MailReder";
+ }
+ {
+ key = "Print";
+ exe = "xfce4-screenshooter";
+ }
+ ];
+ };
+ xfwm4 = lib.mkOption {
+ description = ''
+ Keyboard shortcuts to control xfwm4
+
+ Each keyboard shortcut is defined as a set with the follwoing schema:
+ {
+ enable = bool; [optional; default = true]
+ key = string; [key sequence to triggger the command]
+ # to specify which command to execute use on of the following:
+ pkg = package; [use mainProgramm of a nix package; e.g. pkgs.firefox]
+ exe = string; [provide a program name directly; e.g. firefox]
+ }
+
+ > Modifier keys must be surrounded by angle brackets
+ '';
+ type = t.listOf t.attrs;
+ default = [ ];
+ };
+ };
+
+ config = lib.mkIf config.nixos95.enable {
+
+ home-manager.users.${config.nixos95.user} = {
+
+ xdg.configFile = let
+ to_xml = list : list
+ |> lib.filter slib.isEnable
+ |> lib.map ( elm : let
+ key = lib.escapeXML elm.key;
+ exe = lib.escapeXML (slib.getExe elm);
+ in '' '')
+ |> lib.concatStringsSep "\n";
+ commands_xml = to_xml cfg.commands;
+ xfwm4_xml = to_xml cfg.xfwm4;
+ in {
+ "xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml" = {
+ force = true;
+ text = ''
+
+
+
+
+
+
+ ${commands_xml}
+
+
+
+
+
+ ${xfwm4_xml}
+
+
+
+
+
+
+
+ '';
+ };
};
+
};
};
diff --git a/nixos95/taskbar.nix b/nixos95/taskbar.nix
index e3e81db..7fad763 100644
--- a/nixos95/taskbar.nix
+++ b/nixos95/taskbar.nix
@@ -6,6 +6,7 @@
cfg = config.nixos95.taskbar;
user = config.nixos95.user;
t = lib.types;
+ slib = pkgs.callPackage ./util/lib.nix { };
in {
options.nixos95.taskbar = {
@@ -108,14 +109,14 @@ in {
battery_xml = ifBattery '' '';
applications_cfg = cfg.applications
- |> lib.filter ( elm : !( lib.hasAttr "enable" elm) || elm.enable )
+ |> lib.filter slib.isEnable
|> lib.imap0 ( ptr : elm : rec {
# we start IDs in the 20 range to not get confilics with other plugins
plugin_id = "2" + builtins.toString ptr;
plugin_desktop = let
desc = if elm ? description then elm.description else "";
term = if elm ? term && elm.term then "true" else "false";
- exec = if elm ? pkg then lib.getExe elm.pkg else elm.exe;
+ exec = slib.getExe elm;
in pkgs.writeTextFile {
name = "${elm.name}.desktop";
text = ''
diff --git a/nixos95/util/lib.nix b/nixos95/util/lib.nix
new file mode 100644
index 0000000..b84463e
--- /dev/null
+++ b/nixos95/util/lib.nix
@@ -0,0 +1,6 @@
+{ lib, ... }: {
+ # return true if elm.enable is not set or elm.enable is true
+ isEnable = elm : !( lib.hasAttr "enable" elm ) || elm.enable;
+ # return executable path from elm.pkg if defined or elm.exe
+ getExe = elm : if elm ? pkg then lib.getExe elm.pkg else elm.exe;
+}
--
2.51.2
From 7134bd487062fd06dbf0f1df7649c8cc71fa646b Mon Sep 17 00:00:00 2001
From: gytic <149968794+gytic@users.noreply.github.com>
Date: Mon, 28 Jul 2025 15:24:46 +0200
Subject: [PATCH 3/4] chore(config): port keyboard shortcuts
---
.../Hosts/Default/configuration.nix | 89 +++++++++++++++++++
1 file changed, 89 insertions(+)
diff --git a/Configurations/Hosts/Default/configuration.nix b/Configurations/Hosts/Default/configuration.nix
index 733ce59..5cddc4d 100644
--- a/Configurations/Hosts/Default/configuration.nix
+++ b/Configurations/Hosts/Default/configuration.nix
@@ -65,6 +65,95 @@ in {
}
];
};
+
+ keybinds = {
+ commands = [
+ { key="F2"; exe="xfce4-appfinder --collapsed"; }
+ { key="r"; exe="xfce4-appfinedr --collapsed"; }
+ { key="Print"; exe="xfce4-screenshooter --window"; }
+ { key="XF86WWW"; exe="exo-open --launch WebBrowser"; }
+ { key="XF86Mail"; exe="exo-open --launch MailReader"; }
+ { key="F3"; exe="xfce4-appfinder" ; }
+ { key="Print"; exe="xfce4-screenshooter"; }
+ { key="Escape"; exe="xfdesktop --menu"; }
+ { key="Print"; exe="xfce4-screenshooter -r"; }
+ { key="Delete"; exe="xfce4-session-logout"; }
+ { key="s"; exe="orca"; }
+ { key="t"; exe="exo-open --launch TerminalEmulator"; }
+ { key="f"; exe="thunar"; }
+ { key="l"; exe="xflock4"; }
+ { key="l"; exe="xflock4"; }
+ { key="F1"; exe="xfce4-popup-applicationsmenu"; }
+ { key="p"; exe="xfce4-display-settings --minimal"; }
+ { key="Escape"; exe="xfce4-taskmanager"; }
+ { key="e"; exe="thunar"; }
+ { key="Escape"; exe="xkill"; }
+ { key="HomePage"; exe="exo-open --launch WebBrowser"; }
+ { key="XF86Display"; exe="xfce4-display-settings --minimal"; }
+ ];
+ xfwm4 = [
+ { key="F12"; exe="workspace_12_key"; }
+ { key="KP_Down"; exe="tile_down_key"; }
+ { key="F4"; exe="close_window_key"; }
+ { key="KP_3"; exe="move_window_workspace_3_key"; }
+ { key="F2"; exe="workspace_2_key"; }
+ { key="F6"; exe="workspace_6_key"; }
+ { key="Down"; exe="down_workspace_key"; }
+ { key="KP_9"; exe="move_window_workspace_9_key"; }
+ { key="KP_Up"; exe="tile_up_key"; }
+ { key="End"; exe="move_window_next_workspace_key"; }
+ { key="F8"; exe="workspace_8_key"; }
+ { key="Left"; exe="move_window_left_key"; }
+ { key="KP_Right"; exe="tile_right_key"; }
+ { key="KP_4"; exe="move_window_workspace_4_key"; }
+ { key="Right"; exe="right_key"; }
+ { key="Down"; exe="down_key"; }
+ { key="F3"; exe="workspace_3_key"; }
+ { key="Page_Down"; exe="lower_window_key"; }
+ { key="F9"; exe="workspace_9_key"; }
+ { key="Tab"; exe="cycle_windows_key"; }
+ { key="Right"; exe="move_window_right_key"; }
+ { key="Right"; exe="right_workspace_key"; }
+ { key="F6"; exe="stick_window_key"; }
+ { key="KP_5"; exe="move_window_workspace_5_key"; }
+ { key="F11"; exe="workspace_11_key"; }
+ { key="F10"; exe="maximize_window_key"; }
+ { key="Delete"; exe="del_workspace_key"; }
+ { key="Tab"; exe="switch_window_key"; }
+ { key="d"; exe="show_desktop_key"; }
+ { key="F4"; exe="workspace_4_key"; }
+ { key="KP_Page_Up"; exe="tile_up_right_key"; }
+ { key="F7"; exe="move_window_key"; }
+ { key="Up"; exe="up_key"; }
+ { key="KP_6"; exe="move_window_workspace_6_key"; }
+ { key="F11"; exe="fullscreen_key"; }
+ { key="space"; exe="popup_menu_key"; }
+ { key="KP_Home"; exe="tile_up_left_key"; }
+ { key="Escape"; exe="cancel_key"; }
+ { key="KP_1"; exe="move_window_workspace_1_key"; }
+ { key="KP_Next"; exe="tile_down_right_key"; }
+ { key="KP_Left"; exe="tile_left_key"; }
+ { key="Page_Up"; exe="raise_window_key"; }
+ { key="Home"; exe="move_window_prev_workspace_key"; }
+ { key="Tab"; exe="cycle_reverse_windows_key"; }
+ { key="Left"; exe="left_workspace_key"; }
+ { key="F12"; exe="above_key"; }
+ { key="Up"; exe="move_window_up_key"; }
+ { key="F5"; exe="workspace_5_key"; }
+ { key="F8"; exe="resize_window_key"; }
+ { key="KP_7"; exe="move_window_workspace_7_key"; }
+ { key="KP_2"; exe="move_window_workspace_2_key"; }
+ { key="KP_End"; exe="tile_down_left_key"; }
+ { key="Up"; exe="up_workspace_key"; }
+ { key="F9"; exe="hide_window_key"; }
+ { key="F7"; exe="workspace_7_key"; }
+ { key="F10"; exe="workspace_10_key"; }
+ { key="Left"; exe="left_key"; }
+ { key="KP_8"; exe="move_window_workspace_8_key"; }
+ { key="Insert"; exe="add_workspace_key"; }
+ { key="F1"; exe="workspace_1_key"; }
+ ];
+ };
};
################################################################
--
2.51.2
From c6e68bac0a5258f5eceb7cc7ebb30a94023fe8ae Mon Sep 17 00:00:00 2001
From: gytic <149968794+gytic@users.noreply.github.com>
Date: Mon, 28 Jul 2025 18:32:01 +0200
Subject: [PATCH 4/4] chore(config): port only necessary keybinds
---
.../Hosts/Default/configuration.nix | 83 -------------------
1 file changed, 83 deletions(-)
diff --git a/Configurations/Hosts/Default/configuration.nix b/Configurations/Hosts/Default/configuration.nix
index 5cddc4d..a7de2f6 100644
--- a/Configurations/Hosts/Default/configuration.nix
+++ b/Configurations/Hosts/Default/configuration.nix
@@ -68,90 +68,7 @@ in {
keybinds = {
commands = [
- { key="F2"; exe="xfce4-appfinder --collapsed"; }
- { key="r"; exe="xfce4-appfinedr --collapsed"; }
- { key="Print"; exe="xfce4-screenshooter --window"; }
- { key="XF86WWW"; exe="exo-open --launch WebBrowser"; }
- { key="XF86Mail"; exe="exo-open --launch MailReader"; }
- { key="F3"; exe="xfce4-appfinder" ; }
- { key="Print"; exe="xfce4-screenshooter"; }
- { key="Escape"; exe="xfdesktop --menu"; }
- { key="Print"; exe="xfce4-screenshooter -r"; }
- { key="Delete"; exe="xfce4-session-logout"; }
- { key="s"; exe="orca"; }
- { key="t"; exe="exo-open --launch TerminalEmulator"; }
- { key="f"; exe="thunar"; }
- { key="l"; exe="xflock4"; }
{ key="l"; exe="xflock4"; }
- { key="F1"; exe="xfce4-popup-applicationsmenu"; }
- { key="p"; exe="xfce4-display-settings --minimal"; }
- { key="Escape"; exe="xfce4-taskmanager"; }
- { key="e"; exe="thunar"; }
- { key="Escape"; exe="xkill"; }
- { key="HomePage"; exe="exo-open --launch WebBrowser"; }
- { key="XF86Display"; exe="xfce4-display-settings --minimal"; }
- ];
- xfwm4 = [
- { key="F12"; exe="workspace_12_key"; }
- { key="KP_Down"; exe="tile_down_key"; }
- { key="F4"; exe="close_window_key"; }
- { key="KP_3"; exe="move_window_workspace_3_key"; }
- { key="F2"; exe="workspace_2_key"; }
- { key="F6"; exe="workspace_6_key"; }
- { key="Down"; exe="down_workspace_key"; }
- { key="KP_9"; exe="move_window_workspace_9_key"; }
- { key="KP_Up"; exe="tile_up_key"; }
- { key="End"; exe="move_window_next_workspace_key"; }
- { key="F8"; exe="workspace_8_key"; }
- { key="Left"; exe="move_window_left_key"; }
- { key="KP_Right"; exe="tile_right_key"; }
- { key="KP_4"; exe="move_window_workspace_4_key"; }
- { key="Right"; exe="right_key"; }
- { key="Down"; exe="down_key"; }
- { key="F3"; exe="workspace_3_key"; }
- { key="Page_Down"; exe="lower_window_key"; }
- { key="F9"; exe="workspace_9_key"; }
- { key="Tab"; exe="cycle_windows_key"; }
- { key="Right"; exe="move_window_right_key"; }
- { key="Right"; exe="right_workspace_key"; }
- { key="F6"; exe="stick_window_key"; }
- { key="KP_5"; exe="move_window_workspace_5_key"; }
- { key="F11"; exe="workspace_11_key"; }
- { key="F10"; exe="maximize_window_key"; }
- { key="Delete"; exe="del_workspace_key"; }
- { key="Tab"; exe="switch_window_key"; }
- { key="d"; exe="show_desktop_key"; }
- { key="F4"; exe="workspace_4_key"; }
- { key="KP_Page_Up"; exe="tile_up_right_key"; }
- { key="F7"; exe="move_window_key"; }
- { key="Up"; exe="up_key"; }
- { key="KP_6"; exe="move_window_workspace_6_key"; }
- { key="F11"; exe="fullscreen_key"; }
- { key="space"; exe="popup_menu_key"; }
- { key="KP_Home"; exe="tile_up_left_key"; }
- { key="Escape"; exe="cancel_key"; }
- { key="KP_1"; exe="move_window_workspace_1_key"; }
- { key="KP_Next"; exe="tile_down_right_key"; }
- { key="KP_Left"; exe="tile_left_key"; }
- { key="Page_Up"; exe="raise_window_key"; }
- { key="Home"; exe="move_window_prev_workspace_key"; }
- { key="Tab"; exe="cycle_reverse_windows_key"; }
- { key="Left"; exe="left_workspace_key"; }
- { key="F12"; exe="above_key"; }
- { key="Up"; exe="move_window_up_key"; }
- { key="F5"; exe="workspace_5_key"; }
- { key="F8"; exe="resize_window_key"; }
- { key="KP_7"; exe="move_window_workspace_7_key"; }
- { key="KP_2"; exe="move_window_workspace_2_key"; }
- { key="KP_End"; exe="tile_down_left_key"; }
- { key="Up"; exe="up_workspace_key"; }
- { key="F9"; exe="hide_window_key"; }
- { key="F7"; exe="workspace_7_key"; }
- { key="F10"; exe="workspace_10_key"; }
- { key="Left"; exe="left_key"; }
- { key="KP_8"; exe="move_window_workspace_8_key"; }
- { key="Insert"; exe="add_workspace_key"; }
- { key="F1"; exe="workspace_1_key"; }
];
};
};
--
2.51.2