polybar exwm

This commit is contained in:
Sakooooo 2024-02-07 14:46:14 +04:00
parent 6958f9e2e0
commit 7b467f4557
Signed by: sako
GPG key ID: 3FD715D87D7725E0
2 changed files with 84 additions and 50 deletions

View file

@ -1314,64 +1314,91 @@ Aint no way bro
** EXWM ** EXWM
RELEASE ME RELEASE ME
#+begin_src emacs-lisp #+begin_src emacs-lisp
(when (eq system-type 'gnu/linux) (when (eq system-type 'gnu/linux)
(display-battery-mode) (display-battery-mode)
(use-package exwm (use-package exwm
:config :config
;; background ;; background
(call-process-shell-command "feh --bg-fill ~/background.png" nil 0) (call-process-shell-command "feh --bg-fill ~/background.png" nil 0)
(call-process-shell-command "~/.config/polybar/startpolybar" nil 0) (call-process-shell-command "~/.config/polybar/startpolybar" nil 0)
;; workspaces ;; workspaces
(setq exwm-workspace-number 5) (setq exwm-workspace-number 5)
(require 'exwm-systemtray) (require 'exwm-systemtray)
(exwm-systemtray-enable) (exwm-systemtray-enable)
;; always use these keys in emacs ;; polybar
(setq exwm-input-prefix-keys (defvar sakomacs/polybar-process nil
'(?\C-x "Holds the process of the running Polybar instance, if any")
?\C-u
?\C-h
?\M-x
?\M-`
?\M-&
?\M-:
?\C-\M-j ;; Buffer list
?\C-\ )) ;; Ctrl+Space
;; Ctrl+Q will enable the next key to be sent directly (server-start)
(define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key)
;; Set up global key bindings. These always work, no matter the input state!
;; Keep in mind that changing this list after EXWM initializes has no effect.
(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 (defun sakomacs/kill-panel ()
([s-left] . windmove-left) (interactive)
([s-right] . windmove-right) (when sakomacs/polybar-process
([s-up] . windmove-up) (ignore-errors
([s-down] . windmove-down) (kill-process sakomacs/polybar-process)))
(setq sakomacs/polybar-process nil))
;; Launch applications via shell command (defun sakomacs/start-panel ()
([?\s-&] . (lambda (command) (interactive)
(interactive (list (read-shell-command "$ "))) (sakomacs/kill-panel)
(start-process-shell-command command nil command))) (setq sakomacs/polybar-process (start-process-shell-command "polybar" nil "polybar panel")))
;; Switch workspace (defun sakomacs/send-polybar-hook (module-name hook-index)
([?\s-w] . exwm-workspace-switch) (start-process-shell-command "polybar-msg" nil (format "polybar-msg hook %s %s" module-name hook-index)))
;; 's-N': Switch to certain workspace with Super (Win) plus a number key (0 - 9) (defun sakomacs/send-polybar-exwm-workspace ()
,@(mapcar (lambda (i) (sakomacs/send-polybar-hook "exwm-workspace" 1))
`(,(kbd (format "s-%d" i)) .
(lambda () ;; Update panel indicator when workspace changes
(interactive) (add-hook 'exwm-workspace-switch-hook #'sakomacs/send-polybar-exwm-workspace)
(exwm-workspace-switch-create ,i))))
(number-sequence 0 9)))) ;; always use these keys in emacs
) (setq exwm-input-prefix-keys
'(?\C-x
?\C-u
?\C-h
?\M-x
?\M-`
?\M-&
?\M-:
?\C-\M-j ;; Buffer list
?\C-\ )) ;; Ctrl+Space
;; Ctrl+Q will enable the next key to be sent directly
(define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key)
;; Set up global key bindings. These always work, no matter the input state!
;; Keep in mind that changing this list after EXWM initializes has no effect.
(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-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))))
)
) )
#+end_src #+end_src

View file

@ -59,7 +59,7 @@ separator-foreground = ${colors.disabled}
font-0 = JetBrainsMono ;1 font-0 = JetBrainsMono ;1
modules-left = xworkspaces xwindow modules-left = exwm-workspace xwindow
modules-right = battery pulseaudio date modules-right = battery pulseaudio date
cursor-click = pointer cursor-click = pointer
@ -75,6 +75,13 @@ wm-restack = bspwm
; override-redirect = true ; override-redirect = true
[module/exwm-workspace]
type = custom/ipc
hook-0 = emacsclient -e "exwm-workspace-current-index" | sed -e 's/^"//' -e 's/"$//'
initial = 1
format-underline = ${colors.underline-1}
format-padding = 1
[module/xworkspaces] [module/xworkspaces]
type = internal/xworkspaces type = internal/xworkspaces