stumpwm-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [STUMP] Best of the modelines


From: Sébastien Vauban
Subject: Re: [STUMP] Best of the modelines
Date: Mon, 16 Nov 2009 09:33:58 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

Hi Chris,

Chris Gray wrote:
> Sébastien Vauban wrote:
>> Sébastien Vauban wrote:
>>> I'd be interested by knowing what awesome feature you've put in your 
>>> modeline.
>>>
>>> I know we can put all the things from contribs, adding colors and
>>> information like the currently played song; but do you have anything else
>>> that's interesting and could be shared with us? Monitoring? Application or
>>> network status? Etc?
>
>> I now have this:
>
>> (defun current-date ()
>>   "Returns the date formatted as `2009-11-12 Thu 17:21:43'."
>>   (run-shell-command "YMDd=`date '+%F %a'`; HMS=`date '+%H:%M:%S'`; echo -n 
>> $YMDd ^B$HMS^b" t))
>
> This is possible to do in lisp:
>
> (defconstant *day-names*
>     '("Mon" "Tue" "Wed"
>       "Thu" "Fri" "Sat"
>       "Sun"))
>
> (defconstant *month-names*
>   '("Jan" "Feb" "Mar" "Apr"
>     "May" "Jun" "Jul" "Aug"
>     "Sep" "Oct" "Nov" "Dec"))
>
> (defun date-string ()
>   (multiple-value-bind
>       (second minute hour date month year day-of-week dst-p tz)
>       (get-decoded-time)
>     (format nil "~a ~a ~d ~2,'0d:~2,'0d:~2,'0d ~d"
>           (nth day-of-week *day-names*)
>           (nth (- month 1) *month-names*)
>           date
>           hour
>           minute
>           second
>           year)))

Cool. This is certainly lighter than the solution I had (launching multiple
external processes)... Thanks for sharing!

Though, I've more fears of the processing power that can be taken by other
features of my modeline, in particular the IP address stuff (with computation
of the prefix mask and the default gateway).

The minimum CPU usage that I can see is 9 to 10%. Never under. What should I
expect (on this 4-year old Sony Vaio laptop, 1 x 2.13 GHz CPU)?

Best regards,
  Seb

-- 
Sébastien Vauban





reply via email to

[Prev in Thread] Current Thread [Next in Thread]