Skip to content

Commit

Permalink
Fix waybar bugs and removed unnecessary parts
Browse files Browse the repository at this point in the history
Signed-off-by: Berk Arslan <[email protected]>
  • Loading branch information
Nerox9 committed Jan 13, 2024
1 parent 7f4b76d commit 0e8fc72
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 171 deletions.
2 changes: 1 addition & 1 deletion modules/graphics/labwc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ in {
Documentation = "man:labwc(1)";
};
socketConfig = {
ListenStream = "%t/wayland-1";
ListenStream = "%t/wayland-0";
};
wantedBy = ["labwc.service"];
};
Expand Down
163 changes: 20 additions & 143 deletions modules/graphics/waybar.config.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022-2023 TII (SSRC) and the Ghaf contributors
# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors
# SPDX-License-Identifier: Apache-2.0
{
pkgs,
Expand All @@ -16,6 +16,8 @@
font-size: 20px; background-image: url("${icon}");
background-position: center;
background-repeat: no-repeat;
padding-left: 10;
padding-right: 10;
}
'';
Expand Down Expand Up @@ -55,11 +57,14 @@
icon = "${pkgs.weston}/share/weston/icon_terminal.png";
}
];

wifi-signal-strength = pkgs.callPackage ../../packages/wifi-signal-strength {};
in {
config = lib.mkIf cfg.enable {
ghaf.graphics.launchers = defaultLauncher;
environment.etc."waybar/config" = {
text =
# Modified from default waybar configuration file https://github.com/Alexays/Waybar/blob/master/resources/config
''
{
"height": 30, // Waybar height (to be removed for auto height)
Expand All @@ -68,7 +73,7 @@ in {
+ mkLauncherModules config.ghaf.graphics.launchers
+ '' ],
"modules-center": ["sway/window"],
"modules-right": ["idle_inhibitor", "pulseaudio", "custom/network1", "cpu", "memory", "temperature", "backlight", "battery", "clock", "tray"],
"modules-right": ["pulseaudio", "custom/network1", "backlight", "battery", "clock", "tray"],
"keyboard-state": {
"numlock": true,
"capslock": true,
Expand All @@ -78,13 +83,6 @@ in {
"unlocked": ""
}
},
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": "",
"deactivated": ""
}
},
"tray": {
// "icon-size": 21,
"spacing": 10
Expand All @@ -94,21 +92,6 @@ in {
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
"format-alt": "{:%Y-%m-%d}"
},
"cpu": {
"format": "{usage}% ",
"tooltip": false
},
"memory": {
"format": "{}% "
},
"temperature": {
// "thermal-zone": 2,
// "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input",
"critical-threshold": 80,
// "format-critical": "{temperatureC}°C {icon}",
"format": "{temperatureC}°C {icon}",
"format-icons": ["", "", ""]
},
"backlight": {
// "device": "acpi_video1",
"format": "{percent}% {icon}",
Expand All @@ -125,14 +108,12 @@ in {
"format-charging": "{capacity}% 󰢟",
"format-plugged": "{capacity}% ",
"format-alt": "{time} {icon}",
// "format-good": "", // An empty format will hide the module
// "format-full": "",
"format-icons": ["󰂎", "󰁺", "󰁻", "󰁼", "󰁽", "󰁾", "󰁿", "󰁿", "󰂀", "󰂁", "󰂂", "󰁹"]
},
"custom/network1": {
"format": "{}",
"interval": 15,
"exec": "${pkgs.wifi-signal-strength}/bin/wifi-signal-strength",
"exec": "${wifi-signal-strength}/bin/wifi-signal-strength",
"return-type": "json",
"on-click": "${pkgs.nm-launcher}/bin/nm-launcher",
},
Expand All @@ -146,11 +127,6 @@ in {
"format-source-muted": "",
"format-icons": {
"headphone": "",
"hands-free": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", "", ""]
},
},
Expand All @@ -163,9 +139,9 @@ in {
};
environment.etc."waybar/style.css" = {
text =
# Modified from default waybar style file https://github.com/Alexays/Waybar/blob/master/resources/style.css
''
* {
/* `otf-font-awesome` is required to be installed for icons */
font-family: FontAwesome, Roboto, Helvetica, Arial, sans-serif;
font-size: 13px;
}
Expand All @@ -182,15 +158,6 @@ in {
opacity: 0.2;
}
/*
window#waybar.empty {
background-color: transparent;
}
window#waybar.solo {
background-color: #FFFFFF;
}
*/
window#waybar.termite {
background-color: #3F3F3F;
}
Expand All @@ -201,14 +168,11 @@ in {
}
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: 0;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
button:hover {
background: inherit;
box-shadow: inset 0 -3px #ffffff;
Expand All @@ -233,56 +197,40 @@ in {
background-color: #eb4d4b;
}
#mode {
background-color: #64727D;
border-bottom: 3px solid #ffffff;
}
''
+ mkLauncherPaddings config.ghaf.graphics.launchers
+ ''
#clock,
#battery,
#cpu,
#memory,
#disk,
#temperature,
#backlight,
#custom-network1,
#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;
padding-left: 10;
padding-right: 10;
}
#battery {
background-color: #ffffff;
color: #000000;
padding-left: 10;
padding-right: 10;
}
#battery.charging, #battery.plugged {
Expand Down Expand Up @@ -311,73 +259,35 @@ in {
background-color: #000000;
}
#cpu {
background-color: #2ecc71;
color: #000000;
}
#memory {
background-color: #9b59b6;
}
#disk {
background-color: #964B00;
}
#backlight {
background-color: #90b1b1;
padding-left: 10;
padding-right: 10;
}
#custom-network1 {
background-color: #2980b9;
min-width: 16px;
padding-left: 10;
padding-right: 10;
}
#network.disconnected {
#custom-network1.disconnected {
background-color: #f53c3c;
}
#pulseaudio {
background-color: #f1c40f;
color: #000000;
padding-left: 10;
padding-right: 10;
}
#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;
}
Expand All @@ -391,32 +301,6 @@ in {
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;
Expand All @@ -441,13 +325,6 @@ in {
background: rgba(0, 0, 0, 0.2);
}
#scratchpad {
background: rgba(0, 0, 0, 0.2);
}
#scratchpad.empty {
background-color: transparent;
}
''
+ mkLauncherStyles config.ghaf.graphics.launchers;

