diff --git a/ReadMe.md b/ReadMe.md index de503ce..596d7da 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -1,61 +1,101 @@ -* 功能介绍 -本工具是为Windows Emacs用户定制的小工具集,目前主要实现的功能都跟窗口有关,含: -1. `pop-select/gui-set-transparent` -设置Emacs窗口透明,设置代码: +鍔熻兘浠嬬粛 +=== +鏈珽macs module涓撲负windows璁捐銆備富瑕佸姛鑳芥湁锛 +# 1. 璁剧疆Emacs绐楀彛閫忔槑 # +鏈変袱绉嶆柟寮 +- 璁剧疆鏁翠釜emacs閫忔槑銆 ``` -(ignore-errors (module-load "pop_select.dll全路径,如果没有加入bin路径的话")) -(when (functionp 'pop-select/gui-set-transparent) +(pop-select/transparent-set-all-frame ALPHA) ;; 瀵规墍鏈塮rame璁剧疆閫忔槑锛孉LPHA鑼冨洿0-255锛0鍏ㄩ忔槑锛255涓嶉忔槑 +(pop-select/transparent-set-current-frame ALPHA) ;; 鍙褰撳墠frame璁剧疆閫忔槑锛屽叾瀹冨悓涓 +``` +绀轰緥璁剧疆锛 +``` +(ignore-errors (module-load "pop_select.dll鍏ㄨ矾寰勶紝濡傛灉娌℃湁鍔犲叆bin璺緞鐨勮瘽")) +(when (functionp 'pop-select/transparent-set-all-frame) + (pop-select/transparent-set-all-frame 220)) +``` +- 璁剧疆鏂囧瓧涓嶉忔槑锛岃儗鏅忔槑銆傜敱浜庡疄鐜扮殑闄愬埗锛岃鍔熻兘鎵撳紑鏃朵細浣縀macs缃《锛屽綋璁剧疆涓255鍗充笉閫忔槑鏃跺彇娑堢疆椤 +``` +(pop-select/transparent-set-background ALPHA R G B) ;; ALPHA鑼冨洿0-255锛0鍏ㄩ忔槑锛255涓嶉忔槑銆俁 G B涓簉gb鎷嗗垎鏁板笺 +``` +绀轰緥璁剧疆锛岀敤CTRL+榧犳爣婊氳疆璋冩暣褰撳墠鐨勯忔槑搴︼細 +``` +(ignore-errors (module-load "pop_select.dll鍏ㄨ矾寰勶紝濡傛灉娌℃湁鍔犲叆bin璺緞鐨勮瘽")) +(when (functionp 'pop-select/transparent-set-background) (defvar cur-transparent 255) - (defconst step-transparent 20) ;; 每次增大/减小透明度的数值 - (pop-select/gui-set-transparent cur-transparent) + (defconst step-transparent 20) (defun dec-transparent() (interactive) (setq cur-transparent (min 255 (+ cur-transparent step-transparent))) - (pop-select/gui-set-transparent cur-transparent)) + (let* ((rgb (color-name-to-rgb (face-background 'default))) + (r (round (*(nth 0 rgb) 255))) + (g (round (*(nth 1 rgb) 255))) + (b (round (*(nth 2 rgb) 255)))) + (pop-select/transparent-set-background cur-transparent r g b) + ) + ) (defun inc-transparent() (interactive) (setq cur-transparent (max 0 (- cur-transparent step-transparent))) - (pop-select/gui-set-transparent cur-transparent)) + (let* ((rgb (color-name-to-rgb (face-background 'default))) + (r (round (*(nth 0 rgb) 255))) + (g (round (*(nth 1 rgb) 255))) + (b (round (*(nth 2 rgb) 255)))) + (pop-select/transparent-set-background cur-transparent r g b) + )) (global-set-key (kbd "") 'dec-transparent) (global-set-key (kbd "") 'inc-transparent) ) ``` -2. `pop-select/pop-select` -弹出一个竖型列表窗口,然后可以按ctrl+tab切换到下一项,ctrl+tab+shift切换到上一项,释放按键后返回所选项给emacs +鍚庨潰杩欑鏁堟灉鍥撅細 +![gif](gif/1.gif) + +# 2. CTRL+TAB寮瑰嚭绐楀彛閫夋嫨鍒楄〃 # +`pop-select/pop-select`寮瑰嚭涓涓珫鍨嬪垪琛ㄧ獥鍙o紝鐒跺悗鍙互鎸塩trl+tab鍒囨崲鍒颁笅涓椤癸紝ctrl+tab+shift鍒囨崲鍒颁笂涓椤癸紝閲婃斁鎸夐敭鍚庤繑鍥炴墍閫夐」缁檈macs +``` +(pop-select/pop-select NAME TO-SEL) ;; NAME涓簐ector鍒楄〃锛孴O-SEL鏄垵濮嬮変腑鍝」 +``` ``` (when (fboundp 'pop-select/pop-select) (defun my-pop-select(&optional backward) (interactive) (let* ((myswitch-buffer-list (copy-sequence (buffer-list) - ) + ) ) (vec_name []) sel ) (cl-dolist (buf myswitch-buffer-list) (setq vec_name (vconcat vec_name (list (buffer-name buf))))) - ;; 返回序号 + ;; 杩斿洖搴忓彿 (setq sel (pop-select/pop-select vec_name (if backward (1- (length vec_name)) 1 ))) (let ((buf (switch-to-buffer (nth sel myswitch-buffer-list)))) (when (and (bufferp buf) (featurep 'wcy-desktop)) - (with-current-buffer buf - (when (eq major-mode 'not-loaded-yet) - (wcy-desktop-load-file)))) + (with-current-buffer buf + (when (eq major-mode 'not-loaded-yet) + (wcy-desktop-load-file)))) ) ) ) (global-set-key (kbd "") 'my-pop-select) (global-set-key (if (string-equal system-type "windows-nt") - (kbd "") - (kbd "")) + (kbd "") + (kbd "")) (lambda ()(interactive) (my-pop-select t))) ) ``` -3. `pop-select/beacon-blink`和`pop-select/beacon-set-parameters` -用于替换beacon的闪烁效果,完全不卡Emacs窗口,因为是另起了一个专门的ui线程来画beacon +鏁堟灉鍥撅細 +![gif](gif/2.gif) + +# 3. "寮傛"beacon鏁堟灉 # +鐢ㄤ簬鏇挎崲beacon鐨勯棯鐑佹晥鏋滐紝瀹屽叏涓嶅崱Emacs绐楀彛锛屽洜涓烘槸鍙﹁捣浜嗕竴涓笓闂ㄧ殑ui绾跨▼鏉ョ敾beacon銆傚疄鐜板嚱鏁癭pop-select/beacon-blink`鍜宍pop-select/beacon-set-parameters` +``` +(pop-select/beacon-set-parameters WIDTH HEIGHT R G B DURATION-STEP) ;; 鍙缃搴︼紝楂樺害锛宺gb鑹诧紝浠ュ強blink鏁堟灉鏄剧ず鏃堕棿 +(pop-select/beacon-blink X Y TIMER DELAY) ;; 鍦╔, Y鍧愭爣鏄剧ずTIMER鏃堕暱锛孌ELAY鏄欢杩熸樉绀烘椂闂 +``` ``` (when (fboundp 'pop-select/beacon-set-parameters) ;; 51afef @@ -66,13 +106,13 @@ (setq beacon-blink-when-focused t) (setq beacon-blink-delay 0.01) (setq beacon-blink-duration 0.2) - (setq beacon-blink-when-window-scrolls nil) ; 开启了auto save,保存时都会闪故而屏蔽 + (setq beacon-blink-when-window-scrolls nil) ; 寮鍚簡auto save锛屼繚瀛樻椂閮戒細闂晠鑰屽睆钄 :config (beacon-mode 1) (defadvice beacon-blink (around my-beacon-blink activate) - ;; 目前偶尔不是emacs时也弹窗 + ;; 鐩墠鍋跺皵涓嶆槸emacs鏃朵篃寮圭獥 ;; (message (concat (symbol-name this-command) " " (symbol-name last-command))) - (when (frame-visible-p (window-frame)) ;; 可以阻止最小化时弹窗 + (when (frame-visible-p (window-frame)) ;; 鍙互闃绘鏈灏忓寲鏃跺脊绐 (let ((p (window-absolute-pixel-position))) (when p (pop-select/beacon-blink (car p) ; x @@ -82,3 +122,6 @@ )))))) ) ``` +鏁堟灉鍥捐窡涓婇潰涓鏍凤細 +![gif](gif/2.gif) + diff --git a/gif/1.gif b/gif/1.gif new file mode 100644 index 0000000..6c26d58 Binary files /dev/null and b/gif/1.gif differ diff --git a/gif/2.gif b/gif/2.gif new file mode 100644 index 0000000..b5c7887 Binary files /dev/null and b/gif/2.gif differ