feat(taskbar/battery-plugin): add power bar
Enable the power bar to get a quick overview of the remaining battery. As the bar is not a 'perfect theme fit' (imo) there is an option to disable it (default: enabled) as well as some QoL options to change the critical and warning state as well as some display colors
This commit is contained in:
parent
6a2c79d6a3
commit
49037f4576
2 changed files with 60 additions and 19 deletions
|
|
@ -1,19 +0,0 @@
|
|||
display_label=false
|
||||
display_icon=true
|
||||
display_power=false
|
||||
display_percentage=false
|
||||
display_bar=false
|
||||
display_time=false
|
||||
tooltip_display_percentage=true
|
||||
tooltip_display_time=false
|
||||
low_percentage=30
|
||||
critical_percentage=20
|
||||
action_on_low=1
|
||||
action_on_critical=1
|
||||
hide_when_full=0
|
||||
colorA=rgb(119,118,123)
|
||||
colorH=rgb(143,240,164)
|
||||
colorL=rgb(248,228,92)
|
||||
colorC=rgb(237,51,59)
|
||||
command_on_low=
|
||||
command_on_critical=
|
||||
|
|
@ -7,6 +7,7 @@
|
|||
user = config.nixos95.user;
|
||||
t = lib.types;
|
||||
slib = pkgs.callPackage ./util/lib.nix { };
|
||||
|
||||
in {
|
||||
|
||||
options.nixos95.taskbar = {
|
||||
|
|
@ -37,6 +38,42 @@ in {
|
|||
example = false;
|
||||
type = t.bool;
|
||||
};
|
||||
power_bar = let
|
||||
mkColor = state : default : lib.mkOption {
|
||||
description = "Color to show while ${state}";
|
||||
type = t.str;
|
||||
inherit default;
|
||||
};
|
||||
in {
|
||||
enable = lib.mkOption {
|
||||
description = ''
|
||||
Enable the power bar, which shows the charging level.
|
||||
'';
|
||||
type = t.bool;
|
||||
default = true;
|
||||
example = false;
|
||||
};
|
||||
critical_at = lib.mkOption {
|
||||
description = ''
|
||||
Set the maximum battery percentage of the "critical" state
|
||||
'';
|
||||
type = t.int;
|
||||
default = 10;
|
||||
example = 20;
|
||||
};
|
||||
warning_at = lib.mkOption {
|
||||
description = ''
|
||||
Set the maximum battery percentage of the "warning" state
|
||||
'';
|
||||
type = t.int;
|
||||
default = 20;
|
||||
example = 30;
|
||||
};
|
||||
color_warning = mkColor "in a warning state" "rgb(248,228,92)";
|
||||
color_critical = mkColor "in a critical state" "rgb(237,51,59)";
|
||||
color_loading = mkColor "charging" "rgb(119,118,123)";
|
||||
color_default = mkColor "discharging" "rgb(143,240,164)";
|
||||
};
|
||||
};
|
||||
|
||||
applications = lib.mkOption {
|
||||
|
|
@ -99,6 +136,29 @@ in {
|
|||
"xfce4/panel/battery-7.rc" = {
|
||||
force = true;
|
||||
enable = cfg.battery-plugin.enable;
|
||||
text = let
|
||||
bar = cfg.battery-plugin.power_bar;
|
||||
in ''
|
||||
display_label=false
|
||||
display_icon=true
|
||||
display_power=false
|
||||
display_percentage=false
|
||||
display_bar=${if bar.enable then "true" else "false"}
|
||||
display_time=false
|
||||
tooltip_display_percentage=true
|
||||
tooltip_display_time=false
|
||||
low_percentage=${bar.warning_at}
|
||||
critical_percentage=${bar.critical_at}
|
||||
action_on_low=1
|
||||
action_on_critical=1
|
||||
hide_when_full=0
|
||||
colorA=${bar.color_loading}
|
||||
colorH=${bar.color_default}
|
||||
colorL=${bar.color_warning}
|
||||
colorC=${bar.color_critical}
|
||||
command_on_low=
|
||||
command_on_critical=
|
||||
'';
|
||||
source = ./dotfiles/battery.rc;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue