From 16fa6f59f77fd635665ba719e278bc673ceb1d9e Mon Sep 17 00:00:00 2001 From: Sam Parkinson Date: Thu, 15 Feb 2018 07:34:50 +1100 Subject: [PATCH] nixos/plotinus: add module to enable plotinus --- nixos/modules/module-list.nix | 1 + nixos/modules/programs/plotinus.nix | 36 +++++++++++++++++++++++++++++ nixos/modules/programs/plotinus.xml | 25 ++++++++++++++++++++ nixos/release.nix | 1 + nixos/tests/plotinus.nix | 27 ++++++++++++++++++++++ 5 files changed, 90 insertions(+) create mode 100644 nixos/modules/programs/plotinus.nix create mode 100644 nixos/modules/programs/plotinus.xml create mode 100644 nixos/tests/plotinus.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index d8d6749f7965..4c8da8e12bfe 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -92,6 +92,7 @@ ./programs/nano.nix ./programs/npm.nix ./programs/oblogout.nix + ./programs/plotinus.nix ./programs/qt5ct.nix ./programs/rootston.nix ./programs/screen.nix diff --git a/nixos/modules/programs/plotinus.nix b/nixos/modules/programs/plotinus.nix new file mode 100644 index 000000000000..065e72d6c374 --- /dev/null +++ b/nixos/modules/programs/plotinus.nix @@ -0,0 +1,36 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.programs.plotinus; +in +{ + meta = { + maintainers = pkgs.plotinus.meta.maintainers; + doc = ./plotinus.xml; + }; + + ###### interface + + options = { + programs.plotinus = { + enable = mkOption { + default = false; + description = '' + Whether to enable the Plotinus GTK+3 plugin. Plotinus provides a + popup (triggered by Ctrl-Shift-P) to search the menus of a + compatible application. + ''; + type = types.bool; + }; + }; + }; + + ###### implementation + + config = mkIf cfg.enable { + environment.variables.XDG_DATA_DIRS = [ "${pkgs.plotinus}/share/gsettings-schemas/${pkgs.plotinus.name}" ]; + environment.variables.GTK3_MODULES = [ "${pkgs.plotinus}/lib/libplotinus.so" ]; + }; +} diff --git a/nixos/modules/programs/plotinus.xml b/nixos/modules/programs/plotinus.xml new file mode 100644 index 000000000000..85b0e023e6c1 --- /dev/null +++ b/nixos/modules/programs/plotinus.xml @@ -0,0 +1,25 @@ + + +Plotinus + +Source: modules/programs/plotinus.nix + +Upstream documentation: + +Plotinus is a searchable command palette in every modern GTK+ application. + +When in a GTK+3 application and Plotinus is enabled, you can press Ctrl+Shift+P to open the command palette. The command palette provides a searchable list of of all menu items in the application. + +To enable Plotinus, add the following to your configuration.nix: + + +programs.plotinus.enable = true; + + + + + diff --git a/nixos/release.nix b/nixos/release.nix index e473a0804244..4cae07dd99ac 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -277,6 +277,7 @@ in rec { tests.ipv6 = callTest tests/ipv6.nix {}; tests.jenkins = callTest tests/jenkins.nix {}; tests.plasma5 = callTest tests/plasma5.nix {}; + tests.plotinus = callTest tests/plotinus.nix {}; tests.keymap = callSubTests tests/keymap.nix {}; tests.initrdNetwork = callTest tests/initrd-network.nix {}; tests.kafka_0_9 = callTest tests/kafka_0_9.nix {}; diff --git a/nixos/tests/plotinus.nix b/nixos/tests/plotinus.nix new file mode 100644 index 000000000000..557d65f7960a --- /dev/null +++ b/nixos/tests/plotinus.nix @@ -0,0 +1,27 @@ +import ./make-test.nix ({ pkgs, ... }: { + name = "plotinus"; + meta = { + maintainers = pkgs.plotinus.meta.maintainers; + }; + + machine = + { config, pkgs, ... }: + + { imports = [ ./common/x11.nix ]; + programs.plotinus.enable = true; + environment.systemPackages = [ pkgs.gnome3.gnome-calculator pkgs.xdotool ]; + }; + + testScript = + '' + $machine->waitForX; + $machine->execute("xterm -e 'gnome-calculator' &"); + $machine->waitForWindow(qr/Calculator/); + $machine->execute("xdotool key ctrl+shift+p"); + $machine->sleep(1); # wait for the popup + $machine->execute("xdotool key p r e f e r e n c e s Return"); + $machine->waitForWindow(qr/Preferences/); + $machine->screenshot("screen"); + ''; + +})