Renamed home to programs, moved definition to user level
This commit is contained in:
185
programs/wm/common/waybar/common.nix
Normal file
185
programs/wm/common/waybar/common.nix
Normal file
@@ -0,0 +1,185 @@
|
||||
{
|
||||
widgets = {
|
||||
"group/media" = {
|
||||
orientation = "horizontal";
|
||||
|
||||
modules = [
|
||||
"mpris"
|
||||
"custom/cava"
|
||||
"wireplumber"
|
||||
];
|
||||
};
|
||||
|
||||
mpris = {
|
||||
format = "{player_icon}";
|
||||
format-paused = "{status_icon}";
|
||||
max-length = 100;
|
||||
player-icons = {
|
||||
default = "||";
|
||||
mpv = "||";
|
||||
};
|
||||
status-icons = {
|
||||
paused = "▶";
|
||||
};
|
||||
};
|
||||
|
||||
"custom/cava" = {
|
||||
exec = "sh ~/.config/waybar/cava.sh";
|
||||
format = "{} ♪";
|
||||
};
|
||||
|
||||
wireplumber = {
|
||||
format = "{volume}%";
|
||||
format-muted = "";
|
||||
max-volume = 110;
|
||||
scroll-step = 0.2;
|
||||
};
|
||||
|
||||
"group/hardware" = {
|
||||
orientation = "horizontal";
|
||||
modules = [
|
||||
"cpu"
|
||||
"network"
|
||||
"memory"
|
||||
"disk"
|
||||
"temperature"
|
||||
];
|
||||
};
|
||||
|
||||
network = {
|
||||
# Wifi
|
||||
tooltip = true;
|
||||
format-wifi = "{icon} ";
|
||||
format-icons = [
|
||||
""
|
||||
""
|
||||
""
|
||||
];
|
||||
rotate = 0;
|
||||
|
||||
# Ethernet
|
||||
format-ethernet = "ᯤ";
|
||||
tooltip-format = "Network: <big><b>{essid}</b></big>\nSignal strength: <b>{signaldBm}dBm ({signalStrength}%)</b>\nFrequency: <b>{frequency}MHz</b>\nInterface: <b>{ifname}</b>\nIP: <b>{ipaddr}/{cidr}</b>\nGateway: <b>{gwaddr}</b>\nNetmask: <b>{netmask}</b>\nCurrent : <b>{bandwidthTotalBits}</b>\nUp : <b>{bandwidthUpBits}</b>\nDown : <b>{bandwidthDownBits}</b>";
|
||||
format-linked = " {ifname} (No IP)";
|
||||
format-disconnected = " ";
|
||||
tooltip-format-disconnected = "Disconnected";
|
||||
on-click = "/usr/local/bin/ags -t ControlPanel";
|
||||
interval = 2;
|
||||
};
|
||||
|
||||
memory = {
|
||||
interval = 1;
|
||||
rotate = 270;
|
||||
format = "{icon}";
|
||||
format-icons = [
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
];
|
||||
max-length = 10;
|
||||
};
|
||||
|
||||
cpu = {
|
||||
interval = 1;
|
||||
format = "{icon}";
|
||||
rotate = 270;
|
||||
format-icons = [
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
];
|
||||
};
|
||||
|
||||
temperature = {
|
||||
format = "{temperatureC}°C ";
|
||||
thermal-zone = 0;
|
||||
hwmon-path = "/sys/class/hwmon/hwmon0/temp1_input";
|
||||
critical-threshold = 80;
|
||||
};
|
||||
|
||||
disk = {
|
||||
format = "{percentage_free}% ";
|
||||
tooltip = true;
|
||||
tooltip-format = "{free} / {total} ({percentage_free})";
|
||||
};
|
||||
|
||||
clock = {
|
||||
format = "{:%a %b %d, %I:%M %p}";
|
||||
rotate = 0;
|
||||
on-click = " ";
|
||||
tooltip-format = "<tt>{calendar}</tt>";
|
||||
calendar = {
|
||||
mode = "month";
|
||||
mode-mon-col = 3;
|
||||
on-scroll = 1;
|
||||
on-click-right = "mode";
|
||||
format = {
|
||||
months = "<span color='#cba6f7'><b>{}</b></span>";
|
||||
weekdays = "<span color='#74c7ec'><b>{}</b></span>";
|
||||
today = "<span color='#f38ba8'><b>{}</b></span>";
|
||||
};
|
||||
};
|
||||
actions = {
|
||||
on-click-right = "mode";
|
||||
on-click-forward = "tz_up";
|
||||
on-click-backward = "tz_down";
|
||||
on-scroll-up = "shift_up";
|
||||
on-scroll-down = "shift_down";
|
||||
};
|
||||
};
|
||||
|
||||
"custom/nixicon" = {
|
||||
format = "";
|
||||
on-click = "rofi -show drun -theme $HOME/.config/rofi/custom.rasi";
|
||||
tooltip = false;
|
||||
};
|
||||
|
||||
"custom/weather" = {
|
||||
format = "{}";
|
||||
exec = "curl -s 'wttr.in/52.281311,10.527029?format=2'";
|
||||
interval = 60;
|
||||
tooltip = false;
|
||||
};
|
||||
|
||||
"custom/weather-side" = {
|
||||
format = "{}";
|
||||
exec = "curl -s 'wttr.in/52.281311,10.527029?format=1'";
|
||||
interval = 60;
|
||||
tooltip = false;
|
||||
};
|
||||
|
||||
"custom/notification" = {
|
||||
tooltip = false;
|
||||
format = "{icon}";
|
||||
format-icons = {
|
||||
notification = "<span foreground='red'><sup></sup></span>";
|
||||
none = " ";
|
||||
dnd-notification = "<span foreground='red'><sup></sup></span>";
|
||||
dnd-none = " ";
|
||||
inhibited-notification = "<span foreground='red'><sup></sup></span>";
|
||||
inhibited-none = " ";
|
||||
dnd-inhibited-notification = "<span foreground='red'><sup></sup></span>";
|
||||
dnd-inhibited-none = " ";
|
||||
};
|
||||
return-type = "json";
|
||||
exec-if = "which swaync-client";
|
||||
exec = "swaync-client -swb";
|
||||
on-click = "swaync-client -t -sw";
|
||||
on-click-right = "swaync-client -d -sw";
|
||||
escape = true;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
42
programs/wm/common/waybar/configs/cava.sh
Normal file
42
programs/wm/common/waybar/configs/cava.sh
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Not my own work. Credit to original author
|
||||
|
||||
#----- Optimized bars animation without much CPU usage increase --------
|
||||
bar="▁▂▃▄▅▆▇█"
|
||||
dict="s/;//g"
|
||||
|
||||
# Calculate the length of the bar outside the loop
|
||||
bar_length=${#bar}
|
||||
|
||||
# Create dictionary to replace char with bar
|
||||
for ((i = 0; i < bar_length; i++)); do
|
||||
dict+=";s/$i/${bar:$i:1}/g"
|
||||
done
|
||||
|
||||
# Create cava config
|
||||
config_file="/tmp/bar_cava_config"
|
||||
cat >"$config_file" <<EOF
|
||||
[general]
|
||||
# Older systems show significant CPU use with default framerate
|
||||
# Setting maximum framerate to 30
|
||||
# You can increase the value if you wish
|
||||
framerate = 60
|
||||
bars = 14
|
||||
|
||||
[input]
|
||||
method = pulse
|
||||
source = auto
|
||||
|
||||
[output]
|
||||
method = raw
|
||||
raw_target = /dev/stdout
|
||||
data_format = ascii
|
||||
ascii_max_range = 7
|
||||
EOF
|
||||
|
||||
# Kill cava if it's already running
|
||||
pkill -f "cava -p $config_file"
|
||||
|
||||
# Read stdout from cava and perform substitution in a single sed command
|
||||
cava -p "$config_file" | sed -u "$dict"
|
26
programs/wm/common/waybar/configs/mocha.css
Normal file
26
programs/wm/common/waybar/configs/mocha.css
Normal file
@@ -0,0 +1,26 @@
|
||||
@define-color rosewater #f5e0dc;
|
||||
@define-color flamingo #f2cdcd;
|
||||
@define-color pink #f5c2e7;
|
||||
@define-color mauve #cba6f7;
|
||||
@define-color red #f38ba8;
|
||||
@define-color maroon #eba0ac;
|
||||
@define-color peach #fab387;
|
||||
@define-color yellow #f9e2af;
|
||||
@define-color green #a6e3a1;
|
||||
@define-color teal #94e2d5;
|
||||
@define-color sky #89dceb;
|
||||
@define-color sapphire #74c7ec;
|
||||
@define-color blue #89b4fa;
|
||||
@define-color lavender #b4befe;
|
||||
@define-color text #cdd6f4;
|
||||
@define-color subtext1 #bac2de;
|
||||
@define-color subtext0 #a6adc8;
|
||||
@define-color overlay2 #9399b2;
|
||||
@define-color overlay1 #7f849c;
|
||||
@define-color overlay0 #6c7086;
|
||||
@define-color surface2 #585b70;
|
||||
@define-color surface1 #45475a;
|
||||
@define-color surface0 #313244;
|
||||
@define-color base #1e1e2e;
|
||||
@define-color mantle #181825;
|
||||
@define-color crust #11111b;
|
17
programs/wm/common/waybar/configs/side.css
Normal file
17
programs/wm/common/waybar/configs/side.css
Normal file
@@ -0,0 +1,17 @@
|
||||
@import "mocha.css";
|
||||
|
||||
/* -- Global rules -- */
|
||||
* {
|
||||
border: none;
|
||||
font-family: "JetbrainsMono Nerd Font";
|
||||
font-size: 15px;
|
||||
min-height: 10px;
|
||||
}
|
||||
|
||||
window#waybar {
|
||||
background: @crust;
|
||||
}
|
||||
|
||||
window#waybar.hidden {
|
||||
opacity: 0.2;
|
||||
}
|
160
programs/wm/common/waybar/configs/style.css
Normal file
160
programs/wm/common/waybar/configs/style.css
Normal file
@@ -0,0 +1,160 @@
|
||||
@import "mocha.css";
|
||||
|
||||
/* -- Global rules -- */
|
||||
* {
|
||||
border: none;
|
||||
font-family: "JetbrainsMono Nerd Font";
|
||||
font-size: 15px;
|
||||
min-height: 10px;
|
||||
}
|
||||
|
||||
window#waybar {
|
||||
background: @crust;
|
||||
}
|
||||
|
||||
window#waybar.hidden {
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
||||
/* - Genera rules for visible modules -- */
|
||||
#media,
|
||||
#clock,
|
||||
#cpu,
|
||||
#memory,
|
||||
#disk,
|
||||
#temperature,
|
||||
#network {
|
||||
color: @crust;
|
||||
margin-top: 6px;
|
||||
margin-bottom: 6px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
transition: none;
|
||||
}
|
||||
|
||||
/* Separation to the left */
|
||||
#custom-nixicon,
|
||||
#cpu {
|
||||
margin-left: 5px;
|
||||
border-top-left-radius: 10px;
|
||||
border-bottom-left-radius: 10px;
|
||||
}
|
||||
|
||||
/* Separation to the rigth */
|
||||
#clock,
|
||||
#temperature {
|
||||
margin-right: 20px;
|
||||
border-top-right-radius: 10px;
|
||||
border-bottom-right-radius: 10px;
|
||||
}
|
||||
|
||||
/* -- Specific styles -- */
|
||||
|
||||
#custom-nixicon {
|
||||
font-size: 20px;
|
||||
color: @sapphire;
|
||||
background: @overlay1;
|
||||
padding: 0px;
|
||||
padding-right: 15px;
|
||||
padding-left: 10px;
|
||||
margin-top: 6px;
|
||||
margin-bottom: 6px;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
/* Hardware Group */
|
||||
#clock {
|
||||
background: @yellow;
|
||||
}
|
||||
|
||||
#cpu {
|
||||
background: @blue;
|
||||
}
|
||||
|
||||
#memory {
|
||||
background: @red;
|
||||
}
|
||||
|
||||
#disk {
|
||||
background: @peach;
|
||||
}
|
||||
|
||||
#temperature {
|
||||
background: @sky;
|
||||
}
|
||||
|
||||
#network {
|
||||
background: @lavender;
|
||||
padding-right: 13px;
|
||||
}
|
||||
|
||||
/* Workspace */
|
||||
#workspaces {
|
||||
border-radius: 10px;
|
||||
margin: 6px 5px;
|
||||
padding: 0px 6px;
|
||||
}
|
||||
|
||||
#workspaces button {
|
||||
color: @text;
|
||||
background: transparent;
|
||||
padding: 4px 4px;
|
||||
transition: color 0.3s ease, text-shadow 0.3s ease, transform 0.3s ease;
|
||||
border: none;
|
||||
}
|
||||
|
||||
#workspaces button.occupied {
|
||||
color: @red;
|
||||
}
|
||||
|
||||
#workspaces button.active {
|
||||
color: @green;
|
||||
text-shadow: 0 0 4px @green;
|
||||
}
|
||||
|
||||
#workspaces button:hover {
|
||||
color: @teal;
|
||||
border: none;
|
||||
}
|
||||
|
||||
#workspaces button.active:hover {}
|
||||
|
||||
|
||||
|
||||
/* Media Group */
|
||||
#media {
|
||||
background: @overlay2;
|
||||
border-radius: 10px;
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
#custom-cava {
|
||||
color: @green;
|
||||
}
|
||||
|
||||
#wireplumber, #custom-cava, #mpris {
|
||||
margin-left: 10px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
#wireplumber {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
|
||||
/* Weather */
|
||||
#custom-weather {
|
||||
background: @overlay2;
|
||||
border-radius: 10px;
|
||||
margin: 5px 20px;
|
||||
padding: 0px 10px;
|
||||
}
|
||||
|
||||
/* SwayNC */
|
||||
#custom-notification {
|
||||
font-family: "NotoSansMono Nerd Font";
|
||||
background: @green;
|
||||
border-radius: 10px;
|
||||
padding-left: 10px;
|
||||
padding-right: 5px;
|
||||
}
|
32
programs/wm/common/waybar/default.nix
Normal file
32
programs/wm/common/waybar/default.nix
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
pkgs,
|
||||
monitorSetup,
|
||||
...
|
||||
}:
|
||||
{
|
||||
programs.waybar =
|
||||
{
|
||||
enable = true;
|
||||
package = pkgs.waybar;
|
||||
}
|
||||
// (
|
||||
if monitorSetup == "single" then
|
||||
import ./single.nix
|
||||
else if monitorSetup == "dual" then
|
||||
import ./dual.nix
|
||||
else if monitorSetup == "side" then
|
||||
import ./side.nix
|
||||
else
|
||||
{ }
|
||||
);
|
||||
|
||||
home.file.".config/waybar/cava.sh".source = ./configs/cava.sh;
|
||||
home.file.".config/waybar/mocha.css".source = ./configs/mocha.css;
|
||||
|
||||
home.file.".config/waybar" = {
|
||||
source = ./configs;
|
||||
# copy the scripts directory recursively
|
||||
recursive = true;
|
||||
};
|
||||
|
||||
}
|
47
programs/wm/common/waybar/dual.nix
Normal file
47
programs/wm/common/waybar/dual.nix
Normal file
@@ -0,0 +1,47 @@
|
||||
let
|
||||
common = import ./common.nix;
|
||||
wm = import ./wm.nix;
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
settings = {
|
||||
mainBar =
|
||||
{
|
||||
layer = "top";
|
||||
position = "top";
|
||||
height = 30;
|
||||
output = [ "DP-1" ];
|
||||
modules-left = [
|
||||
"custom/nixicon"
|
||||
"clock"
|
||||
];
|
||||
modules-center = [
|
||||
"hyprland/workspaces"
|
||||
"niri/workspaces"
|
||||
"custom/notification"
|
||||
];
|
||||
modules-right = [
|
||||
"group/hardware"
|
||||
];
|
||||
}
|
||||
// common.widgets
|
||||
// wm.widgets;
|
||||
|
||||
secondBar =
|
||||
{
|
||||
layer = "top";
|
||||
position = "top";
|
||||
height = 30;
|
||||
output = [ "HDMI-A-2" ];
|
||||
modules-left = [ "group/media" ];
|
||||
modules-center = [
|
||||
"hyprland/workspaces"
|
||||
"niri/workspaces"
|
||||
];
|
||||
modules-right = [ "custom/weather" ];
|
||||
}
|
||||
// common.widgets
|
||||
// wm.widgets;
|
||||
};
|
||||
|
||||
}
|
36
programs/wm/common/waybar/side.nix
Normal file
36
programs/wm/common/waybar/side.nix
Normal file
@@ -0,0 +1,36 @@
|
||||
let
|
||||
common = import ./common.nix;
|
||||
wm = import ./wm.nix;
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
settings = {
|
||||
mainBar =
|
||||
{
|
||||
layer = "top";
|
||||
position = "left";
|
||||
#height = 30;
|
||||
modules-left = [
|
||||
"custom/nixicon"
|
||||
"clock"
|
||||
"custom/cava"
|
||||
"mpris"
|
||||
"wireplumber"
|
||||
];
|
||||
modules-center = [
|
||||
"hyprland/workspaces"
|
||||
"niri/workspaces"
|
||||
];
|
||||
modules-right = [
|
||||
"custom/weather-side"
|
||||
"cpu"
|
||||
"network"
|
||||
"memory"
|
||||
"disk"
|
||||
"temperature"
|
||||
];
|
||||
}
|
||||
// common.widgets
|
||||
// wm.widgets;
|
||||
};
|
||||
}
|
30
programs/wm/common/waybar/single.nix
Normal file
30
programs/wm/common/waybar/single.nix
Normal file
@@ -0,0 +1,30 @@
|
||||
let
|
||||
common = import ./common.nix;
|
||||
wm = import ./wm.nix;
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
settings = {
|
||||
mainBar =
|
||||
{
|
||||
layer = "top";
|
||||
position = "top";
|
||||
height = 30;
|
||||
modules-left = [
|
||||
"custom/nixicon"
|
||||
"clock"
|
||||
"group/media"
|
||||
];
|
||||
modules-center = [
|
||||
"hyprland/workspaces"
|
||||
"niri/workspaces"
|
||||
];
|
||||
modules-right = [
|
||||
"custom/weather"
|
||||
"group/hardware"
|
||||
];
|
||||
}
|
||||
// common.widgets
|
||||
// wm.widgets;
|
||||
};
|
||||
}
|
19
programs/wm/common/waybar/wm.nix
Normal file
19
programs/wm/common/waybar/wm.nix
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
widgets = {
|
||||
"hyprland/workspaces" = {
|
||||
format = "{icon}";
|
||||
format-icons = {
|
||||
default = "";
|
||||
active = "";
|
||||
};
|
||||
};
|
||||
|
||||
"niri/workspaces" = {
|
||||
format = "{icon}";
|
||||
format-icons = {
|
||||
default = "";
|
||||
active = "";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user