mirror of
https://github.com/pestctrl/emacs-config.git
synced 2026-02-16 08:14:15 +00:00
Otehr split stuff
This commit is contained in:
parent
a3d7f5af5c
commit
07c7af33ed
3 changed files with 142 additions and 0 deletions
40
lisp/keyboard-toggle.el
Normal file
40
lisp/keyboard-toggle.el
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
;;; keyboard-toggle.el --- -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2020 Benson Chu
|
||||
|
||||
;; Author: Benson Chu <bensonchu457@gmail.com>
|
||||
;; Created: [2020-01-25 13:44]
|
||||
|
||||
;; 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:
|
||||
|
||||
;;; Code:
|
||||
(defun dvorak? ()
|
||||
(string-match-p "de(neo_dvorak)"
|
||||
(shell-command-to-string "setxkbmap -v | grep symbols")))
|
||||
|
||||
(defun set-keyboard (layout)
|
||||
(shell-command (format "setxkbmap %s" layout)))
|
||||
|
||||
(defun my/toggle-keyboard ()
|
||||
(interactive)
|
||||
(if (dvorak?)
|
||||
(set-keyboard "us")
|
||||
(set-keyboard "de neo_dvorak")))
|
||||
|
||||
(provide 'keyboard-toggle)
|
||||
;;; keyboard-toggle.el ends here
|
||||
48
lisp/old-and-broken/workspace-prompter.el
Normal file
48
lisp/old-and-broken/workspace-prompter.el
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
;;; workspace-prompter.el --- -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2020 Benson Chu
|
||||
|
||||
;; Author: Benson Chu <bensonchu457@gmail.com>
|
||||
;; Created: [2020-01-25 13:43]
|
||||
|
||||
;; 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:
|
||||
|
||||
;;; Code:
|
||||
|
||||
|
||||
(defun prompt-workspace (&optional prompt)
|
||||
"Prompt for a workspace, returning the workspace frame."
|
||||
(exwm-workspace--update-switch-history)
|
||||
(let* ((current-idx (exwm-workspace--position exwm-workspace--current))
|
||||
(history-add-new-input nil) ;prevent modifying history
|
||||
(history-idx (read-from-minibuffer
|
||||
(or prompt "Workspace: ")
|
||||
(elt exwm-workspace--switch-history current-idx)
|
||||
exwm-workspace--switch-map nil
|
||||
`(exwm-workspace--switch-history . ,current-idx)))
|
||||
(workspace-idx (mod (1- (cl-position history-idx exwm-workspace--switch-history
|
||||
:test #'equal))
|
||||
10)))
|
||||
(elt exwm-workspace--list workspace-idx)))
|
||||
|
||||
(advice-add 'exwm-workspace--prompt-for-workspace
|
||||
:override
|
||||
#'prompt-workspace)
|
||||
|
||||
(provide 'workspace-prompter)
|
||||
;;; workspace-prompter.el ends here
|
||||
54
lisp/side-window-split.el
Normal file
54
lisp/side-window-split.el
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
;;; side-window-split.el --- -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2020 Benson Chu
|
||||
|
||||
;; Author: Benson Chu <bensonchu457@gmail.com>
|
||||
;; Created: [2020-01-25 13:36]
|
||||
|
||||
;; 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:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defun side-window-op (side &optional size buffer)
|
||||
(let ((prev-win (selected-window))
|
||||
(win (display-buffer-in-side-window
|
||||
(or buffer (current-buffer))
|
||||
`((side . ,side)))))
|
||||
(select-window win)
|
||||
(set-window-dedicated-p win t)
|
||||
(set-window-parameter win 'no-delete-other-windows t)
|
||||
(when size
|
||||
(window-resize win (- size (window-pixel-width)) t nil t))
|
||||
(select-window prev-win)))
|
||||
|
||||
(defun side-left-window ()
|
||||
(interactive)
|
||||
(side-window-op 'left))
|
||||
|
||||
(defun side-right-window ()
|
||||
(interactive)
|
||||
(side-window-op 'right))
|
||||
|
||||
(defun side-bottom-window ()
|
||||
(interactive)
|
||||
(side-window-op 'bottom))
|
||||
|
||||
(setq window-sides-vertical t)
|
||||
|
||||
(provide 'side-window-split)
|
||||
;;; side-window-split.el ends here
|
||||
Loading…
Reference in a new issue