commit a0f4c89ce73bb1cbc10bf6fadc8960e799a7cc2e
parent 4476b2f14973aacd9df3ccc45539f601a02c9943
Author: William Casarin <jb55@jb55.com>
Date: Wed, 3 Mar 2021 06:38:02 -0800
x11-rename: init
Diffstat:
2 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/jb55pkgs/default.nix b/jb55pkgs/default.nix
@@ -26,6 +26,7 @@ in rec {
define = callPackage ./pkgs/define { };
rsslink = callPackage ./pkgs/rsslink { };
+ x11-rename = callPackage ./pkgs/x11-rename { };
ratio = fetch-srht {
repo = "ratio";
diff --git a/jb55pkgs/pkgs/x11-rename/default.nix b/jb55pkgs/pkgs/x11-rename/default.nix
@@ -0,0 +1,32 @@
+{ pkgs ? import <nixpkgs> {},
+ stdenv ? pkgs.stdenv,
+ fetchurl ? pkgs.fetchurl,
+ bash ? pkgs.bash,
+ xdotool ? pkgs.xdotool,
+ zenity ? pkgs.gnome3.zenity,
+ writeScript ? pkgs.writeScript
+}:
+let
+ x11-rename-zen = writeScript "x11-rename-zen" ''
+ #!${bash}/bin/bash
+ name="$(${zenity}/bin/zenity --entry --text=name:)"
+ ${xdotool}/bin/xdotool selectwindow set_window --name $name
+ '';
+in
+stdenv.mkDerivation rec {
+ pname = "x11-rename";
+ version = "0.1";
+
+ src = writeScript pname ''
+ #!${bash}/bin/bash
+ ${xdotool}/bin/xdotool selectwindow set_window --name "$1"
+ '';
+
+ phases = ["installPhase"];
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp $src $out/bin/${pname}
+ cp ${x11-rename-zen} $out/bin/x11-rename-zen
+ '';
+}