Feature request: a bit of interop with trayer [filling xmobar with empty space] #239
Comments
hmmm. perhaps the simplest way of accomplishing what you want would be it's still a hack. if trayer supported X11's of course the best way would be to implement a system dock plugin |
Thanks for the pointers. I'll first try the icon thing as it seems the simplest. I'm not very versed in the whole "X thing" :D so that's probably way over my head. By system dock in haskell you mean to make it part of xmobar, or a different program? (or as a library)? Xmobar is pretty lightweight and I guess people like that, adding docks into it, dunno how much dependencies would that pull in. |
yes, i meant implementing a dock using X APIs directly within xmobar. |
What about integrating with https://hackage.haskell.org/package/gtk-traymanager-0.1.6? From what I read it is based on |
I implemented joar's idea of an dynamically generated, transparent XPM icon for padding. If someone find this feature request when searching for dynamic xmobar width, like I did, they might find it useful. trayer-padding-icon.sh#!/bin/sh
# Detects the width of running trayer-srg window (xprop name 'panel')
# and creates an XPM icon of that width, 1px height, and transparent.
# Outputs an <icon>-tag for use in xmobar to display the generated
# XPM icon.
#
# Run script from xmobar:
# `Run Com "/where/ever/trayer-padding-icon.sh" [] "trayerpad" 10`
# and use `%trayerpad%` in your template.
# Function to create a transparent Wx1 px XPM icon
create_xpm_icon () {
timestamp=$(date)
pixels=$(for i in `seq $1`; do echo -n "."; done)
cat << EOF > "$2"
/* XPM *
static char * trayer_pad_xpm[] = {
/* This XPM icon is used for padding in xmobar to */
/* leave room for trayer-srg. It is dynamically */
/* updated by by trayer-pad-icon.sh which is run */
/* by xmobar. */
/* Created: ${timestamp} */
/* <w/cols> <h/rows> <colors> <chars per pixel> */
"$1 1 1 1",
/* Colors (none: transparent) */
". c none",
/* Pixels */
"$pixels"
};
EOF
}
# Width of the trayer window
width=$(xprop -name panel | grep 'program specified minimum size' | cut -d ' ' -f 5)
# Icon file name
iconfile="/tmp/trayer-padding-${width}px.xpm"
# If the desired icon does not exist create it
if [ ! -f $iconfile ]
then
create_xpm_icon $width $iconfile
fi
# Output the icon tag for xmobar
echo "<icon=${iconfile}/>"
|
@jonascj rad! love it. |
According to https://wiki.archlinux.org/index.php/stalonetray, If you didn't want to deal with manual adjustment of system tray size, you could use taffybar. |
Found this lovely hack over on jaor/xmobar#239 (comment).
Found this lovely hack over on jaor/xmobar#239 (comment).
So, I suppose many people would like to use xmobar and trayer (or other system dock) together. You sort of can now, but the problem is that xmobar can't shrink/expand when the system tray expands, so you either have to allocate fixed space, which looks really awkward (plus it can overflow if tray grows too much) or possibly use the tray on different display (not everyone has 2+ monitors).
I have "developed" a hack to make the shrinking part as good as it gets, here is the basic idea:
What I would like to have is simply a way to make an "n pixels wide padding" monitor, so I could fit the trayer precisely and not rely on whitespace calculations (as this is not portable and just a bit wacky in general). Ideally, the monitor could take stdout of some program or some other way to calculate the width dynamically.
I don't know how difficult this might be, but if you give me some hints on how to do this "pixel filling" output I could try to work it together. I already wrote one experimental plugin myself (for pulse audio) but that only output text, so I roughly understands the architecture.
I run trayer like so:
The space-printing code
My xmobarrc is here: https://github.com/Fuco1/dotfiles/blob/master/xmonad/.xmonad/xmobarrc
The text was updated successfully, but these errors were encountered: