added stuff

This commit is contained in:
Charlie Root 2024-04-09 23:11:33 +02:00
commit 9d0ebdfbd0
907 changed files with 70990 additions and 0 deletions

View file

@ -0,0 +1,277 @@
{
config,
pkgs,
lib,
osConfig,
...
}: let
inherit (lib) optionalString primaryMonitor;
sys = osConfig.modules.system;
in {
mainBar = {
layer = "top";
position = "left";
# monitor configuration, kind of dirty since it assumes DP-1 is my main monitor
output = primaryMonitor osConfig; #builtins.elemAt monitors 0;
width = 55;
spacing = 7;
margin-left = 6;
margin-top = 9;
margin-bottom = 9;
margin-right = null;
fixed-center = true;
exclusive = true;
modules-left = [
"custom/search"
"hyprland/workspaces"
"custom/lock"
"backlight"
"battery"
"custom/weather"
"custom/todo"
];
modules-center = [];
modules-right = [
"cpu"
(optionalString sys.bluetooth.enable "bluetooth")
"gamemode"
"pulseaudio"
"network"
"custom/swallow"
"clock"
"custom/power"
];
"hyprland/workspaces" = let
hyprctl = config.wayland.windowManager.hyprland.package + "/bin/hyprctl";
in {
on-click = "activate";
on-scroll-up = "${hyprctl} dispatch workspace m+1";
on-scroll-down = "${hyprctl} dispatch workspace m-1";
format = "{icon}";
active-only = true;
all-outputs = true;
format-icons = {
"1" = "";
"2" = "";
"3" = "";
"4" = "";
"5" = "";
"6" = "";
"7" = "";
"8" = "";
"9" = "";
"10" = "";
};
};
"custom/search" = {
format = " ";
tooltip = false;
on-click = "${lib.getExe pkgs.killall} rofi || run-as-service $(rofi -show drun)";
};
"custom/todo" = {
format = "{}";
tooltip = true;
interval = 7;
exec = let
todo = pkgs.todo + "/bin/todo";
sed = pkgs.gnused + "/bin/sed";
wc = pkgs.coreutils + "/bin/wc";
in
pkgs.writeShellScript "todo-waybar" ''
#!/bin/sh
total_todo=$(${todo} | ${wc} -l)
todo_raw_done=$(${todo} raw done | ${sed} 's/^/ /' | ${sed} -z 's/\n/\\n/g')
todo_raw_undone=$(${todo} raw todo | ${sed} 's/^/ /' | ${sed} -z 's/\n/\\n/g')
done=$(${todo} raw done | ${wc} -l)
undone=$(${todo} raw todo | ${wc} -l)
tooltip=$(${todo})
left="$done/$total_todo"
header="<b>todo</b>\\n\\n"
tooltip=""
if [[ $total_todo -gt 0 ]]; then
if [[ $undone -gt 0 ]]; then
export tooltip="$header👷 Today, you need to do:\\n\\n $(echo $todo_raw_undone)\\n\\n You have already done:\\n\\n $(echo $todo_raw_done)"
export output=" 🗒 \\n $left"
else
export tooltip="$header All done!\\n🥤 Remember to stay hydrated!"
export output=" 🎉 \\n $left"
fi
else
export tooltip=""
export output=""
fi
printf '{"text": "%s", "tooltip": "%s" }' "$output" "$tooltip"
'';
return-type = "json";
};
"custom/weather" = let
waybar-wttr = pkgs.stdenv.mkDerivation {
name = "waybar-wttr";
buildInputs = [(pkgs.python3.withPackages (pythonPackages: with pythonPackages; [requests]))];
unpackPhase = "true";
installPhase = ''
mkdir -p $out/bin
cp ${../../scripts/waybar-wttr.py} $out/bin/waybar-wttr
chmod +x $out/bin/waybar-wttr
'';
};
in {
format = "{}";
tooltip = true;
interval = 30;
exec = "${waybar-wttr}/bin/waybar-wttr";
return-type = "json";
};
"custom/lock" = {
tooltip = false;
on-click = "${pkgs.bash}/bin/bash -c '(sleep 0.5s; ${lib.getExe pkgs.swaylock-effects} --grace 0)' & disown";
format = "";
};
"custom/swallow" = {
tooltip = false;
on-click = let
hyprctl = config.wayland.windowManager.hyprland.package + "/bin/hyprctl";
notify-send = pkgs.libnotify + "/bin/notify-send";
rg = pkgs.ripgrep + "/bin/rg";
in
pkgs.writeShellScript "waybar-swallow" ''
#!/bin/sh
if ${hyprctl} getoption misc:enable_swallow | ${rg} -q "int: 1"; then
${hyprctl} keyword misc:enable_swallow false >/dev/null &&
${notify-send} "Hyprland" "Turned off swallowing"
else
${hyprctl} keyword misc:enable_swallow true >/dev/null &&
${notify-send} "Hyprland" "Turned on swallowing"
fi
'';
format = "󰊰";
};
"custom/power" = {
tooltip = false;
on-click = let
sudo = pkgs.sudo + "/bin/sudo";
rofi = config.programs.rofi.package + "/bin/rofi";
poweroff = pkgs.systemd + "/bin/poweroff";
reboot = pkgs.systemd + "/bin/reboot";
in
pkgs.writeShellScript "shutdown-waybar" ''
#!/bin/sh
off=" Shutdown"
reboot=" Reboot"
cancel="󰅖 Cancel"
sure="$(printf '%s\n%s\n%s' "$off" "$reboot" "$cancel" |
${rofi} -dmenu -p ' Are you sure?')"
if [ "$sure" = "$off" ]; then
${sudo} ${poweroff}
elif [ "$sure" = "$reboot" ]; then
${sudo} ${reboot}
fi
'';
format = "󰐥";
};
clock = {
format = ''
{:%H
%M}'';
tooltip-format = ''
<big>{:%Y %B}</big>
<tt><small>{calendar}</small></tt>
'';
};
backlight = let
brightnessctl = lib.getExe pkgs.brightnessctl;
in {
format = "{icon}";
format-icons = ["󰋙" "󰫃" "󰫄" "󰫅" "󰫆" "󰫇" "󰫈"];
#format-icons = ["" "" "" "" "" "" "" "" ""];
on-scroll-up = "${brightnessctl} s 1%-";
on-scroll-down = "${brightnessctl} s +1%";
};
battery = {
states = {
warning = 30;
critical = 15;
};
format = "{icon}";
format-charging = "󰂄";
format-plugged = "󰂄";
format-alt = "{icon}";
format-icons = ["󰂃" "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"];
};
network = let
nm-editor = "${pkgs.networkmanagerapplet}/bin/nm-connection-editor";
in {
format-wifi = "󰤨";
format-ethernet = "󰈀";
format-alt = "󱛇";
format-disconnected = "󰤭";
tooltip-format = "{ipaddr}/{ifname} via {gwaddr} ({signalStrength}%)";
on-click-right = "${nm-editor}";
};
pulseaudio = {
scroll-step = 5;
tooltip = true;
tooltip-format = "{volume}";
on-click = "${pkgs.killall}/bin/killall pavucontrol || ${pkgs.pavucontrol}/bin/pavucontrol";
format = "{icon}";
format-muted = "󰝟";
format-icons = {
default = ["" "" ""];
};
};
cpu = {
interval = 10;
format = "";
max-length = 10;
states = {
"50" = 50;
"60" = 75;
"70" = 90;
};
};
bluetooth = {
# controller = "controller1", // specify the alias of the controller if there are more than 1 on the system
format = "";
format-disabled = "󰂲"; # an empty format will hide the module
format-connected = "󰂱";
tooltip-format = "{controller_alias}\t{controller_address}";
tooltip-format-connected = "{controller_alias}\t{controller_address}\n\n{device_enumerate}";
tooltip-format-disabled = "";
tooltip-format-enumerate-connected = "{device_alias}\t{device_address}";
};
gamemode = {
format = "󰊴";
format-alt = "{glyph}";
glyph = "󰊴";
hide-not-running = true;
use-icon = true;
icon-name = "input-gaming-symbolic";
icon-spacing = 4;
icon-size = 20;
tooltip = true;
tooltip-format = "Games running: {count}";
};
};
}

