Waybar: Replace ugly icons for a beauty.
This commit is contained in:
parent
2bfd58acc1
commit
8d49899e50
|
@ -10,45 +10,45 @@
|
||||||
in {
|
in {
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
# Specify default model.
|
# Specify default model.
|
||||||
environment.variables.OLLAMA_MODEL = cfg.primaryModel;
|
# environment.variables.OLLAMA_MODEL = cfg.primaryModel;
|
||||||
|
#
|
||||||
systemd.services = {
|
# systemd.services = {
|
||||||
# Enable Ollama server.
|
# # Enable Ollama server.
|
||||||
ollama = {
|
# ollama = {
|
||||||
description = "Ollama LLM server";
|
# description = "Ollama LLM server";
|
||||||
serviceConfig = {
|
# serviceConfig = {
|
||||||
Type = "simple";
|
# Type = "simple";
|
||||||
};
|
# };
|
||||||
wantedBy = [
|
# wantedBy = [
|
||||||
"multi-user.target"
|
# "multi-user.target"
|
||||||
];
|
# ];
|
||||||
script = ''
|
# script = ''
|
||||||
HOME=/root ${lib.getExe pkgsUnstable.ollama} serve
|
# HOME=/root ${lib.getExe pkgsUnstable.ollama} serve
|
||||||
'';
|
# '';
|
||||||
};
|
# };
|
||||||
|
#
|
||||||
# Download Ollama models.
|
# # Download Ollama models.
|
||||||
ollama-pull = {
|
# ollama-pull = {
|
||||||
description = "Ollama LLM model";
|
# description = "Ollama LLM model";
|
||||||
after = [
|
# after = [
|
||||||
"NetworkManager-wait-online.service"
|
# "NetworkManager-wait-online.service"
|
||||||
"ollama.service"
|
# "ollama.service"
|
||||||
];
|
# ];
|
||||||
wantedBy = [
|
# wantedBy = [
|
||||||
"multi-user.target"
|
# "multi-user.target"
|
||||||
];
|
# ];
|
||||||
wants = [
|
# wants = [
|
||||||
"NetworkManager-wait-online.service"
|
# "NetworkManager-wait-online.service"
|
||||||
"ollama.service"
|
# "ollama.service"
|
||||||
];
|
# ];
|
||||||
serviceConfig = {
|
# serviceConfig = {
|
||||||
Type = "simple";
|
# Type = "simple";
|
||||||
};
|
# };
|
||||||
script = util.trimTabs ''
|
# script = util.trimTabs ''
|
||||||
sleep 5
|
# sleep 5
|
||||||
${lib.getExe pkgsUnstable.ollama} pull ${lib.concatStringsSep " " cfg.models}
|
# ${lib.getExe pkgsUnstable.ollama} pull ${lib.concatStringsSep " " cfg.models}
|
||||||
'';
|
# '';
|
||||||
};
|
# };
|
||||||
};
|
# };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
} @args: let
|
||||||
|
swayscript = pkgs.callPackage <package/swayscript> args;
|
||||||
alpha = config.module.style.opacity.hex;
|
alpha = config.module.style.opacity.hex;
|
||||||
color = config.module.style.color;
|
color = config.module.style.color;
|
||||||
max = 3;
|
max = 3;
|
||||||
|
@ -20,7 +21,7 @@ in {
|
||||||
margin = 32;
|
margin = 32;
|
||||||
max-history = max;
|
max-history = max;
|
||||||
max-visible = max;
|
max-visible = max;
|
||||||
on-notify = "exec swayscript notify";
|
on-notify = "exec ${swayscript}/bin/swayscript notify";
|
||||||
text-color = "#${config.module.style.color.bg.dark}";
|
text-color = "#${config.module.style.color.bg.dark}";
|
||||||
width = 480;
|
width = 480;
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
in {
|
in {
|
||||||
text = ''
|
text = ''
|
||||||
bindsym ${mod} input * xkb_switch_layout 0
|
bindsym ${mod} input * xkb_switch_layout 0
|
||||||
|
bindsym --to-code ${mod}+a exec 'swayscript network'
|
||||||
bindsym --to-code ${mod}+c exec 'systemctl reboot -i'
|
bindsym --to-code ${mod}+c exec 'systemctl reboot -i'
|
||||||
bindsym --to-code ${mod}+g exec 'swayscript gaming'
|
bindsym --to-code ${mod}+g exec 'swayscript gaming'
|
||||||
bindsym --to-code ${mod}+l exec 'powerlimit toggle'
|
bindsym --to-code ${mod}+l exec 'powerlimit toggle'
|
||||||
|
|
|
@ -2,7 +2,5 @@
|
||||||
text = ''
|
text = ''
|
||||||
bindsym --to-code $mod+shift+r exec 'pkill waybar || exec waybar'
|
bindsym --to-code $mod+shift+r exec 'pkill waybar || exec waybar'
|
||||||
exec waybar
|
exec waybar
|
||||||
exec nm-applet
|
|
||||||
exec blueman-applet
|
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ in {
|
||||||
"group/batteryinfo"
|
"group/batteryinfo"
|
||||||
"group/hardware"
|
"group/hardware"
|
||||||
"custom/display"
|
"custom/display"
|
||||||
|
"custom/network"
|
||||||
"tray"
|
"tray"
|
||||||
];
|
];
|
||||||
"sway/workspaces" = {
|
"sway/workspaces" = {
|
||||||
|
@ -186,6 +187,15 @@ in {
|
||||||
return-type = "json";
|
return-type = "json";
|
||||||
signal = 4;
|
signal = 4;
|
||||||
};
|
};
|
||||||
|
"custom/network" = {
|
||||||
|
exec = "swayscript networkwidget";
|
||||||
|
# interval = refreshInterval;
|
||||||
|
on-click = "blueman-manager";
|
||||||
|
on-click-middle = "swayscript network";
|
||||||
|
on-click-right = "nm-connection-editor";
|
||||||
|
return-type = "json";
|
||||||
|
signal = 7;
|
||||||
|
};
|
||||||
"custom/taghw1" = {
|
"custom/taghw1" = {
|
||||||
exec = "echo ";
|
exec = "echo ";
|
||||||
};
|
};
|
||||||
|
|
|
@ -23,6 +23,7 @@ in {
|
||||||
/* Padding for global widgets. */
|
/* Padding for global widgets. */
|
||||||
#clock,
|
#clock,
|
||||||
#custom-display,
|
#custom-display,
|
||||||
|
#custom-network,
|
||||||
#language,
|
#language,
|
||||||
#mpris,
|
#mpris,
|
||||||
#pulseaudio,
|
#pulseaudio,
|
||||||
|
@ -44,6 +45,7 @@ in {
|
||||||
#batteryinfo:hover,
|
#batteryinfo:hover,
|
||||||
#clock:hover,
|
#clock:hover,
|
||||||
#custom-display:hover,
|
#custom-display:hover,
|
||||||
|
#custom-network:hover,
|
||||||
#hardware:hover,
|
#hardware:hover,
|
||||||
#language:hover,
|
#language:hover,
|
||||||
#mpris:hover,
|
#mpris:hover,
|
||||||
|
@ -58,6 +60,7 @@ in {
|
||||||
#battery,
|
#battery,
|
||||||
#cpu.usage,
|
#cpu.usage,
|
||||||
#custom-display,
|
#custom-display,
|
||||||
|
#custom-network,
|
||||||
#memory,
|
#memory,
|
||||||
#pulseaudio,
|
#pulseaudio,
|
||||||
#temperature,
|
#temperature,
|
||||||
|
@ -69,6 +72,8 @@ in {
|
||||||
#battery.critical,
|
#battery.critical,
|
||||||
#cpu.usage.critical,
|
#cpu.usage.critical,
|
||||||
#custom-display.modified,
|
#custom-display.modified,
|
||||||
|
#custom-network.issue,
|
||||||
|
#custom-network.vpn,
|
||||||
#memory.critical,
|
#memory.critical,
|
||||||
#pulseaudio.muted,
|
#pulseaudio.muted,
|
||||||
#pulseaudio.source-muted,
|
#pulseaudio.source-muted,
|
||||||
|
|
62
package/swayscript/script/NetworkWidget.nix
Normal file
62
package/swayscript/script/NetworkWidget.nix
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
{ ... }: {
|
||||||
|
text = ''
|
||||||
|
# Waybar output.
|
||||||
|
function networkwidget() {
|
||||||
|
local IFS=$'\n'
|
||||||
|
local internet=$(nmcli networking connectivity check)
|
||||||
|
local _ethernets=($(nmcli connection show --active | rg ethernet | cut -f1 -d\ ))
|
||||||
|
local _vpns=($(nmcli connection show --active | rg vpn | cut -f1 -d\ ))
|
||||||
|
local _wifis=($(nmcli connection show --active | rg wifi | cut -f1 -d\ ))
|
||||||
|
local _bts=($(bluetoothctl devices Connected | cut -d\ -f3))
|
||||||
|
local icon=""
|
||||||
|
local class=""
|
||||||
|
|
||||||
|
if [[ "''${_bts}" != "" ]]; then
|
||||||
|
icon=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "''${_vpns}" != "" ]]; then
|
||||||
|
class="vpn"
|
||||||
|
icon=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "''${internet}" != "full" ]]; then
|
||||||
|
class="issue"
|
||||||
|
icon=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
for net in ''${_vpns[@]}; do
|
||||||
|
[[ "''${networks}" = "" ]] || networks+="\\\n"
|
||||||
|
networks+=" ''${net}"
|
||||||
|
done
|
||||||
|
|
||||||
|
for net in ''${_ethernets[@]}; do
|
||||||
|
[[ "''${networks}" = "" ]] || networks+="\\\n"
|
||||||
|
networks+=" ''${net}"
|
||||||
|
done
|
||||||
|
|
||||||
|
for net in ''${_wifis[@]}; do
|
||||||
|
[[ "''${networks}" = "" ]] || networks+="\\\n"
|
||||||
|
networks+=" ''${net}"
|
||||||
|
done
|
||||||
|
|
||||||
|
for bt in ''${_bts[@]}; do
|
||||||
|
[[ "''${networks}" = "" ]] || networks+="\\\n"
|
||||||
|
networks+=" ''${bt}"
|
||||||
|
done
|
||||||
|
|
||||||
|
printf "{\"text\": \"''${icon}\", \"tooltip\": \"''${networks[@]}\", \"class\": \"''${class}\"}\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Toggle network.
|
||||||
|
function network() {
|
||||||
|
notify_short
|
||||||
|
local state=$(nmcli networking)
|
||||||
|
if [[ "''${state}" = "enabled" ]]; then
|
||||||
|
nmcli networking off
|
||||||
|
else
|
||||||
|
nmcli networking on
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
}
|
|
@ -1,7 +1,16 @@
|
||||||
{ ... }: {
|
{
|
||||||
|
pkgs,
|
||||||
|
util,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
networking = {
|
networking = {
|
||||||
networkmanager = {
|
networkmanager = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
dispatcherScripts = [{
|
||||||
|
source = pkgs.writeText "nm-wb-dispatcher" (util.trimTabs ''
|
||||||
|
${pkgs.procps}/bin/pkill -RTMIN+7 waybar
|
||||||
|
'');
|
||||||
|
}];
|
||||||
# unmanaged = [
|
# unmanaged = [
|
||||||
# "type:bridge"
|
# "type:bridge"
|
||||||
# "type:ethernet"
|
# "type:ethernet"
|
||||||
|
|
14
system/Udev.nix
Normal file
14
system/Udev.nix
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
util,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
waybar_reload = pkgs.writeShellScriptBin "bt-wb-dispatcher" (util.trimTabs ''
|
||||||
|
${pkgs.procps}/bin/pkill -RTMIN+7 waybar
|
||||||
|
'');
|
||||||
|
in {
|
||||||
|
services.udev.extraRules = util.trimTabs ''
|
||||||
|
ACTION=="add", SUBSYSTEM=="bluetooth", RUN+="${waybar_reload}/bin/bt-wb-dispatcher"
|
||||||
|
ACTION=="remove", SUBSYSTEM=="bluetooth", RUN+="${waybar_reload}/bin/bt-wb-dispatcher"
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Reference in a new issue