nwg-bar, ironbar and some minor things
This commit is contained in:
43
modules/home/programs/ironbar/colors.nix
Normal file
43
modules/home/programs/ironbar/colors.nix
Normal file
@@ -0,0 +1,43 @@
|
||||
rec {
|
||||
base = {
|
||||
rosewater = "#f5e0dc";
|
||||
flamingo = "#f2cdcd";
|
||||
pink = "#f5c2e7";
|
||||
mauve = "#cba6f7";
|
||||
red = "#f38ba8";
|
||||
maroon = "#eba0ac";
|
||||
peach = "#fab387";
|
||||
yellow = "#f9e2af";
|
||||
green = "#a6e3a1";
|
||||
teal = "#94e2d5";
|
||||
sky = "#89dceb";
|
||||
sapphire = "#74c7ec";
|
||||
blue = "#89b4fa";
|
||||
lavender = "#b4befe";
|
||||
|
||||
text = "#cdd6f4";
|
||||
subtext1 = "#bac2de";
|
||||
subtext0 = "#a6adc8";
|
||||
overlay2 = "#9399b2";
|
||||
overlay1 = "#7f849c";
|
||||
overlay0 = "#6c7086";
|
||||
|
||||
surface2 = "#585b70";
|
||||
surface1 = "#45475a";
|
||||
surface0 = "#313244";
|
||||
|
||||
base = "#1e1e2e";
|
||||
mantle = "#181825";
|
||||
crust = "#11111b";
|
||||
|
||||
border = "#28283d";
|
||||
};
|
||||
extra =
|
||||
{
|
||||
fg = base.text;
|
||||
bg = base.base;
|
||||
bg1 = base.surface0;
|
||||
shadow = base.crust;
|
||||
}
|
||||
// base;
|
||||
}
|
||||
294
modules/home/programs/ironbar/default.nix
Normal file
294
modules/home/programs/ironbar/default.nix
Normal file
@@ -0,0 +1,294 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
inputs,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
cfg = config.home.programs.ironbar;
|
||||
in {
|
||||
options = {
|
||||
home.programs.ironbar.enable = mkEnableOption "Enables ironbar";
|
||||
};
|
||||
imports = [
|
||||
inputs.ironbar.homeManagerModules.default
|
||||
];
|
||||
config = mkIf cfg.enable {
|
||||
programs.ironbar = {
|
||||
enable = true;
|
||||
config = let
|
||||
workspaces = {
|
||||
type = "workspaces";
|
||||
all_monitors = false;
|
||||
favorites = map (n: builtins.toString n) [1 2 3 4 5 6 7 8 9 10];
|
||||
hidden = ["special"];
|
||||
name_map = let
|
||||
workspaces = lib.genAttrs (map (n: builtins.toString n) [1 2 3 4 5 6 7 8 9 10]);
|
||||
mkColorfull = text: color: "${text}"; # "<span foreground=\"${color}\">${text}</span>";
|
||||
dotify = _: mkColorfull "●";
|
||||
c = builtins.mapAttrs dotify (import ./colors.nix).base;
|
||||
in
|
||||
workspaces (
|
||||
i:
|
||||
if i == "1"
|
||||
then c.red
|
||||
else if i == "2"
|
||||
then c.maroon
|
||||
else if i == "3"
|
||||
then c.peach
|
||||
else if i == "4"
|
||||
then c.yellow
|
||||
else if i == "5"
|
||||
then c.green
|
||||
else if i == "6"
|
||||
then c.teal
|
||||
else if i == "7"
|
||||
then c.sky
|
||||
else if i == "8"
|
||||
then c.sapphire
|
||||
else if i == "9"
|
||||
then c.blue
|
||||
else if i == "10"
|
||||
then c.lavender
|
||||
else c.mauve
|
||||
);
|
||||
};
|
||||
|
||||
music = let
|
||||
state_path = "${config.xdg.stateHome}/music-ctrls-state";
|
||||
show-script = pkgs.writeShellApplication {
|
||||
name = "mctrls-shower";
|
||||
runtimeInputs = with pkgs; [coreutils];
|
||||
text = ''
|
||||
${pkgs.coreutils}/bin/touch ${state_path}
|
||||
out=$(< ${state_path})
|
||||
if [[ $out != "show" ]]; then
|
||||
echo -ne "show" > ${state_path}
|
||||
fi
|
||||
'';
|
||||
};
|
||||
hide-script = pkgs.writeShellApplication {
|
||||
name = "mctrls-hider";
|
||||
runtimeInputs = with pkgs; [coreutils];
|
||||
text = ''
|
||||
${pkgs.coreutils}/bin/touch ${state_path}
|
||||
out=$(< ${state_path})
|
||||
if [[ $out == "show" ]]; then
|
||||
echo -ne "" >${state_path}
|
||||
fi
|
||||
'';
|
||||
};
|
||||
in {
|
||||
type = "music";
|
||||
player_type = "mpris";
|
||||
format = "{title}";
|
||||
truncate = "end";
|
||||
#icons.play = "icon:media-playback-start";
|
||||
#icons.pause = "icon:media-playback-pause";
|
||||
music_dir = config.xdg.userDirs.music;
|
||||
show_status_icon = false;
|
||||
on_mouse_enter.cmd = "${show-script}/bin/mctrls-shower";
|
||||
on_mouse_exit.cmd = "${hide-script}/bin/mctrls-hider";
|
||||
#icon_size = 64;
|
||||
#cover_image_size = 256;
|
||||
};
|
||||
music_img = rec {
|
||||
type = "custom";
|
||||
name = "music-img";
|
||||
class = name;
|
||||
on_mouse_enter = music.on_mouse_enter;
|
||||
on_mouse_exit = music.on_mouse_exit;
|
||||
bar = [
|
||||
{
|
||||
type = "image";
|
||||
class = name + "-img";
|
||||
#src = ''{{poll:5000:${pkgs.playerctl}/bin/playerctl metadata mpris:artUrl}}'';
|
||||
src = ''{{watch:${pkgs.playerctl}/bin/playerctl -F metadata mpris:artUrl}}'';
|
||||
}
|
||||
];
|
||||
};
|
||||
music_inline_controls = let
|
||||
check-script = pkgs.writeShellApplication {
|
||||
name = "mctrls-checker";
|
||||
runtimeInputs = with pkgs; [coreutils];
|
||||
text = let
|
||||
state_path = "${config.xdg.stateHome}/music-ctrls-state";
|
||||
in ''
|
||||
${pkgs.coreutils}/bin/touch ${state_path}
|
||||
if [[ $(< ${state_path}) == "show" ]]; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
};
|
||||
play-icon-script = pkgs.writeShellApplication {
|
||||
name = "pp-icon";
|
||||
runtimeInputs = [pkgs.playerctl];
|
||||
text = ''
|
||||
if [[ $(${pkgs.playerctl}/bin/playerctl status) == "Playing" ]]; then
|
||||
echo ""
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
'';
|
||||
};
|
||||
in rec {
|
||||
type = "custom";
|
||||
name = "music-ctrls";
|
||||
class = name;
|
||||
show_if = {
|
||||
mode = "poll";
|
||||
interval = 1000;
|
||||
cmd = "${check-script}/bin/mctrls-checker";
|
||||
};
|
||||
on_mouse_enter = music.on_mouse_enter;
|
||||
on_mouse_exit = music.on_mouse_exit;
|
||||
transition_type = "slide_start";
|
||||
bar = let
|
||||
pctl = cmd:
|
||||
"!"
|
||||
+ (pkgs.writeShellApplication {
|
||||
name = "iron-${cmd}";
|
||||
runtimeInputs = [pkgs.playerctl];
|
||||
text = "${pkgs.playerctl}/bin/playerctl ${cmd}";
|
||||
})
|
||||
+ "/bin/iron-${cmd}";
|
||||
in [
|
||||
{
|
||||
type = "button";
|
||||
class = name + "-prev";
|
||||
label = "";
|
||||
on_click = pctl "previous";
|
||||
}
|
||||
{
|
||||
type = "button";
|
||||
class = name + "-pp";
|
||||
label = "{{poll:100:${play-icon-script}/bin/pp-icon}}";
|
||||
on_click = pctl "play-pause";
|
||||
}
|
||||
{
|
||||
type = "button";
|
||||
class = name + "-next";
|
||||
label = "";
|
||||
on_click = pctl "next";
|
||||
}
|
||||
];
|
||||
};
|
||||
sys_info = {
|
||||
type = "sys_info";
|
||||
format = [" {cpu_percent}%" " {memory_percent}%"];
|
||||
};
|
||||
battery = {
|
||||
type = "upower";
|
||||
format = "{percentage}%";
|
||||
};
|
||||
|
||||
tray = {type = "tray";};
|
||||
clock = {
|
||||
type = "clock";
|
||||
format = "%l:%M %P";
|
||||
};
|
||||
|
||||
cava = {
|
||||
type = "script";
|
||||
mode = "watch";
|
||||
cmd =
|
||||
(pkgs.writeShellApplication {
|
||||
name = "cava";
|
||||
runtimeInputs = [pkgs.cava pkgs.gnused];
|
||||
text = ''
|
||||
printf "[general]\nframerate=160\nbars = 7\n[output]\nmethod = raw\nraw_target = /dev/stdout\ndata_format = ascii\nascii_max_range = 7\n" | cava -p /dev/stdin | sed -u 's/;//g;s/0/▁/g;s/1/▂/g;s/2/▃/g;s/3/▄/g;s/4/▅/g;s/5/▆/g;s/6/▇/g;s/7/█/g; '
|
||||
'';
|
||||
})
|
||||
+ "/bin/cava";
|
||||
};
|
||||
dash = rec {
|
||||
type = "custom";
|
||||
name = "nix-launcher";
|
||||
class = name;
|
||||
bar = [
|
||||
{
|
||||
type = "button";
|
||||
label = " ";
|
||||
on_click = "popup:toggle";
|
||||
}
|
||||
];
|
||||
popup = [
|
||||
{
|
||||
type = "box";
|
||||
orientation = "v";
|
||||
widgets = [
|
||||
#{
|
||||
# type = "label";
|
||||
# label = "{{${pkgs.macchina}/bin/macchina}}";
|
||||
#}
|
||||
{
|
||||
type = "box";
|
||||
widgets = [
|
||||
{
|
||||
type = "button";
|
||||
label = " Applications";
|
||||
on_click = "!tuirun-toggle";
|
||||
}
|
||||
{
|
||||
type = "button";
|
||||
label = " Sound";
|
||||
on_click = "!${pkgs.pavucontrol}/bin/pavucontrol";
|
||||
}
|
||||
{
|
||||
type = "button";
|
||||
label = " Power";
|
||||
on_click = "!${pkgs.nwg-bar}/bin/nwg-bar";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
left = [
|
||||
#focused
|
||||
dash
|
||||
workspaces
|
||||
];
|
||||
right = [
|
||||
tray
|
||||
sys_info
|
||||
cava
|
||||
battery
|
||||
clock
|
||||
];
|
||||
center = [
|
||||
music_img
|
||||
music
|
||||
music_inline_controls
|
||||
];
|
||||
in {
|
||||
anchor_to_edges = true;
|
||||
position = "top";
|
||||
start = left;
|
||||
end = right;
|
||||
center = center;
|
||||
#center = [
|
||||
# {
|
||||
# type = "label";
|
||||
# label = "random num: {{500:playerctl metadata mpris:artUrl}}";
|
||||
# }
|
||||
#];
|
||||
height = 32;
|
||||
icon_theme = config.gtk.iconTheme.name;
|
||||
};
|
||||
style = let
|
||||
built = pkgs.callPackage ./scss-pkg.nix {
|
||||
src = ./styles;
|
||||
entry = "main";
|
||||
};
|
||||
in ''
|
||||
@import url("${built}/out.css");
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
19
modules/home/programs/ironbar/scss-pkg.nix
Normal file
19
modules/home/programs/ironbar/scss-pkg.nix
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
dart-sass,
|
||||
stdenvNoCC,
|
||||
src ? ./styles,
|
||||
entry ? "main",
|
||||
}:
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "built-scss";
|
||||
version = "1.0";
|
||||
inherit src;
|
||||
nativeBuildInputs = [dart-sass];
|
||||
buildPhase = ''
|
||||
dart-sass ${entry}.scss > __nix_out__.css.out
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir -p $out/
|
||||
cp __nix_out__.css.out $out/out.css
|
||||
'';
|
||||
}
|
||||
35
modules/home/programs/ironbar/styles/_colors.scss
Normal file
35
modules/home/programs/ironbar/styles/_colors.scss
Normal file
@@ -0,0 +1,35 @@
|
||||
$rosewater: #f5e0dc;
|
||||
$flamingo: #f2cdcd;
|
||||
$pink: #f5c2e7;
|
||||
$mauve: #cba6f7;
|
||||
$red: #f38ba8;
|
||||
$maroon: #eba0ac;
|
||||
$peach: #fab387;
|
||||
$yellow: #f9e2af;
|
||||
$green: #a6e3a1;
|
||||
$teal: #94e2d5;
|
||||
$sky: #89dceb;
|
||||
$sapphire: #74c7ec;
|
||||
$blue: #89b4fa;
|
||||
$lavender: #b4befe;
|
||||
|
||||
$text: #cdd6f4;
|
||||
$subtext1: #bac2de;
|
||||
$subtext0: #a6adc8;
|
||||
$overlay2: #9399b2;
|
||||
$overlay1: #7f849c;
|
||||
$overlay0: #6c7086;
|
||||
|
||||
$surface2: #585b70;
|
||||
$surface1: #45475a;
|
||||
$surface0: #313244;
|
||||
|
||||
$base: #1e1e2e;
|
||||
$mantle: #181825;
|
||||
$crust: #11111b;
|
||||
|
||||
$fg: $text;
|
||||
$bg: $base;
|
||||
$bg1: $surface0;
|
||||
$border: #28283d;
|
||||
$shadow: $crust;
|
||||
221
modules/home/programs/ironbar/styles/main.scss
Normal file
221
modules/home/programs/ironbar/styles/main.scss
Normal file
@@ -0,0 +1,221 @@
|
||||
@use "colors" as *;
|
||||
|
||||
* {
|
||||
font-family:
|
||||
Product Sans,
|
||||
Roboto,
|
||||
sans-serif,
|
||||
monospace;
|
||||
font-size: 13px;
|
||||
transition: 200ms ease;
|
||||
|
||||
color: $fg;
|
||||
/*background-color: #2d2d2d;*/
|
||||
/*background-color: $bg;*/
|
||||
border: none;
|
||||
|
||||
/*opacity: 0.4;*/
|
||||
}
|
||||
|
||||
#bar {
|
||||
background-color: $bg;
|
||||
}
|
||||
|
||||
.container {
|
||||
background-color: $bg;
|
||||
}
|
||||
|
||||
#right > * + * {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
#left > * + * {
|
||||
margin-right: 20px;
|
||||
}
|
||||
.nix-launcher button {
|
||||
all: unset;
|
||||
background-color: $bg;
|
||||
}
|
||||
.popup-nix-launcher label {
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
.nix-launcher label {
|
||||
background-color: transparent;
|
||||
color: $bg;
|
||||
font-family: monospace;
|
||||
font-size: 1.5rem;
|
||||
padding: 0 1.1rem 0 0.5rem;
|
||||
}
|
||||
|
||||
.workspaces {
|
||||
all: unset;
|
||||
margin-left: 10px;
|
||||
}
|
||||
.workspaces label {
|
||||
font-family: Material Symbols Outlined;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
.workspaces .item {
|
||||
all: unset;
|
||||
color: $pink;
|
||||
margin-right: 5px;
|
||||
padding: 0px;
|
||||
font-family: Material Symbols Outlined;
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.workspaces .item.focused {
|
||||
color: $red;
|
||||
}
|
||||
.workspaces .item.focused label {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
.workspaces .item.inactive {
|
||||
color: $maroon;
|
||||
}
|
||||
.workspaces .item.inactive label {
|
||||
font-size: 0.5rem;
|
||||
}
|
||||
|
||||
.clock {
|
||||
color: $fg;
|
||||
background-color: $bg;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.sysinfo {
|
||||
color: $fg;
|
||||
}
|
||||
|
||||
.tray {
|
||||
background-color: $bg;
|
||||
}
|
||||
|
||||
.tray .item {
|
||||
background-color: $bg;
|
||||
-gtk-icon-effect: dim;
|
||||
}
|
||||
|
||||
.upower,
|
||||
.upower * {
|
||||
all: unset;
|
||||
background-color: $bg;
|
||||
color: $fg;
|
||||
}
|
||||
.music-img {
|
||||
border-radius: 8px;
|
||||
margin-right: 8px;
|
||||
}
|
||||
.music-ctrls * {
|
||||
all: unset;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.music {
|
||||
background-color: $bg;
|
||||
color: $fg;
|
||||
}
|
||||
.music label {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.popup {
|
||||
background-color: $bg;
|
||||
border: 1px solid $subtext0;
|
||||
}
|
||||
|
||||
.popup-clock {
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
.calendar-clock {
|
||||
color: $fg;
|
||||
font-size: 2.5em;
|
||||
padding-bottom: 0.1em;
|
||||
}
|
||||
|
||||
.calendar {
|
||||
background-color: $bg;
|
||||
color: $fg;
|
||||
}
|
||||
|
||||
.calendar .header {
|
||||
padding-top: 1em;
|
||||
border-top: 1px solid $subtext0;
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
.calendar:selected {
|
||||
background-color: $blue;
|
||||
}
|
||||
|
||||
.power-menu {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.power-menu .power-btn {
|
||||
color: $fg;
|
||||
background-color: $bg;
|
||||
}
|
||||
|
||||
.power-menu .power-btn:hover {
|
||||
background-color: $mantle;
|
||||
}
|
||||
|
||||
.popup-power-menu {
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
.popup-power-menu #header {
|
||||
color: $fg;
|
||||
font-size: 1.4em;
|
||||
border-bottom: 1px solid $overlay1;
|
||||
padding-bottom: 0.4em;
|
||||
margin-bottom: 0.8em;
|
||||
}
|
||||
|
||||
.popup-power-menu .power-btn {
|
||||
color: $fg;
|
||||
background-color: $bg;
|
||||
border: 1px solid $overlay1;
|
||||
padding: 0.6em 1em;
|
||||
}
|
||||
|
||||
.popup-power-menu .power-btn + .power-btn {
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
.popup-power-menu .power-btn:hover {
|
||||
background-color: $mantle;
|
||||
}
|
||||
|
||||
.music {
|
||||
all: unset;
|
||||
color: $fg;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.popup-music .album-art {
|
||||
margin-right: 1em;
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.popup-music .title .icon-box,
|
||||
.popup-mpd .title .icon-icon {
|
||||
font-size: 1.7em;
|
||||
}
|
||||
|
||||
.popup-music .controls * {
|
||||
border-radius: 0;
|
||||
background-color: transparent;
|
||||
color: $fg;
|
||||
}
|
||||
|
||||
.popup-music .controls *:disabled {
|
||||
color: $overlay1;
|
||||
}
|
||||
|
||||
.focused {
|
||||
color: $fg;
|
||||
}
|
||||
Reference in New Issue
Block a user