105 lines
3.1 KiB
EmacsLisp
105 lines
3.1 KiB
EmacsLisp
;;; terminal.el --- Userland terminal with vterm -*- lexical-binding: t -*-
|
|
|
|
;; This file is not part of GNU Emacs
|
|
|
|
;; This program is free software: you can redistribute it and/or modify
|
|
;; it under the terms of the GNU General Public License as published by
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
;; (at your option) any later version.
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
;; GNU General Public License for more details.
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
;; commentary
|
|
|
|
;;; Code:
|
|
|
|
(require 'transient)
|
|
|
|
(defcustom theurgy-enable-vterm-windows nil
|
|
"Whether `vterm' should be enabled on Windows sytems."
|
|
:type 'boolean
|
|
:group 'theurgy
|
|
:group 'theurgy-compat)
|
|
|
|
(when (or (not (equal system-type 'windows-nt)) theurgy-enable-vterm-windows)
|
|
(use-package vterm
|
|
:ensure t))
|
|
|
|
(defun theurgy-shell ()
|
|
(interactive)
|
|
(if (fboundp 'vterm)
|
|
'vterm
|
|
'shell))
|
|
|
|
(defun theurgy-bottom-shell ()
|
|
"Put a shell in the bottom of the frame."
|
|
(interactive)
|
|
(let ((win (car (window-at-side-list nil 'bottom))))
|
|
(if (and win (equal 'bottom (window-parameter win 'window-side)))
|
|
(delete-window win)
|
|
(funcall (theurgy-shell)))))
|
|
|
|
(defun theurgy-main-shell ()
|
|
"Put a shell in a main window."
|
|
(interactive)
|
|
(if (get-buffer "*Shell Session*")
|
|
(switch-to-buffer "*Shell Session*")
|
|
(funcall (theurgy-shell) "*Shell Session*")))
|
|
|
|
(defun theurgy-gomuks ()
|
|
"Launch gomuks as it's own buffer."
|
|
(interactive)
|
|
(if (get-buffer "*Gomuks*")
|
|
(switch-to-buffer "*Gomuks*")
|
|
(funcall (theurgy-shell) "*Gomuks*")
|
|
(let ((buf (current-buffer)))
|
|
(vterm-send-string "gomuks")
|
|
(vterm-send-return)
|
|
(rename-buffer "Gomuks"))))
|
|
|
|
(defun theurgy-gomuks-workspace ()
|
|
"Launch gomuks as a workspace."
|
|
(interactive)
|
|
(theurgy-gomuks)
|
|
(tab-rename "Gomuks")
|
|
(tab-bar-change-tab-group "userland: gomuks"))
|
|
|
|
(define-key global-map (kbd "C-<return>") 'theurgy-main-shell)
|
|
|
|
(global-set-key (kbd "M-RET") 'theurgy-bottom-shell)
|
|
(define-key vterm-mode-map (kbd "M-RET") 'theurgy-bottom-shell)
|
|
|
|
(add-to-list 'display-buffer-alist
|
|
'("\\*vterm\\*\\|\\*shell\\*"
|
|
(display-buffer-in-side-window)
|
|
(side . bottom)
|
|
(slot . 0)
|
|
(window-height . 0.2)))
|
|
|
|
(use-package restart-emacs)
|
|
|
|
(use-package system-packages)
|
|
|
|
(transient-define-prefix system-interactions-transient ()
|
|
"Transient menu for interfacing with the system via system-packages and restart."
|
|
["Emacs system actions" ("R" "Restart" restart-emacs)]
|
|
["Package..." ("s" "Search" system-packages-search)
|
|
("u" "Update" system-packages-update)
|
|
("i" "Install" system-packages-install)
|
|
("r" "Uninstall" system-packages-uninstall)
|
|
("o" "Remove Orphans" system-packages-remove-orphaned)])
|
|
|
|
(define-key global-map (kbd "C-c o s") #'system-interactions-transient)
|
|
|
|
(provide 'terminal)
|
|
|
|
;;; terminal.el ends here
|