mirror of
http://github.com/JaeUs3792/dotfiles
synced 2025-12-13 23:51:34 +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)
|
||||
(let ((command-parts (split-string command "[ ]+")))
|
||||
(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 ()
|
||||
;; Make workspace 1 be the one where we land at startup
|
||||
(exwm-workspace-switch-create 1)
|
||||
(efs/start-panel)
|
||||
;; if not wsl
|
||||
(efs/run-in-background "xsetroot -cursor_name left_ptr &")
|
||||
(efs/run-in-background "nm-applet &")
|
||||
(efs/run-in-background "pamac-tray &")
|
||||
;;(efs/run-in-background "xfce4-power-manager &")
|
||||
(efs/run-in-background "volumeicon &")
|
||||
(efs/run-in-background "numlockx on &")
|
||||
(efs/run-in-background "blueberry-tray &")
|
||||
(efs/run-in-background "fcitx &")
|
||||
;;(efs/run-in-background "xsetroot -cursor_name left_ptr")
|
||||
;;(efs/run-in-background "nm-applet")
|
||||
;;(efs/run-in-background "pamac-tray")
|
||||
;;(efs/run-in-background "volumeicon")
|
||||
;;(efs/run-in-background "numlockx on")
|
||||
;;(efs/run-in-background "blueberry-tray")
|
||||
|
||||
;; Launch apps that will run in the background
|
||||
(efs/run-in-background "dwall -s firewatch")
|
||||
(efs/run-in-background "picom -b --config $HOME/.xmonad/scripts/picom.conf &")
|
||||
)
|
||||
(efs/run-in-background "fcitx")
|
||||
(efs/run-in-background "dwall -s firewatch"))
|
||||
|
||||
(defun efs/exwm-update-class ()
|
||||
(exwm-workspace-rename-buffer exwm-class-name))
|
||||
@ -37,21 +42,6 @@
|
||||
|
||||
(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
|
||||
:config
|
||||
;; Set the default number of workspaces
|
||||
@ -76,6 +66,10 @@
|
||||
(setq mouse-autoselect-window 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
|
||||
(setq exwm-input-prefix-keys
|
||||
'(?\C-x
|
||||
@ -112,6 +106,11 @@
|
||||
(interactive (list (read-shell-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
|
||||
([?\s-w] . exwm-workspace-switch)
|
||||
([?\s-`] . (lambda () (interactive) (exwm-workspace-switch-create 0)))
|
||||
@ -124,19 +123,17 @@
|
||||
(exwm-workspace-switch-create ,i))))
|
||||
(number-sequence 0 9))))
|
||||
|
||||
;;(require 'exwm-systemtray)
|
||||
;;(setq exwm-systemtray-height 24)
|
||||
;;(exwm-systemtray-enable)
|
||||
(exwm-enable))
|
||||
|
||||
(use-package desktop-environment
|
||||
:after exwm
|
||||
:config (desktop-environment-mode)
|
||||
:custom
|
||||
(desktop-environment-brightness-small-increment "2%+")
|
||||
(desktop-environment-brightness-small-decrement "2%-")
|
||||
(desktop-environment-brightness-normal-increment "5%+")
|
||||
(desktop-environment-brightness-normal-decrement "5%-"))
|
||||
;; if not wsl
|
||||
;;(use-package desktop-environment
|
||||
;; :after exwm
|
||||
;; :config (desktop-environment-mode)
|
||||
;; :custom
|
||||
;; (desktop-environment-brightness-small-increment "2%+")
|
||||
;; (desktop-environment-brightness-small-decrement "2%-")
|
||||
;; (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!)
|
||||
(server-start)
|
||||
|
||||
@ -13,42 +13,50 @@ DesktopNames=exwm
|
||||
#+end_src
|
||||
|
||||
#+begin_src shell
|
||||
#!/bin/sh
|
||||
# Fire it up for WSL
|
||||
VETHER_IP=$(/bin/grep nameserver /etc/resolv.conf 2> /dev/null | /bin/tr -s ' ' | /bin/cut -d' ' -f2)
|
||||
export DISPLAY=$VETHER_IP:10.0
|
||||
picom -b --config $HOME/.xmonad/scripts/picom.conf &
|
||||
exec dbus-launch --exit-with-session emacs -mm --debug-init -l ~/.emacs.d/desktop.el
|
||||
#!/bin/sh
|
||||
# Fire it up for WSL
|
||||
VETHER_IP=$(/bin/grep nameserver /etc/resolv.conf 2> /dev/null | /bin/tr -s ' ' | /bin/cut -d' ' -f2)
|
||||
export DISPLAY=$VETHER_IP:10.0
|
||||
picom -b --config $HOME/.xmonad/scripts/picom.conf &
|
||||
exec dbus-launch --exit-with-session emacs -mm --debug-init -l ~/.emacs.d/desktop.el
|
||||
|
||||
#+end_src
|
||||
|
||||
|
||||
* 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
|
||||
#+begin_src emacs-lisp :tangle ~/.emacs.d/desktop.el
|
||||
|
||||
(defun efs/run-in-background (command)
|
||||
(let ((command-parts (split-string command "[ ]+")))
|
||||
(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 ()
|
||||
;; Make workspace 1 be the one where we land at startup
|
||||
(exwm-workspace-switch-create 1)
|
||||
(efs/start-panel)
|
||||
;; if not wsl
|
||||
(efs/run-in-background "xsetroot -cursor_name left_ptr &")
|
||||
(efs/run-in-background "nm-applet &")
|
||||
(efs/run-in-background "pamac-tray &")
|
||||
;;(efs/run-in-background "xfce4-power-manager &")
|
||||
(efs/run-in-background "volumeicon &")
|
||||
(efs/run-in-background "numlockx on &")
|
||||
(efs/run-in-background "blueberry-tray &")
|
||||
(efs/run-in-background "fcitx &")
|
||||
;;(efs/run-in-background "xsetroot -cursor_name left_ptr")
|
||||
;;(efs/run-in-background "nm-applet")
|
||||
;;(efs/run-in-background "pamac-tray")
|
||||
;;(efs/run-in-background "volumeicon")
|
||||
;;(efs/run-in-background "numlockx on")
|
||||
;;(efs/run-in-background "blueberry-tray")
|
||||
|
||||
;; Launch apps that will run in the background
|
||||
(efs/run-in-background "dwall -s firewatch")
|
||||
(efs/run-in-background "picom -b --config $HOME/.xmonad/scripts/picom.conf &")
|
||||
)
|
||||
(efs/run-in-background "fcitx")
|
||||
(efs/run-in-background "dwall -s firewatch"))
|
||||
|
||||
(defun efs/exwm-update-class ()
|
||||
(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))))
|
||||
|
||||
;;(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
|
||||
:config
|
||||
;; 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
|
||||
focus-follows-mouse t)
|
||||
|
||||
(add-hook 'exwm-floating-setup-hook
|
||||
(lambda ()
|
||||
(exwm-layout-hide-mode-line)))
|
||||
|
||||
;; These keys should always pass through to Emacs
|
||||
(setq exwm-input-prefix-keys
|
||||
'(?\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 "$ ")))
|
||||
(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
|
||||
([?\s-w] . exwm-workspace-switch)
|
||||
([?\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))))
|
||||
(number-sequence 0 9))))
|
||||
|
||||
(require 'exwm-systemtray)
|
||||
(setq exwm-systemtray-height 32)
|
||||
(exwm-systemtray-enable)
|
||||
(exwm-enable))
|
||||
|
||||
(use-package desktop-environment
|
||||
:after exwm
|
||||
:config (desktop-environment-mode)
|
||||
:custom
|
||||
(desktop-environment-brightness-small-increment "2%+")
|
||||
(desktop-environment-brightness-small-decrement "2%-")
|
||||
(desktop-environment-brightness-normal-increment "5%+")
|
||||
(desktop-environment-brightness-normal-decrement "5%-"))
|
||||
;; if not wsl
|
||||
;;(use-package desktop-environment
|
||||
;; :after exwm
|
||||
;; :config (desktop-environment-mode)
|
||||
;; :custom
|
||||
;; (desktop-environment-brightness-small-increment "2%+")
|
||||
;; (desktop-environment-brightness-small-decrement "2%-")
|
||||
;; (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!)
|
||||
(server-start)
|
||||
|
||||
@ -1163,11 +1163,6 @@ https://emacs.stackexchange.com/a/30691
|
||||
(setq eshell-visual-commands '("htop" "zsh" "vim"))))
|
||||
#+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)
|
||||
#+begin_src emacs-lisp
|
||||
|
||||
Reference in New Issue
Block a user