View file

@ -0,0 +1,224 @@
{colors}:
with colors; let
OSLogo = builtins.fetchurl rec {
name = "OSLogo-${sha256}.png";
sha256 = "14mbpw8jv1w2c5wvfvj8clmjw0fi956bq5xf9s2q3my14far0as8";
url = "https://raw.githubusercontent.com/NixOS/nixos-artwork/master/logo/nix-snowflake.svg";
};
in ''
* {
font-family: Material Design Icons, Iosevka Nerd Font Mono;
font-size: 19px;
}
window#waybar {
background-color: #${base00};
border: .5px solid #${base01};
border-radius: 20px;
box-shadow: 2 3 2 2px #151515;
color: #${base05};
margin: 16px 16px;
transition-property: background-color;
transition-duration: .5s;
}
window#waybar.hidden {
opacity: 0.2;
}
#custom-weather,
#clock,
#network,
#custom-swallow,
#custom-power,
#cpu,
#battery,
#backlight,
#memory,
#workspaces,
#custom-search,
#custom-power,
#custom-todo,
#custom-lock,
#custom-weather,
#volume,
#cpu,
#bluetooth,
#gamemode,
#pulseaudio {
border-radius: 15px;
margin: 0px 7px 0px 7px;
background-color: #${base02};
padding: 10px 0px 10px 0px;
}
#workspaces button {
background-color: transparent;
/* Use box-shadow instead of border so the text isn't offset */
color: #${base0D};
font-size: 21px;
/* padding-left: 6px; */
box-shadow: inset 0 -3px transparent;
}
#workspaces button:hover {
color: #${base0C};
box-shadow: inherit;
text-shadow: inherit;
}
#workspaces button.active {
color: #${base0A};
}
#workspaces button.urgent {
color: #${base08};
}
#custom-power {
color: #${base08};
}
#workspaces {
font-size: 15px;
background-color: #${base02};
}
#network {
color: #${base0D};
padding: 14px 0px 14px 0px;
}
#gamemode {
color: #${base0D};
}
#custom-weather {
color: #${base05};
background-color: #${base02};
}
#cpu {
color: rgba(0, 0, 0, 0.0);
background-color: rgba(0, 0, 0, 0.0);
margin: -50;
}
#cpu.50 {
color: #${base06};
background-color: #${base02};
border-radius: 15px;
margin: 0px 7px 0px 7px;
padding: 10px 0px 10px 0px;
}
#cpu.60 {
color: #${base09};
background-color: #${base02};
border-radius: 15px;
margin: 0px 7px 0px 7px;
padding: 10px 0px 10px 0px;
}
#cpu.70 {
color: #${base08};
background-color: #${base02};
border-radius: 15px;
margin: 0px 7px 0px 7px;
padding: 10px 0px 10px 0px;
}
#bluetooth {
color: #${base0E};
}
#bluetooth.off,
#bluetooth.pairable,
#bluetooth.discovering,
#bluetooth.disabled {
color: rgba(0, 0, 0, 0.0);
background-color: rgba(0, 0, 0, 0.0);
margin: -50;
}
#clock {
color: #${base05};
background-color: #${base02};
font-weight: 700;
font-size: 20px;
padding: 5px 0px 5px 0px;
font-family: "Iosevka Term";
}
#pulseaudio {
color: #${base0B};
padding: 5px 0px 5px 0px;
font-size: 30;
}
#pulseaudio.source-muted,
#pulseaudio.muted {
color: #${base08};
padding: 16px 0px 16px 0px;
font-size: 15;
}
#custom-swallow {
color: #${base0E};
padding: 14px 0px 14px 0px;
}
#custom-lock {
color: #${base0D};
font-size: 27;
padding: 6px 0px 6px 0px;
}
#custom-todo {
color: #${base05};
padding-left: 2px;
}
#custom-power {
margin-bottom: 7px;
padding: 14px 0px 14px 0px;
}
#custom-search {
background-image: url("${OSLogo}");
background-size: 65%;
background-position: center;
background-repeat: no-repeat;
margin-top: 7px;
}
#backlight {
color: #${base0A};
}
#battery {
color: #${base0C};
}
#battery.warning {
color: #${base09};
}
#battery.critical:not(.charging) {
color: #${base08};
}
tooltip {
font-family: 'Lato', sans-serif;
border-radius: 15px;
padding: 20px;
margin: 30px;
}
tooltip label {
font-family: 'Lato', sans-serif;
padding: 20px;
}
''

