Update taffybar and Emacs configuration

This commit is contained in:
2026-03-09 00:46:12 -07:00
committed by Kat Huang
parent 69a0842892
commit a978aadebf
5 changed files with 55 additions and 21 deletions

View File

@@ -20,6 +20,7 @@ import qualified Data.Text as T
import qualified GI.Gdk as Gdk import qualified GI.Gdk as Gdk
import qualified GI.GdkPixbuf.Objects.Pixbuf as Gdk import qualified GI.GdkPixbuf.Objects.Pixbuf as Gdk
import qualified GI.Gtk as Gtk import qualified GI.Gtk as Gtk
import qualified GI.Pango as Pango
import Network.HostName (getHostName) import Network.HostName (getHostName)
import qualified StatusNotifier.Tray as SNITray import qualified StatusNotifier.Tray as SNITray
import System.Environment (lookupEnv) import System.Environment (lookupEnv)
@@ -78,21 +79,31 @@ decorateWithClassAndBoxM :: (MonadIO m) => Text -> m Gtk.Widget -> m Gtk.Widget
decorateWithClassAndBoxM klass builder = decorateWithClassAndBoxM klass builder =
builder >>= decorateWithClassAndBox klass builder >>= decorateWithClassAndBox klass
setLabelAlignmentRecursively :: Float -> Gtk.Justification -> Gtk.Widget -> IO () forEachLabelRecursively :: Gtk.Widget -> (Gtk.Label -> IO ()) -> IO ()
setLabelAlignmentRecursively xalign justify widget = do forEachLabelRecursively widget action = do
maybeLabel <- castTo Gtk.Label widget maybeLabel <- castTo Gtk.Label widget
case maybeLabel of case maybeLabel of
Just label -> do Just label -> action label
Gtk.labelSetXalign label xalign
Gtk.labelSetJustify label justify
Nothing -> pure () Nothing -> pure ()
maybeContainer <- castTo Gtk.Container widget maybeContainer <- castTo Gtk.Container widget
case maybeContainer of case maybeContainer of
Just container -> Just container ->
Gtk.containerGetChildren container >>= mapM_ (setLabelAlignmentRecursively xalign justify) Gtk.containerGetChildren container >>= mapM_ (`forEachLabelRecursively` action)
Nothing -> pure () Nothing -> pure ()
setLabelAlignmentRecursively :: Float -> Gtk.Justification -> Gtk.Widget -> IO ()
setLabelAlignmentRecursively xalign justify widget =
forEachLabelRecursively widget $ \label -> do
Gtk.labelSetXalign label xalign
Gtk.labelSetJustify label justify
setFixedLabelWidth :: Int32 -> Gtk.Label -> IO ()
setFixedLabelWidth width label = do
Gtk.labelSetWidthChars label width
Gtk.labelSetMaxWidthChars label width
Gtk.labelSetEllipsize label Pango.EllipsizeModeEnd
-- ** X11 Workspaces -- ** X11 Workspaces
x11FullWorkspaceNames :: X11Property [(WorkspaceId, String)] x11FullWorkspaceNames :: X11Property [(WorkspaceId, String)]
@@ -277,7 +288,14 @@ layoutWidget =
windowsWidget :: TaffyIO Gtk.Widget windowsWidget :: TaffyIO Gtk.Widget
windowsWidget = windowsWidget =
decorateWithClassAndBoxM "windows" (windowsNew defaultWindowsConfig) decorateWithClassAndBoxM
"windows"
( windowsNew
defaultWindowsConfig
{ getActiveLabel = truncatedGetActiveLabel 28,
configureActiveLabel = liftIO . setFixedLabelWidth 28
}
)
workspacesWidget :: TaffyIO Gtk.Widget workspacesWidget :: TaffyIO Gtk.Widget
workspacesWidget = Workspaces.workspacesNew cfg workspacesWidget = Workspaces.workspacesNew cfg
@@ -326,7 +344,8 @@ mprisWidget =
simplePlayerWidget simplePlayerWidget
defaultPlayerConfig defaultPlayerConfig
{ setNowPlayingLabel = { setNowPlayingLabel =
\np -> stackedMprisLabel <$> playingText 20 20 np \np -> stackedMprisLabel <$> playingText 20 20 np,
setupPlayerLabel = setFixedLabelWidth 20
} }
} }

View File

