Re: [STUMP] Modules (loading)

Lucas Pandolfo <[email protected]>
Newsgroups gmane.comp.window-managers.stumpwm.devel
Message-ID <CALLZCYk1UOsc16r2wCFdAdd+GTpt-VDMKufmmz-23A6MVnuuwg@mail.gmail.com>
Replacing the said line?

Then i suppose the battery files in /proc and /sys are different, so the
battery module wont work. Also the proposed fix wont work.



On 14 January 2015 at 10:32, Kete Foy <[email protected]> wrote:

>  had an error, and the modeline said
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *no battery The value "" is not of type HASH-TABLE. Backtrace for:
> #<SB-THREAD:THREAD "main thread" RUNNING {10044CE433}> 0:
> (SB-IMPL::GETHASH3 "present" "" NIL) [tl,external] 1:
> (BATTERY::CURRENT-BATTERY-CHARGE) 2: (BATTERY::FMT-BAT-CHARGE #<unavailable
> argument>) 3: (FORMAT-EXPAND ((#\b BATTERY::FMT-BAT-CHARGE) (#\h
> STUMPWM::FMT-HEAD) (#\w STUMPWM::FMT-WINDOW-LIST) (#\W
> STUMPWM::FMT-HEAD-WINDOW-LIST) (#\g STUMPWM::FMT-GROUP-LIST) (#\n
> STUMPWM::FMT-GROUP) (#\u STUMPWM::FMT-URGENT-WINDOW-LIST) (#\v
> STUMPWM::FMT-HEAD-WINDOW-LIST-HIDDEN-WINDOWS) (#\d
> STUMPWM::FMT-MODELINE-TIME)) "%n |%w | %b | %d" #S(MODE-LINE :SCREEN
> #1=#S<screen #<XLIB:SCREEN #2=:0.0 1280x800x24 TRUE-COLOR>> :HEAD #S(frame
> 0 NIL 0 0 1280 800) :WINDOW #3=#<XLIB:WINDOW #2#:0 40000A> :FORMAT
> *SCREEN-MODE-LINE-FORMAT* :POSITION :TOP :CONTENTS "Grp3 |
> 0*[email protected] <0*[email protected]> | Wed Jan 14  8:24:47 | Battery
> 100% " :CC #S(STUMPWM::CCONTEXT :SCREEN #1# :WIN #3# :PX #<XLIB:PIXMAP
> #2#:0 40000C> :GC #<XLIB:GCONTEXT #2#:0 4194315> :DEFAULT-FG 8355711
> :DEFAULT-BRIGHT 12566463 :DEFAULT-BG 3355443 :FG NIL :BG NIL :BRIGHTP NIL
> :REVERSEP NIL :COLOR-STACK NIL ...) :HEIGHT 19 :FACTOR 781/800 :MODE
> :STUMP)) 4: ((:METHOD STUMPWM::MODE-LINE-FORMAT-ELT (LIST)) ("%n |%w | %b |
> %d")) [fast-method] 5: (STUMPWM::REDRAW-MODE-LINE #S(MODE-LINE :SCREEN
> #1=#S<screen #<XLIB:SCREEN #2=:0.0 1280x800x24 TRUE-COLOR>> :HEAD #S(frame
> 0 NIL 0 0 1280 800) :WINDOW #3=#<XLIB:WINDOW #2#:0 40000A> :FORMAT
> *SCREEN-MODE-LINE-FORMAT* :POSITION :TOP :CONTENTS "Grp3 |
> 0*[email protected] <0*[email protected]> | Wed Jan 14  8:24:47 | Battery
> 100% " :CC #S(STUMPWM::CCONTEXT :SCREEN #1# :WIN #3# :PX #<XLIB:PIXMAP
> #2#:0 40000C> :GC #<XLIB:GCONTEXT #2#:0 4194315> :DEFAULT-FG 8355711
> :DEFAULT-BRIGHT 12566463 :DEFAULT-BG 3355443 :FG NIL :BG NIL :BRIGHTP NIL
> :REVERSEP NIL :COLOR-STACK NIL ...) :HEIGHT 19 :FACTOR 781/800 :MODE
> :STUMP) NIL) 6: (STUMPWM::UPDATE-MODE-LINES #S<screen #<XLIB:SCREEN :0.0
> 1280x800x24 TRUE-COLOR>>) 7: (STUMPWM::UPDATE-ALL-MODE-LINES) 8:
> (STUMPWM::RUN-EXPIRED-TIMERS) 9: (STUMPWM::STUMPWM-INTERNAL-LOOP) 10:
> (STUMPWM::STUMPWM-INTERNAL ":0") 11: (STUMPWM ":0") 12: ((LAMBDA NIL :IN
> "/home/kete/stumpwm/make-image.lisp")) 13: ((FLET
> #:WITHOUT-INTERRUPTS-BODY-89 :IN SB-EXT:SAVE-LISP-AND-DIE)) 14: ((LABELS
> SB-IMPL::RESTART-LISP :IN SB-EXT:SAVE-LISP-AND-DIE)) *
> On 01/14/2015 07:31 AM, Lucas Pandolfo wrote:
>
>  Oh, i see.
>
>  I suppose you have the directory */sys/class/power_supply/BAT0*.
>  The battery module uses the */proc/acpi/battery/* path.
>
> Try replacing */proc/acpi/battery/* with  */sys/class/power_supply/ *in
> the *battery.lisp* file (line 28).
>
>
>
>
>
>  If this works the module can be refactored to export another variable
> **battery-path**. Something like:
>
> =====================================
>
> (export '(*battery-path*))
> (defvar *battery-path* nil)
>
> (defun read-battery-file (battery fname)
>   (let ((fields (make-hash-table :test #'equal)))
>     (with-open-file (s (or *battery-path* (concatenate 'string
> "/proc/acpi/battery/" battery "/" fname)
>                                  :if-does-not-exist nil)
>  ....)))
>
> =================================
>
>  And then users could do *(setf *battery-path*
> "/sys/class/power_supply/BAT0") *after loading the module.
>
> That or just make the module check for */proc/acpi/ *and then
> */sys/class/power_supply/* or wathever.
>
> On 14 January 2015 at 00:41, Kete Foy <[email protected]> wrote:
>
>>  On 01/10/2015 03:51 PM, Lucas Pandolfo wrote:
>>
>>  Is it a notebook?
>>
>>
>> Yes
>>
>>
>> If it is, what does  'ls /proc/acpi/battery/ -l' return?
>>
>>
>>  I don't have the battery directory in Parabola ("ArchLinux").
>>
>> By the way, here is the shell command that I use to monitor the battery
>> charge (requires the acpi package):
>> (setf stumpwm:*screen-mode-line-format*
>>       (list "%n |%w | %d | Battery"
>>       '(:eval (stumpwm:run-shell-command "acpi |cut -d ',' -f 2" t))))
>>
>
>
>

_______________________________________________
Stumpwm-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.