mirror of
https://git.disroot.org/FollieHiyuki/dotfiles.git
synced 2024-11-24 16:28:22 -05:00
Basic EXWM
This commit is contained in:
parent
2dfd894bff
commit
0aa9c452b8
@ -10,7 +10,7 @@
|
||||
|
||||
=> is bloated (I use a lot of programs, sometimes just to try out)
|
||||
=> yet clean (follow XDG base directory specification)
|
||||
=> for [bspwm](https://github.com/baskerville/bspwm), [spectrwm](https://github.com/conformal/spectrwm), [sway](https://github.com/swaywm/sway), [wayfire](https://github.com/WayfireWM/wayfire), [river](https://github.com/ifreund/river), [hikari](https://hikari.acmelabs.space/) (and [exwm](https://github.com/ch11ng/exwm) occasionally)
|
||||
=> for [bspwm](https://github.com/baskerville/bspwm), [spectrwm](https://github.com/conformal/spectrwm), [exwm](https://github.com/ch11ng/exwm), [sway](https://github.com/swaywm/sway), [wayfire](https://github.com/WayfireWM/wayfire), [river](https://github.com/ifreund/river), [hikari](https://hikari.acmelabs.space/)
|
||||
=> and features [Nord](https://github.com/arcticicestudio/nord) and [OneDark](https://github.com/joshdick/onedark.vim) colorschemes
|
||||
|
||||
![sway](https://git.disroot.org/FollieHiyuki/dotfiles/raw/branch/master/assets/sway.png)
|
||||
@ -58,6 +58,8 @@
|
||||
|
||||
- [@hlissner](https://github.com/hlissner) for a detailed zsh config (and Doom Emacs)
|
||||
|
||||
- [@daviwil](https://github.com/daviwil) for his Emacs streams
|
||||
|
||||
- My Waybar config is heavily inspired by [@begs](https://git.sr.ht/~begs/dotfiles)
|
||||
|
||||
- I use some scripts from other people:
|
||||
|
@ -12,29 +12,22 @@ if [ -f "$usermodmap" ]; then
|
||||
xmodmap "$usermodmap"
|
||||
fi
|
||||
|
||||
pipewire &
|
||||
if ! pgrep -f mpd > /dev/null
|
||||
then
|
||||
mpd &
|
||||
fi
|
||||
dunst &
|
||||
greenclip daemon &
|
||||
ibus-daemon -drx &
|
||||
# emacs --daemon &
|
||||
picom -b &
|
||||
# xrandr --output eDP-1 --primary --auto --output DP-2 --left-of eDP-1 --auto --output HDMI-2 --right-of eDP-1 --auto &
|
||||
# $HOME/.local/bin/garbage/off_touch &
|
||||
# animatedwall --full ~/Pictures/Animated/fubuki.mp4 &
|
||||
feh --no-fehbg --bg-fill --randomize ~/Pictures/Wallpapers/* &
|
||||
|
||||
export XDG_SESSION_TYPE=x11
|
||||
export PATH=$HOME/.local/bin/X11:$PATH
|
||||
# $HOME/.config/emacs/bin/doom env
|
||||
|
||||
session=${1:-spectrwm}
|
||||
|
||||
case $session in
|
||||
bspwm ) exec bspwm ;;
|
||||
spectrwm ) exec spectrwm -c ~/.config/spectrwm/spectrwm-nord.conf ;;
|
||||
exwm ) exec dbus-run-session emacs -mm --debug-init -l ~/.config/doom/exwm.el ;;
|
||||
exwm ) exec dbus-run-session -- emacs -mm --debug-init -l ~/.config/doom/exwm.el ;;
|
||||
* ) exec "$1" ;;
|
||||
esac
|
||||
|
@ -1,14 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Startup applications
|
||||
pipewire &
|
||||
dunst &
|
||||
sxhkd &
|
||||
mpDris2 &
|
||||
xsetroot -cursor_name left_ptr &
|
||||
$HOME/.config/polybar/run_polybar.sh &
|
||||
ibus-daemon -drx &
|
||||
greenclip daemon &
|
||||
# emacs --daemon &
|
||||
# xrandr --output eDP-1 --primary --auto --output DP-2 --left-of eDP-1 --auto --output HDMI-2 --right-of eDP-1 --auto &
|
||||
# animatedwall --full ~/Pictures/Animated/fubuki.mp4 &
|
||||
feh --no-fehbg --bg-fill --randomize ~/Pictures/Wallpapers/* &
|
||||
mpDris2 &
|
||||
|
||||
# Workspaces
|
||||
bspc monitor eDP -d 1 2 3 4 5 6 7 8
|
||||
bspc monitor HDMI-A-0 -d 9 10
|
||||
bspc monitor eDP-1 -d 1 2 3 4 5 6 7 8
|
||||
bspc monitor HDMI-2 -d 9 10
|
||||
|
||||
# Modes
|
||||
bspc config top_padding 0
|
||||
|
177
home/.config/doom/exwm.el
Normal file
177
home/.config/doom/exwm.el
Normal file
@ -0,0 +1,177 @@
|
||||
;;; exwm.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defun exwm-config--fix/ido-buffer-window-other-frame ()
|
||||
"Fix `ido-buffer-window-other-frame'."
|
||||
(defalias 'exwm-config-ido-buffer-window-other-frame
|
||||
(symbol-function #'ido-buffer-window-other-frame))
|
||||
(defun ido-buffer-window-other-frame (buffer)
|
||||
"This is a version redefined by EXWM.
|
||||
You can find the original one at `exwm-config-ido-buffer-window-other-frame'."
|
||||
(with-current-buffer (window-buffer (selected-window))
|
||||
(if (and (derived-mode-p 'exwm-mode)
|
||||
exwm--floating-frame)
|
||||
;; Switch from a floating frame.
|
||||
(with-current-buffer buffer
|
||||
(if (and (derived-mode-p 'exwm-mode)
|
||||
exwm--floating-frame
|
||||
(eq exwm--frame exwm-workspace--current))
|
||||
;; Switch to another floating frame.
|
||||
(frame-root-window exwm--floating-frame)
|
||||
;; Do not switch if the buffer is not on the current workspace.
|
||||
(or (get-buffer-window buffer exwm-workspace--current)
|
||||
(selected-window))))
|
||||
(with-current-buffer buffer
|
||||
(when (derived-mode-p 'exwm-mode)
|
||||
(if (eq exwm--frame exwm-workspace--current)
|
||||
(when exwm--floating-frame
|
||||
;; Switch to a floating frame on the current workspace.
|
||||
(frame-selected-window exwm--floating-frame))
|
||||
;; Do not switch to exwm-mode buffers on other workspace (which
|
||||
;; won't work unless `exwm-layout-show-all-buffers' is set)
|
||||
(unless exwm-layout-show-all-buffers
|
||||
(selected-window)))))))))
|
||||
|
||||
(defun exwm-config-ido ()
|
||||
"Configure Ido to work with EXWM."
|
||||
(add-hook 'exwm-init-hook #'exwm-config--fix/ido-buffer-window-other-frame))
|
||||
|
||||
(defun follie/run-in-background (command)
|
||||
(let ((command-parts (split-string command "[ ]+")))
|
||||
(apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts)))))
|
||||
|
||||
(defun follie/set-wallpaper ()
|
||||
(interative)
|
||||
(start-process-shell-command
|
||||
"feh" nil "feh --no-fehbg --bg-fill --randomize ~/Pictures/Wallpapers/*"))
|
||||
|
||||
(defun follie/exwm-init-hook ()
|
||||
;; Make workspace 1 the default at startup
|
||||
;;(exwm-workspace-switch-create 1)
|
||||
|
||||
;; Open eshell at startup
|
||||
;;(eshell)
|
||||
|
||||
;; Additional status info on modeline
|
||||
(setq display-time-day-and-date t)
|
||||
(display-time-mode 1)
|
||||
(if (not (equal "Battery status not available" (battery)))
|
||||
(display-battery-mode 1))
|
||||
|
||||
;; Startup apps
|
||||
(follie/run-in-background "pipewire")
|
||||
(follie/run-in-background "dunst")
|
||||
(follie/run-in-background "mpDris2")
|
||||
(start-process-shell-command "xsetroot" nil "xsetroot -cursor_name left_ptr"))
|
||||
|
||||
(defun follie/configure-window-by-class ()
|
||||
(interactive)
|
||||
(pcase exwm-class-name
|
||||
("Komikku" (exwm-floating-toggle-floating)
|
||||
(exwm-layout-toggle-mode-line))))
|
||||
|
||||
(defun follie/update-displays ()
|
||||
(lambda ()
|
||||
(start-process-shell-command "xrandr" nil "xrandr --output eDP-1 --mode 1920x1080 --pos 0x0 --rotate normal --output HDMI-1 --mode 1920x1080 --pos 1920x0 --rotate normal"))
|
||||
;;(follie/set-wallpaper)
|
||||
(message "Displays updated"))
|
||||
|
||||
(use-package! exwm
|
||||
:config
|
||||
;; Number of workspaces
|
||||
(setq exwm-workspace-number 2)
|
||||
|
||||
;; Extra stuff at startup
|
||||
(add-hook 'exwm-init-hook #'follie/exwm-init-hook)
|
||||
|
||||
;; Update buffer name
|
||||
(add-hook 'exwm-update-class-hook
|
||||
(lambda ()
|
||||
(exwm-workspace-rename-buffer exwm-class-name)))
|
||||
|
||||
;; Window rules
|
||||
(add-hook 'exwm-manage-finish-hook #'follie/configure-window-by-class)
|
||||
|
||||
;; Automatically move EXWM buffer to current workspace
|
||||
(setq exwm-layout-show-all-buffers t)
|
||||
;; Display all buffers in every workspace buffer list
|
||||
(setq exwm-workspace-show-all-buffers t)
|
||||
|
||||
;; Multi monitor
|
||||
(require 'exwm-randr)
|
||||
(setq exwm-randr-workspace-monitor-plist '(1 "HDMI-1"))
|
||||
(add-hook 'exwm-randr-screen-change-hook #'follie/update-displays)
|
||||
(exwm-randr-enable)
|
||||
|
||||
;; Set wallpapers after changing resolution
|
||||
;;(follie/set-wallpaper)
|
||||
|
||||
;; System tray on minibuffer
|
||||
(require 'exwm-systemtray)
|
||||
;;(setq exwm-systemtray-height 12)
|
||||
(exwm-systemtray-enable)
|
||||
|
||||
;; Automatically send cursor to the selected display
|
||||
(setq exwm-workspace-warp-cursor t)
|
||||
;; Focus follows cursor
|
||||
(setq mouse-autoselect-window t
|
||||
focus-follows-mouse t)
|
||||
|
||||
;; Keys that always pass through to Emacs in line-mode
|
||||
(setq exwm-input-prefix-keys
|
||||
'(?\C-x
|
||||
?\C-u
|
||||
?\C-h
|
||||
?\M-x
|
||||
?\M-`
|
||||
?\M-&
|
||||
?\M-:
|
||||
?\C-\M-j)) ;; Buffer list
|
||||
|
||||
;; Ctrl+q to enable next key to be sent directly
|
||||
(define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key)
|
||||
|
||||
;; Global key bindings
|
||||
(setq exwm-input-global-keys
|
||||
`(
|
||||
;; Reset to line-mode (C-c C-k switches to char-mode via exwm-input-release-keyboard)
|
||||
([?\s-r] . exwm-reset)
|
||||
|
||||
;; Move between windows
|
||||
([s-left] . windmove-left)
|
||||
([s-right] . windmove-right)
|
||||
([s-up] . windmove-up)
|
||||
([s-down] . windmove-down)
|
||||
|
||||
;; Launch applications via shell command
|
||||
([?\s-&] . (lambda (command)
|
||||
(interactive (list (read-shell-command "$ ")))
|
||||
(start-process-shell-command command nil command)))
|
||||
|
||||
;; Switch workspace
|
||||
([?\s-w] . exwm-workspace-switch)
|
||||
([?\s-`] . (lambda () (interactive) (exwm-workspace-switch-create 0)))
|
||||
|
||||
;; 's-N': Switch to certain workspace with Super (Win) plus a number key (0 - 9)
|
||||
,@(mapcar (lambda (i)
|
||||
`(,(kbd (format "s-%d" i)) .
|
||||
(lambda ()
|
||||
(interactive)
|
||||
(exwm-workspace-switch-create ,i))))
|
||||
(number-sequence 0 9))))
|
||||
(exwm-input-set-key (kbd "s-SPC") 'counsel-linux-app)
|
||||
|
||||
;; Enable EXWM
|
||||
(exwm-enable)
|
||||
;; Work around ido frame
|
||||
(exwm-config-ido))
|
||||
|
||||
;; Control dunst
|
||||
(defun efs/disable-desktop-notifications ()
|
||||
(interactive)
|
||||
(start-process-shell-command "notify-send" nil "notify-send \"DUNST_COMMAND_PAUSE\""))
|
||||
(defun efs/enable-desktop-notifications ()
|
||||
(interactive)
|
||||
(start-process-shell-command "notify-send" nil "notify-send \"DUNST_COMMAND_RESUME\""))
|
||||
(defun efs/toggle-desktop-notifications ()
|
||||
(interactive)
|
||||
(start-process-shell-command "notify-send" nil "notify-send \"DUNST_COMMAND_TOGGLE\""))
|
11
home/.config/spectrwm/autostart
Executable file
11
home/.config/spectrwm/autostart
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
pipewire &
|
||||
dunst &
|
||||
ibus-daemon -drx &
|
||||
greenclip daemon &
|
||||
# emacs --daemon &
|
||||
# xrandr --output eDP-1 --primary --auto --output DP-2 --left-of eDP-1 --auto --output HDMI-2 --right-of eDP-1 --auto &
|
||||
# animatedwall --full ~/Pictures/Animated/fubuki.mp4 &
|
||||
feh --no-fehbg --bg-fill --randomize ~/Pictures/Wallpapers/* &
|
||||
mpDris2 &
|
@ -38,7 +38,7 @@ name = ws[9]:
|
||||
name = ws[10]:
|
||||
|
||||
# Autostart
|
||||
autorun = ws[1]:mpDris2
|
||||
autorun = ws[1]:~/.config/spectrwm/autostart
|
||||
|
||||
# Region containment
|
||||
# Distance window must be dragged/resized beyond the region edge before it is
|
||||
|
@ -38,7 +38,7 @@ name = ws[9]:
|
||||
name = ws[10]:
|
||||
|
||||
# Autostart
|
||||
autorun = ws[1]:mpDris2
|
||||
autorun = ws[1]:~/.config/spectrwm/autostart
|
||||
|
||||
# Region containment
|
||||
# Distance window must be dragged/resized beyond the region edge before it is
|
||||
|
@ -32,4 +32,5 @@ then
|
||||
fi
|
||||
|
||||
export XDG_CURRENT_DESKTOP=$1
|
||||
# $HOME/.config/emacs/bin/doom env
|
||||
exec dbus-run-session "$@" > "${XDG_RUNTIME_DIR}/$1-$(date "+%Y-%m-%d").log" 2>&1
|
||||
|
Loading…
Reference in New Issue
Block a user