diff --git a/.bashrc b/.bashrc index c8cda3f..d9bc0c2 100644 --- a/.bashrc +++ b/.bashrc @@ -133,9 +133,13 @@ fi # [[file:Console.org::*Micromamba][Micromamba:1]] init_mamba () { - export MAMBA_EXE="/home/pavel/.guix-extra-profiles/dev/dev/bin/micromamba"; + export MAMBA_EXE=$(which micromamba); export MAMBA_ROOT_PREFIX="/home/pavel/micromamba"; - __mamba_setup="$("$MAMBA_EXE" shell hook --shell bash --prefix "$MAMBA_ROOT_PREFIX" 2> /dev/null)" + if [[ "$(micromamba --version)" > "2.0.0" ]]; then + __mamba_setup="$("$MAMBA_EXE" shell hook --shell bash --root-prefix "$MAMBA_ROOT_PREFIX" 2> /dev/null)" + else + __mamba_setup="$("$MAMBA_EXE" shell hook --shell bash --prefix "$MAMBA_ROOT_PREFIX" 2> /dev/null)" + fi if [ $? -eq 0 ]; then eval "$__mamba_setup" else diff --git a/.config/fish/config.fish b/.config/fish/config.fish index 73883c4..bdcf5ba 100644 --- a/.config/fish/config.fish +++ b/.config/fish/config.fish @@ -38,9 +38,13 @@ set fish_greeting # [[file:../../Console.org::*Micromamba][Micromamba:1]] function init_mamba - set -gx MAMBA_EXE "/home/pavel/.guix-extra-profiles/dev/dev/bin/micromamba" + set -gx MAMBA_EXE (which micromamba) set -gx MAMBA_ROOT_PREFIX "/home/pavel/micromamba" - $MAMBA_EXE shell hook --shell fish --prefix $MAMBA_ROOT_PREFIX | source + if test (string replace -a '.' '' -- (micromamba --version)) -gt 200 + $MAMBA_EXE shell hook --shell fish --root-prefix $MAMBA_ROOT_PREFIX | source &> /dev/null + else + $MAMBA_EXE shell hook --shell fish --prefix $MAMBA_ROOT_PREFIX | source + end end if test -n "$INIT_MAMBA"; diff --git a/.config/polybar/config b/.config/polybar/config index ef69d82..133a1c1 100644 --- a/.config/polybar/config +++ b/.config/polybar/config @@ -35,20 +35,6 @@ gright =  ; Glyph settings:1 ends here ; [[file:../../Desktop.org::*Generating glyphs][Generating glyphs:3]] -[module/glyph-light-cyan--cyan] -type = custom/text -content-background = ${colors.light-cyan} -content-foreground = ${colors.cyan} -content = ${glyph.gright} -content-font = 5 - -[module/glyph-magenta--light-cyan] -type = custom/text -content-background = ${colors.magenta} -content-foreground = ${colors.light-cyan} -content = ${glyph.gright} -content-font = 5 - [module/glyph-light-blue--blue] type = custom/text content-background = ${colors.light-blue} @@ -112,10 +98,24 @@ content-foreground = ${colors.cyan} content = ${glyph.gright} content-font = 5 -[module/glyph-magenta--cyan] +[module/glyph-light-cyan--cyan] +type = custom/text +content-background = ${colors.light-cyan} +content-foreground = ${colors.cyan} +content = ${glyph.gright} +content-font = 5 + +[module/glyph-light-cyan--light-cyan] +type = custom/text +content-background = ${colors.light-cyan} +content-foreground = ${colors.light-cyan} +content = ${glyph.gright} +content-font = 5 + +[module/glyph-magenta--light-cyan] type = custom/text content-background = ${colors.magenta} -content-foreground = ${colors.cyan} +content-foreground = ${colors.light-cyan} content = ${glyph.gright} content-font = 5 @@ -126,6 +126,34 @@ content-foreground = ${colors.magenta} content = ${glyph.gright} content-font = 5 +[module/glyph-red--light-blue] +type = custom/text +content-background = ${colors.red} +content-foreground = ${colors.light-blue} +content = ${glyph.gright} +content-font = 5 + +[module/glyph-light-green--red] +type = custom/text +content-background = ${colors.light-green} +content-foreground = ${colors.red} +content = ${glyph.gright} +content-font = 5 + +[module/glyph-light-magenta--light-cyan] +type = custom/text +content-background = ${colors.light-magenta} +content-foreground = ${colors.light-cyan} +content = ${glyph.gright} +content-font = 5 + +[module/glyph-magenta--cyan] +type = custom/text +content-background = ${colors.magenta} +content-foreground = ${colors.cyan} +content = ${glyph.gright} +content-font = 5 + [module/glyph-blue--background] type = custom/text content-background = ${colors.blue} @@ -213,6 +241,11 @@ scroll-down = i3wm-wsprev ; Global bar config:4 ends here ; [[file:../../Desktop.org::*Global bar config][Global bar config:5]] +dpi-x = ${env:DPI} +dpi-y = ${env:DPI} +; Global bar config:5 ends here + +; [[file:../../Desktop.org::*Global bar config][Global bar config:6]] [settings] screenchange-reload = true compositing-background = source @@ -224,7 +257,7 @@ compositing-border = over [global/wm] margin-top = 0 margin-bottom = 0 -; Global bar config:5 ends here +; Global bar config:6 ends here ; [[file:../../Desktop.org::*pulseaudio][pulseaudio:1]] [module/pulseaudio] @@ -327,6 +360,20 @@ format-background = ${colors.light-cyan} format-foreground = ${colors.foreground} ; nvidia:2 ends here +; [[file:../../Desktop.org::*backlight][backlight:2]] +[module/backlight] +type = custom/script +exec = /home/pavel/bin/polybar/backlight.sh +scroll-up = /home/pavel/bin/polybar/backlight.sh up +click-left = /home/pavel/bin/polybar/backlight.sh up +scroll-down = /home/pavel/bin/polybar/backlight.sh down +click-right = /home/pavel/bin/polybar/backlight.sh down +interval = 1 + +format-background = ${colors.light-cyan} +format-foreground = ${colors.foreground} +; backlight:2 ends here + ; [[file:../../Desktop.org::*ram-memory][ram-memory:1]] [module/ram-memory] type = internal/memory @@ -429,8 +476,8 @@ layout-icon-1 = us;US ; [[file:../../Desktop.org::*battery][battery:1]] [module/battery] type = internal/battery -battery = BAT0 -adapter = ADP0 +battery = ${env:BATTERY:BAT0} +adapter = ${env:ADAPTER:ADP0} time-format = %H:%M format-discharging = @@ -527,7 +574,7 @@ content-background = ${colors.blue} ; [[file:../../Desktop.org::*C-g][C-g:3]] [module/glyph-left-light-background--blue] type = custom/text -content-background = ${colors.backround} +content-background = ${colors.background} content-foreground = ${colors.blue} content = ${glyph.gleft} content-font = 5 diff --git a/.config/shepherd/init.scm b/.config/shepherd/init.scm index b05acbd..f1c2abe 100644 --- a/.config/shepherd/init.scm +++ b/.config/shepherd/init.scm @@ -1,136 +1,122 @@ +(use-modules (shepherd service timer)) + (define mpd - (make - #:provides '(mpd) + (service '(mpd) #:respawn? #t #:start (make-forkexec-constructor '("mpd" "--no-daemon")) #:stop (make-kill-destructor))) (define sqrt-data-agent-mpd - (make - #:provides '(sqrt-data-agent-mpd) + (service '(sqrt-data-agent-mpd) #:respawn? #t #:start (make-forkexec-constructor '("sqrt_data_agent_mpd")) #:stop (make-kill-destructor) - #:requires '(mpd))) + #:requirement '(mpd))) (define deterred-mpd - (make - #:provides '(deterred-mpd) + (service '(deterred-mpd) #:respawn? #t #:start (make-forkexec-constructor '("python" "/home/pavel/10-19 Code/13 Other Projects/13.02 sqrt-data/13.02.R Repos/13.02.R.05 deterred/watchers/deterred-mpd.py" "--db" "/home/pavel/.deterred/database.db")) #:stop (make-kill-destructor) - #:requires '(mpd))) + #:requirement '(mpd))) (define mcron - (make - #:provides '(mcron) + (service '(mcron) #:respawn? #t #:start (make-forkexec-constructor '("mcron")) #:stop (make-kill-destructor))) (define aw-server - (make - #:provides '(aw-server) + (service '(aw-server) #:respawn? #t - #:start (make-forkexec-constructor '("aw-server")) + #:start (make-forkexec-constructor '("/home/pavel/bin/scripts/aw-run" "aw-server")) #:stop (make-kill-destructor))) (define aw-watcher-afk - (make - #:provides '(aw-watcher-afk) - #:requires '(aw-server) + (service '(aw-watcher-afk) + #:requirement '(aw-server) #:respawn? #t - #:start (make-forkexec-constructor '("/home/pavel/bin/scripts/aw-watcher-afk-wrapper")) + #:start (make-forkexec-constructor '("/home/pavel/bin/scripts/aw-run" "aw-watcher-afk")) #:stop (make-kill-destructor))) (define aw-watcher-window - (make - #:provides '(aw-watcher-window) - #:requires '(aw-server) + (service '(aw-watcher-window) + #:requirement '(aw-server) #:respawn? #t - #:start (make-forkexec-constructor '("aw-watcher-window")) + #:start (make-forkexec-constructor '("/home/pavel/bin/scripts/aw-run" "aw-watcher-window")) #:stop (make-kill-destructor))) (define pulseeffects - (make - #:provides '(pulseeffects) + (service '(pulseeffects) #:respawn? #t #:start (make-forkexec-constructor '("flatpak" "run" "com.github.wwmm.pulseeffects" "--gapplication-service")) #:stop (make-kill-destructor))) (define xsettingsd - (make - #:provides '(xsettingsd) + (service '(xsettingsd) #:respawn? #t #:start (make-forkexec-constructor '("xsettingsd")) #:stop (make-kill-destructor))) (define nm-applet - (make - #:provides '(nm-applet) + (service '(nm-applet) #:respawn? #t #:start (make-forkexec-constructor '("nm-applet")) #:stop (make-kill-destructor))) (define discord-rich-presence - (make - #:provides '(discord-rich-presence) + (service '(discord-rich-presence) #:one-shot? #t #:start (make-system-constructor "ln -sf {app/com.discordapp.Discord,$XDG_RUNTIME_DIR}/discord-ipc-0"))) (define polkit-gnome - (make - #:provides '(polkit-gnome) + (service '(polkit-gnome) #:respawn? #t - #:start (make-forkexec-constructor '("/home/pavel/.guix-extra-profiles/desktop-misc/desktop-misc/libexec/polkit-gnome-authentication-agent-1")) + #:start (make-forkexec-constructor + (if (file-exists? "/home/pavel/.guix-extra-profiles/") + '("/home/pavel/.guix-extra-profiles/desktop-misc/desktop-misc/libexec/polkit-gnome-authentication-agent-1") + '("/usr/libexec/polkit-agent-helper-1"))) #:stop (make-kill-destructor))) (define xmodmap - (make - #:provides '(xmodmap) + (service '(xmodmap) #:one-shot? #t #:start (make-system-constructor "xmodmap /home/pavel/.Xmodmap"))) (define vpn - (make - #:provides '(vpn) + (service '(vpn) #:respawn? #t #:start (make-forkexec-constructor '("/home/pavel/bin/scripts/vpn-start")) #:stop (make-kill-destructor))) (define davmail - (make - #:provides '(davmail) + (service '(davmail) #:respawn? #t #:start (make-forkexec-constructor '("/home/pavel/bin/davmail")) #:stop (make-kill-destructor))) (define vnstatd - (make - #:provides '(vnstatd) + (service '(vnstatd) #:respawn? #t #:start (make-forkexec-constructor '("vnstatd" "-n")) #:stop (make-kill-destructor))) (define opensnitchd - (make - #:provides '(opensnitchd) + (service '(opensnitchd) #:respawn? #t #:start (make-forkexec-constructor '("sudo" "opensnitchd")) #:stop (make-kill-destructor))) (define opensnitch-ui - (make - #:provides '(opensnitch-ui) + (service '(opensnitch-ui) #:respawn? #t #:start (make-forkexec-constructor '("sudo" "opensnitch-ui")) #:stop (make-kill-destructor))) (define ollama - (make - #:provides '(ollama) + (service '(ollama) #:respawn? #t #:start (make-forkexec-constructor '("ollama" "serve")) #:stop (make-kill-destructor))) @@ -156,23 +142,25 @@ ;; opensnitch-ui ollama) -(action 'shepherd 'daemonize) +(perform-service-action root-service 'daemonize) -(for-each start '(mpd - sqrt-data-agent-mpd - deterred-mpd - mcron - aw-server - aw-watcher-afk - aw-watcher-window - pulseeffects - xsettingsd - ;; discord-rich-presence - ;; polkit-gnome - davmail - ;; ; xmodmap - ;; nm-applet - vnstatd - ;; opensnitchd - ;; opensnitch-ui - )) +(for-each start-service + (list + mpd + sqrt-data-agent-mpd + deterred-mpd + mcron + aw-server + aw-watcher-afk + aw-watcher-window + pulseeffects + xsettingsd + ;; discord-rich-presence + ;; polkit-gnome + davmail + ;; ; xmodmap + ;; nm-applet + vnstatd + ;; opensnitchd + ;; opensnitch-ui + )) diff --git a/.emacs.d/desktop.el b/.emacs.d/desktop.el index 1ea77f3..6b82850 100644 --- a/.emacs.d/desktop.el +++ b/.emacs.d/desktop.el @@ -177,9 +177,6 @@ _=_: Balance " (seq-uniq (cons exwm-workspace-current-index my/exwm-last-workspaces)))) -(add-hook 'exwm-workspace-switch-hook - #'my/exwm-store-last-workspace) - (defun my/exwm-last-workspaces-clear () "Clean `my/exwm-last-workspaces' from deleted workspaces." (setq my/exwm-last-workspaces @@ -556,8 +553,9 @@ _d_: Discord (exwm--log "Unhandled: %s(%d)" (x-get-atom-name type exwm-workspace--current) type))))) -(with-eval-after-load 'exwm - (advice-add 'exwm--on-ClientMessage :override #'exwm--on-ClientMessage-old)) +(unless my/is-uconsole + (with-eval-after-load 'exwm + (advice-add 'exwm--on-ClientMessage :override #'exwm--on-ClientMessage-old))) (setq exwm-manage-configurations '(((member exwm-class-name '("Nyxt")) @@ -570,8 +568,11 @@ _d_: Discord (my/exwm-set-wallpaper) (my/exwm-run-shepherd) (my/run-in-background "gpgconf --reload gpg-agent") - (when (my/is-arch) - (my/run-in-background "set_layout"))) + (when (or (my/is-arch) + (equal (system-name) "amaranth")) + (my/run-in-background "set_layout")) + (add-hook 'exwm-workspace-switch-hook + #'my/exwm-store-last-workspace)) (defun my/exwm-update-class () (exwm-workspace-rename-buffer (format "EXWM :: %s" exwm-class-name))) @@ -710,6 +711,16 @@ _d_: Discord (when (or (< ,i (exwm-workspace--count)) (y-or-n-p (format "Create workspace %d" ,i))) (exwm-workspace-switch-create ,i) )))) + (number-sequence 0 9)) + ,@(mapcar (lambda (i) + (when (= i 0) + (setq i 10)) + `(,(kbd (format "s-" i)) . + (lambda () + (interactive) + (when (or (< ,i (exwm-workspace--count)) + (y-or-n-p (format "Create workspace %d" ,i))) + (exwm-workspace-switch-create ,i) )))) (number-sequence 0 9)))) (defun exwm-input--fake-last-command () diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 2889c0f..b42e844 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -23,6 +23,8 @@ (setq my/is-termux (string-match-p (rx (* nonl) "com.termux" (* nonl)) (getenv "HOME"))) +(setq my/is-uconsole (string= (system-name) "amaranth")) + (defun my/system-name () (or (getenv "ANDROID_NAME") (system-name))) @@ -41,7 +43,7 @@ gcs-done) (setq my/emacs-started t))) -(setq use-package-verbose nil) +(setq use-package-verbose t) (setq use-package-compute-statistics t) @@ -1421,6 +1423,9 @@ targets." (add-to-list 'default-frame-alist `(font . ,font))) (message "Install JetBrainsMono Nerd Font!"))) +(when my/is-uconsole + (set-face-attribute 'default nil :height 140)) + (when (display-graphic-p) (set-face-attribute 'variable-pitch nil :family "Cantarell" :height 1.0) (set-face-attribute @@ -1573,6 +1578,15 @@ targets." (when (fboundp #'my/exwm-run-polybar) (my/exwm-run-polybar)))) +(defun my/doom-modeline-uconsole--font-height () + 20) + +(when my/is-uconsole + (with-eval-after-load 'doom-modeline + (advice-add #'doom-modeline--font-height :override #'my-doom-modeline--font-height)) + (setq doom-modeline-window-width-limit 70) + (setq doom-modeline-major-mode-icon nil)) + (use-package perspective :straight t :init diff --git a/.profile b/.profile index 6de1f06..d121071 100755 --- a/.profile +++ b/.profile @@ -30,6 +30,12 @@ if [ -f "/home/pavel/.no-guix" ]; then fi # Environment:6 ends here +# [[file:Console.org::*Environment][Environment:7]] +if [ "$(hostname)" = "amaranth" ]; then + export XDG_DATA_DIRS=/usr/share/fkms:/usr/local/share:/usr/share/raspi-ui-overrides:/usr/share:/usr/share/gdm:/var/lib/menu-xdg:$XDG_DATA_DIRS +fi +# Environment:7 ends here + # [[file:Console.org::*My paths][My paths:1]] if [ -d "$HOME/bin" ] ; then export PATH="$HOME/bin:$PATH" @@ -52,10 +58,10 @@ fi # [[file:Console.org::*ssh-agent][ssh-agent:1]] if ! pgrep -u "$USER" ssh-agent > /dev/null; then - ssh-agent -t 1h > "/tmp/ssh-agent.env" + ssh-agent -t 1h > "$XDG_RUNTIME_DIR/ssh-agent.env" fi if [[ ! -f "$SSH_AUTH_SOCK" ]]; then - source "/tmp/ssh-agent.env" >/dev/null + source "$XDG_RUNTIME_DIR/ssh-agent.env" >/dev/null fi # ssh-agent:1 ends here @@ -104,30 +110,48 @@ fi # Other package managers:1 ends here # [[file:Console.org::*Other package managers][Other package managers:2]] -if [ -d "$HOME/.local/share/flatpak" ]; then - export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/.local/share/flatpak/exports/share" +if [ -d "/usr/local/go/" ]; then + export PATH="/usr/local/go/bin:$PATH" fi # Other package managers:2 ends here # [[file:Console.org::*Other package managers][Other package managers:3]] +if [ -d "$HOME/.cargo" ] ; then + export PATH="$HOME/.cargo/bin:$PATH" +fi +# Other package managers:3 ends here + +# [[file:Console.org::*Other package managers][Other package managers:4]] +if [ -d "/opt/guile" ]; then + export PATH="/opt/guile/bin:$PATH" +fi +# Other package managers:4 ends here + +# [[file:Console.org::*Other package managers][Other package managers:5]] +if [ -d "$HOME/.local/share/flatpak" ]; then + export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/.local/share/flatpak/exports/share" +fi +# Other package managers:5 ends here + +# [[file:Console.org::*Other package managers][Other package managers:6]] if [ -f /run/current-system/profile/etc/profile.d/nix.sh ] && [ -z "$NO_GUIX" ] ; then . /run/current-system/profile/etc/profile.d/nix.sh fi if [ -e /home/pavel/.nix-profile/etc/profile.d/nix.sh ] && [ -z "$NO_GUIX" ] ; then . /home/pavel/.nix-profile/etc/profile.d/nix.sh; fi -# Other package managers:3 ends here +# Other package managers:6 ends here -# [[file:Console.org::*Other package managers][Other package managers:4]] +# [[file:Console.org::*Other package managers][Other package managers:7]] if [ -d "$HOME/.guix-extra-profiles/desktop-misc" ] && [ -z "$NO_GUIX" ] ; then export FONTCONFIG_PATH="$HOME/.guix-extra-profiles/desktop-misc/desktop-misc/etc/fonts" fi -# Other package managers:4 ends here +# Other package managers:7 ends here -# [[file:Console.org::*Other package managers][Other package managers:5]] +# [[file:Console.org::*Other package managers][Other package managers:8]] if [ -d "$HOME/.nix-profile" ] && [ -z "$NO_GUIX" ]; then export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/.nix-profile/share/applications" fi -# Other package managers:5 ends here +# Other package managers:8 ends here # [[file:Console.org::*npm][npm:2]] export NPM_CONFIG_USERCONFIG=$HOME/._npmrc diff --git a/Console.org b/Console.org index f4473ff..9c52b09 100644 --- a/Console.org +++ b/Console.org @@ -80,6 +80,14 @@ if [ -f "/home/pavel/.no-guix" ]; then fi #+end_src +Fix =XDG_DATA_DIRS= on Raspberry. Not sure what's going on. + +#+begin_src bash +if [ "$(hostname)" = "amaranth" ]; then + export XDG_DATA_DIRS=/usr/share/fkms:/usr/local/share:/usr/share/raspi-ui-overrides:/usr/share:/usr/share/gdm:/var/lib/menu-xdg:$XDG_DATA_DIRS +fi +#+end_src + ** My paths My script folders #+begin_src sh @@ -161,7 +169,7 @@ Somehow LibreOffice doesn't work without the following: export GIO_EXTRA_MODULES="" #+end_src ** Other package managers -Using other package managers with Guix requires some extra work. +Using other package managers with Guix requires some extra work; this section is also relevant for my non-guix setup. Cask #+begin_src sh @@ -170,6 +178,27 @@ if [ -d "$HOME/.cask" ]; then fi #+end_src +Golang: +#+begin_src sh +if [ -d "/usr/local/go/" ]; then + export PATH="/usr/local/go/bin:$PATH" +fi +#+end_src + +Cargo: +#+begin_src sh +if [ -d "$HOME/.cargo" ] ; then + export PATH="$HOME/.cargo/bin:$PATH" +fi +#+end_src + +Guile: +#+begin_src sh +if [ -d "/opt/guile" ]; then + export PATH="/opt/guile/bin:$PATH" +fi +#+end_src + Make flatpak apps visible to launchers: #+begin_src sh if [ -d "$HOME/.local/share/flatpak" ]; then @@ -196,12 +225,14 @@ fi #+end_src Make nix apps visible to launchers: + #+begin_src sh if [ -d "$HOME/.nix-profile" ] && [ -z "$NO_GUIX" ]; then export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/.nix-profile/share/applications" fi #+end_src + *** npm npm is especially cumbersome, for instance because by default it tries to install packages to =/gnu/store/=. @@ -247,13 +278,6 @@ if [ -d "/usr/local/texlive/2020" ]; then fi #+end_src -Cargo (Rust) -#+begin_src sh :tangle no -if [ -d "$HOME/.cargo" ] ; then - export PATH="$HOME/.cargo/bin:$PATH" -fi -#+end_src - RVM (Ruby) #+begin_src sh :tangle no if [ -d "$HOME/.rvm" ] ; then @@ -474,9 +498,13 @@ Yeah, tell this to yourself #+begin_src bash init_mamba () { - export MAMBA_EXE="/home/pavel/.guix-extra-profiles/dev/dev/bin/micromamba"; + export MAMBA_EXE=$(which micromamba); export MAMBA_ROOT_PREFIX="/home/pavel/micromamba"; - __mamba_setup="$("$MAMBA_EXE" shell hook --shell bash --prefix "$MAMBA_ROOT_PREFIX" 2> /dev/null)" + if [[ "$(micromamba --version)" > "2.0.0" ]]; then + __mamba_setup="$("$MAMBA_EXE" shell hook --shell bash --root-prefix "$MAMBA_ROOT_PREFIX" 2> /dev/null)" + else + __mamba_setup="$("$MAMBA_EXE" shell hook --shell bash --prefix "$MAMBA_ROOT_PREFIX" 2> /dev/null)" + fi if [ $? -eq 0 ]; then eval "$__mamba_setup" else @@ -564,6 +592,7 @@ end #+end_src Suppress fish greeting + #+begin_src fish set fish_greeting #+end_src @@ -571,9 +600,13 @@ set fish_greeting First, a function to initialize micromamba. #+begin_src fish function init_mamba - set -gx MAMBA_EXE "/home/pavel/.guix-extra-profiles/dev/dev/bin/micromamba" + set -gx MAMBA_EXE (which micromamba) set -gx MAMBA_ROOT_PREFIX "/home/pavel/micromamba" - $MAMBA_EXE shell hook --shell fish --prefix $MAMBA_ROOT_PREFIX | source + if test (string replace -a '.' '' -- (micromamba --version)) -gt 200 + $MAMBA_EXE shell hook --shell fish --root-prefix $MAMBA_ROOT_PREFIX | source &> /dev/null + else + $MAMBA_EXE shell hook --shell fish --prefix $MAMBA_ROOT_PREFIX | source + end end if test -n "$INIT_MAMBA"; diff --git a/Desktop.org b/Desktop.org index 292adea..19cd5ce 100644 --- a/Desktop.org +++ b/Desktop.org @@ -38,13 +38,16 @@ To use them, let's define a noweb block: color)) #+end_src +#+RESULTS: get-color +: #222222 + Test: #+begin_src emacs-lisp :noweb yes <> #+end_src #+RESULTS: -: #f07178 +: #cc3333 Also, get a foreground for the current color: #+NAME: get-fg-for-color @@ -57,13 +60,16 @@ Also, get a foreground for the current color: val)) #+end_src +#+RESULTS: get-fg-for-color +: #fff8f0 + Test; #+begin_src emacs-lisp :noweb yes <> #+end_src #+RESULTS: -: #fafafa +: #fff8f0 This table used to have values, now it has only keys: #+tblname: colors @@ -102,6 +108,26 @@ Some programs get their colors from =XResources=. Let's generate that file. "\n") #+end_src +#+RESULTS: get-xresources +#+begin_example +,*color0: #222222 +,*color1: #cc3333 +,*color2: #217a3c +,*color3: #8a5d00 +,*color4: #375cd8 +,*color5: #ba35af +,*color6: #1f6fbf +,*color7: #fff8f0 +,*color8: #484848 +,*color9: #ff8f88 +,*color10: #8adf80 +,*color11: #fac200 +,*color12: #cbcfff +,*color13: #df8fff +,*color14: #88c8ff +,*color15: #ffffff +#+end_example + #+begin_src conf-xdefaults :noweb yes :tangle ~/.Xresources <> @@ -120,6 +146,7 @@ Also, Xresources are used to set =Xft= settings. Unfortunately, the DPI setting ((string-equal hostname "eminence") 120) ((string-equal hostname "violet") 120) ((string-equal hostname "iris") 120) + ((string-equal hostname "amaranth") 140) (t 96))) #+end_src @@ -295,7 +322,7 @@ The GUI pinentry doesn't work too well with EXWM because of issues with popup wi #+end_src #+RESULTS: find-pinentry -: /home/pavel/.guix-profile/bin/pinentry +: /usr/bin/pinentry #+begin_src conf-space :tangle ~/.gnupg/gpg-agent.conf :noweb yes default-cache-ttl 3600 @@ -539,9 +566,6 @@ Here is a snippet of code that does it: (setq my/exwm-last-workspaces (seq-uniq (cons exwm-workspace-current-index my/exwm-last-workspaces)))) - -(add-hook 'exwm-workspace-switch-hook - #'my/exwm-store-last-workspace) #+end_src The variable =my/exwm-last-workspaces= stores the workspace indices; the first item is the index of the current workspace, the second item is the index of the previous workspace, and so on. @@ -912,6 +936,16 @@ And keybindings that are available in both =char-mode= and =line-mode=: (when (or (< ,i (exwm-workspace--count)) (y-or-n-p (format "Create workspace %d" ,i))) (exwm-workspace-switch-create ,i) )))) + (number-sequence 0 9)) + ,@(mapcar (lambda (i) + (when (= i 0) + (setq i 10)) + `(,(kbd (format "s-" i)) . + (lambda () + (interactive) + (when (or (< ,i (exwm-workspace--count)) + (y-or-n-p (format "Create workspace %d" ,i))) + (exwm-workspace-switch-create ,i) )))) (number-sequence 0 9)))) #+end_src @@ -1167,8 +1201,9 @@ It seems like this strange commit: [[https://github.com/ch11ng/exwm/commit/ce219 (exwm--log "Unhandled: %s(%d)" (x-get-atom-name type exwm-workspace--current) type))))) -(with-eval-after-load 'exwm - (advice-add 'exwm--on-ClientMessage :override #'exwm--on-ClientMessage-old)) +(unless my/is-uconsole + (with-eval-after-load 'exwm + (advice-add 'exwm--on-ClientMessage :override #'exwm--on-ClientMessage-old))) #+end_src ** Application-specific settings @@ -1190,8 +1225,11 @@ And the EXWM config itself. (my/exwm-set-wallpaper) (my/exwm-run-shepherd) (my/run-in-background "gpgconf --reload gpg-agent") - (when (my/is-arch) - (my/run-in-background "set_layout"))) + (when (or (my/is-arch) + (equal (system-name) "amaranth")) + (my/run-in-background "set_layout")) + (add-hook 'exwm-workspace-switch-hook + #'my/exwm-store-last-workspace)) (defun my/exwm-update-class () (exwm-workspace-rename-buffer (format "EXWM :: %s" exwm-class-name))) @@ -1922,6 +1960,7 @@ As we want to interweave polybar modules with these glyphs in the right order an | 1 | pulseaudio | light-magenta | + | | 2 | mpd | magenta | + | | 16 | nvidia | light-cyan | + | +| 17 | backlight | light-cyan | + | | 3 | cpu | cyan | + | | 15 | temperature | cyan | + | | 9 | battery | cyan | + | @@ -1938,17 +1977,25 @@ As we want to interweave polybar modules with these glyphs in the right order an Also excluding some modules from certain monitors, which for now is about excluding =battery= from the monitors of my desktop PC: #+NAME: polybar_modules_exclude -| Monitor | Exclude | -|----------+---------| -| DVI-D-0 | battery | -| HDMI-A-0 | battery | -| HDMI-0 | battery | -| DP-1 | battery | -| eDP | nvidia | -| eDP-1 | nvidia | -| DVI-D-0 | nvidia | -| HDMI-A-0 | nvidia | -| HDMI-1 | nvidia | +| Monitor | Hostname | Exclude | +|----------+----------+-------------| +| HDMI-0 | violet | battery | +| HDMI-0 | violet | backlight | +| DP-1 | violet | battery | +| DP-1 | violet | backlight | +| HDMI-A-0 | eminence | battery | +| HDMI-A-0 | eminence | nvidia | +| eDP | eminence | nvidia | +| HDMI-1 | iris | nvidia | +| HDMI-1 | iris | backlight | +| DSI-1 | amaranth | nvidia | +| DSI-1 | amaranth | mpd | +| DSI-1 | amaranth | openvpn | +| DSI-1 | amaranth | swap-memory | +| DSI-1 | amaranth | bandwidth | +| DSI-1 | amaranth | temperature | +| DSI-1 | amaranth | weather | +| DSI-1 | amaranth | sun | Another thing we need to do is to set the color of modules in accordance with the =polybar_modules= table. The background can be determined from the =Color= column with the following code block: #+NAME: get-polybar-bg @@ -1977,21 +2024,27 @@ Most of these combinations can be inferred from the =polybar_modules= table, the #+NAME: polybar-generate-glyphs #+begin_src emacs-lisp :var table=polybar_modules exclude-table=polybar_modules_exclude extra=polybar_extra_colors -(let* ((monitors +(let* ((monitor-hostnames (thread-last exclude-table - (seq-map (lambda (el) (nth 0 el))) + (seq-map (lambda (el) (concat (nth 0 el) ":" (nth 1 el)))) (seq-uniq))) (exclude-combinations - (seq-map - (lambda (monitor) - (seq-map - (lambda (el) (nth 1 el)) - (seq-filter - (lambda (el) (and (string-equal (nth 0 el) monitor) - (nth 1 el))) - exclude-table))) - `(,@monitors ""))) + (seq-uniq + (seq-map + (lambda (monitor-hostname) + (let* ((split (string-split monitor-hostname ":")) + (monitor (nth 0 split)) + (hostname (nth 1 split))) + (seq-map + (lambda (el) (nth 2 el)) + (seq-filter + (lambda (el) + (and (string-equal (nth 0 el) monitor) + (string-equal (nth 1 el) hostname) + (nth 2 el))) + exclude-table)))) + `(,@monitor-hostnames "")))) (module-glyph-combinations (thread-last exclude-combinations @@ -2007,16 +2060,16 @@ Most of these combinations can be inferred from the =polybar_modules= table, the (seq-uniq))) (color-changes nil)) (dolist (e extra) - (add-to-list - 'color-changes - (concat (nth 0 e) "--" (nth 1 e)))) + (push (concat (nth 0 e) "--" (nth 1 e)) + color-changes)) (dolist (comb module-glyph-combinations) (dotimes (i (1- (length comb))) - (add-to-list - 'color-changes + (push (concat (nth 2 (nth i comb)) "--" - (nth 2 (nth (1+ i) comb)))))) + (nth 2 (nth (1+ i) comb))) + color-changes))) + (setq color-changes (seq-uniq color-changes)) (mapconcat (lambda (el) (let ((colors (split-string el "--"))) @@ -2036,10 +2089,10 @@ content-font = 5" #+end_src Here's a rough outline of how the code works: -- =monitors= is a list of unique monitors in =exclude-table= -- =exclude-combilnations= is a list of lists of module names to be excluded for each monitor -- =module-glyphs-combinations= is a list of lists of actual modules for each monitor -- =color-changes= is a list of unique adjacent colors across modules in all monitors +- =monitor-hostnames= is a list of unique monitor-hostname combination in =exclude-table= +- =exclude-combilnations= is a list of lists of module names to be excluded for each combinations +- =module-glyphs-combinations= is a list of lists of actual modules for each combination +- =color-changes= is a list of unique adjacent colors across modules in all combinations Finally, =color-changes= is used to generate glyph modules that look like this: #+begin_src conf-windows :tangle no @@ -2066,12 +2119,13 @@ The parameters here, excluding the two required tables, are: - =last-color= - the second color of the last glyph. #+NAME: polybar-generate-modules -#+begin_src emacs-lisp :var table=polybar_modules exclude-table=polybar_modules_exclude monitor="DVI-D-0" first-color="background" last-color="background" +#+begin_src emacs-lisp :var table=polybar_modules exclude-table=polybar_modules_exclude monitor="DSI-1" first-color="background" last-color="background" hostname="amaranth" (let* ((exclude-modules (thread-last exclude-table - (seq-filter (lambda (el) (string-equal (nth 0 el) monitor))) - (seq-map (lambda (el) (nth 1 el))))) + (seq-filter (lambda (el) (and (string-equal (nth 0 el) monitor) + (string-equal (nth 1 el) hostname)))) + (seq-map (lambda (el) (nth 2 el))))) (modules (thread-last table @@ -2169,6 +2223,12 @@ scroll-down = i3wm-wsprev ; cursor-scroll = ns-resize #+end_src +DPI: +#+begin_src conf-windows +dpi-x = ${env:DPI} +dpi-y = ${env:DPI} +#+end_src + Misc settings. #+begin_src conf-windows [settings] @@ -2191,6 +2251,9 @@ The script below allows me to: #+begin_src bash :tangle ./bin/polybar.sh :noweb yes hostname=$(hostname) # Settings varying on the hostname +DPI=96 +BAR_HEIGHT=29 + if [ "$hostname" = "azure" ]; then TRAY_MONITOR="eDP-1" elif [ "$hostname" = "eminence" ]; then @@ -2201,52 +2264,45 @@ elif [ "$hostname" = "eminence" ]; then fi elif [ "$hostname" = "iris" ]; then TRAY_MONITOR="HDMI-1" +elif [ "$hostname" = "amaranth" ]; then + export BATTERY="axp20x-battery" + export ADAPTER="axp22x-ac" + TRAY_MONITOR="DSI-1" else TRAY_MONITOR="DP-1" fi # Setting varying on the monitor -declare -A FONT_SIZES=( - ["eDP"]="13" - ["eDP-1"]="13" - ["DVI-D-0"]="13" - ["HDMI-A-0"]="13" - ["HDMI-1"]="13" - ["HDMI-0"]="13" - ["DP-1"]="13" +declare -A FONT_SIZE_OVERRIDE=( + ["amaranth:DSI-1"]="13" ) -declare -A EMOJI_SCALE=( - ["eDP"]="9" - ["eDP-1"]="9" - ["DVI-D-0"]="10" - ["HDMI-A-0"]="10" - ["HDMI-1"]="10" - ["HDMI-0"]="10" - ["DP-1"]="10" +declare -A EMOJI_SCALE_OVERRIDE=( + ["amaranth:DSI-1"]="13" ) -declare -A BAR_HEIGHT=( - ["eDP"]="29" - ["eDP-1"]="29" - ["DVI-D-0"]="29" - ["HDMI-A-0"]="29" - ["HDMI-1"]="29" - ["HDMI-0"]="29" - ["DP-1"]="29" +declare -A DPI_OVERRIDE=( + ["amaranth:DSI-1"]="140" +) +declare -A BAR_HEIGHT_OVERRIDE=( + ["amaranth:DSI-1"]="40" ) declare -A BLOCKS=( - ["eDP"]="<>" - ["eDP-1"]="<>" - ["DVI-D-0"]="<>" - ["HDMI-A-0"]="<>" - ["HDMI-1"]="<>" - ["HDMI-0"]="<>" - ["DP-1"]="<>" + ["violet:HDMI-0"]="<>" + ["violet:DP-1"]="<>" + ["eminence:eDP"]="<>" + ["eminence:HDMI-A-0"]="<>" + ["iris:HDMI-1"]="<>" + ["amaranth:DSI-1"]="<>" ) declare -A TEMP_HWMON_PATHS=( ["eminence"]="/sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon2/temp1_input" ["indigo"]="/sys/devices/platform/coretemp.0/hwmon/hwmon2/temp1_input" ["violet"]="/sys/devices/platform/coretemp.0/hwmon/hwmon2/temp1_input" + ["amaranth"]="/sys/devices/virtual/thermal/thermal_zone0/hwmon0/temp1_input" +) + +declare -A BACKLIGHT_CARDS=( + ["amaranth"]="backlight@0" ) # Geolocation for some modules @@ -2262,19 +2318,19 @@ for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do else export TRAY="none" fi - SIZE=${FONT_SIZES[$MONITOR]} - SCALE=${EMOJI_SCALE[$MONITOR]} - TEMP=${TEMP_HWMON_PATHS[$(hostname)]} - if [[ -z "$SCALE" ]]; then + + KEY="$(hostname):${m}" + + export HEIGHT=${BAR_HEIGHT_OVERRIDE[$KEY]:-$BAR_HEIGHT} + export DPI=${DPI_OVERRIDE[$KEY]:-$DPI} + export RIGHT_BLOCKS=${BLOCKS[$KEY]} + if [[ -z "$RIGHT_BLOCKS" ]]; then continue fi - # export FONT0="pango:monospace:size=$SIZE;1" - # export FONT1="NotoEmoji:scale=$SCALE:antialias=false;1" - # export FONT2="fontawesome:pixelsize=$SIZE;1" - # export FONT3="JetBrains Mono Nerd Font:monospace:size=15;1" - export HEIGHT=${BAR_HEIGHT[$MONITOR]} - export RIGHT_BLOCKS=${BLOCKS[$MONITOR]} - export TEMP_HWMON_PATH=${TEMP} + + export TEMP_HWMON_PATH=${TEMP_HWMON_PATHS[$(hostname)]} + export BACKLIGHT_CARD=${BACKLIGHT_CARDS[$(hostname)]} + polybar mybar & done #+end_src @@ -2396,7 +2452,72 @@ format = 