Initial waybar config setup + multimonitor like xmonad

This commit is contained in:
Emmet 2023-08-17 22:10:08 -05:00
parent 60f742df55
commit a86e15d277
3 changed files with 440 additions and 19 deletions

View file

@ -42,7 +42,7 @@
syncthing syncthing
# Office # Office
libreoffice-fresh-unwrapped libreoffice-fresh
mate.atril mate.atril
xournalpp xournalpp
glib glib

View file

@ -23,11 +23,5 @@
enable = true; enable = true;
}; };
}; };
waybar = {
enable = true;
package = pkgs.waybar.overrideAttrs (oldAttrs: {
mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ];
});
};
}; };
} }

View file

@ -73,7 +73,7 @@
bind=,code:255,exec,airplane-mode bind=,code:255,exec,airplane-mode
bind=SUPERSHIFT,S,exec,systemctl suspend bind=SUPERSHIFT,S,exec,systemctl suspend
bind=SUPERSHIFT,L,exec,swaylock --indicator-radius 200 --screenshots --effect-blur 10x10 bind=SUPERCTRL,L,exec,swaylock --indicator-radius 200 --screenshots --effect-blur 10x10
bind=SUPER,H,movefocus,l bind=SUPER,H,movefocus,l
bind=SUPER,J,movefocus,d bind=SUPER,J,movefocus,d
@ -85,16 +85,15 @@
bind=SUPERSHIFT,K,movewindow,u bind=SUPERSHIFT,K,movewindow,u
bind=SUPERSHIFT,L,movewindow,r bind=SUPERSHIFT,L,movewindow,r
bind=SUPER,1,workspace,1 bind=SUPER,1,exec,hyprworkspace 1
bind=SUPER,2,workspace,2 bind=SUPER,2,exec,hyprworkspace 2
bind=SUPER,3,workspace,3 bind=SUPER,3,exec,hyprworkspace 3
bind=SUPER,4,workspace,4 bind=SUPER,4,exec,hyprworkspace 4
bind=SUPER,5,workspace,5 bind=SUPER,5,exec,hyprworkspace 5
bind=SUPER,6,workspace,6 bind=SUPER,6,exec,hyprworkspace 6
bind=SUPER,7,workspace,7 bind=SUPER,7,exec,hyprworkspace 7
bind=SUPER,8,workspace,8 bind=SUPER,8,exec,hyprworkspace 8
bind=SUPER,9,workspace,9 bind=SUPER,9,exec,hyprworkspace 9
bind=SUPER,0,workspace,10
bind=SUPERSHIFT,1,movetoworkspace,1 bind=SUPERSHIFT,1,movetoworkspace,1
bind=SUPERSHIFT,2,movetoworkspace,2 bind=SUPERSHIFT,2,movetoworkspace,2
@ -105,7 +104,6 @@
bind=SUPERSHIFT,7,movetoworkspace,7 bind=SUPERSHIFT,7,movetoworkspace,7
bind=SUPERSHIFT,8,movetoworkspace,8 bind=SUPERSHIFT,8,movetoworkspace,8
bind=SUPERSHIFT,9,movetoworkspace,9 bind=SUPERSHIFT,9,movetoworkspace,9
bind=SUPERSHIFT,0,movetoworkspace,10
bind=SUPER,Z,exec,pypr toggle term bind=SUPER,Z,exec,pypr toggle term
bind=SUPER,F,exec,pypr toggle ranger bind=SUPER,F,exec,pypr toggle ranger
@ -207,6 +205,35 @@
templow=$1 templow=$1
wlsunset -t $templow -T $temphigh & wlsunset -t $templow -T $temphigh &
'') '')
(pkgs.writeScriptBin "hyprworkspace" ''
#!/bin/sh
# from https://github.com/taylor85345/hyprland-dotfiles/blob/master/hypr/scripts/workspace
monitors=/tmp/hypr/monitors_temp
hyprctl monitors > $monitors
if [[ -z $1 ]]; then
workspace=$(grep -B 5 "focused: no" "$monitors" | awk 'NR==1 {print $3}')
else
workspace=$1
fi
activemonitor=$(grep -B 11 "focused: yes" "$monitors" | awk 'NR==1 {print $2}')
passivemonitor=$(grep -B 6 "($workspace)" "$monitors" | awk 'NR==1 {print $2}')
#activews=$(grep -A 2 "$activemonitor" "$monitors" | awk 'NR==3 {print $1}' RS='(' FS=')')
passivews=$(grep -A 6 "Monitor $passivemonitor" "$monitors" | awk 'NR==4 {print $1}' RS='(' FS=')')
if [[ $workspace -eq $passivews ]] && [[ $activemonitor != "$passivemonitor" ]]; then
hyprctl dispatch swapactiveworkspaces "$activemonitor" "$passivemonitor" &&
hyprctl reload &&
hyprctl dispatch focusmonitor "$activemonitor"
echo $activemonitor $passivemonitor
else
hyprctl dispatch moveworkspacetomonitor "$workspace $activemonitor" && hyprctl dispatch workspace "$workspace"
fi
exit 0
'')
(pkgs.python3Packages.buildPythonPackage rec { (pkgs.python3Packages.buildPythonPackage rec {
pname = "pyprland"; pname = "pyprland";
version = "1.4.0"; version = "1.4.0";
@ -257,6 +284,406 @@
} }
} }
''; '';
programs.waybar = {
enable = true;
package = pkgs.waybar.overrideAttrs (oldAttrs: {
mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ];
});
settings = {
mainBar = {
layer = "top";
position = "top";
height = 30;
# width = 1280;
spacing = 4;
modules-left = [ ];
modules-center = [ "wlr/workspaces" ];
modules-right = [ "idle_inhibitor" "pulseaudio" "network" "cpu" "memory" "backlight" "battery" "clock" "tray"];
"wlr/workspaces" = {
"format" = "{icon}";
"format-icons" = {
"1" = "";
"2" = "";
"3" = "";
"4" = "";
"5" = "";
};
"persistent_workspaces" = {
"1" = [];
"2" = [];
"3" = [];
"4" = [];
"5" = [];
"6" = [];
"7" = [];
"8" = [];
"9" = [];
};
};
"idle_inhibitor" = {
format = "{icon}";
format-icons = {
activated = "";
deactivated = "";
};
};
tray = {
#"icon-size" = 21;
"spacing" = 10;
};
clock = {
"timezone" = "America/New_York";
"tooltip-format" = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
"format-alt" = "{:%Y-%m-%d}";
};
cpu = {
"format" = "{usage}% ";
"tooltip" = false;
};
memory = {
"format" = "{}% ";
};
backlight = {
"format" = "{percent}% {icon}";
"format-icons" = ["" "" "" "" "" "" "" "" ""];
};
battery = {
"states" = {
"good" = 95;
"warning" = 30;
"critical" = 15;
};
"format" = "{capacity}% {icon}";
"format-charging" = "{capacity}% ";
"format-plugged" = "{capacity}% ";
"format-alt" = "{time} {icon}";
#"format-good" = ""; # An empty format will hide the module
#"format-full" = "";
"format-icons" = ["" "" "" "" ""];
};
network = {
"format-wifi" = "{essid} ({signalStrength}%) ";
"format-ethernet" = "{ipaddr}/{cidr} ";
"tooltip-format" = "{ifname} via {gwaddr} ";
"format-linked" = "{ifname} (No IP) ";
"format-disconnected" = "Disconnected ";
"format-alt" = "{ifname}: {ipaddr}/{cidr}";
};
pulseaudio = {
"scroll-step" = 1;
"format" = "{volume}% {icon} {format_source}";
"format-bluetooth" = "{volume}% {icon} {format_source}";
"format-bluetooth-muted" = " {icon} {format_source}";
"format-muted" = " {format_source}";
"format-source" = "{volume}% ";
"format-source-muted" = "";
"format-icons" = {
"headphone" = "";
"hands-free" = "";
"headset" = "";
"phone" = "";
"portable" = "";
"car" = "";
"default" = ["" "" ""];
};
"on-click" = "pavucontrol";
};
};
};
style = ''
* {
/* `otf-font-awesome` is required to be installed for icons */
font-family: FontAwesome, Roboto, Helvetica, Arial, sans-serif;
font-size: 13px;
}
window#waybar {
background-color: rgba(43, 48, 59, 0.9);
color: #ffffff;
transition-property: background-color;
transition-duration: .5s;
}
window#waybar.hidden {
opacity: 0.2;
}
/*
window#waybar.empty {
background-color: transparent;
}
window#waybar.solo {
background-color: #FFFFFF;
}
*/
window#waybar.termite {
background-color: #3F3F3F;
}
window#waybar.chromium {
background-color: #000000;
border: none;
}
button {
/* Use box-shadow instead of border so the text isn't offset */
box-shadow: inset 0 -3px transparent;
/* Avoid rounded borders under each button name */
border: none;
border-radius: 2;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
button:hover {
background: inherit;
}
#workspaces button {
padding: 0 7px;
background-color: transparent;
color: #ffffff;
}
#workspaces button:hover {
background: rgba(0, 0, 0, 0.2);
}
#workspaces button.focused {
background-color: #64727D;
box-shadow: inset 0 -3px #ffffff;
}
#workspaces button.active {
background-color: #ff0000;
}
#workspaces button.visible {
background-color: #0000ff;
}
#workspaces button.urgent {
background-color: #eb4d4b;
}
#mode {
background-color: #64727D;
border-bottom: 3px solid #ffffff;
}
#clock,
#battery,
#cpu,
#memory,
#disk,
#temperature,
#backlight,
#network,
#pulseaudio,
#wireplumber,
#custom-media,
#tray,
#mode,
#idle_inhibitor,
#scratchpad,
#mpd {
padding: 0 10px;
color: #ffffff;
}
#window,
#workspaces {
margin: 0 4px;
}
/* If workspaces is the leftmost module, omit left margin */
.modules-left > widget:first-child > #workspaces {
margin-left: 0;
}
/* If workspaces is the rightmost module, omit right margin */
.modules-right > widget:last-child > #workspaces {
margin-right: 0;
}
#clock {
background-color: #64727D;
}
#battery {
background-color: #ffffff;
color: #000000;
}
#battery.charging, #battery.plugged {
color: #ffffff;
background-color: #26A65B;
}
@keyframes blink {
to {
background-color: #ffffff;
color: #000000;
}
}
#battery.critical:not(.charging) {
background-color: #f53c3c;
color: #ffffff;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
label:focus {
background-color: #000000;
}
#cpu {
background-color: #2ecc71;
color: #000000;
}
#memory {
background-color: #9b59b6;
}
#disk {
background-color: #964B00;
}
#backlight {
background-color: #90b1b1;
}
#network {
background-color: #2980b9;
}
#network.disconnected {
background-color: #f53c3c;
}
#pulseaudio {
background-color: #f1c40f;
color: #000000;
}
#pulseaudio.muted {
background-color: #90b1b1;
color: #2a5c45;
}
#wireplumber {
background-color: #fff0f5;
color: #000000;
}
#wireplumber.muted {
background-color: #f53c3c;
}
#custom-media {
background-color: #66cc99;
color: #2a5c45;
min-width: 100px;
}
#custom-media.custom-spotify {
background-color: #66cc99;
}
#custom-media.custom-vlc {
background-color: #ffa000;
}
#temperature {
background-color: #f0932b;
}
#temperature.critical {
background-color: #eb4d4b;
}
#tray {
background-color: #2980b9;
}
#tray > .passive {
-gtk-icon-effect: dim;
}
#tray > .needs-attention {
-gtk-icon-effect: highlight;
background-color: #eb4d4b;
}
#idle_inhibitor {
background-color: #2d3436;
}
#idle_inhibitor.activated {
background-color: #ecf0f1;
color: #2d3436;
}
#mpd {
background-color: #66cc99;
color: #2a5c45;
}
#mpd.disconnected {
background-color: #f53c3c;
}
#mpd.stopped {
background-color: #90b1b1;
}
#mpd.paused {
background-color: #51a37a;
}
#language {
background: #00b093;
color: #740864;
padding: 0 5px;
margin: 0 5px;
min-width: 16px;
}
#keyboard-state {
background: #97e1ad;
color: #000000;
padding: 0 0px;
margin: 0 5px;
min-width: 16px;
}
#keyboard-state > label {
padding: 0 5px;
}
#keyboard-state > label.locked {
background: rgba(0, 0, 0, 0.2);
}
#scratchpad {
background: rgba(0, 0, 0, 0.2);
}
#scratchpad.empty {
background-color: transparent;
}
'';
};
programs.fuzzel.enable = true; programs.fuzzel.enable = true;
programs.fuzzel.settings = { programs.fuzzel.settings = {
main = { main = {