Skip to content

Commit

Permalink
nixos/plotinus: add module to enable plotinus
Browse files Browse the repository at this point in the history
  • Loading branch information
samdroid-apps authored and jtojnar committed Feb 14, 2018
1 parent 8f316ff commit 16fa6f5
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 0 deletions.
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
36 changes: 36 additions & 0 deletions nixos/modules/programs/plotinus.nix
Original file line number Diff line number Diff line change
@@ -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" ];
};
}
25 changes: 25 additions & 0 deletions nixos/modules/programs/plotinus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<chapter xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
version="5.0"
xml:id="module-program-plotinus">

<title>Plotinus</title>

<para><emphasis>Source:</emphasis> <filename>modules/programs/plotinus.nix</filename></para>

<para><emphasis>Upstream documentation:</emphasis> <link xlink:href="https://github.com/p-e-w/plotinus"/></para>

<para>Plotinus is a searchable command palette in every modern GTK+ application.</para>

<para>When in a GTK+3 application and Plotinus is enabled, you can press <literal>Ctrl+Shift+P</literal> to open the command palette. The command palette provides a searchable list of of all menu items in the application.</para>

<para>To enable Plotinus, add the following to your <filename>configuration.nix</filename>:

<programlisting>
programs.plotinus.enable = true;
</programlisting>

</para>

</chapter>
1 change: 1 addition & 0 deletions nixos/release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {};
Expand Down
27 changes: 27 additions & 0 deletions nixos/tests/plotinus.nix
Original file line number Diff line number Diff line change
@@ -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");
'';

})

0 comments on commit 16fa6f5

Please sign in to comment.