mirror of
http://github.com/JaeUs3792/dotfiles
synced 2025-12-14 08:01:35 +09:00
Exwm : Buffer handling
This commit is contained in:
@ -1,25 +1,30 @@
|
|||||||
|
(straight-use-package
|
||||||
|
'(app-launcher :type git :host github :repo "SebastienWae/app-launcher"))
|
||||||
|
|
||||||
(defun efs/run-in-background (command)
|
(defun efs/run-in-background (command)
|
||||||
(let ((command-parts (split-string command "[ ]+")))
|
(let ((command-parts (split-string command "[ ]+")))
|
||||||
(apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts)))))
|
(apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts)))))
|
||||||
|
(defun vifon/exwm-terminal ()
|
||||||
|
(interactive)
|
||||||
|
(let ((default-directory (if (derived-mode-p 'dired-mode)
|
||||||
|
(dired-current-directory)
|
||||||
|
default-directory)))
|
||||||
|
(start-process "alacritty" nil "alacritty")))
|
||||||
(defun efs/exwm-init-hook ()
|
(defun efs/exwm-init-hook ()
|
||||||
;; Make workspace 1 be the one where we land at startup
|
;; Make workspace 1 be the one where we land at startup
|
||||||
(exwm-workspace-switch-create 1)
|
(exwm-workspace-switch-create 1)
|
||||||
(efs/start-panel)
|
(efs/start-panel)
|
||||||
;; if not wsl
|
;; if not wsl
|
||||||
(efs/run-in-background "xsetroot -cursor_name left_ptr &")
|
;;(efs/run-in-background "xsetroot -cursor_name left_ptr")
|
||||||
(efs/run-in-background "nm-applet &")
|
;;(efs/run-in-background "nm-applet")
|
||||||
(efs/run-in-background "pamac-tray &")
|
;;(efs/run-in-background "pamac-tray")
|
||||||
;;(efs/run-in-background "xfce4-power-manager &")
|
;;(efs/run-in-background "volumeicon")
|
||||||
(efs/run-in-background "volumeicon &")
|
;;(efs/run-in-background "numlockx on")
|
||||||
(efs/run-in-background "numlockx on &")
|
;;(efs/run-in-background "blueberry-tray")
|
||||||
(efs/run-in-background "blueberry-tray &")
|
|
||||||
(efs/run-in-background "fcitx &")
|
|
||||||
|
|
||||||
;; Launch apps that will run in the background
|
;; Launch apps that will run in the background
|
||||||
(efs/run-in-background "dwall -s firewatch")
|
(efs/run-in-background "fcitx")
|
||||||
(efs/run-in-background "picom -b --config $HOME/.xmonad/scripts/picom.conf &")
|
(efs/run-in-background "dwall -s firewatch"))
|
||||||
)
|
|
||||||
|
|
||||||
(defun efs/exwm-update-class ()
|
(defun efs/exwm-update-class ()
|
||||||
(exwm-workspace-rename-buffer exwm-class-name))
|
(exwm-workspace-rename-buffer exwm-class-name))
|
||||||
@ -37,21 +42,6 @@
|
|||||||
|
|
||||||
(exwm-floating-move (- pos-x) (- pos-y))))
|
(exwm-floating-move (- pos-x) (- pos-y))))
|
||||||
|
|
||||||
;;(defun efs/configure-window-by-class ()
|
|
||||||
;; (interactive)
|
|
||||||
;; (pcase exwm-class-name
|
|
||||||
;; ("vivaldi-stable" (exwm-workspace-move-window 2))
|
|
||||||
;; ("Sol" (exwm-workspace-move-window 3))
|
|
||||||
;; ("mpv" (exwm-floating-toggle-floating)
|
|
||||||
;; (exwm-layout-toggle-mode-line))))
|
|
||||||
|
|
||||||
;; This function should be used only after configuring autorandr!
|
|
||||||
;;(defun efs/update-displays ()
|
|
||||||
;; (efs/run-in-background "autorandr --change --force")
|
|
||||||
;; (efs/set-wallpaper)
|
|
||||||
;; (message "Display config: %s"
|
|
||||||
;; (string-trim (shell-command-to-string "autorandr --current"))))
|
|
||||||
|
|
||||||
(use-package exwm
|
(use-package exwm
|
||||||
:config
|
:config
|
||||||
;; Set the default number of workspaces
|
;; Set the default number of workspaces
|
||||||
@ -76,6 +66,10 @@
|
|||||||
(setq mouse-autoselect-window t
|
(setq mouse-autoselect-window t
|
||||||
focus-follows-mouse t)
|
focus-follows-mouse t)
|
||||||
|
|
||||||
|
(add-hook 'exwm-floating-setup-hook
|
||||||
|
(lambda ()
|
||||||
|
(exwm-layout-hide-mode-line)))
|
||||||
|
|
||||||
;; These keys should always pass through to Emacs
|
;; These keys should always pass through to Emacs
|
||||||
(setq exwm-input-prefix-keys
|
(setq exwm-input-prefix-keys
|
||||||
'(?\C-x
|
'(?\C-x
|
||||||
@ -112,6 +106,11 @@
|
|||||||
(interactive (list (read-shell-command "$ ")))
|
(interactive (list (read-shell-command "$ ")))
|
||||||
(start-process-shell-command command nil command)))
|
(start-process-shell-command command nil command)))
|
||||||
|
|
||||||
|
([?\s-C] . (lambda () (interactive) (kill-buffer)))
|
||||||
|
|
||||||
|
;; App
|
||||||
|
(,(kbd "<s-return>") . vifon/exwm-terminal)
|
||||||
|
(,(kbd "<s-SPC>") . app-launcher-run-app)
|
||||||
;; Switch workspace
|
;; Switch workspace
|
||||||
([?\s-w] . exwm-workspace-switch)
|
([?\s-w] . exwm-workspace-switch)
|
||||||
([?\s-`] . (lambda () (interactive) (exwm-workspace-switch-create 0)))
|
([?\s-`] . (lambda () (interactive) (exwm-workspace-switch-create 0)))
|
||||||
@ -124,19 +123,17 @@
|
|||||||
(exwm-workspace-switch-create ,i))))
|
(exwm-workspace-switch-create ,i))))
|
||||||
(number-sequence 0 9))))
|
(number-sequence 0 9))))
|
||||||
|
|
||||||
;;(require 'exwm-systemtray)
|
|
||||||
;;(setq exwm-systemtray-height 24)
|
|
||||||
;;(exwm-systemtray-enable)
|
|
||||||
(exwm-enable))
|
(exwm-enable))
|
||||||
|
|
||||||
(use-package desktop-environment
|
;; if not wsl
|
||||||
:after exwm
|
;;(use-package desktop-environment
|
||||||
:config (desktop-environment-mode)
|
;; :after exwm
|
||||||
:custom
|
;; :config (desktop-environment-mode)
|
||||||
(desktop-environment-brightness-small-increment "2%+")
|
;; :custom
|
||||||
(desktop-environment-brightness-small-decrement "2%-")
|
;; (desktop-environment-brightness-small-increment "2%+")
|
||||||
(desktop-environment-brightness-normal-increment "5%+")
|
;; (desktop-environment-brightness-small-decrement "2%-")
|
||||||
(desktop-environment-brightness-normal-decrement "5%-"))
|
;; (desktop-environment-brightness-normal-increment "5%+")
|
||||||
|
;; (desktop-environment-brightness-normal-decrement "5%-"))
|
||||||
|
|
||||||
;; Make sure the server is started (better to do this in your main Emacs config!)
|
;; Make sure the server is started (better to do this in your main Emacs config!)
|
||||||
(server-start)
|
(server-start)
|
||||||
|
|||||||
@ -13,42 +13,50 @@ DesktopNames=exwm
|
|||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+begin_src shell
|
#+begin_src shell
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Fire it up for WSL
|
# Fire it up for WSL
|
||||||
VETHER_IP=$(/bin/grep nameserver /etc/resolv.conf 2> /dev/null | /bin/tr -s ' ' | /bin/cut -d' ' -f2)
|
VETHER_IP=$(/bin/grep nameserver /etc/resolv.conf 2> /dev/null | /bin/tr -s ' ' | /bin/cut -d' ' -f2)
|
||||||
export DISPLAY=$VETHER_IP:10.0
|
export DISPLAY=$VETHER_IP:10.0
|
||||||
picom -b --config $HOME/.xmonad/scripts/picom.conf &
|
picom -b --config $HOME/.xmonad/scripts/picom.conf &
|
||||||
exec dbus-launch --exit-with-session emacs -mm --debug-init -l ~/.emacs.d/desktop.el
|
exec dbus-launch --exit-with-session emacs -mm --debug-init -l ~/.emacs.d/desktop.el
|
||||||
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
|
||||||
* Configuration
|
* Configuration
|
||||||
|
|
||||||
|
** App Launcher
|
||||||
|
#+begin_src emacs-lisp :tangle ~/.emacs.d/desktop.el
|
||||||
|
(straight-use-package
|
||||||
|
'(app-launcher :type git :host github :repo "SebastienWae/app-launcher"))
|
||||||
|
#+end_src
|
||||||
** EXWM
|
** EXWM
|
||||||
#+begin_src emacs-lisp :tangle ~/.emacs.d/desktop.el
|
#+begin_src emacs-lisp :tangle ~/.emacs.d/desktop.el
|
||||||
|
|
||||||
(defun efs/run-in-background (command)
|
(defun efs/run-in-background (command)
|
||||||
(let ((command-parts (split-string command "[ ]+")))
|
(let ((command-parts (split-string command "[ ]+")))
|
||||||
(apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts)))))
|
(apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts)))))
|
||||||
|
(defun vifon/exwm-terminal ()
|
||||||
|
(interactive)
|
||||||
|
(let ((default-directory (if (derived-mode-p 'dired-mode)
|
||||||
|
(dired-current-directory)
|
||||||
|
default-directory)))
|
||||||
|
(start-process "alacritty" nil "alacritty")))
|
||||||
(defun efs/exwm-init-hook ()
|
(defun efs/exwm-init-hook ()
|
||||||
;; Make workspace 1 be the one where we land at startup
|
;; Make workspace 1 be the one where we land at startup
|
||||||
(exwm-workspace-switch-create 1)
|
(exwm-workspace-switch-create 1)
|
||||||
(efs/start-panel)
|
(efs/start-panel)
|
||||||
;; if not wsl
|
;; if not wsl
|
||||||
(efs/run-in-background "xsetroot -cursor_name left_ptr &")
|
;;(efs/run-in-background "xsetroot -cursor_name left_ptr")
|
||||||
(efs/run-in-background "nm-applet &")
|
;;(efs/run-in-background "nm-applet")
|
||||||
(efs/run-in-background "pamac-tray &")
|
;;(efs/run-in-background "pamac-tray")
|
||||||
;;(efs/run-in-background "xfce4-power-manager &")
|
;;(efs/run-in-background "volumeicon")
|
||||||
(efs/run-in-background "volumeicon &")
|
;;(efs/run-in-background "numlockx on")
|
||||||
(efs/run-in-background "numlockx on &")
|
;;(efs/run-in-background "blueberry-tray")
|
||||||
(efs/run-in-background "blueberry-tray &")
|
|
||||||
(efs/run-in-background "fcitx &")
|
|
||||||
|
|
||||||
;; Launch apps that will run in the background
|
;; Launch apps that will run in the background
|
||||||
(efs/run-in-background "dwall -s firewatch")
|
(efs/run-in-background "fcitx")
|
||||||
(efs/run-in-background "picom -b --config $HOME/.xmonad/scripts/picom.conf &")
|
(efs/run-in-background "dwall -s firewatch"))
|
||||||
)
|
|
||||||
|
|
||||||
(defun efs/exwm-update-class ()
|
(defun efs/exwm-update-class ()
|
||||||
(exwm-workspace-rename-buffer exwm-class-name))
|
(exwm-workspace-rename-buffer exwm-class-name))
|
||||||
@ -66,21 +74,6 @@ exec dbus-launch --exit-with-session emacs -mm --debug-init -l ~/.emacs.d/deskto
|
|||||||
|
|
||||||
(exwm-floating-move (- pos-x) (- pos-y))))
|
(exwm-floating-move (- pos-x) (- pos-y))))
|
||||||
|
|
||||||
;;(defun efs/configure-window-by-class ()
|
|
||||||
;; (interactive)
|
|
||||||
;; (pcase exwm-class-name
|
|
||||||
;; ("vivaldi-stable" (exwm-workspace-move-window 2))
|
|
||||||
;; ("Sol" (exwm-workspace-move-window 3))
|
|
||||||
;; ("mpv" (exwm-floating-toggle-floating)
|
|
||||||
;; (exwm-layout-toggle-mode-line))))
|
|
||||||
|
|
||||||
;; This function should be used only after configuring autorandr!
|
|
||||||
;;(defun efs/update-displays ()
|
|
||||||
;; (efs/run-in-background "autorandr --change --force")
|
|
||||||
;; (efs/set-wallpaper)
|
|
||||||
;; (message "Display config: %s"
|
|
||||||
;; (string-trim (shell-command-to-string "autorandr --current"))))
|
|
||||||
|
|
||||||
(use-package exwm
|
(use-package exwm
|
||||||
:config
|
:config
|
||||||
;; Set the default number of workspaces
|
;; Set the default number of workspaces
|
||||||
@ -105,6 +98,10 @@ exec dbus-launch --exit-with-session emacs -mm --debug-init -l ~/.emacs.d/deskto
|
|||||||
(setq mouse-autoselect-window t
|
(setq mouse-autoselect-window t
|
||||||
focus-follows-mouse t)
|
focus-follows-mouse t)
|
||||||
|
|
||||||
|
(add-hook 'exwm-floating-setup-hook
|
||||||
|
(lambda ()
|
||||||
|
(exwm-layout-hide-mode-line)))
|
||||||
|
|
||||||
;; These keys should always pass through to Emacs
|
;; These keys should always pass through to Emacs
|
||||||
(setq exwm-input-prefix-keys
|
(setq exwm-input-prefix-keys
|
||||||
'(?\C-x
|
'(?\C-x
|
||||||
@ -141,6 +138,11 @@ exec dbus-launch --exit-with-session emacs -mm --debug-init -l ~/.emacs.d/deskto
|
|||||||
(interactive (list (read-shell-command "$ ")))
|
(interactive (list (read-shell-command "$ ")))
|
||||||
(start-process-shell-command command nil command)))
|
(start-process-shell-command command nil command)))
|
||||||
|
|
||||||
|
([?\s-C] . (lambda () (interactive) (kill-buffer)))
|
||||||
|
|
||||||
|
;; App
|
||||||
|
(,(kbd "<s-return>") . vifon/exwm-terminal)
|
||||||
|
(,(kbd "<s-SPC>") . app-launcher-run-app)
|
||||||
;; Switch workspace
|
;; Switch workspace
|
||||||
([?\s-w] . exwm-workspace-switch)
|
([?\s-w] . exwm-workspace-switch)
|
||||||
([?\s-`] . (lambda () (interactive) (exwm-workspace-switch-create 0)))
|
([?\s-`] . (lambda () (interactive) (exwm-workspace-switch-create 0)))
|
||||||
@ -153,19 +155,17 @@ exec dbus-launch --exit-with-session emacs -mm --debug-init -l ~/.emacs.d/deskto
|
|||||||
(exwm-workspace-switch-create ,i))))
|
(exwm-workspace-switch-create ,i))))
|
||||||
(number-sequence 0 9))))
|
(number-sequence 0 9))))
|
||||||
|
|
||||||
(require 'exwm-systemtray)
|
|
||||||
(setq exwm-systemtray-height 32)
|
|
||||||
(exwm-systemtray-enable)
|
|
||||||
(exwm-enable))
|
(exwm-enable))
|
||||||
|
|
||||||
(use-package desktop-environment
|
;; if not wsl
|
||||||
:after exwm
|
;;(use-package desktop-environment
|
||||||
:config (desktop-environment-mode)
|
;; :after exwm
|
||||||
:custom
|
;; :config (desktop-environment-mode)
|
||||||
(desktop-environment-brightness-small-increment "2%+")
|
;; :custom
|
||||||
(desktop-environment-brightness-small-decrement "2%-")
|
;; (desktop-environment-brightness-small-increment "2%+")
|
||||||
(desktop-environment-brightness-normal-increment "5%+")
|
;; (desktop-environment-brightness-small-decrement "2%-")
|
||||||
(desktop-environment-brightness-normal-decrement "5%-"))
|
;; (desktop-environment-brightness-normal-increment "5%+")
|
||||||
|
;; (desktop-environment-brightness-normal-decrement "5%-"))
|
||||||
|
|
||||||
;; Make sure the server is started (better to do this in your main Emacs config!)
|
;; Make sure the server is started (better to do this in your main Emacs config!)
|
||||||
(server-start)
|
(server-start)
|
||||||
|
|||||||
@ -1163,11 +1163,6 @@ https://emacs.stackexchange.com/a/30691
|
|||||||
(setq eshell-visual-commands '("htop" "zsh" "vim"))))
|
(setq eshell-visual-commands '("htop" "zsh" "vim"))))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
* App Launcher
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(straight-use-package
|
|
||||||
'(app-launcher :type git :host github :repo "SebastienWae/app-launcher"))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
* Dired (from Doom Emacs)
|
* Dired (from Doom Emacs)
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
|
|||||||
Reference in New Issue
Block a user