mirror of
http://github.com/JaeUs3792/dotfiles
synced 2025-12-13 23:51:34 +09:00
Exwm : Polybar for workspace / WSL2 bridge mode
This commit is contained in:
141
.config/polybar/config
Normal file
141
.config/polybar/config
Normal file
@ -0,0 +1,141 @@
|
||||
; Docs: https://github.com/polybar/polybar
|
||||
;==========================================================
|
||||
|
||||
[settings]
|
||||
screenchange-reload = true
|
||||
|
||||
[global/wm]
|
||||
margin-top = 0
|
||||
margin-bottom = 0
|
||||
|
||||
[colors]
|
||||
background = #f0232635
|
||||
background-alt = #576075
|
||||
foreground = #A6Accd
|
||||
foreground-alt = #555
|
||||
primary = #ffb52a
|
||||
secondary = #e60053
|
||||
alert = #bd2c40
|
||||
underline-1 = #c792ea
|
||||
|
||||
[bar/panel]
|
||||
width = 100%
|
||||
height = 24
|
||||
offset-x = 0
|
||||
offset-y = 0
|
||||
fixed-center = true
|
||||
enable-ipc = true
|
||||
|
||||
background = ${colors.background}
|
||||
foreground = ${colors.foreground}
|
||||
|
||||
line-size = 2
|
||||
line-color = #f00
|
||||
|
||||
border-size = 0
|
||||
border-color = #00000000
|
||||
|
||||
padding-top = 5
|
||||
padding-left = 1
|
||||
padding-right = 1
|
||||
|
||||
module-margin = 1
|
||||
|
||||
font-0 = "Cantarell:size=12:weight=bold;2"
|
||||
font-1 = "Font Awesome:size=10;2"
|
||||
font-2 = "Material Icons:size=15;5"
|
||||
font-3 = "Fira Mono:size=10;-3"
|
||||
|
||||
modules-left = exwm-workspace
|
||||
modules-right = cpu temperature battery date
|
||||
|
||||
tray-position = right
|
||||
tray-padding = 2
|
||||
tray-maxsize = 28
|
||||
|
||||
cursor-click = pointer
|
||||
cursor-scroll = ns-resize
|
||||
|
||||
[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/cpu]
|
||||
type = internal/cpu
|
||||
interval = 2
|
||||
format = <label> <ramp-coreload>
|
||||
format-underline = ${colors.underline-1}
|
||||
click-left = emacsclient -e "(proced)"
|
||||
label = %percentage:2%%
|
||||
ramp-coreload-spacing = 0
|
||||
ramp-coreload-0 = ▁
|
||||
ramp-coreload-0-foreground = ${colors.foreground-alt}
|
||||
ramp-coreload-1 = ▂
|
||||
ramp-coreload-2 = ▃
|
||||
ramp-coreload-3 = ▄
|
||||
ramp-coreload-4 = ▅
|
||||
ramp-coreload-5 = ▆
|
||||
ramp-coreload-6 = ▇
|
||||
|
||||
[module/date]
|
||||
type = internal/date
|
||||
interval = 5
|
||||
|
||||
date = "%a %b %e"
|
||||
date-alt = "%A %B %d %Y"
|
||||
|
||||
time = %l:%M %p
|
||||
time-alt = %H:%M:%S
|
||||
|
||||
format-prefix-foreground = ${colors.foreground-alt}
|
||||
format-underline = ${colors.underline-1}
|
||||
|
||||
label = %date% %time%
|
||||
|
||||
[module/battery]
|
||||
type = internal/battery
|
||||
battery = BAT0
|
||||
adapter = ADP1
|
||||
full-at = 98
|
||||
time-format = %-l:%M
|
||||
|
||||
label-charging = %percentage%% / %time%
|
||||
format-charging = <animation-charging> <label-charging>
|
||||
format-charging-underline = ${colors.underline-1}
|
||||
|
||||
label-discharging = %percentage%% / %time%
|
||||
format-discharging = <ramp-capacity> <label-discharging>
|
||||
format-discharging-underline = ${self.format-charging-underline}
|
||||
|
||||
format-full = <ramp-capacity> <label-full>
|
||||
format-full-underline = ${self.format-charging-underline}
|
||||
|
||||
ramp-capacity-0 =
|
||||
ramp-capacity-1 =
|
||||
ramp-capacity-2 =
|
||||
ramp-capacity-3 =
|
||||
ramp-capacity-4 =
|
||||
|
||||
animation-charging-0 =
|
||||
animation-charging-1 =
|
||||
animation-charging-2 =
|
||||
animation-charging-3 =
|
||||
animation-charging-4 =
|
||||
animation-charging-framerate = 750
|
||||
|
||||
[module/temperature]
|
||||
type = internal/temperature
|
||||
thermal-zone = 0
|
||||
warn-temperature = 60
|
||||
|
||||
format = <label>
|
||||
format-underline = ${colors.underline-1}
|
||||
format-warn = <label-warn>
|
||||
format-warn-underline = ${self.format-underline}
|
||||
|
||||
label = %temperature-c%
|
||||
label-warn = %temperature-c%!
|
||||
label-warn-foreground = ${colors.secondary}
|
||||
@ -5,6 +5,7 @@
|
||||
(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 &")
|
||||
@ -123,6 +124,9 @@
|
||||
(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
|
||||
@ -136,3 +140,27 @@
|
||||
|
||||
;; Make sure the server is started (better to do this in your main Emacs config!)
|
||||
(server-start)
|
||||
|
||||
(defvar efs/polybar-process nil
|
||||
"Holds the process of the running Polybar instance, if any")
|
||||
|
||||
(defun efs/kill-panel ()
|
||||
(interactive)
|
||||
(when efs/polybar-process
|
||||
(ignore-errors
|
||||
(kill-process efs/polybar-process)))
|
||||
(setq efs/polybar-process nil))
|
||||
|
||||
(defun efs/start-panel ()
|
||||
(interactive)
|
||||
(efs/kill-panel)
|
||||
(setq efs/polybar-process (start-process-shell-command "polybar" nil "polybar panel")))
|
||||
|
||||
(defun efs/send-polybar-hook (module-name hook-index)
|
||||
(start-process-shell-command "polybar-msg" nil (format "polybar-msg hook %s %s" module-name hook-index)))
|
||||
|
||||
(defun efs/send-polybar-exwm-workspace ()
|
||||
(efs/send-polybar-hook "exwm-workspace" 1))
|
||||
|
||||
;; Update panel indicator when workspace changes
|
||||
(add-hook 'exwm-workspace-switch-hook #'efs/send-polybar-exwm-workspace)
|
||||
|
||||
@ -24,7 +24,9 @@ exec dbus-launch --exit-with-session emacs -mm --debug-init -l ~/.emacs.d/deskto
|
||||
|
||||
|
||||
* Configuration
|
||||
** 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)))))
|
||||
@ -32,6 +34,7 @@ exec dbus-launch --exit-with-session emacs -mm --debug-init -l ~/.emacs.d/deskto
|
||||
(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 &")
|
||||
@ -150,6 +153,9 @@ 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
|
||||
@ -165,3 +171,31 @@ exec dbus-launch --exit-with-session emacs -mm --debug-init -l ~/.emacs.d/deskto
|
||||
(server-start)
|
||||
|
||||
#+end_src
|
||||
** Polybar
|
||||
#+begin_src emacs-lisp :tangle ~/.emacs.d/desktop.el
|
||||
|
||||
(defvar efs/polybar-process nil
|
||||
"Holds the process of the running Polybar instance, if any")
|
||||
|
||||
(defun efs/kill-panel ()
|
||||
(interactive)
|
||||
(when efs/polybar-process
|
||||
(ignore-errors
|
||||
(kill-process efs/polybar-process)))
|
||||
(setq efs/polybar-process nil))
|
||||
|
||||
(defun efs/start-panel ()
|
||||
(interactive)
|
||||
(efs/kill-panel)
|
||||
(setq efs/polybar-process (start-process-shell-command "polybar" nil "polybar panel")))
|
||||
|
||||
(defun efs/send-polybar-hook (module-name hook-index)
|
||||
(start-process-shell-command "polybar-msg" nil (format "polybar-msg hook %s %s" module-name hook-index)))
|
||||
|
||||
(defun efs/send-polybar-exwm-workspace ()
|
||||
(efs/send-polybar-hook "exwm-workspace" 1))
|
||||
|
||||
;; Update panel indicator when workspace changes
|
||||
(add-hook 'exwm-workspace-switch-hook #'efs/send-polybar-exwm-workspace)
|
||||
#+end_src
|
||||
|
||||
|
||||
@ -349,23 +349,24 @@ https://nathantypanski.com/blog/2014-08-03-a-vim-like-emacs-config.html
|
||||
;;(global-prettify-symbols-mode +1)
|
||||
#+end_src
|
||||
* Whitespace
|
||||
This makes nov to ugly
|
||||
#+begin_src emacs-lisp
|
||||
;; somtimes need to check white space. this configuration will be helpful
|
||||
(custom-set-faces
|
||||
;; custom-set-faces was added by Custom.
|
||||
;; If you edit it by hand, you could mess it up, so be careful.
|
||||
;; Your init file should contain only one such instance.
|
||||
;; If there is more than one, they won't work right.
|
||||
'(whitespace-line ((nil (:bold t :background "yellow"))))
|
||||
'(whitespace-tab ((nil (:bold t :background "linen"))))
|
||||
'(whitespace-trailing ((nil (:bold t :background "red1")))))
|
||||
(global-whitespace-mode t)
|
||||
(add-hook
|
||||
'after-change-major-mode-hook
|
||||
'(lambda ()
|
||||
(setq whitespace-line-column nil
|
||||
whitespace-style '(face trailing))))
|
||||
(add-hook 'before-save-hook 'delete-trailing-whitespace)
|
||||
;;(custom-set-faces
|
||||
;; ;; custom-set-faces was added by Custom.
|
||||
;; ;; If you edit it by hand, you could mess it up, so be careful.
|
||||
;; ;; Your init file should contain only one such instance.
|
||||
;; ;; If there is more than one, they won't work right.
|
||||
;; '(whitespace-line ((nil (:bold t :background "yellow"))))
|
||||
;; '(whitespace-tab ((nil (:bold t :background "linen"))))
|
||||
;; '(whitespace-trailing ((nil (:bold t :background "red1")))))
|
||||
;;(global-whitespace-mode t)
|
||||
;;(add-hook
|
||||
;; 'after-change-major-mode-hook
|
||||
;; '(lambda ()
|
||||
;; (setq whitespace-line-column nil
|
||||
;; whitespace-style '(face trailing))))
|
||||
;;(add-hook 'before-save-hook 'delete-trailing-whitespace)
|
||||
#+end_src
|
||||
|
||||
* Emojify
|
||||
|
||||
@ -8,7 +8,9 @@
|
||||
# Enable screen locking on suspend
|
||||
#xss-lock -- slock &
|
||||
# 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
|
||||
#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=192.168.144.1: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
|
||||
|
||||
Reference in New Issue
Block a user