View file

@ -0,0 +1,276 @@
{
config,
pkgs,
lib,
osConfig,
...
}: let
inherit (lib) optionalString primaryMonitor;
sys = osConfig.modules.system;
in {
mainBar = {
layer = "top";
position = "left";
# monitor configuration, kind of dirty since it assumes DP-1 is my main monitor
output = primaryMonitor osConfig;
width = 55;
spacing = 7;
margin-left = 6;
margin-top = 9;
margin-bottom = 9;
margin-right = null;
fixed-center = true;
exclusive = true;
modules-left = [
"custom/search"
"hyprland/workspaces"
"backlight"
"battery"
"custom/weather"
"custom/todo"
];
modules-center = [];
modules-right = [
"cpu"
(optionalString sys.bluetooth.enable "bluetooth")
"gamemode"
"pulseaudio"
"network"
"custom/swallow"
"clock"
"custom/power"
];
"hyprland/workspaces" = let
hyprctl = config.wayland.windowManager.hyprland.package + "/bin/hyprctl";
in {
on-click = "activate";
on-scroll-up = "${hyprctl} dispatch workspace m+1";
on-scroll-down = "${hyprctl} dispatch workspace m-1";
format = "{icon}";
active-only = true;
all-outputs = true;
format-icons = {
"1" = "";
"2" = "";
"3" = "";
"4" = "";
"5" = "";
"6" = "";
"7" = "";
"8" = "";
"9" = "";
"10" = "";
};
};
"custom/search" = {
format = " ";
tooltip = false;
on-click = "${lib.getExe pkgs.killall} rofi || run-as-service $(rofi -show drun)";
};
"custom/todo" = {
format = "{}";
tooltip = true;
interval = 7;
exec = let
todo = pkgs.todo + "/bin/todo";
sed = pkgs.gnused + "/bin/sed";
wc = pkgs.coreutils + "/bin/wc";
in
pkgs.writeShellScript "todo-waybar" ''
#!/bin/sh
total_todo=$(${todo} | ${wc} -l)
todo_raw_done=$(${todo} raw done | ${sed} 's/^/ /' | ${sed} -z 's/\n/\\n/g')
todo_raw_undone=$(${todo} raw todo | ${sed} 's/^/ /' | ${sed} -z 's/\n/\\n/g')
done=$(${todo} raw done | ${wc} -l)
undone=$(${todo} raw todo | ${wc} -l)
tooltip=$(${todo})
left="$done/$total_todo"
header="<b>todo</b>\\n\\n"
tooltip=""
if [[ $total_todo -gt 0 ]]; then
if [[ $undone -gt 0 ]]; then
export tooltip="$header👷 Today, you need to do:\\n\\n $(echo $todo_raw_undone)\\n\\n You have already done:\\n\\n $(echo $todo_raw_done)"
export output=" 🗒 \\n $left"
else
export tooltip="$header All done!\\n🥤 Remember to stay hydrated!"
export output=" 🎉 \\n $left"
fi
else
export tooltip=""
export output=""
fi
printf '{"text": "%s", "tooltip": "%s" }' "$output" "$tooltip"
'';
return-type = "json";
};
"custom/weather" = let
waybar-wttr = pkgs.stdenv.mkDerivation {
name = "waybar-wttr";
buildInputs = [(pkgs.python3.withPackages (pythonPackages: with pythonPackages; [requests]))];
unpackPhase = "true";
installPhase = ''
mkdir -p $out/bin
cp ${../../scripts/waybar-wttr.py} $out/bin/waybar-wttr
chmod +x $out/bin/waybar-wttr
'';
};
in {
format = "{}";
tooltip = true;
interval = 30;
exec = "${waybar-wttr}/bin/waybar-wttr";
return-type = "json";
};
"custom/lock" = {
tooltip = false;
on-click = "${pkgs.bash}/bin/bash -c '(sleep 0.5s; ${lib.getExe pkgs.swaylock-effects} --grace 0)' & disown";
format = "";
};
"custom/swallow" = {
tooltip = false;
on-click = let
hyprctl = config.wayland.windowManager.hyprland.package + "/bin/hyprctl";
notify-send = pkgs.libnotify + "/bin/notify-send";
rg = pkgs.ripgrep + "/bin/rg";
in
pkgs.writeShellScript "waybar-swallow" ''
#!/bin/sh
if ${hyprctl} getoption misc:enable_swallow | ${rg} -q "int: 1"; then
${hyprctl} keyword misc:enable_swallow false >/dev/null &&
${notify-send} "Hyprland" "Turned off swallowing"
else
${hyprctl} keyword misc:enable_swallow true >/dev/null &&
${notify-send} "Hyprland" "Turned on swallowing"
fi
'';
format = "󰊰";
};
"custom/power" = {
tooltip = false;
on-click = let
sudo = pkgs.sudo + "/bin/sudo";
rofi = config.programs.rofi.package + "/bin/rofi";
poweroff = pkgs.systemd + "/bin/poweroff";
reboot = pkgs.systemd + "/bin/reboot";
in
pkgs.writeShellScript "shutdown-waybar" ''
#!/bin/sh
off=" Shutdown"
reboot=" Reboot"
cancel="󰅖 Cancel"
sure="$(printf '%s\n%s\n%s' "$off" "$reboot" "$cancel" |
${rofi} -dmenu -p ' Are you sure?')"
if [ "$sure" = "$off" ]; then
${sudo} ${poweroff}
elif [ "$sure" = "$reboot" ]; then
${sudo} ${reboot}
fi
'';
format = "󰐥";
};
clock = {
format = ''
{:%H
%M}'';
tooltip-format = ''
<big>{:%Y %B}</big>
<tt><small>{calendar}</small></tt>
'';
};
backlight = let
brightnessctl = lib.getExe pkgs.brightnessctl;
in {
format = "{icon}";
format-icons = ["󰋙" "󰫃" "󰫄" "󰫅" "󰫆" "󰫇" "󰫈"];
#format-icons = ["" "" "" "" "" "" "" "" ""];
on-scroll-up = "${brightnessctl} s 1%-";
on-scroll-down = "${brightnessctl} s +1%";
};
battery = {
states = {
warning = 30;
critical = 15;
};
format = "{icon}";
format-charging = "󰂄";
format-plugged = "󰂄";
format-alt = "{icon}";
format-icons = ["󰂃" "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"];
};
network = let
nm-editor = "${pkgs.networkmanagerapplet}/bin/nm-connection-editor";
in {
format-wifi = "󰤨";
format-ethernet = "󰈀";
format-alt = "󱛇";
format-disconnected = "󰤭";
tooltip-format = "{ipaddr}/{ifname} via {gwaddr} ({signalStrength}%)";
on-click-right = "${nm-editor}";
};
pulseaudio = {
scroll-step = 5;
tooltip = true;
tooltip-format = "{volume}";
on-click = "${pkgs.killall}/bin/killall pavucontrol || ${pkgs.pavucontrol}/bin/pavucontrol";
format = "{icon}";
format-muted = "󰝟";
format-icons = {
default = ["" "" ""];
};
};
cpu = {
interval = 10;
format = "";
max-length = 10;
states = {
"50" = 50;
"60" = 75;
"70" = 90;
};
};
bluetooth = {
# controller = "controller1", // specify the alias of the controller if there are more than 1 on the system
format = "";
format-disabled = "󰂲"; # an empty format will hide the module
format-connected = "󰂱";
tooltip-format = "{controller_alias}\t{controller_address}";
tooltip-format-connected = "{controller_alias}\t{controller_address}\n\n{device_enumerate}";
tooltip-format-disabled = "";
tooltip-format-enumerate-connected = "{device_alias}\t{device_address}";
};
gamemode = {
format = "󰊴";
format-alt = "{glyph}";
glyph = "󰊴";
hide-not-running = true;
use-icon = true;
icon-name = "input-gaming-symbolic";
icon-spacing = 4;
icon-size = 20;
tooltip = true;
tooltip-format = "Games running: {count}";
};
};
}

