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.GdkPixbuf.Objects.Pixbuf as Gdk
import qualified GI.Gtk as Gtk
import qualified GI.Pango as Pango
import Network.HostName (getHostName)
import qualified StatusNotifier.Tray as SNITray
import System.Environment (lookupEnv)
@@ -78,21 +79,31 @@ decorateWithClassAndBoxM :: (MonadIO m) => Text -> m Gtk.Widget -> m Gtk.Widget
decorateWithClassAndBoxM klass builder =
builder >>= decorateWithClassAndBox klass
setLabelAlignmentRecursively :: Float -> Gtk.Justification -> Gtk.Widget -> IO ()
setLabelAlignmentRecursively xalign justify widget = do
forEachLabelRecursively :: Gtk.Widget -> (Gtk.Label -> IO ()) -> IO ()
forEachLabelRecursively widget action = do
maybeLabel <- castTo Gtk.Label widget
case maybeLabel of
Just label -> do
Gtk.labelSetXalign label xalign
Gtk.labelSetJustify label justify
Just label -> action label
Nothing -> pure ()
maybeContainer <- castTo Gtk.Container widget
case maybeContainer of
Just container ->
Gtk.containerGetChildren container >>= mapM_ (setLabelAlignmentRecursively xalign justify)
Gtk.containerGetChildren container >>= mapM_ (`forEachLabelRecursively` action)
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
x11FullWorkspaceNames :: X11Property [(WorkspaceId, String)]
@@ -277,7 +288,14 @@ layoutWidget =
windowsWidget :: TaffyIO Gtk.Widget
windowsWidget =
decorateWithClassAndBoxM "windows" (windowsNew defaultWindowsConfig)
decorateWithClassAndBoxM
"windows"
( windowsNew
defaultWindowsConfig
{ getActiveLabel = truncatedGetActiveLabel 28,
configureActiveLabel = liftIO . setFixedLabelWidth 28
}
)
workspacesWidget :: TaffyIO Gtk.Widget
workspacesWidget = Workspaces.workspacesNew cfg
@@ -326,7 +344,8 @@ mprisWidget =
simplePlayerWidget
defaultPlayerConfig
{ 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
:config
(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)))
#+END_SRC
** direnv
@@ -3977,17 +3978,18 @@ Ensure all themes that I use are installed:
(use-package doom-themes
:defer t)
(use-package badwolf-theme)
(use-package badwolf-theme
:defer t)
#+END_SRC
** all-the-icons
#+BEGIN_SRC emacs-lisp
(use-package all-the-icons
:demand t)
:defer t)
#+END_SRC
** nerd-icons
#+BEGIN_SRC emacs-lisp
(use-package nerd-icons
:demand t)
:defer t)
#+END_SRC
** doom-modeline
#+begin_src emacs-lisp

View File

@@ -1,17 +1,31 @@
;; 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-builds-directory (expand-file-name "builds/" elpaca-directory))
(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory))
(defvar elpaca-order '(elpaca :repo "git@github.com:progfolio/elpaca.git"
(defvar elpaca-sources-directory (expand-file-name "sources/" elpaca-directory))
(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
:files (:defaults "elpaca-test.el" (:exclude "extensions"))
:build (:not elpaca--activate-package)))
(let* ((repo (expand-file-name "elpaca/" elpaca-repos-directory))
:build (:not elpaca-activate)))
;; 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))
(autoloads (expand-file-name "elpaca-autoloads" repo))
(order (cdr elpaca-order))
(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)
(make-directory repo t)
(when (<= emacs-major-version 28) (require 'subr-x))
@@ -34,6 +48,6 @@
(unless (require 'elpaca-autoloads nil t)
(require 'elpaca)
(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)
(elpaca `(,@elpaca-order))

View File

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