Expand Down
3 changes: 1 addition & 2 deletions modules/virtualization/microvm/guivm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
pkgs.waypipe
pkgs.networkmanagerapplet
pkgs.nm-launcher
pkgs.wifi-signal-strength
];
};

Expand Down Expand Up @@ -101,7 +100,7 @@
serviceConfig = {
Type = "simple";
Environment = [
"WAYLAND_DISPLAY=\"wayland-1\""
"WAYLAND_DISPLAY=\"wayland-1\"" # Set the display as "wayland-0" to take LabWC in use
"DISPLAY=\":0\""
"XDG_SESSION_TYPE=wayland"
"QT_QPA_PLATFORM=\"wayland\"" # Qt Applications
Expand Down
1 change: 0 additions & 1 deletion overlays/custom-packages/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ _: {
(import ./wifi-connector)
(import ./qemu)
(import ./nm-launcher)
(import ./wifi-signal-strength)
(import ./labwc)
];
}
2 changes: 1 addition & 1 deletion overlays/custom-packages/labwc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
substituteInPlace ../docs/autostart \
--replace swaybg ${final.swaybg}/bin/swaybg \
--replace kanshi ${final.kanshi}/bin/kanshi \
--replace waybar "${final.waybar}/bin/waybar -s /etc/waybar/style.css -c /etc/waybar/config" \
--replace waybar "${final.waybar}/bin/waybar -s /etc/waybar/style.css -c /etc/waybar/config" \
--replace mako ${final.mako}/bin/mako \
--replace swayidle ${final.swayidle}/bin/swayidle
Expand Down
5 changes: 0 additions & 5 deletions overlays/custom-packages/wifi-signal-strength/default.nix

This file was deleted.

Loading

0 comments on commit 0e8fc72

Please sign in to comment.