;;; jao-x11.el --- keyboard settings -*- lexical-binding: t; -*- ;; Copyright (C) 2026 jao ;; Author: jao ;; 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 . (require 'jao-shell) ;;; Brightness (jao-shell-def-exec jao-bright-set-up "brightnessctl" "-q" "s" "5%+") (jao-shell-def-exec jao-bright-set-down "brightnessctl" "-q" "s" "5%-") (defun jao-brightness () (string-trim (or (cadr (jao-shell-cmd-lines "brightnessctl")) "(Unknown)"))) ;;;###autoload (defun jao-bright-show () (interactive) (message "%s" (jao-brightness))) ;;;###autoload (defun jao-bright-up () (interactive) (jao-shell-exec "brightnessctl -q s 5%%+" t) (jao-bright-show)) ;;;###autoload (defun jao-bright-down () (interactive) (jao-shell-exec "brightnessctl -q s 5%%-" t) (jao-bright-show)) ;;; Keyboard ;;;###autoload (defun jao-kb-layout () (string-trim (shell-command-to-string "setxkbmap -query | grep 'layout:' | awk '{print $2}'"))) ;;;###autoload (defun jao-kb-set (lyt &optional intl) (interactive "sLayout: ") (let ((intl (if intl " -variant intl" ""))) (shell-command-to-string (format "setxkbmap %s%s" lyt intl)))) ;;;###autoload (defun jao-kb-toggled-p () (not (string-empty-p (shell-command-to-string "setxkbmap -query|grep variant")))) ;;;###autoload (defun jao-kb-toggle () (interactive) (jao-kb-set (jao-kb-layout) (not (jao-kb-toggled-p)))) ;;;###autoload (defun jao-kb-disable-laptop () (interactive) (jao-shell-exec "xinput float 13")) (provide 'jao-x11-kbd) ;;; jao-x11.el ends here