It's kind of hard to modify or disable some of the bindings
WJCFerguson opened this issue · comments
Thanks for this package - it seems useful.
It would be nice if the bindings were more easily modified. e.g. like many, in exwm I use super with hjkl to move around with windmove
. There has been some swearing at my laptop as I accidentally locked my screen multiple times in trying to work out how to disable it, not least because slock
just gives me a red screen and no option to unlock(? - never used slock before), so I had to switch to another VT and kill slock.
The neatest way I found to disable s-l
was:
(use-package desktop-environment
:after exwm
:diminish desktop-environment-mode
:init (progn
;; get rid of s-l binding
(setq desktop-environment--keybindings
(delq (assoc (kbd "s-l") desktop-environment--keybindings)
desktop-environment--keybindings))
(desktop-environment-mode)))
Or is there an easier way to remove something from an alist?
Making that list a customization item would probably be the easiest?
I'm sorry for the problems you had to face.
slock
just gives me a red screen
when you see a red screen, type your password (the screen is blue while doing that) and validate with RET
The neatest way I found to disable
s-l
was [...]
you could try something like:
(unbind-key "s-l" desktop-environment-mode-map)
(exwm-input-set-key (kbd "s-l") nil)
(exwm-input--update-global-prefix-keys)
Maybe @ch11ng has a better idea.
Closer to your idea and maybe a bit simpler:
(setf
(alist-get (kbd "s-l") desktop-environment--keybindings nil t #'equal)
nil)
Could you please send a PR with a change in the README explaining such a workaround?
Making that list a customization item would probably be the easiest?
why not. Would you mind doing a prototype?
Ha - that explains slock thanks. Funny the man page makes no mention of how it works.
Fair request on the customization - I'll put it in my todo list but can't guarantee when I'll get to it :).
I don't know emacs lisp very much, I have found that the following code works.
(let (previous-keybinding)
(use-package desktop-environment
:after exwm
:diminish desktop-environment-mode
:init (progn
(setq previous-keybinding
(alist-get (elt (kbd "s-l") 0) global-map nil nil #'equal))
(desktop-environment-mode)))
(with-eval-after-load 'desktop-environment
(unbind-key "s-l" desktop-environment-mode-map)
(exwm-input-set-key (kbd "s-l") previous-keybinding)
(exwm-input--update-global-prefix-keys)))
Some recent improvements made by @Ambrevar should let you do something simpler (untested):
(use-package desktop-environment
:demand t
:after exwm
:diminish desktop-environment-mode
:config
(progn
(unbind-key "s-l" desktop-environment-mode-map)
(desktop-environment-mode)))
@DamienCassou
Thank you for the tip.
It seems that your suggestion makes s-l
undefined.
But with a slight change, I could obtain a solution.
(use-package desktop-environment
:demand t
:after exwm
:diminish desktop-environment-mode
:config
(progn
(setf
(alist-get (elt (kbd "s-l") 0) desktop-environment-mode-map nil t)
nil)
(desktop-environment-mode)))
For anyone looking online, this is the solution I found in the exwm layer for spacemacs and the one which seems to be the simplest:
(use-package desktop-environment
:after exwm
:config
(setq desktop-environment-update-exwm-global-keys :prefix)
(define-key desktop-environment-mode-map (kbd "s-l") nil)
(desktop-environment-mode))