定制 mwgg/i3phtatus 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mwgg/i3phtatus

Composer 安装命令:

composer require mwgg/i3phtatus

包简介

A dead simple extensible i3status replacement written in PHP

README 文档

README

i3phtatus is an easily extensible i3status replacement meant for i3bar, written in PHP.

i3phtatus

Usage

Replace your current "status_command" setting in ~/.i3/config with i3phtatus:

status_command php /opt/i3phtatus/i3phtatus.php

By default, i3phtatus will expect the config file to be at ~/.i3/i3phtatus.conf.php. If you wish to specify a different location, use the -c flag:

status_command php /opt/i3phtatus/i3phtatus.php -c ~/my_i3phtatus.conf.php

Configuration

Configuration is stored in a PHP array. There you can configure the refresh rate (in milliseconds before the information is updated), "good", "bad" and "warn" colors for modules requiring colored output, as well as individual modules options.

Modules are displayed in the same order as they appear in the config. Unnecessary modules may simply be commented out or removed from the config file.

"amixer_volume" => array(
    "module" => "amixer_volume",
    "mode" => "percent",
    "label" => "VOL: "
),
"amixer_volume_bar" => array(
    "module" => "amixer_volume",
    "mode" => "bar",
    "width" => 10
)

The example above will output |VOL: 68%|-||||||    -|

"Key" for a particular module may be anything, as long as they are all unique. Each module config section must have at least the module parameter, which corresponds to the function name of a particular module. Some modules require additional parameters.

Optional label parameter in the module configuration will prepend a label to the output.

Writing modules

Modules are PHP functions, their names must be prefixed with module_ and they are automatically loaded from the modules subfolder. Each module function shall accept one argument, containing the module options, as specified in the config file.

function module_uname($module_options) {
    return array(
        "full_text" => php_uname($module_options["mode"])
    );
}

All modules must return an array with at least a full_text element, containing the desired output. Should it be necessary to color the output, an element color should be added, containing a hex value. Standard "good", "bad" and "warn" colors are defined in the config file and may be referenced by adding the $config variable to the function scope:

function module_awesome_stuff($module_options) {
    global $config;
    return array(
        "full_text" => "my awesome module",
        "color" => $config["color_good"]
    );
}

Should a module require storing temporary data (such as last refresh time for modules that pull remote data and don't need to do so every second), a global array called $module_tmp may be used:

   ...
   global $module_tmp;
   $module_tmp["awesome_stuff"]["last_update"] = time();
   ...

Pronunciation guide

Phtatus

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 4
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPLv3
  • 更新时间: 2015-09-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固