Merge pull request #373 from TheMC47/xmobarBorder

Added xmobarBorder utility function to add borders to strings
This commit is contained in:
Brent Yorgey 2020-08-29 15:31:51 -05:00 committed by GitHub
commit 2ad0c04447
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View File

@ -145,6 +145,8 @@
* `XMonad.Util.EZConfig` * `XMonad.Util.EZConfig`
- Added support for XF86Bluetooth. - Added support for XF86Bluetooth.
* `XMonad.Hooks.DynamicLog`
- Added `xmobarBorder` function to create borders around strings.
## 0.16 ## 0.16

View File

@ -43,8 +43,8 @@ module XMonad.Hooks.DynamicLog (
-- * Formatting utilities -- * Formatting utilities
wrap, pad, trim, shorten, wrap, pad, trim, shorten,
xmobarColor, xmobarAction, xmobarRaw, xmobarColor, xmobarAction, xmobarBorder,
xmobarStrip, xmobarStripTags, xmobarRaw, xmobarStrip, xmobarStripTags,
dzenColor, dzenEscape, dzenStrip, dzenColor, dzenEscape, dzenStrip,
-- * Internal formatting functions -- * Internal formatting functions
@ -436,6 +436,18 @@ xmobarAction command button = wrap l r
l = "<action=`" ++ command ++ "` button=" ++ button ++ ">" l = "<action=`" ++ command ++ "` button=" ++ button ++ ">"
r = "</action>" r = "</action>"
-- | Use xmobar box to add a border to an arbitrary string.
xmobarBorder :: String -- ^ Border type. Possible values: VBoth, HBoth, Full,
-- Top, Bottom, Left or Right
-> String -- ^ color: a color name, or #rrggbb format
-> Int -- ^ width in pixels
-> String -- ^ output string
-> String
xmobarBorder border color width = wrap prefix "</box>"
where
prefix = "<box type=" ++ border ++ " width=" ++ show width ++ " color="
++ color ++ ">"
-- | Encapsulate arbitrary text for display only, i.e. untrusted content if -- | Encapsulate arbitrary text for display only, i.e. untrusted content if
-- wrapped (perhaps from window titles) will be displayed only, with all tags -- wrapped (perhaps from window titles) will be displayed only, with all tags
-- ignored. Introduced in xmobar 0.21; see their documentation. Be careful not -- ignored. Introduced in xmobar 0.21; see their documentation. Be careful not