modern_lisp-machine/stumpwm/init.lisp

157 lines
4.9 KiB
Common Lisp

(in-package :stumpwm)
(add-to-load-path "~/.guix-profile/share/common-lisp/sbcl/stumpwm-ttf-fonts/")
(add-to-load-path "~/.guix-profile/share/common-lisp/sbcl/stumpwm-swm-gaps/")
;;(add-to-list )
;;;; gaps
;;(load-module "swm-gaps")
;;
(when *initializing*
(mode-line))
(run-shell-command "xmodmap -e 'clear mod4'" t) ;; clears windowskey/mod4
(run-shell-command "xmodmap -e 'keycode 133 = F20'" t) ;;assigns F20 to keycode 133
(set-prefix-key (kbd "F20")) ;; sets prefix to F20 which was just assigned to windows key
(run-shell-command "exec feh --bg-fill ~/wallpaper.jpg & picom -b")
(run-shell-command "xrandr --output HDMI-A-0 --mode 1366x768")
(defcommand nyxt () ()
(run-or-raise "nyxt" '(:class "Nyxt")))
(define-key *top-map* (kbd "M-p") "nyxt")
;; in the case i want a new terminal
(define-key *top-map* (kbd "M-l") "exec alacritty")
;; for reusing a open terminal
(defcommand terminal () ()
(run-or-raise "alacritty" '(:class "Alacritty")))
(define-key *top-map* (kbd "M-v") "terminal")
(define-key *top-map* (kbd "M-d") "exec rofi -show run")
(define-key *root-map* (kbd "R") "restart-hard")
;; Frames
(define-key *root-map* (kbd "x") "hsplit")
(define-key *root-map* (kbd "z") "vsplit")
(define-key *root-map* (kbd "n") "remove-split")
(define-key *root-map* (kbd "Q") "quit")
(define-key *root-map* (kbd "q") "delete")
(define-key *root-map* (kbd "r") "remove")
(define-key *root-map* (kbd "h") "move-focus left")
(define-key *root-map* (kbd "j") "move-focus down")
(define-key *root-map* (kbd "k") "move-focus up")
(define-key *root-map* (kbd "l") "move-focus right")
(define-key *top-map* (kbd "H") "move-window left")
(define-key *top-map* (kbd "J") "move-window down")
(define-key *top-map* (kbd "K") "move-window up")
(define-key *top-map* (kbd "L") "move-window right")
(setf *mouse-focus-policy* :click)
(define-key *top-map* (kbd "M-n") "exec xmodmap -e 'clear mod4' && exec xmodmap -e 'keycode 133 = F20'")
(run-shell-command "xrdb /home/hashirama/.Xresources")
(run-shell-command "export GTK_IM_MODULE=fcitx")
(run-shell-command "export QT_IM_MODULE=fcitx")
(run-shell-command "export export XMODIFIERS=@im=fcitx")
(define-key *top-map* (kbd "M-e") "exec ~/.local/bin/goldendict")
(defun pretty-time ()
"日付を '17:19:51 2014年4月27日、日曜日' の形式で返します。"
(defun stringify-dow (dow)
(nth dow '("月曜日" "火曜日" "水曜日" "木曜日" "金曜日" "土曜日" "日曜日")))
(defun stringify-mon (mon)
(nth (- mon 1) '("1月" "2月" "3月" "4月"
"5月" "6月" "7月" "8月"
"9月" "10月" "11月" "12月")))
(multiple-value-bind (sec min hr date mon yr dow dst-p tz)
(get-decoded-time)
(format NIL "~2,'0d:~2,'0d:~2,'0d ~d年~a時 ~d分、~a秒"
yr (stringify-mon mon)
date (stringify-dow dow)
hr min sec)))
;; ----
(setf *mode-line-timeout* 2)
;;---
(defvar *senju/workspaces*
;; (list "一" "二" "三" "四" "五" "六" "七" "八" "九" "十" "数学" "勉強"))
(list "一" "二" "三" "四" "五" "六" "七" "八" "九" "十" "数学" "勉強"))
(stumpwm:grename (nth 0 *senju/workspaces*))
(dolist (workspace (cdr *senju/workspaces*))
(stumpwm:gnewbg workspace))
(defvar *move-to-keybinds*
(list "!" "@" "#" "$" "%" "^" "&" "*" "(" "[" "]"))
(dotimes (y (length *senju/workspaces*))
(let ((workspace (write-to-string (+ y 1))))
(define-key *root-map* (kbd workspace) (concat "gselect " workspace))
(define-key *root-map* (kbd (nth y *move-to-keybinds*)) (concat "gmove-and-follow " workspace))))
(defun workspace-number-to-character (index)
(elt '("一" "二" "三" "四" "五" "六" "七" "八" "九" "十" "数学" "勉強") index))
;; Modify the modeline format to display group numbers as characters
(defvar *modeline-format*
'(" " (:eval (workspace-number-to-character (current-group))) " " mode-line-misc-info mode-line-client
mode-line-modified mode-line-frame-identification " " mode-line-buffer-identification))
(load-module "ttf-fonts")
(setf xft:*font-dirs* '("~/.local/share/fonts/"))
(xft:cache-fonts)
(set-font (make-instance 'xft:font :family "Iosevka Comfy,Iosevka Comfy SemiLight" :subfamily "SemiLight" :size 10))
(setf *startup-message* "fonts loaded")
(setf *screen-mode-line-format* (list "[^B%n^b] %W^>%d"))
(setf *mode-line-timeout* 2)
(setf *screen-mode-line-format*
(list "[^B%n^b] %W " ; groups/windows
"^>" ; right align
(list '(:eval (concat "| "
" |")))
" ^7* " '(:eval (pretty-time)); date
))
;; gaps
(load-module "swm-gaps")
(setf swm-gaps:*inner-gaps-size* 10
swm-gaps:*outer-gaps-size* 5
swm-gaps:*head-gaps-size* 5)
(when *initializing*
(swm-gaps:toggle-gaps))