View file

@ -0,0 +1,201 @@
{colors}:
with colors; let
OSLogo = builtins.fetchurl rec {
name = "OSLogo-${sha256}.png";
sha256 = "14mbpw8jv1w2c5wvfvj8clmjw0fi956bq5xf9s2q3my14far0as8";
url = "https://raw.githubusercontent.com/NixOS/nixos-artwork/master/logo/nix-snowflake.svg";
};
in ''
* {
font-family: Material Design Icons, Iosevka Nerd Font Mono;
font-size: 19px;
border-radius: 12px;
}
window#waybar {
background-color: #${base00};
border: .5px solid #${base01};
border-radius: 14px;
box-shadow: 2 3 2 2px #151515;
color: #${base05};
margin: 16px 16px;
transition-property: background-color;
transition-duration: .5s;
}
window#waybar.hidden {
opacity: 0.2;
}
#clock,
#network,
#custom-power,
#cpu,
#battery,
#backlight,
#memory,
#workspaces,
#custom-search,
#custom-power,
#custom-todo,
#custom-lock,
#custom-weather,
#custom-swallow,
#volume,
#bluetooth,
#gamemode,
#pulseaudio {
border-radius: 14px;
margin: 0px 7px 0px 7px;
background-color: #${base01};
padding: 10px 0px 10px 0px;
}
#workspaces {
font-size: 14px;
background-color: #${base01};
}
#workspaces button {
background-color: transparent;
border-radius: 14px;
color: #${base04};
font-size: 21px;
/* Use box-shadow instead of border so the text isn't offset */
box-shadow: inset 0 -3px transparent;
}
#workspaces button:hover {
color: #${base0C};
box-shadow: inherit;
text-shadow: inherit;
}
#workspaces button.active {
color: #${base0A};
}
#workspaces button.urgent {
color: #${base08};
}
#network {
/* prevents the network icon from being too squashed */
padding: 14px 0px 14px 0px;
}
#cpu {
color: rgba(0, 0, 0, 0.0);
background-color: rgba(0, 0, 0, 0.0);
margin: -50;
border-radius: 16px;
}
#cpu.50 {
color: #${base06};
background-color: #${base02};
border-radius: 15px;
margin: 0px 7px 0px 7px;
padding: 10px 0px 10px 0px;
}
#cpu.60 {
color: #${base09};
background-color: #${base02};
border-radius: 15px;
margin: 0px 7px 0px 7px;
padding: 10px 0px 10px 0px;
}
#cpu.70 {
color: #${base08};
background-color: #${base02};
border-radius: 15px;
margin: 0px 7px 0px 7px;
padding: 10px 0px 10px 0px;
}
#bluetooth.off,
#bluetooth.pairable,
#bluetooth.discovering,
#bluetooth.disabled {
color: rgba(0, 0, 0, 0.0);
background-color: rgba(0, 0, 0, 0.0);
margin: -50;
border-radius: 16px;
}
#clock {
color: #${base05};
background-color: #${base01};
font-weight: 700;
font-size: 20px;
padding: 5px 0px 5px 0px;
font-family: "Iosevka Term";
}
#pulseaudio {
padding: 5px 0px 5px 0px;
font-size: 30;
}
#pulseaudio.source-muted,
#pulseaudio.muted {
color: #${base08};
padding: 16px 0px 16px 0px;
font-size: 15;
}
#custom-swallow {
padding: 14px 0px 14px 0px;
}
#custom-todo {
padding-left: 2px;
background-color: #${base01};
}
#custom-power {
margin-bottom: 7px;
padding: 14px 0px 14px 0px;
}
#custom-search {
background-image: url("${OSLogo}");
background-size: 65%;
background-position: center;
background-repeat: no-repeat;
margin-top: 7px;
}
#custom-power {
margin-bottom: 7px;
padding: 14px 0px 14px 0px;
color: #${base0A};
}
#battery {
border-radius: 14px;
}
#battery.warning {
color: #${base09};
}
#battery.critical:not(.charging) {
color: #${base08};
}
tooltip {
font-family: 'Lato', sans-serif;
border-radius: 14px;
padding: 20px;
margin: 30px;
}
tooltip label {
font-family: 'Lato', sans-serif;
padding: 20px;
}
''