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