stumpwm-devel
[Top][All Lists]
Advanced

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

Re: [STUMP] Modules (loading)


From: Lucas Pandolfo
Subject: Re: [STUMP] Modules (loading)
Date: Wed, 14 Jan 2015 10:40:46 -0300

Upon further inspection, the /proc and /sys interfaces are different (both in path and format) :(

Well, it was fun while it lasted. In the end you'll have to stick to your own method or the battery-portable module.

On 14 January 2015 at 10:35, Lucas Pandolfo <address@hidden> wrote:
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 <address@hidden> 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 | address@hidden | 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 | address@hidden | 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 <address@hidden> 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))))





reply via email to

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