waybar refactoring

auto-flake-update
Yorick van Pelt 2022-04-11 15:58:15 +02:00
parent a465cda40d
commit 1959d85536
Signed by: yorick
GPG Key ID: A36E70F9DC014A15
7 changed files with 85 additions and 145 deletions

4
bin/btoggle.sh Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
MAC=94:DB:56:79:7D:86
bluetoothctl info "$MAC" | grep -q 'Connected: yes' &&
bluetoothctl disconnect "$MAC" || bluetoothctl connect "$MAC"

View File

@ -1,39 +0,0 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.arbtt;
in {
options.services.arbtt = {
enable = mkEnableOption "arbtt";
package = mkOption { type = types.package; default = pkgs.haskellPackages.arbtt; };
};
config = mkIf cfg.enable {
systemd.user.services.arbtt = {
Unit = {
Description = "arbtt";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Service = {
ExecStart = ''
${cfg.package}/bin/arbtt-capture
'';
};
};
};
}

View File

@ -17,11 +17,15 @@ let
in
{
# TODO: waybar module from home-manager
xdg.configFile."waybar" = {
source = ./waybar;
recursive = true;
xdg.configFile."waybar/config" = {
text = builtins.toJSON (builtins.fromTOML (builtins.readFile ./waybar.toml));
onChange = "systemctl --user restart waybar";
};
programs.waybar = {
enable = true;
style = ./waybar.css;
systemd.enable = true;
};
programs.mako.enable = true;
services = {
gpg-agent.extraConfig = ''
@ -160,22 +164,6 @@ in
XDG_CURRENT_DESKTOP = "sway";
};
systemd.user.services.waybar = {
Unit = {
Description = "waybar";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
ExecStart = ''
${pkgs.waybar}/bin/waybar
'';
};
};
systemd.user.services.gebaard = {
Unit = {
Description = "gebaard";

View File

@ -10,7 +10,7 @@ let
HOME = "/build";
} "${pkgs.thefuck}/bin/thefuck -a > $out";
in {
imports = [ ./arbtt.nix ./desktop.nix ];
imports = [ ./desktop.nix ];
nixpkgs = {
config.allowUnfree = true;
inherit (import /home/yorick/dotfiles/config.nix) overlays;

73
home-manager/waybar.toml Normal file
View File

@ -0,0 +1,73 @@
layer = "top"
height = 26
modules-left = [ "sway/workspaces", "sway/mode", "custom/spotify" ]
modules-center = [ "sway/window" ]
modules-right = [ "pulseaudio", "network", "disk", "battery", "clock", "tray" ]
["sway/workspaces"]
all-outputs = false
format = "{icon} {name}"
["sway/workspaces".format-icons]
1 = ""
2 = "#"
3 = ""
4 = ""
5 = ""
6 = ""
7 = ""
urgent = ""
focused = ""
default = ""
["sway/mode"]
format = '<span style="italic">{}</span>'
[tray]
spacing = 10
[clock]
format = "{:%Y-%m-%d %H:%M}"
on-click = "xdg-open https://calendar.google.com"
[disk]
format = "{free} "
[battery]
format = "{capacity}% {icon}"
format-icons = [ "", "", "", "", "" ]
[battery.states]
warning = 30
critical = 15
[network]
format-wifi = "{essid} "
format-ethernet = "{ifname} "
format-disconnected = "Disconnected ⚠"
tooltip-format = "{ipaddr}"
[pulseaudio]
scroll-step = 5
format = "{volume}% {icon}"
format-bluetooth = "{volume}% {icon}"
format-muted = ""
on-click = "pkill pavucontrol; pavucontrol"
# toggle headphones
on-click-right = "~/dotfiles/bin/btoggle.sh"
[pulseaudio.format-icons]
headphones = ""
handsfree = ""
headset = ""
phone = ""
portable = ""
car = ""
default = [ "", "" ]
["custom/spotify"]
format = " {}"
escape = true
max-length = 40
on-click = "playerctl play-pause"
exec = "$HOME/dotfiles/bin/spotify_meta.sh 2> /dev/null"

View File

@ -1,86 +0,0 @@
{
"layer": "top", // Waybar at top layer
// "position": "bottom", // Waybar at the bottom of your screen
"height": 26, // Waybar height
// "width": 1280, // Waybar width
// Choose the order of the modules
"modules-left": ["sway/workspaces", "sway/mode", "custom/spotify"],
"modules-center": ["sway/window"],
"modules-right": ["pulseaudio", "network", "disk", "battery", "clock", "tray"],
// Modules configuration
"sway/workspaces": {
"all-outputs": false,
"format": "{icon} {name}",
"format-icons": {
"1": "",
"2": "#",
"3": "",
"4": "",
"5": "",
"6": "",
"7": "",
"urgent": "",
"focused": "",
"default": ""
}
},
"sway/mode": {
"format": "<span style=\"italic\">{}</span>"
},
"tray": {
// "icon-size": 21,
"spacing": 10
},
"clock": {
"format-alt": "{:%Y-%m-%d}"
},
"cpu": {
"format": "{load}% "
},
"memory": {
"format": "{}% "
},
"disk": {
"format": "{free} "
},
"battery": {
"states": {
// "good": 95,
"warning": 30,
"critical": 15
},
"format": "{capacity}% {icon}",
// "format-good": "", // An empty format will hide the module
// "format-full": "",
"format-icons": ["", "", "", "", ""]
},
"network": {
//"interface": "wlp58s0", // (Optional) To force the use of this interface
"format-wifi": "{essid} ",
"format-ethernet": "{ifname} ",
"format-disconnected": "Disconnected ⚠"
},
"pulseaudio": {
"scroll-step": 5,
"format": "{volume}% {icon}",
"format-bluetooth": "{volume}% {icon}",
"format-muted": "",
"format-icons": {
"headphones": "",
"handsfree": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", ""]
},
"on-click": "pavucontrol"
},
"custom/spotify": {
"format": " {}",
"escape": true,
"max-length": 40,
"on-click": "playerctl play-pause",
"exec": "$HOME/dotfiles/bin/spotify_meta.sh 2> /dev/null" // Script in resources folder
}
}