gnu: guix: Update to 1h2qlbb.
[jackhill/guix/guix.git] / gnu / packages / terminals.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2016, 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
3 ;;; Copyright © 2016 Mckinley Olsen <mck.olsen@gmail.com>
4 ;;; Copyright © 2016, 2017 Alex Griffin <a@ajgrf.com>
5 ;;; Copyright © 2016 David Craven <david@craven.ch>
6 ;;; Copyright © 2016, 2017, 2019 Ludovic Courtès <ludo@gnu.org>
7 ;;; Copyright © 2016, 2017 José Miguel Sánchez García <jmi2k@openmailbox.org>
8 ;;; Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
9 ;;; Copyright © 2017 Kei Kebreau <kkebreau@posteo.net>
10 ;;; Copyright © 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
11 ;;; Copyright © 2017 Petter <petter@mykolab.ch>
12 ;;; Copyright © 2018 Hartmut Goebel <h.goebel@crazy-compilers.com>
13 ;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
14 ;;; Copyright © 2018 Gabriel Hondet <gabrielhondet@gmail.com>
15 ;;; Copyright © 2019 Rutger Helling <rhelling@mykolab.com>
16 ;;; Copyright © 2018, 2019 Eric Bavier <bavier@member.fsf.org>
17 ;;; Copyright © 2019 Julien Lepiller <julien@lepiller.eu>
18 ;;;
19 ;;; This file is part of GNU Guix.
20 ;;;
21 ;;; GNU Guix is free software; you can redistribute it and/or modify it
22 ;;; under the terms of the GNU General Public License as published by
23 ;;; the Free Software Foundation; either version 3 of the License, or (at
24 ;;; your option) any later version.
25 ;;;
26 ;;; GNU Guix is distributed in the hope that it will be useful, but
27 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
28 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 ;;; GNU General Public License for more details.
30 ;;;
31 ;;; You should have received a copy of the GNU General Public License
32 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
33
34 (define-module (gnu packages terminals)
35 #:use-module ((guix licenses) #:prefix license:)
36 #:use-module (guix build-system cmake)
37 #:use-module (guix build-system gnu)
38 #:use-module (guix build-system glib-or-gtk)
39 #:use-module (guix build-system go)
40 #:use-module (guix build-system python)
41 #:use-module (guix download)
42 #:use-module (guix git-download)
43 #:use-module (guix packages)
44 #:use-module (gnu packages)
45 #:use-module (gnu packages autotools)
46 #:use-module (gnu packages check)
47 #:use-module (gnu packages compression)
48 #:use-module (gnu packages crypto)
49 #:use-module (gnu packages docbook)
50 #:use-module (gnu packages fontutils)
51 #:use-module (gnu packages freedesktop)
52 #:use-module (gnu packages gcc)
53 #:use-module (gnu packages gettext)
54 #:use-module (gnu packages gl)
55 #:use-module (gnu packages glib)
56 #:use-module (gnu packages gnome)
57 #:use-module (gnu packages golang)
58 #:use-module (gnu packages gtk)
59 #:use-module (gnu packages image)
60 #:use-module (gnu packages libcanberra)
61 #:use-module (gnu packages libevent)
62 #:use-module (gnu packages linux)
63 #:use-module (gnu packages ncurses)
64 #:use-module (gnu packages perl)
65 #:use-module (gnu packages perl-check)
66 #:use-module (gnu packages pkg-config)
67 #:use-module (gnu packages popt)
68 #:use-module (gnu packages protobuf)
69 #:use-module (gnu packages python)
70 #:use-module (gnu packages python-web)
71 #:use-module (gnu packages python-xyz)
72 #:use-module (gnu packages qt)
73 #:use-module (gnu packages serialization)
74 #:use-module (gnu packages sphinx)
75 #:use-module (gnu packages ssh)
76 #:use-module (gnu packages textutils)
77 #:use-module (gnu packages xdisorg)
78 #:use-module (gnu packages xml)
79 #:use-module (gnu packages xorg)
80 #:use-module (srfi srfi-26))
81
82 (define-public tilda
83 (package
84 (name "tilda")
85 (version "1.4.1")
86 (source (origin
87 (method git-fetch)
88 (uri (git-reference
89 (url "https://github.com/lanoxx/tilda.git")
90 (commit (string-append "tilda-" version))))
91 (file-name (git-file-name name version))
92 (sha256
93 (base32
94 "154rsldqjv2m1bddisb930qicb0y35kx7bxq392n2hn68jr2pxkj"))))
95 (build-system glib-or-gtk-build-system)
96 (arguments
97 '(#:phases (modify-phases %standard-phases
98 (replace 'bootstrap
99 (lambda _
100 (setenv "NOCONFIGURE" "true")
101 (invoke "sh" "autogen.sh"))))))
102 (native-inputs
103 `(("autoconf" ,autoconf)
104 ("automake" ,automake)
105 ("gettext" ,gettext-minimal)
106 ("pkg-config" ,pkg-config)))
107 (inputs
108 `(("libconfuse" ,libconfuse)
109 ("vte" ,vte)))
110 (synopsis "GTK+-based drop-down terminal")
111 (description "Tilda is a terminal emulator similar to normal terminals like
112 gnome-terminal (GNOME) or Konsole (KDE), with the difference that it drops down
113 from the edge of a screen when a certain configurable hotkey is pressed. This
114 is similar to the built-in consoles in some applications. Tilda is highly
115 configurable through a graphical wizard.")
116 (home-page "https://github.com/lanoxx/tilda")
117 (license license:gpl2+)))
118
119 (define-public termite
120 (package
121 (name "termite")
122 (version "15")
123 (source
124 (origin
125 (method git-fetch)
126 (uri (git-reference
127 (url (string-append "https://github.com/thestinger/"
128 name ".git"))
129 (commit (string-append "v" version))
130 (recursive? #t)))
131 (file-name (string-append name "-" version "-checkout"))
132 (sha256
133 (base32
134 "0hp1x6lj098m3jgna274wv5dv60lnzg22297di68g4hw9djjyd2k"))))
135 (build-system gnu-build-system)
136 (arguments
137 `(#:phases
138 (modify-phases %standard-phases
139 (delete 'configure))
140 #:tests? #f
141 ;; This sets the destination when installing the necessary terminal
142 ;; capability data, which are not provided by 'ncurses'. See
143 ;; <https://lists.gnu.org/archive/html/bug-ncurses/2009-10/msg00031.html>.
144 #:make-flags (list "PREFIX="
145 (string-append "VERSION=v" (version))
146 (string-append "DESTDIR="
147 (assoc-ref %outputs "out")))))
148 (inputs
149 `(("vte" ,vte-ng)
150 ("gtk+" ,gtk+)
151 ("ncurses" ,ncurses)))
152 (native-inputs
153 `(("pkg-config" ,pkg-config)))
154
155 ;; FIXME: This should only be located in 'ncurses'. Nonetheless it is
156 ;; provided for usability reasons. See <https://bugs.gnu.org/22138>.
157 (native-search-paths
158 (list (search-path-specification
159 (variable "TERMINFO_DIRS")
160 (files '("share/terminfo")))))
161 (home-page "https://github.com/thestinger/termite/")
162 (synopsis "Keyboard-centric, VTE-based terminal")
163 (description "Termite is a minimal terminal emulator designed for use with
164 tiling window managers. It is a modal application, similar to Vim, with an
165 insert mode and command mode where keybindings have different functions.")
166
167 ;; Files under util/ are under the Expat license; the rest is LGPLv2+.
168 (license license:lgpl2.0+)))
169
170 (define-public asciinema
171 (package
172 (name "asciinema")
173 (version "1.4.0")
174 (source
175 (origin
176 (method url-fetch)
177 (uri (pypi-uri "asciinema" version))
178 (sha256
179 (base32
180 "1jrf8c8711gkdilmvyv3d37kp8xfvdc5cqighw5k92a6g9z4acgv"))))
181 (build-system python-build-system)
182 (arguments
183 `(#:phases
184 (modify-phases %standard-phases
185 (add-before 'build 'patch-exec-paths
186 (lambda* (#:key inputs #:allow-other-keys)
187 (let ((ncurses (assoc-ref inputs "ncurses")))
188 (substitute* "asciinema/recorder.py"
189 (("'tput'")
190 (string-append "'" ncurses "/bin/tput'"))))
191 #t)))))
192 (inputs `(("ncurses" ,ncurses)))
193 (native-inputs
194 ;; For tests.
195 `(("python-requests" ,python-requests)))
196 (home-page "https://asciinema.org")
197 (synopsis "Terminal session recorder")
198 (description
199 "Use asciinema to record and share your terminal sessions, the right way.
200 Forget screen recording apps and blurry video. Enjoy a lightweight, purely
201 text-based approach to terminal recording.")
202 (license license:gpl3)))
203
204 (define-public libtsm
205 (let ((commit "f70e37982f382b03c6939dac3d5f814450bda253")
206 (revision "1"))
207 (package
208 (name "libtsm")
209 (version (git-version "0.0.0" revision commit))
210 (source (origin
211 (method git-fetch)
212 ;; The freedesktop repository is no longer maintained.
213 (uri (git-reference
214 (url (string-append "https://github.com/Aetf/" name))
215 (commit commit)))
216 (sha256
217 (base32
218 "0mwn91i5h5d518i1s05y7hzv6bc13vzcvxszpfh77473iwg4wprx"))))
219 (build-system cmake-build-system)
220 (arguments
221 `(#:configure-flags '("-DBUILD_TESTING=ON")))
222 (native-inputs
223 `(("pkg-config" ,pkg-config)))
224 (inputs
225 `(("libxkbcommon" ,libxkbcommon)
226 ("check" ,check)))
227 (synopsis "Xterm state machine library")
228 (description "TSM is a state machine for DEC VT100-VT520 compatible
229 terminal emulators. It tries to support all common standards while keeping
230 compatibility to existing emulators like xterm, gnome-terminal, konsole, etc.")
231 (home-page "https://www.freedesktop.org/wiki/Software/libtsm")
232 ;; Hash table implementation is lgpl2.1+ licensed.
233 ;; The wcwidth implementation in external/wcwidth.{h,c} uses a license
234 ;; derived from ISC.
235 ;; UCS-4 to UTF-8 encoding is copied from "terminology" which is released
236 ;; under the bsd 2 license.
237 (license (list license:expat license:lgpl2.1+ license:isc license:bsd-2)))))
238
239 (define-public kmscon
240 (let ((commit "01dd0a231e2125a40ceba5f59fd945ff29bf2cdc")
241 (revision "1"))
242 (package
243 (name "kmscon")
244 (version (git-version "0.0.0" revision commit))
245 (source (origin
246 (method git-fetch)
247 ;; The freedesktop repository is no longer maintained.
248 (uri (git-reference
249 (url (string-append "https://github.com/Aetf/" name))
250 (commit commit)))
251 (sha256
252 (base32
253 "0q62kjsvy2iwy8adfiygx2bfwlh83rphgxbis95ycspqidg9py87"))
254 (patches
255 (search-patches "kmscon-runtime-keymap-switch.patch"))
256 (modules '((guix build utils)))
257 (file-name (git-file-name name version))))
258 (build-system gnu-build-system)
259 (arguments
260 `(;; The closure of MESA is huge so we'd rather avoid it.
261 #:disallowed-references (,mesa)
262
263 #:phases (modify-phases %standard-phases
264 (replace 'bootstrap
265 (lambda _
266 (setenv "NOCONFIGURE" "indeed")
267 (invoke "sh" "autogen.sh")))
268 ;; Use elogind instead of systemd.
269 (add-before 'configure 'remove-systemd
270 (lambda _
271 (substitute* "configure"
272 (("libsystemd-daemon libsystemd-login")
273 "libelogind"))
274 (substitute* "src/uterm_systemd.c"
275 (("#include <systemd/sd-login.h>")
276 "#include <elogind/sd-login.h>")
277 ;; We don't have this header.
278 (("#include <systemd/sd-daemon\\.h>")
279 "")
280 ;; Replace the call to 'sd_booted' by the truth value.
281 (("sd_booted\\(\\)")
282 "1")))))))
283 (native-inputs
284 `(("pkg-config" ,pkg-config)
285 ("autoconf" ,autoconf)
286 ("automake" ,automake)
287 ("libtool" ,libtool)
288 ("libxslt" ,libxslt) ;to build the man page
289 ("libxml2" ,libxml2) ;for XML_CATALOG_FILES
290 ("docbook-xsl" ,docbook-xsl)))
291 (inputs
292 `(("libdrm" ,libdrm)
293 ("libtsm" ,libtsm)
294 ("libxkbcommon" ,libxkbcommon)
295 ("logind" ,elogind)
296 ;; MESA can be used for accelerated video output via OpenGLESv2, but
297 ;; it's a bit dependency that we'd rather avoid in the installation
298 ;; image.
299 ;; ("mesa" ,mesa)
300 ("pango" ,pango)
301 ("udev" ,eudev)))
302 (synopsis "Linux KMS-based terminal emulator")
303 (description "Kmscon is a terminal emulator based on Linux's @dfn{kernel
304 mode setting} (KMS). It can replace the in-kernel virtual terminal (VT)
305 implementation with a user-space console. Compared to the Linux console,
306 kmscon provides enhanced features including XKB-compatible internationalized
307 keyboard support, UTF-8 input/font support, hardware-accelerated rendering,
308 multi-seat support, a replacement for @command{mingetty}, and more.")
309 (home-page "https://www.freedesktop.org/wiki/Software/kmscon")
310 ;; Hash table implementation is lgpl2.1+ licensed.
311 ;; The wcwidth implementation in external/wcwidth.{h,c} uses a license
312 ;; derived from ISC.
313 ;; UCS-4 to UTF-8 encoding is copied from "terminology" which is released
314 ;; under the bsd 2 license.
315 ;; Unifont-Font is from http://unifoundry.com/unifont.html and licensed
316 ;; under the terms of the GNU GPL.
317 (license (list license:expat license:lgpl2.1+ license:bsd-2
318 license:gpl2+))
319 (supported-systems (filter (cut string-suffix? "-linux" <>)
320 %supported-systems)))))
321
322 (define-public libtermkey
323 (package
324 (name "libtermkey")
325 (version "0.21.1")
326 (source (origin
327 (method url-fetch)
328 (uri (string-append "http://www.leonerd.org.uk/code/libtermkey/"
329 "libtermkey-" version ".tar.gz"))
330 (sha256
331 (base32 "0psd0kf10q5ixfima0mxz10syy7qq1ilz1npr0rz862xycvzgjyf"))))
332 (build-system gnu-build-system)
333 (arguments
334 '(#:make-flags (list
335 "CC=gcc"
336 (string-append "PREFIX=" (assoc-ref %outputs "out")))
337 #:phases (modify-phases %standard-phases
338 (delete 'configure)) ; no configure script
339 #:test-target "test"))
340 (inputs `(("ncurses" ,ncurses)))
341 (native-inputs `(("libtool" ,libtool)
342 ("perl-test-harness" ,perl-test-harness)
343 ("pkg-config" ,pkg-config)))
344 (synopsis "Keyboard entry processing library for terminal-based programs")
345 (description
346 "Libtermkey handles all the necessary logic to recognise special keys, UTF-8
347 combining, and so on, with a simple interface.")
348 (home-page "http://www.leonerd.org.uk/code/libtermkey")
349 (license license:expat)))
350
351 (define-public picocom
352 (package
353 (name "picocom")
354 (version "3.1")
355 (source (origin
356 (method git-fetch)
357 (uri (git-reference
358 (url "https://github.com/npat-efault/picocom.git")
359 (commit version)))
360 (file-name (git-file-name name version))
361 (sha256
362 (base32
363 "1vvjydqf0ax47nvdyyl67jafw5b3sfsav00xid6qpgia1gs2r72n"))))
364 (build-system gnu-build-system)
365 (arguments
366 `(#:make-flags '("CC=gcc")
367 #:tests? #f ; no tests
368 #:phases
369 (modify-phases %standard-phases
370 (delete 'configure) ; no configure script
371 (replace 'install
372 ;; The Makefile lacks an ‘install’ target.
373 (lambda* (#:key outputs #:allow-other-keys)
374 (let* ((out (assoc-ref outputs "out"))
375 (bin (string-append out "/bin"))
376 (man (string-append out "/share/man/man1")))
377 (install-file "picocom" bin)
378 (install-file "picocom.1" man)))))))
379 (home-page "https://github.com/npat-efault/picocom")
380 (synopsis "Minimal dumb-terminal emulator")
381 (description
382 "Picocom is a minimal dumb-terminal emulation program. It was designed to
383 serve as a simple and manual modem configuration, testing, and debugging tool.
384 It also serves well as a low-tech serial communications program to allow access
385 to all types of devices that provide serial consoles.")
386 (license license:gpl2+)))
387
388 (define-public beep
389 (package
390 (name "beep")
391 (version "1.4.4")
392 (source
393 (origin
394 (method git-fetch)
395 (uri (git-reference
396 ;; The original beep 1.3 at <http://www.johnath.com/beep> has been
397 ;; unmaintained for some time, and vulnerable to at least two CVEs:
398 ;; https://github.com/johnath/beep/issues/11#issuecomment-454056858
399 ;; Use this maintained fork instead.
400 (url "https://github.com/spkr-beep/beep.git")
401 (commit (string-append "v" version))))
402 (file-name (git-file-name name version))
403 (sha256
404 (base32 "1bk7g63qpiclbq20iz2x238by8s1b2iafdim7i6dq1i5n01s7lgx"))))
405 (build-system gnu-build-system)
406 (arguments
407 `(#:tests? #f ; no tests
408 #:make-flags
409 (list (string-append "prefix=" (assoc-ref %outputs "out"))
410 (string-append "pkgdocdir=$(docdir)/" ,name "-" ,version))
411 #:phases
412 (modify-phases %standard-phases
413 (delete 'configure)))) ; no configure script
414 (native-inputs
415 `(("gcc" ,gcc-8))) ; for ‘-fstack-clash-protection’
416 (synopsis "Linux command-line utility to control the PC speaker")
417 (description "beep allows the user to control the PC speaker with precision,
418 allowing different sounds to indicate different events. While it can be run
419 quite happily on the command line, its intended place of residence is within
420 scripts, notifying the user when something interesting occurs. Of course, it
421 has no notion of what's interesing, but it's very good at that notifying part.")
422 (home-page "https://github.com/spkr-beep/beep")
423 (license license:gpl2+)))
424
425 (define-public unibilium
426 (package
427 (name "unibilium")
428 (version "2.0.0")
429 (source
430 (origin
431 (method git-fetch)
432 (uri (git-reference
433 (url "https://github.com/mauke/unibilium.git")
434 (commit (string-append "v" version))))
435 (file-name (git-file-name name version))
436 (sha256
437 (base32
438 "1wa9a32wzqnxqh1jh554afj13dzjr6mw2wzqzw8d08nza9pg2ra2"))))
439 (build-system gnu-build-system)
440 (arguments
441 `(#:make-flags
442 (list "CC=gcc"
443 (string-append "PREFIX=" (assoc-ref %outputs "out")))
444 #:test-target "test"
445 ;; FIXME: tests require "prove"
446 #:tests? #f
447 #:phases
448 (modify-phases %standard-phases
449 (delete 'configure))))
450 (native-inputs
451 `(("libtool" ,libtool)
452 ("perl" ,perl)))
453 (home-page "https://github.com/mauke/unibilium")
454 (synopsis "Terminfo parsing library")
455 (description "Unibilium is a basic C terminfo library. It doesn't depend
456 on curses or any other library. It also doesn't use global variables, so it
457 should be thread-safe.")
458 (license license:lgpl3+)))
459
460 (define-public libvterm
461 (package
462 (name "libvterm")
463 (version "0.1")
464 (source
465 (origin
466 (method url-fetch)
467 (uri (string-append "http://www.leonerd.org.uk/code/libvterm/"
468 "libvterm-" version ".tar.gz"))
469 (sha256
470 (base32
471 "1pcxjhvdwhr2f3lyzf2rv1vp3l62bgkjm1ybhj82qf8yly7ca6g4"))))
472 (build-system gnu-build-system)
473 (arguments
474 `(#:make-flags
475 (list "CC=gcc"
476 (string-append "PREFIX=" (assoc-ref %outputs "out")))
477 #:tests? #f ; XXX: some tests fail in this release
478 #:test-target "test"
479 #:phases
480 (modify-phases %standard-phases
481 (delete 'configure))))
482 (native-inputs
483 `(("libtool" ,libtool)
484 ("perl" ,perl)))
485 (home-page "http://www.leonerd.org.uk/code/libvterm/")
486 (synopsis "VT220/xterm/ECMA-48 terminal emulator library")
487 (description "Libvterm is an abstract C99 library which implements a VT220
488 or xterm-like terminal emulator. It doesn't use any particular graphics
489 toolkit or output system, instead it invokes callback function pointers that
490 its embedding program should provide it to draw on its behalf. It avoids
491 calling @code{malloc} during normal running state, allowing it to be used in
492 embedded kernel situations.")
493 (license license:expat)))
494
495 (define-public cool-retro-term
496 (let ((commit "1.1.1")
497 (revision "0")) ;not used currently
498 (package
499 (name "cool-retro-term")
500 (version "1.1.1")
501 (source (origin
502 (method git-fetch)
503 (file-name (string-append name "-" version "-checkout"))
504 (uri (git-reference
505 (url (string-append "https://github.com/Swordfish90/" name))
506 (commit commit)
507 (recursive? #t)))
508 (sha256
509 (base32 "0wb6anchxa5jpn9c73kr4byrf2xlj8x8qzc5x7ny6saj7kbbvp75"))
510 (modules '((guix build utils)
511 (srfi srfi-1)
512 (srfi srfi-26)
513 (ice-9 rdelim)
514 (ice-9 regex)))
515 (snippet
516 '(let* ((fonts '(;"1971-ibm-3278" ; BSD 3-clause
517 "1977-apple2" ; Non-Free
518 "1977-commodore-pet" ; Non-Free
519 "1979-atari-400-800" ; Non-Free
520 ;"1981-ibm-pc ; CC-SA 4.0
521 "1982-commodore64")) ; Non-Free
522 ;"1985-ibm-pc-vga" ; CC-SA 4.0
523 ;"modern-fixedsys-excelsior" ; Redistributable
524 ;"modern-hermit" ; SIL
525 ;"modern-inconsolata"; SIL
526 ;"modern-pro-font-win-tweaked" ; X11
527 ;"modern-proggy-tiny"; X11
528 ;"modern-terminus" ; SIL
529 (name-rx (make-regexp " *name: *\"([^\"]*)\""))
530 (source-rx (make-regexp " *source: \"fonts/([^/]*)[^\"]*\""))
531 (fontname-rx (make-regexp "\"fontName\":\"([^\"]*).*"))
532 (names
533 ;; Gather font names from all Fonts*.qml files.
534 ;; These will be used to remove items from the
535 ;; default profiles.
536 (fold
537 (lambda (font-file names)
538 (call-with-input-file font-file
539 (lambda (port)
540 (let loop ((name #f) (names names))
541 (let ((line (read-line port)))
542 (cond
543 ((eof-object? line) (pk 'names names))
544 ((regexp-exec name-rx line)
545 => (lambda (m)
546 (loop (match:substring m 1) names)))
547 ((regexp-exec source-rx line)
548 => (lambda (m)
549 (let ((font (match:substring m 1)))
550 (if (member font fonts)
551 (loop #f (lset-adjoin string=?
552 names name))
553 (loop #f names)))))
554 (else (loop name names))))))))
555 '() (find-files "app/qml" "Font.*\\.qml"))))
556 ;; Remove the font files themselves
557 (for-each (lambda (font)
558 (delete-file-recursively
559 (string-append "app/qml/fonts/" font)))
560 fonts)
561 ;; Remove mention of those fonts in the source
562 (substitute* "app/qml/resources.qrc"
563 (((string-append " *<file>fonts/("
564 (string-join fonts "|")
565 ").*"))
566 ""))
567 (for-each
568 (lambda (file)
569 (let ((start-rx (make-regexp " *ListElement\\{"))
570 (end-rx (make-regexp " *\\}")))
571 (with-atomic-file-replacement file
572 (lambda (in out)
573 (let loop ((line-buffer '())
574 (hold? #f)
575 (discard? #f))
576 (let ((line (read-line in 'concat)))
577 (cond
578 ((eof-object? line) #t) ;done
579 ((regexp-exec start-rx line)
580 (loop (cons line line-buffer) #t #f))
581 ((or (regexp-exec source-rx line)
582 (regexp-exec fontname-rx line))
583 => (lambda (m)
584 (let ((font-or-name (match:substring m 1)))
585 (if (or (member font-or-name fonts)
586 (member font-or-name names))
587 (loop '() #f #t)
588 (loop (cons line line-buffer)
589 hold? #f)))))
590 ((regexp-exec end-rx line)
591 (unless discard?
592 (for-each (cut display <> out)
593 (reverse line-buffer))
594 (display line out))
595 (loop '() #f #f))
596 (hold? (loop (cons line line-buffer)
597 hold? discard?))
598 (discard? (loop line-buffer #f #t))
599 (else (display line out)
600 (loop '() #f #f)))))))))
601 '("app/qml/FontPixels.qml"
602 "app/qml/FontScanlines.qml"
603 "app/qml/Fonts.qml"
604 "app/qml/ApplicationSettings.qml"))
605 ;; Final substitution for default scanline and pixel fonts
606 (substitute* "app/qml/ApplicationSettings.qml"
607 (("COMMODORE_PET") "PROGGY_TINY"))
608 #t))))
609 (build-system gnu-build-system)
610 (inputs
611 `(("qtbase" ,qtbase)
612 ("qtdeclarative" ,qtdeclarative)
613 ("qtgraphicaleffects" ,qtgraphicaleffects)
614 ("qtquickcontrols" ,qtquickcontrols)))
615 (arguments
616 `(#:phases
617 (modify-phases %standard-phases
618 (replace 'configure
619 (lambda* (#:key outputs #:allow-other-keys)
620 (let ((out (assoc-ref outputs "out")))
621 (substitute* '("qmltermwidget/qmltermwidget.pro")
622 (("INSTALL_DIR = \\$\\$\\[QT_INSTALL_QML\\]")
623 (string-append "INSTALL_DIR = " out "/lib/qt5/qml")))
624 (substitute* '("cool-retro-term.pro" "app/app.pro")
625 (("/usr") out))
626 (invoke "qmake"))))
627 (add-after 'install 'wrap-executable
628 (lambda* (#:key inputs outputs #:allow-other-keys)
629 (let ((out (assoc-ref outputs "out"))
630 (qml "/lib/qt5/qml"))
631 (wrap-program (string-append out "/bin/cool-retro-term")
632 `("QML2_IMPORT_PATH" ":" prefix
633 (,(string-append out qml)
634 ,@(map (lambda (i)
635 (string-append (assoc-ref inputs i) qml))
636 '("qtdeclarative"
637 "qtgraphicaleffects"
638 "qtquickcontrols")))))
639 #t)))
640 (add-after 'install 'add-alternate-name
641 (lambda* (#:key outputs #:allow-other-keys)
642 (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
643 (symlink (string-append bin "/cool-retro-term")
644 (string-append bin "/crt"))
645 #t)))
646 (add-after 'install 'install-man
647 (lambda* (#:key outputs #:allow-other-keys)
648 (let ((mandir (string-append (assoc-ref outputs "out")
649 "/share/man/man1")))
650 (install-file "packaging/debian/cool-retro-term.1" mandir)
651 #t))))))
652 (synopsis "Terminal emulator")
653 (description
654 "Cool-retro-term (crt) is a terminal emulator which mimics the look and
655 feel of the old cathode ray tube (CRT) screens. It has been designed to be
656 eye-candy, customizable, and reasonably lightweight.")
657 (home-page "https://github.com/Swordfish90/cool-retro-term")
658 (license (list
659 license:gpl2+ ; qmltermwidget
660 license:gpl3+ ; cool-retro-term
661 ;; Fonts
662 license:silofl1.1
663 license:x11
664 license:bsd-3)))))
665
666 (define-public sakura
667 (package
668 (name "sakura")
669 (version "3.6.0")
670 (source (origin
671 (method url-fetch)
672 (uri (string-append "https://launchpad.net/" name "/trunk/"
673 version "/+download/" name "-" version
674 ".tar.bz2"))
675 (sha256
676 (base32
677 "1q463qm41ym7jb3kbzjz7b6x549vmgkb70arpkhsf86yxly1y5m1"))))
678 (build-system cmake-build-system)
679 (arguments
680 '(#:tests? #f)) ; no check phase
681 (native-inputs
682 `(("gettext" ,gettext-minimal)
683 ("perl" ,perl) ; for pod2man
684 ("pkg-config" ,pkg-config)))
685 (inputs
686 `(("libxft" ,libxft)
687 ("vte" ,vte)))
688 (home-page "https://launchpad.net/sakura")
689 (synopsis "A simple but powerful libvte-based terminal emulator")
690 (description "@code{Sakura} is a terminal emulator based on GTK+ and VTE.
691 It's a terminal emulator with few dependencies, so you don't need a full GNOME
692 desktop installed to have a decent terminal emulator.")
693 (license license:gpl2)))
694
695 (define-public go-github.com-nsf-termbox-go
696 (let ((commit "288510b9734e30e7966ec2f22b87c5f8e67345e3")
697 (revision "1"))
698 (package
699 (name "go-github.com-nsf-termbox-go")
700 (version (git-version "0.0.0" revision commit))
701 (source (origin
702 (method git-fetch)
703 (uri (git-reference
704 (url "https://github.com/nsf/termbox-go.git")
705 (commit commit)))
706 (file-name (git-file-name name version))
707 (sha256
708 (base32
709 "0hdyisfaf8yb55h3p03p4sbq19546mp9fy28f2kn659mycmhxqk4"))))
710 (build-system go-build-system)
711 (arguments
712 '(#:import-path "github.com/nsf/termbox-go"))
713 (propagated-inputs
714 `(("go-github.com-mattn-go-runewidth"
715 ,go-github.com-mattn-go-runewidth)))
716 (synopsis "@code{termbox} provides a minimal API for text-based user
717 interfaces")
718 (description
719 "Termbox is a library that provides a minimalistic API which allows the
720 programmer to write text-based user interfaces.")
721 (home-page "https://github.com/nsf/termbox-go")
722 (license license:expat))))
723
724 (define-public go-golang.org-x-crypto-ssh-terminal
725 (let ((commit "c78caca803c95773f48a844d3dcab04b9bc4d6dd")
726 (revision "0"))
727 (package
728 (name "go-golang.org-x-crypto-ssh-terminal")
729 (version (git-version "0.0.0" revision commit))
730 (source (origin
731 (method git-fetch)
732 (uri (git-reference
733 (url "https://go.googlesource.com/crypto")
734 (commit commit)))
735 (file-name (git-file-name name version))
736 (sha256
737 (base32
738 "0vxlfxr9y681yn2cfh6dbqmq35vvq4f45ay0mm31ffkny9cms0y4"))))
739 (build-system go-build-system)
740 (arguments
741 '(#:import-path "golang.org/x/crypto/ssh/terminal"
742 #:unpack-path "golang.org/x/crypto"
743 #:phases
744 (modify-phases %standard-phases
745 (add-before 'reset-gzip-timestamps 'make-gzip-archive-writable
746 (lambda* (#:key outputs #:allow-other-keys)
747 (map (lambda (file)
748 (make-file-writable file))
749 (find-files
750 (string-append (assoc-ref outputs "out")
751 "/src/golang.org/x/crypto/ed25519/testdata")
752 ".*\\.gz$"))
753 #t)))))
754 (synopsis "Support functions for dealing with terminals in Go")
755 (description "@code{terminal} provides support functions for dealing
756 with terminals in Go.")
757 (home-page "https://go.googlesource.com/crypto/")
758 (license license:bsd-3))))
759
760 (define-public go-github-com-junegunn-fzf
761 (package
762 (name "go-github-com-junegunn-fzf")
763 (version "0.18.0")
764 (source
765 (origin
766 (method git-fetch)
767 (uri (git-reference
768 (url "https://github.com/junegunn/fzf")
769 (commit version)))
770 (file-name (git-file-name name version))
771 (sha256
772 (base32
773 "0pwpr4fpw56yzzkcabzzgbgwraaxmp7xzzmap7w1xsrkbj7dl2xl"))))
774 (build-system go-build-system)
775 (arguments
776 `(#:import-path "github.com/junegunn/fzf"))
777 (inputs
778 `(("go-github.com-mattn-go-runewidth" ,go-github.com-mattn-go-runewidth)
779 ("go-github-com-mattn-go-shellwords" ,go-github-com-mattn-go-shellwords)
780 ("go-github-com-mattn-go-isatty" ,go-github-com-mattn-go-isatty)
781 ("go-github-com-gdamore-tcell" ,go-github-com-gdamore-tcell)
782 ("go-golang-org-x-crypto-ssh-terminal" ,go-golang-org-x-crypto-ssh-terminal)))
783 (home-page "https://github.com/junegunn/fzf")
784 (synopsis "Command-line fuzzy-finder")
785 (description "This package provides an interactive command-line filter
786 usable with any list--including files, command history, processes and more.")
787 (license license:expat)))
788
789 (define-public go-github.com-howeyc-gopass
790 (let ((commit "bf9dde6d0d2c004a008c27aaee91170c786f6db8")
791 (revision "0"))
792 (package
793 (name "go-github.com-howeyc-gopass")
794 (version (git-version "0.0.0" revision commit))
795 (source (origin
796 (method git-fetch)
797 (uri (git-reference
798 (url "https://github.com/howeyc/gopass.git")
799 (commit commit)))
800 (file-name (git-file-name name version))
801 (sha256
802 (base32
803 "1jxzyfnqi0h1fzlsvlkn10bncic803bfhslyijcxk55mgh297g45"))))
804 (build-system go-build-system)
805 (arguments
806 '(#:import-path "github.com/howeyc/gopass"))
807 (propagated-inputs
808 `(("go-golang.org-x-crypto-ssh-terminal"
809 ,go-golang.org-x-crypto-ssh-terminal)))
810 (synopsis "Retrieve password from a terminal or piped input in Go")
811 (description
812 "@code{gopass} is a Go package for retrieving a password from user
813 terminal or piped input.")
814 (home-page "https://github.com/howeyc/gopass")
815 (license license:isc))))
816
817 (define-public python-pyte
818 (package
819 (name "python-pyte")
820 (version "0.7.0")
821 (source
822 (origin
823 (method url-fetch)
824 (uri (pypi-uri "pyte" version))
825 (sha256
826 (base32
827 "1an54hvyjm8gncx8cgabz9mkpgjkdb0bkyjlkh7g7f94nr3wnfl7"))))
828 (build-system python-build-system)
829 (arguments
830 '(#:phases
831 (modify-phases %standard-phases
832 (add-after 'unpack 'remove-failing-test
833 ;; TODO: Reenable when the `captured` files required by this test
834 ;; are included in the archive.
835 (lambda _
836 (delete-file "tests/test_input_output.py")
837 #t)))))
838 (propagated-inputs
839 `(("python-wcwidth" ,python-wcwidth)))
840 (native-inputs
841 `(("python-pytest-runner" ,python-pytest-runner)
842 ("python-pytest" ,python-pytest)))
843 (home-page "https://pyte.readthedocs.io/")
844 (synopsis "Simple VTXXX-compatible terminal emulator")
845 (description "@code{pyte} is an in-memory VTxxx-compatible terminal
846 emulator. @var{VTxxx} stands for a series of video terminals, developed by
847 DEC between 1970 and 1995. The first and probably most famous one was the
848 VT100 terminal, which is now a de-facto standard for all virtual terminal
849 emulators.
850
851 pyte is a fork of vt102, which was an incomplete pure Python implementation
852 of VT100 terminal.")
853 (license license:lgpl3+)))
854
855 (define-public python2-pyte
856 (package-with-python2 python-pyte))
857
858 (define-public python-blessings
859 (package
860 (name "python-blessings")
861 (version "1.6.1")
862 (source
863 (origin
864 (method url-fetch)
865 (uri (pypi-uri "blessings" version))
866 (sha256
867 (base32
868 "1smngy65p8mi62lgm04icasx22v976szhs2aq95y2ljmi1srb4bl"))))
869 (build-system python-build-system)
870 (arguments
871 ;; TODO: For py3, 2to2 is used to convert the code, but test-suite fails
872 `(#:tests? #f))
873 (native-inputs
874 `(("python-nose" ,python-nose)))
875 (home-page "https://github.com/erikrose/blessings")
876 (synopsis "Python module to manage terminal color, styling, and
877 positioning")
878 (description "Blessings is a pythonic API to manipulate terminal color,
879 styling, and positioning. It provides similar features to curses but avoids
880 some of curses’s limitations: it does not require clearing the whole screen
881 for little changes, provides a scroll-back buffer after the program exits, and
882 avoids styling altogether when the output is redirected to something other
883 than a terminal.")
884 (license license:expat)))
885
886 (define-public python2-blessings
887 (package-with-python2 python-blessings))
888
889 (define-public python-curtsies
890 (package
891 (name "python-curtsies")
892 (version "0.2.11")
893 (source
894 (origin
895 (method url-fetch)
896 (uri (pypi-uri "curtsies" version))
897 (sha256
898 (base32
899 "1vljmw3sy6lrqahhpyg4gk13mzcx3mwhvg8s41698ms3cpgkjipc"))))
900 (build-system python-build-system)
901 (arguments
902 `(#:phases
903 (modify-phases %standard-phases
904 (replace 'check
905 (lambda _
906 (invoke "nosetests" "-v"))))))
907 (propagated-inputs
908 `(("python-blessings" ,python-blessings)
909 ("python-wcwidth" ,python-wcwidth)))
910 (native-inputs
911 `(("python-mock" ,python-mock)
912 ("python-pyte" ,python-pyte)
913 ("python-nose" ,python-nose)))
914 (home-page "https://github.com/thomasballinger/curtsies")
915 (synopsis "Library for curses-like terminal interaction with colored
916 strings")
917 (description "Curtsies is a Python library for interacting with the
918 terminal. It features string-like objects which carry formatting information,
919 per-line fullscreen terminal rendering, and keyboard input event reporting.")
920 (license license:expat)))
921
922 (define-public python2-curtsies
923 (package-with-python2 python-curtsies))
924
925 (define-public tmate
926 (package
927 (name "tmate")
928 (version "2.2.1")
929 (source
930 (origin
931 (method git-fetch)
932 (uri (git-reference
933 (url "https://github.com/tmate-io/tmate.git")
934 (commit version)))
935 (file-name (git-file-name name version))
936 (sha256
937 (base32
938 "0pfl9vrswzim9ydi1n652h3rax2zrmy6sqkp0r09yy3lw83h4y1r"))))
939 (build-system gnu-build-system)
940 (inputs
941 `(("libevent" ,libevent)
942 ("libssh" ,libssh)
943 ("msgpack" ,msgpack)
944 ("ncurses" ,ncurses)))
945 (native-inputs
946 `(("autoconf" ,autoconf)
947 ("automake" ,automake)
948 ("pkg-config" ,pkg-config)))
949 (home-page "https://tmate.io/")
950 (synopsis "Terminal sharing application")
951 (description "tmate is a terminal sharing application that allows you to
952 share your terminal with other users over the Internet. tmate is a fork of
953 tmux.")
954 (license license:isc)))
955
956 (define-public kitty
957 (package
958 (name "kitty")
959 (version "0.14.4")
960 (home-page "https://sw.kovidgoyal.net/kitty/")
961 (source
962 (origin
963 (method git-fetch)
964 (uri (git-reference
965 (url "https://github.com/kovidgoyal/kitty.git")
966 (commit (string-append "v" version))))
967 (file-name (git-file-name name version))
968 (sha256
969 (base32
970 "0z0y80wcbra3zfyaiim98afbqlfpkjkql430zfb8shx61rzzmn9i"))
971 (modules '((guix build utils)))
972 (snippet
973 '(begin
974 ;; patch needed as sphinx-build is used as a python script
975 ;; whereas the guix package uses a bash script launching the
976 ;; python script
977 (substitute* "docs/conf.py"
978 (("(from kitty.constants import str_version)" kitty-imp)
979 (string-append "sys.path.append(\"..\")\n" kitty-imp)))
980 (substitute* "docs/Makefile"
981 (("^SPHINXBUILD[[:space:]]+= (python3.*)$")
982 "SPHINXBUILD = sphinx-build\n"))
983 #t))))
984 (build-system gnu-build-system)
985 (inputs
986 `(("python" ,python)
987 ("harfbuzz" ,harfbuzz)
988 ("zlib" ,zlib)
989 ("libcanberra" ,libcanberra)
990 ("libpng" ,libpng)
991 ("freetype" ,freetype)
992 ("fontconfig" ,fontconfig)
993 ("pygments" ,python-pygments)
994 ("wayland" ,wayland)))
995 (native-inputs
996 `(("pkg-config" ,pkg-config)
997 ("libxrandr" ,libxrandr)
998 ("libdbus" ,dbus)
999 ("libxcursor" ,libxcursor)
1000 ("libxi" ,libxi)
1001 ("libxinerama" ,libxinerama)
1002 ("libgl1-mesa" ,mesa)
1003 ("libxkbcommon" ,libxkbcommon)
1004 ("sphinx" ,python-sphinx)
1005 ("ncurses" ,ncurses) ;; for tic command
1006 ("wayland-protocols" ,wayland-protocols)))
1007 (arguments
1008 '(#:phases (modify-phases %standard-phases
1009 (delete 'configure)
1010 ;; Wayland backend requires EGL, which isn't found
1011 ;; out-of-the-box for some reason. Hard-code it instead.
1012 (add-after 'unpack 'hard-code-libegl
1013 (lambda _
1014 (let* ((mesa (assoc-ref %build-inputs "libgl1-mesa"))
1015 (libegl (string-append mesa "/lib/libEGL.so.1")))
1016 (substitute* "glfw/egl_context.c"
1017 (("libEGL.so.1") libegl)))
1018 #t))
1019 (replace 'build
1020 (lambda _
1021 (invoke "python3" "setup.py" "linux-package")))
1022 (replace 'check
1023 (lambda _
1024 (invoke "python3" "setup.py" "test")))
1025 (add-before 'install 'rm-pycache
1026 ;; created python cache __pycache__ are non deterministic
1027 (lambda _
1028 (let ((pycaches (find-files "linux-package/"
1029 "__pycache__"
1030 #:directories? #t)))
1031 (for-each delete-file-recursively pycaches)
1032 #t)))
1033 (replace 'install
1034 (lambda _
1035 (let* ((out (assoc-ref %outputs "out"))
1036 (obin (string-append out "/bin"))
1037 (olib (string-append out "/lib"))
1038 (oshare (string-append out "/share")))
1039 (copy-recursively "linux-package/bin" obin)
1040 (copy-recursively "linux-package/share" oshare)
1041 (copy-recursively "linux-package/lib" olib)
1042 #t))))))
1043 (synopsis "Fast, featureful, GPU based terminal emulator")
1044 (description "Kitty is a fast and featureful GPU-based terminal emulator:
1045 @itemize
1046 @item Offloads rendering to the GPU for lower system load and buttery smooth
1047 scrolling. Uses threaded rendering to minimize input latency.
1048 @item Supports all modern terminal features: graphics (images), unicode,
1049 true-color, OpenType ligatures, mouse protocol, focus tracking, bracketed
1050 paste and several new terminal protocol extensions.
1051 @item Supports tiling multiple terminal windows side by side in different
1052 layouts without needing to use an extra program like tmux.
1053 @item Can be controlled from scripts or the shell prompt, even over SSH.
1054 @item Has a framework for Kittens, small terminal programs that can be used to
1055 extend kitty's functionality. For example, they are used for Unicode input,
1056 hints, and side-by-side diff.
1057 @item Supports startup sessions which allow you to specify the window/tab
1058 layout, working directories and programs to run on startup.
1059 @item Allows you to open the scrollback buffer in a separate window using
1060 arbitrary programs of your choice. This is useful for browsing the history
1061 comfortably in a pager or editor.
1062 @end itemize")
1063 (license license:gpl3+)))
1064
1065 (define-public eternalterminal
1066 (package
1067 (name "eternalterminal")
1068 (version "5.1.10")
1069 (source
1070 (origin
1071 (method git-fetch)
1072 (uri (git-reference
1073 (url "https://github.com/MisterTea/EternalTerminal.git")
1074 (commit (string-append "et-v" version))))
1075 (file-name (git-file-name name version))
1076 (sha256
1077 (base32 "0jh89229bd9s82h3aj6faaybwr5xvnk8w2kgz47gq263pz021zpl"))))
1078 (build-system cmake-build-system)
1079 (arguments
1080 '(#:configure-flags '("-DBUILD_TEST=ON")
1081 #:phases
1082 (modify-phases %standard-phases
1083 (add-after 'unpack 'insert-googletests
1084 (lambda* (#:key inputs #:allow-other-keys)
1085 (let ((tests (assoc-ref inputs "googletest")))
1086 (copy-recursively tests "external/googletest"))
1087 #t))
1088 (add-after 'install 'dont-provide-gtest-libraries
1089 (lambda* (#:key outputs #:allow-other-keys)
1090 (let ((out (assoc-ref outputs "out")))
1091 (delete-file-recursively (string-append out "/include"))
1092 (delete-file-recursively (string-append out "/lib")))
1093 #t)))))
1094 (inputs
1095 `(("gflags" ,gflags)
1096 ("libsodium" ,libsodium)
1097 ("protobuf" ,protobuf)))
1098 (native-inputs
1099 `(("googletest" ,(package-source googletest))))
1100 (home-page "https://mistertea.github.io/EternalTerminal/")
1101 (synopsis "Remote shell that reconnects without interrupting the session")
1102 (description "@dfn{Eternal Terminal} (ET) is a remote shell that
1103 automatically reconnects without interrupting the session. ET uses SSH to
1104 initialize a secure connection. Unlike SSH sessions, which must be killed and
1105 reconnected after a network outage an ET session will survive network outages
1106 and IP roaming. ET provides the same core functionality as @command{mosh},
1107 while also supporting native scrolling and @command{tmux} control mode
1108 (@code{tmux -CC}).")
1109 (license license:asl2.0)))
1110
1111 (define-public wterm
1112 (package
1113 (name "wterm")
1114 (version "0.7")
1115 (source
1116 (origin
1117 (method git-fetch)
1118 (uri (git-reference
1119 (url "https://github.com/majestrate/wterm.git")
1120 (commit "0ae42717c08a85a6509214e881422c7fbe7ecc45")))
1121 (sha256
1122 (base32
1123 "0g4lzmc1w6na81i6hny32xds4xfig4xzswzfijyi6p93a1226dv0"))
1124 (file-name (git-file-name name version))))
1125 (build-system gnu-build-system)
1126 (native-inputs
1127 `(("pkg-config" ,pkg-config)))
1128 (inputs
1129 `(("fontconfig" ,fontconfig)
1130 ("freetype" ,freetype)
1131 ("libdrm" ,libdrm)
1132 ("libxkbcommon" ,libxkbcommon)
1133 ("ncurses" ,ncurses)
1134 ("pixman" ,pixman)
1135 ("wayland" ,wayland)))
1136 (arguments
1137 '(#:tests? #f
1138
1139 ;; Without -j1 it fails to find file libwld.a.
1140 #:parallel-build? #f
1141
1142 #:make-flags (list "CC=gcc"
1143 (string-append "PREFIX=" %output)
1144 (string-append "TERMINFO="
1145 (assoc-ref %outputs "out")
1146 "/share/terminfo"))
1147 #:phases
1148 (modify-phases %standard-phases
1149 (delete 'configure)
1150 (add-after 'unpack 'terminfo-fix
1151 (lambda _
1152 (substitute* "Makefile"
1153 (("\ttic .*") "\tmkdir -p $(SHARE_PREFIX)/share/terminfo
1154 \ttic -o $(SHARE_PREFIX)/share/terminfo -s wterm.info\n"))
1155 #t)))))
1156 (native-search-paths
1157 (list (search-path-specification
1158 (variable "TERMINFO_DIRS")
1159 (files '("share/terminfo")))))
1160 (home-page "https://github.com/majestrate/wterm")
1161 (synopsis "Terminal emulator for Wayland")
1162 (description "wterm is a native Wayland terminal emulator based on
1163 an st fork using wld. st is a simple terminal emulator for X originally
1164 made by suckless.")
1165 (license license:x11)))