Skip to content

Commit

Permalink
Renamed import theme directive to source
Browse files Browse the repository at this point in the history
  • Loading branch information
noccy80 committed Dec 17, 2016
1 parent ea5ef3e commit edfc0bf
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 11 deletions.
8 changes: 5 additions & 3 deletions lib/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public function readTheme($file) {

// Strip out all the directives $pragma, $set, $icon etc before parsing
//echo $theme."\n\n";
preg_match_all('/\$(pragma|icon|set|import|include)\((.+?)\)/', $theme, $directives);
$theme = preg_replace('/\$(pragma|icon|set|import|include)\((.+?)\)/', "", $theme);
preg_match_all('/\$(pragma|icon|set|source|include)\((.+?)\)/', $theme, $directives);
$theme = preg_replace('/\$(pragma|icon|set|source|include)\((.+?)\)/', "", $theme);

$d_vars = []; // vars from $set() directives
$d_icons = []; // icons from $icon() directives
Expand All @@ -42,7 +42,7 @@ public function readTheme($file) {
list($name,$value) = explode(",",$value,2);
$d_icons[$name] = $value;
break;
case 'import':
case 'source':
$path = dirname($file).DIRECTORY_SEPARATOR.$value;
if (file_exists($path))
$this->readTheme($path);
Expand All @@ -59,6 +59,8 @@ public function readTheme($file) {
list($name,$value) = explode(",",$value,2);
$d_vars[$name] = $value;
break;
default:
printf("Warning: Unsupported directive \$%s\n", $directive);
}
}

Expand Down
6 changes: 4 additions & 2 deletions modules/git.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
function _git(array $opts) {

$git = "env LANG=C git";
if (!is_dir(".git"))
return null;

$branch = exec("{$git} symbolic-ref --short HEAD 2>/dev/null");
if (!$branch)
return null;
//if (!$branch)
// return null;

$marks = [];

Expand Down
4 changes: 2 additions & 2 deletions modules/loadavg.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


function _loadavg() {
return panel(sprintf("%s%s",icon('loadavg.load'), sys_getloadavg()[0]),[],'loadavg');
return panel(sprintf("%s%s",icon('loadavg.icon'), sys_getloadavg()[0]),[],'loadavg');
}
module("loadavg", "Display system load average", [ "info", "loadavg" ]);
seticon("loadavg.load","");
seticon("loadavg.icon","");
4 changes: 2 additions & 2 deletions modules/thermal.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ function _thermal(array $opts) {
$zone = $opts[THERMAL_ZONE];
$temp = (int)@trim(file_get_contents("/sys/class/thermal/{$zone}/temp"));
$temp = (float)$temp/1000;
$text = sprintf("%s".$opts[THERMAL_FORMAT], icon('thermal.temp'), $temp);
$text = sprintf("%s".$opts[THERMAL_FORMAT], icon('thermal.icon'), $temp);
$attr['class'] = $opts[THERMAL_CLASS];
return panel($text, $attr, 'thermal');
}
module("thermal", "Show thermal zone info");
option("zone", THERMAL_ZONE, OPT_TYPE_STRING, "Thermal zone (from /sys/class/thermal)", "thermal_zone0");
option("format", THERMAL_FORMAT, OPT_TYPE_STRING, "Format", "%.1fºc");
option("class", THERMAL_CLASS, OPT_TYPE_STRING, "The class to use", "system");
seticon("thermal.temp", "");
seticon("thermal.icon", "");
2 changes: 2 additions & 0 deletions themes/blues.theme
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
$source(user.icons)

* {
background: blue;
color: white;
Expand Down
2 changes: 1 addition & 1 deletion themes/classic.theme
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

$source(user.icons)

* {
pad-before: 0;
Expand Down
2 changes: 1 addition & 1 deletion themes/default.theme
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$import(user.icons);
$source(user.icons);

// Defaults, applies to everything
* {
Expand Down
2 changes: 2 additions & 0 deletions themes/gray.theme
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
$source(user.icons)

* {
color: black;
background: white;
Expand Down
2 changes: 2 additions & 0 deletions themes/mono.theme
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
$source(user.icons)

* {
color: white;
background: none;
Expand Down
1 change: 1 addition & 0 deletions themes/solarized.theme
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Solarized color theme
// http://ethanschoonover.com/solarized

$source(user.icons)
$pragma(truecolor)

// --- palette ---
Expand Down

0 comments on commit edfc0bf

Please sign in to comment.