I have hacked up a simple xmessage replacement which looks neater,
has dmenu-like handling and supports unicode.
Since this is my first real project, I appreciate serious criticism of
the code.
Thanks go out to Christoph Lohmann for svkb/thingmenu, which inspired
various pieces of code.
I do not consider the program finished yet, just grep for TODO to see
what I mean.
-flo
Linky?
And I am obviously too tired to write mails.
Code now attached.
-flo
An operation Mode without any Buttons where the Window closes itselfs
after x seconds would be also great I think. Than somebody could use
smessage also for displaying popup-infos whithin a desktop environment
for example.
Kind regards,
Michael
Nice code.
If you want to replace xmessage, you should make text scrollable and selectable.
cc -Wall -Wextra -Werror -std=c99 -pedantic -I/usr/X11R6/include
-D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DNAME=\"smessage\"
-DVERSION=\"ALPHA\" -c smessage.c
smessage.c: In function ‘handlekey’:
smessage.c:568:2: error: ‘XKeycodeToKeysym’ is deprecated (declared at
/usr/include/X11/Xlib.h:1695) [-Werror=deprecated-declarations]
cc1: all warnings being treated as errors
make: *** [smessage.o] Error 1
On 23.02.2012 09:13, Michael Stummvoll wrote:
> nice Tool, but you should make thinks like the font or colors
> configurable (excluded in a config.h).
personally I don't like nested includes much, but if it's general
consent that it is the preferred way, I'll change it. At the moment,
nesting is not necessary anyway.
> Also when i resize a window
> (make it bigger) its not redrawn correctly for me.
The redrawing costed me a night and I thought it would work, but I'll
look into it. I just are short an time at the moment.
> An operation Mode without any Buttons where the Window closes itselfs
> after x seconds would be also great I think. Than somebody could use
> smessage also for displaying popup-infos whithin a desktop environment
> for example.
Thats a nice idea, I think it would be great with the (not yet
implemented) function to force geometry.
-flo
On 23.02.2012 13:06, Aurélien Aptel wrote:
> Nice code.
Thanks.
> If you want to replace xmessage, you should make text scrollable and
selectable.
Thats actually quite at the top on my to do list.
-flo
On 23.02.2012 13:30, Bartosz Pranczke wrote:
> I have a warning preventing this from compile.
>
> cc -Wall -Wextra -Werror -std=c99 -pedantic -I/usr/X11R6/include
> -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DNAME=\"smessage\"
> -DVERSION=\"ALPHA\" -c smessage.c
> smessage.c: In function ‘handlekey’:
> smessage.c:568:2: error: ‘XKeycodeToKeysym’ is deprecated (declared at
> /usr/include/X11/Xlib.h:1695) [-Werror=deprecated-declarations]
Delete -Werror to make it compile anyway, but this warning is new to
me. And honestly, I don't think it makes sense, since if the want you
to use XKB, you won't be using Xlib anyway.
But it clearly shows that i should make a release option in the
makefile, which is not that picky.
Out of couriousity, what system do you use? I hacked on slackware,
where I didn't got that warning.
-flo
> > An operation Mode without any Buttons where the Window closes
> > itselfs after x seconds would be also great I think. Than somebody
> > could use smessage also for displaying popup-infos whithin a
> > desktop environment for example.
>
> Thats a nice idea, I think it would be great with the (not yet
> implemented) function to force geometry.
Closing after x seconds can be made within a simple shell script. So I
think you can omit that part of this feature. Maybe only provide script
itself as example.
On 23.02.2012 09:13, Michael Stummvoll wrote:
> Also when i resize a window
> (make it bigger) its not redrawn correctly for me.
I've looked into this, but wasn't able to reproduce this. I've found
and fixed another error, which occured when it is shrinked to a width
below one character width + 2 * margins.
The only way I can think of is that you use a font, which width is not
8. Since I've not yet figured out an elegant way how to determine the
(average and/or actual) glyph width in X, it's hardcoded by now, so you
can try to change the 8 at the end of the line smessage.c:458 to the
width of your fixed font. If you use a proportinal font, I have no
solution at the moment.
-flo
I guess you could find the right amount of characters to draw to fill
a line using (dichotomously) XmbTextExtents().
On Thu, 23 Feb 2012 09:13:07 +0100, Michael Stummvoll wrote:
> An operation Mode without any Buttons where the Window closes itselfs
> after x seconds would be also great I think. Than somebody could use
> smessage also for displaying popup-infos whithin a desktop
> environment
> for example.
As mentioned before, the closing timer should be implemented in a
separate script, but how is the consensus about duplicating
functionality?
The button handling of original xmessage might be provided by
Christoph's
thingmenu, so is it reasonable to implement it again for smessage or
should
the functionality kept separated?
-flo
I didn't play too much with X11 API.. would it be even possible to
modify smessage.c to draw directly on the display without using a
window? if so.. any help on how would I do this?
--
Fernando
Take a look at xosd's osd_cat program. I haven't looked at the code,
but it will likely do what you want.
Nick
X11 is complex enough to not have to hack such things up.
Smessage would need to set the WMHints input flag to False and en-
force its size hints. Doing so will tell dwm to not focus the win-
dow and keeping the window out of the tiling management.
Next you would need something that keeps up on the currently dis-
played windows and/or the content of the status window, but that
would make smessage a whole framework and gnomesque.
Attached is a tarball of how far I am for modifying smessage to
be like that. It is far from being finished. I stopped when cal-
culating the window size. At the moment smessage is only designed
to fit what is given to it, which is wrong, when you want to en-
force your window size. When this function is added, then the
popup state can easily be used to enforce what you want.
Additional that tarball includes a suckless make framework, a
config.h configuration and a rudimentary manpage. The features are
not finished yet, so there is not much to write about.
I'm sorry about this half-finished rubbish, but life is taking too
much time. I'm sorry.
Sincerely,
Christoph