]> git.ekhem.eu.org Git - guix.git/commitdiff
[home] Select emoji with dmenu.
authorJakub Czajka <jakub@ekhem.eu.org>
Mon, 26 Dec 2022 19:09:39 +0000 (20:09 +0100)
committerJakub Czajka <jczajka@google.com>
Sun, 24 Dec 2023 18:53:07 +0000 (19:53 +0100)
X11/.config/X11/xbindkeysrc
conf/home/desktop.scm
conf/home/emoji.scm [new file with mode: 0644]
home.scm
scripts/select_emoji [new file with mode: 0755]

index 31f74e42a2496f720336a1ec8802ab339c2e889f..c2a885ec9eda844743568c2e2c8c73c0518f3f60 100644 (file)
@@ -7,6 +7,9 @@
 "volume 5%-"
   XF86AudioLowerVolume
 
+"select_emoji"
+  Mod4 + e
+
 "sleep 0.5; xtrlock"
   Mod4 + l
 
index aee2e937e975df65ff28cf0a56dc9994af88410c..53d72ebc6fb37fac1c4d309edd2d6b6274a75785 100644 (file)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xorg)
   #:use-module (gnu services)
-  #:export (autorandr-services
+  #:export (autorandr-service
            desktop-services
            screenshot-service))
 
-(define autorandr-services
-  (list (service home-program-service-type
-                (home-program-configuration
-                 (packages
-                  (list autorandr
-                        xrandr))
-                 (dotfiles
-                  (list "autorandr/.config/autorandr/postswitch"))))
-       notify-service))
+(define autorandr-service
+  (service home-program-service-type
+          (home-program-configuration
+           (packages
+            (list autorandr
+                  xrandr))
+           (dotfiles
+            (list "autorandr/.config/autorandr/postswitch")))))
 
 (define desktop-services
   (list status-bar-service
diff --git a/conf/home/emoji.scm b/conf/home/emoji.scm
new file mode 100644 (file)
index 0000000..f2167f4
--- /dev/null
@@ -0,0 +1,40 @@
+;; Copyright (c) 2022 Jakub Czajka <jakub@ekhem.eu.org>
+;; License: GPL-3.0 or later.
+;;
+;; emoji.scm - package for copying emojis to the clipboard.
+
+(define-module (conf home emoji)
+  #:use-module (guix build-system trivial)
+  #:use-module (guix gexp)
+  #:use-module (guix licenses)
+  #:use-module (guix packages)
+  #:export (select-emoji))
+
+(define select-emoji
+  (package
+   (name "select-emoji")
+   (version "1.0")
+   (source
+    (local-file
+     (string-concatenate
+      (list (getenv "GUIX_PACKAGE_PATH")
+           "/scripts/select_emoji"))))
+   (build-system trivial-build-system)
+   (arguments
+    '(#:modules ((guix build utils))
+      #:builder
+      (begin
+       (use-modules (guix build utils))
+
+       (let* ((ins  (assoc-ref %build-inputs "source"))
+              (out  (assoc-ref %outputs "out"))
+              (dir  (string-concatenate (list out "/bin")))
+              (file (string-append dir "/select_emoji")))
+         (mkdir-p dir)
+         (copy-file ins file)
+         (chmod file #o555)))))
+   (synopsis "Script for copying emojis to the clipboard through dmenu.")
+   (description "`select_emoji` displays a list of emojis with dmenu and copies
+the selection to the clipboard.")
+   (home-page "https://git.ekhem.eu.org")
+   (license gpl3+)))
index 057b307f5eef80ed32656d15ce3afcd7f7330299..27ec32f44cf0f873bd31507b80a9d79d1a978f9d 100644 (file)
--- a/home.scm
+++ b/home.scm
@@ -4,18 +4,22 @@
 ;; home.scm - home directory configuration for GNU Guix.
 
 (use-modules (conf home bash)
+            (conf home emoji)
             (conf home desktop)
             (conf home emacs)
+            (conf home notify)
             (conf home suckless)
              (gnu packages package-management))
 
 (home-environment
  (packages
-  (list st-libxft-bgra
+  (list select-emoji
+       st-libxft-bgra
        stow))
  (services
   (append
    (list autorandr-service
+        notify-service
          screenshot-service)
    bash-services
    desktop-services
diff --git a/scripts/select_emoji b/scripts/select_emoji
new file mode 100755 (executable)
index 0000000..aa4f160
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+# Copyright (c) 2022 Jakub Czajka <jakub@ekhem.eu.org>
+# License: GPL-3.0 or later.
+
+EMOJI=$(cat ${XDG_DATA_HOME}/emojis \
+      | dmenu -i -l 15 \
+      | cut --delimiter=" " --fields=1)
+
+if [ -n "${EMOJI}" ]
+then
+    echo -n ${EMOJI} | xclip \
+      && dunstify "${EMOJI} copied to clipboard"
+fi