@@ -3603,7 +3603,8 @@ I had to disable this mode because something that it does messes with coding set
(use-package editorconfig (use-package editorconfig
:config :config
(progn (progn
(add-to-list 'editorconfig-exclude-modes '(org-mode)) (when (boundp 'editorconfig-exclude-modes)
(add-to-list 'editorconfig-exclude-modes 'org-mode))
(editorconfig-mode 1))) (editorconfig-mode 1)))
#+END_SRC #+END_SRC
** direnv ** direnv
@@ -3977,17 +3978,18 @@ Ensure all themes that I use are installed:
(use-package doom-themes (use-package doom-themes
:defer t) :defer t)
(use-package badwolf-theme) (use-package badwolf-theme
:defer t)
#+END_SRC #+END_SRC
** all-the-icons ** all-the-icons
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package all-the-icons (use-package all-the-icons
:demand t) :defer t)
#+END_SRC #+END_SRC
** nerd-icons ** nerd-icons
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package nerd-icons (use-package nerd-icons
:demand t) :defer t)
#+END_SRC #+END_SRC
** doom-modeline ** doom-modeline
#+begin_src emacs-lisp #+begin_src emacs-lisp

View File

@@ -1,17 +1,31 @@
;; Elpaca Installer -*- lexical-binding: t; -*- ;; Elpaca Installer -*- lexical-binding: t; -*-
(defvar elpaca-installer-version 0.11) (defvar elpaca-installer-version 0.12)
(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory)) (defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory))
(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory)) (defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory))
(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory)) (defvar elpaca-sources-directory (expand-file-name "sources/" elpaca-directory))
(defvar elpaca-order '(elpaca :repo "git@github.com:progfolio/elpaca.git" (defvar elpaca-legacy-repos-directory (expand-file-name "repos/" elpaca-directory))
(defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git"
:ref nil :depth 1 :inherit ignore :ref nil :depth 1 :inherit ignore
:files (:defaults "elpaca-test.el" (:exclude "extensions")) :files (:defaults "elpaca-test.el" (:exclude "extensions"))
:build (:not elpaca--activate-package))) :build (:not elpaca-activate)))
(let* ((repo (expand-file-name "elpaca/" elpaca-repos-directory)) ;; Elpaca now expects package sources under `sources/`. Preserve older local
;; installs that still use `repos/` so startup can recover without recloning.
(when (and (file-directory-p elpaca-legacy-repos-directory)
(not (file-exists-p elpaca-sources-directory)))
(rename-file (directory-file-name elpaca-legacy-repos-directory)
(directory-file-name elpaca-sources-directory)))
(when (and (file-directory-p elpaca-sources-directory)
(not (file-exists-p elpaca-legacy-repos-directory)))
(make-symbolic-link (directory-file-name elpaca-sources-directory)
(directory-file-name elpaca-legacy-repos-directory)))
(let* ((repo (expand-file-name "elpaca/" elpaca-sources-directory))
(build (expand-file-name "elpaca/" elpaca-builds-directory)) (build (expand-file-name "elpaca/" elpaca-builds-directory))
(autoloads (expand-file-name "elpaca-autoloads" repo))
(order (cdr elpaca-order)) (order (cdr elpaca-order))
(default-directory repo)) (default-directory repo))
(add-to-list 'load-path (if (file-exists-p build) build repo)) (add-to-list 'load-path repo)
(when (file-exists-p build)
(add-to-list 'load-path build))
(unless (file-exists-p repo) (unless (file-exists-p repo)
(make-directory repo t) (make-directory repo t)
(when (<= emacs-major-version 28) (require 'subr-x)) (when (<= emacs-major-version 28) (require 'subr-x))
@@ -34,6 +48,6 @@
(unless (require 'elpaca-autoloads nil t) (unless (require 'elpaca-autoloads nil t)
(require 'elpaca) (require 'elpaca)
(elpaca-generate-autoloads "elpaca" repo) (elpaca-generate-autoloads "elpaca" repo)
(let ((load-source-file-function nil)) (load "./elpaca-autoloads")))) (let ((load-source-file-function nil)) (load autoloads))))
(add-hook 'after-init-hook #'elpaca-process-queues) (add-hook 'after-init-hook #'elpaca-process-queues)
(elpaca `(,@elpaca-order)) (elpaca `(,@elpaca-order))

View File

@@ -79,7 +79,6 @@
(org :type git :host github :repo "colonelpanic8/org-mode" :local-repo "org" (org :type git :host github :repo "colonelpanic8/org-mode" :local-repo "org"
:branch "my-main-2025" :branch "my-main-2025"
:depth full :depth full
:build (:not autoloads)
:files (:defaults "lisp/*.el" ("etc/styles/" "etc/styles/*")) :files (:defaults "lisp/*.el" ("etc/styles/" "etc/styles/*"))
:wait t)) :wait t))