From 953383d5765f9f785390ce64d33f8f70b19f88b5 Mon Sep 17 00:00:00 2001 From: Riley Apeldoorn Date: Sun, 15 May 2022 20:02:26 +0200 Subject: [PATCH] Fix utility scripts --- flake.nix | 8 ++++++++ modules/default.nix | 2 +- modules/gui/clipboard.nix | 13 ++++++++++--- modules/gui/wm/default.nix | 2 +- modules/gui/wm/keybinds.nix | 6 +++--- modules/gui/wm/scripts.nix | 5 +++-- 6 files changed, 26 insertions(+), 10 deletions(-) diff --git a/flake.nix b/flake.nix index afc4ee7..9cfb4fd 100644 --- a/flake.nix +++ b/flake.nix @@ -14,6 +14,8 @@ outputs = args: with args.nixpkgs; { nixosConfigurations = { + + # Desktop "thor" = lib.nixosSystem { system = "x86_64-linux"; modules = [ @@ -22,6 +24,8 @@ ]; specialArgs = args; }; + + # Laptop "loki" = lib.nixosSystem { system = "x86_64-linux"; modules = [ @@ -30,6 +34,10 @@ ]; specialArgs = args; }; + + # TODO: Pinebook Pro + # TODO: Raspberry Pi + }; }; diff --git a/modules/default.nix b/modules/default.nix index 7f5a8e2..2d58160 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -34,7 +34,7 @@ let named = submodule { hex = mkOption { type = themeType; }; }; }; - scripts = (import ../scripts/clip.nix { inherit pkgs; }); + in { options.riley = with lib; { diff --git a/modules/gui/clipboard.nix b/modules/gui/clipboard.nix index 6f2fba9..43d023d 100644 --- a/modules/gui/clipboard.nix +++ b/modules/gui/clipboard.nix @@ -1,10 +1,17 @@ -{ config, lib, pkgs, scripts, ... }: +{ config, lib, pkgs, ... }: -(lib.mkIf (config.riley.gui) { +let scripts = (import ../../scripts/clip.nix { + inherit pkgs; + }); + +in (lib.mkIf (config.riley.gui) { # Add some shell scripts that abstract away the # horrible reality that the clipboard is managed by # the display server. - users.users."riley".packages = with scripts; [ c p ]; + users.users."riley".packages = + with scripts; [ + c p + ]; }) diff --git a/modules/gui/wm/default.nix b/modules/gui/wm/default.nix index 8ba57c5..d7eb7fc 100644 --- a/modules/gui/wm/default.nix +++ b/modules/gui/wm/default.nix @@ -1,6 +1,6 @@ { pkgs, config, lib, ... }: -let scripts = (import ./scripts.nix); +let scripts = (import ./scripts.nix { inherit pkgs; }); theme = config.riley.theme.hex; modifier = "Mod4"; terminal = "${pkgs.alacritty}/bin/alacritty"; diff --git a/modules/gui/wm/keybinds.nix b/modules/gui/wm/keybinds.nix index 600e4a4..175b947 100644 --- a/modules/gui/wm/keybinds.nix +++ b/modules/gui/wm/keybinds.nix @@ -113,15 +113,15 @@ with lib; let mod = modifier; utils = ({ lock ? null, sc ? null }: (optionalAttrs (lock != null) { "${mod}+Escape" = "exec ${lock}/bin/lock"; - }) // (optionalAttrs (sc ? null) { - "${mod}+d" = "exec ${sc}/bin/sc"; + }) // (optionalAttrs (sc != null) { + "${mod}+d --release" = "exec ${sc}/bin/sc"; }) ); in (mkMerge [ (media { inherit (pkgs) mpc_cli pulseaudio; }) - (utils { inherit (scripts) lock sc; }) + (utils scripts) (genDirectional directional) (genWorkspaces workspace) diff --git a/modules/gui/wm/scripts.nix b/modules/gui/wm/scripts.nix index aa71049..3664fc1 100644 --- a/modules/gui/wm/scripts.nix +++ b/modules/gui/wm/scripts.nix @@ -12,8 +12,9 @@ name = "sc"; runtimeInputs = [ xclip scrot ]; text = '' - scrot -ozs /tmp/sc.png - xclip -t "image/png" -sel clip -i < /tmp/sc.png + env > /tmp/env_sc.txt + scrot -D :0 -ozs /tmp/sc.png 2>/tmp/aaa.txt + xclip -t "image/png" -sel clip -i < /tmp/sc.png 2>/tmp/bbb.txt ''; });