Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
293 views
in Technique[技术] by (71.8m points)

c - Xmobar is "Updating" when attempting to run script

My issue here is that my Xmobar says that it's "Updating..." when I provide the layout with a path to a C script (the executable)that I hacked together. I included Run Stdinreader and that made no dent on the issue.

I was under the impression that if a script can output to the terminal, it could to Xmobar. This C script is responsible for printing a quote to the terminal based on conditions specified. I don't need help with the script itself (although it is rushed and could be better constructed). I just want to know:

Is this an issue with an incompatibility with Xmobar and C? Or, did I forget to do something that will make the taskbar spit out the correct output?

My Xmobar Config is:

    Config {
--this is an edited dotfile from the example shown from the Archlinux wiki for the xmobarrc file. This is a good starting point (and may also serve as a regular status bar *as in my case it does)
--This is not my original work from scratch; these are merely my edits for my personal taste. For instance, I removed the Weather module and heavily edited the colors
   -- appearance
     font =         "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*"
   , bgColor =      "#020616"
   , fgColor =      "#9e9e9e"
   , position =     Top
   , border =       BottomB
   , borderColor =  "#020616"

   -- behavior
   , lowerOnStart =     True    -- send to bottom of window stack on start
   , hideOnStart =      False   -- start with window unmapped (hidden)
   , allDesktops =      True    -- show on all desktops
   , overrideRedirect = True    -- set the Override Redirect flag (Xlib)
   , pickBroadest =     False   -- choose widest display (multi-monitor)
   , persistent =       True    -- enable/disable hiding (True = disabled)

   -- plugins
   --   Numbers can be automatically colored according to their value. xmobar
   --   decides color based on a three-tier/two-cutoff system, controlled by
   --   command options:
   --     --Low sets the low cutoff
   --     --High sets the high cutoff
   --
   --     --low sets the color below --Low cutoff
   --     --normal sets the color between --Low and --High cutoffs
   --     --High sets the color above --High cutoff
   --
   --   The --template option controls how the plugin is displayed. Text
   --   color can be set by enclosing in <fc></fc> tags. For more details
   --   see http://projects.haskell.org/xmobar/#system-monitor-plugins.
   , commands =
       [ Run Weather "RJTT" [ "--template", "<skyCondition> | <fc=#4682B4><tempC></fc>°C | <fc=#4682B4><rh></fc>% | <fc=#4682B4><pressure></fc>hPa"
                             ] 36000 --edits: Weather ia omitted from my layout
        -- network activity monitor (dynamic interface resolution)
        , Run DynNetwork     [ "--template" , "<dev>: <tx>kB/s|<rx>kB/s"
                             , "--Low"      , "1000"       -- units: B/s
                             , "--High"     , "5000"       -- units: B/s
                             , "--low"      , "#98b7d1"
                             , "--normal"   , "#98b7d1"
                             , "--high"     , "#98b7d1"
                             ] 10

        -- cpu activity monitor
        , Run MultiCpu       [ "--template" , "Cpu: <total0>%|<total1>%"
                             , "--Low"      , "50"         -- units: %
                             , "--High"     , "85"         -- units: %
                             , "--low"      , "#9e9e9e"
                             , "--normal"   , "#6f90c9"
                             , "--high"     , "#6f90c9"
                             ] 10
        ,  Run StdinReader
        -- cpu core temperature monitor
        , Run CoreTemp       [ "--template" , "Temp: <core0>°C|<core1>°C"
                             , "--Low"      , "70"        -- units: °C
                             , "--High"     , "80"        -- units: °C
                             , "--low"      , "#9e9e9e"
                             , "--normal"   , "#ead581"
                             , "--high"     , "#6f90c9"
                             ] 50
                          
        -- memory usage monitor
        , Run Memory         [ "--template" ,"Mem: <usedratio>%"
                             , "--Low"      , "20"        -- units: %
                             , "--High"     , "90"        -- units: %
                             , "--low"      , "#9e9e9e"
                             , "--normal"   , "#ead581"
                             , "--high"     , "#f77647"
                             ] 10

        -- battery monitor
        , Run Battery        [ "--template" , "Batt: <acstatus>"
                             , "--Low"      , "10"        -- units: %
                             , "--High"     , "80"        -- units: %
                             , "--low"      , "#f77647"
                             , "--normal"   , "#dde298"
                             , "--high"     , "#b8e298"

                             , "--" -- battery specific options
                                       -- discharging status
                                       , "-o"    , " <left>% <fc=#efaf5b> (<timeleft>) </fc>"
                                       -- AC "on" status
                                       , "-O"    , "<fc=#dd5d6c>Currently Charging</fc>"
                                       -- charged status
                                       , "-i"    , "<fc=#60e9ff>Fully Charged</fc>"
                             ] 50

        -- time and date indicator
        --   (%F = y-m-d date, %a = day of week, %T = h:m:s time)
        , Run Date           "<fc=#C8E86A>%F (%a) %r</fc>" "date" 10

        ]
   }

   -- layout
   , sepChar =  "%"   -- delineator between plugin names and straight text
   , alignSep = "}{"  -- separator between left-right alignment
   , template = "Current User: <fc=#f77647> %whoami% </fc>| <fc=#787773> %~/scripting/taskbarquote% </fc> }{| <fc=#98b7d1> %dynnetwork% </fc>| %date% | %battery% ||%multicpu% | %coretemp% | %memory% "

Thanks.

This would be the C script. Above it is the problem:

enter image description here

question from:https://stackoverflow.com/questions/65837189/xmobar-is-updating-when-attempting-to-run-script

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Did more research today. The problem here is that %% counts as an argument to "run" something, but above it is where it's supposed to be defined. It's not.

I just used %diskspace% for a new script that outputs my Sink volume. It would work the same with the C script.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...