waybar
This commit is contained in:
commit
ecf83288c7
|
@ -0,0 +1,90 @@
|
||||||
|
{
|
||||||
|
"layer": "top", // Waybar at top layer
|
||||||
|
"position": "bottom", // Waybar position (top|bottom|left|right)
|
||||||
|
"height": 30,
|
||||||
|
"modules-left": ["sway/workspaces", "sway/mode", "sway/window"],
|
||||||
|
"modules-center": [],
|
||||||
|
"modules-right": ["temperature", "network", "battery", "pulseaudio", "backlight", "cpu", "memory", "custom/layout", "clock", "tray"],
|
||||||
|
// Module config
|
||||||
|
"sway/mode": {
|
||||||
|
"tooltip": true,
|
||||||
|
"format": "<span weight=\"bold\">{}</span>"
|
||||||
|
},
|
||||||
|
"temperature": {
|
||||||
|
"thermal-zone": 1,
|
||||||
|
"hwmon-path": "/sys/class/hwmon/hwmon2/temp3_input",
|
||||||
|
"critical-threshold": 80,
|
||||||
|
"format-critical": "🌡 {temperatureC}°C",
|
||||||
|
"format": " {temperatureC}°C"
|
||||||
|
},
|
||||||
|
"custom/vpn": {
|
||||||
|
},
|
||||||
|
"network": {
|
||||||
|
"tooltip": false,
|
||||||
|
"interface": "wlp3s0*",
|
||||||
|
"format-wifi": " {essid} ({signalStrength}%)",
|
||||||
|
"format-ethernet": "{ifname}: {ipaddr}/{cidr}",
|
||||||
|
"format-linked": "{ifname} (No IP)",
|
||||||
|
"format-alt": "{ifname}: {ipaddr}",
|
||||||
|
"format-disconnected": "No internet"
|
||||||
|
},
|
||||||
|
"battery": {
|
||||||
|
"tooltip": false,
|
||||||
|
"states": {
|
||||||
|
"good": 95,
|
||||||
|
"warning": 30,
|
||||||
|
"critical": 15
|
||||||
|
},
|
||||||
|
"format": "{icon} {capacity}%",
|
||||||
|
"format-alt": "{time} {icon} {power}",
|
||||||
|
"format-charging": " {capacity}%",
|
||||||
|
"format-icons": ["🪫", "", "🔋"],
|
||||||
|
"format-plugged": " {capacity}%"
|
||||||
|
},
|
||||||
|
"backlight": {
|
||||||
|
"device": "amdgpu_bl0",
|
||||||
|
"format": "{icon} {percent}%",
|
||||||
|
"format-icons": ["", ""]
|
||||||
|
},
|
||||||
|
"pulseaudio": {
|
||||||
|
"tooltip": true,
|
||||||
|
"scroll-step": 1.0,
|
||||||
|
"format": "{icon} {volume}%",
|
||||||
|
"format-bluetooth": " {volume}%",
|
||||||
|
"format-muted": "🔇",
|
||||||
|
"format-source": "{volume}%",
|
||||||
|
"format-source-muted": "🔇",
|
||||||
|
"format-icons": {
|
||||||
|
"headphones": "🎧",
|
||||||
|
"handsfree": "🎧",
|
||||||
|
"headset": "🎧",
|
||||||
|
"phone": "",
|
||||||
|
"portable": "",
|
||||||
|
"car": "",
|
||||||
|
"default": ["🔊"]
|
||||||
|
},
|
||||||
|
"on-click": "pavucontrol"
|
||||||
|
},
|
||||||
|
"cpu": {
|
||||||
|
"interval": 5,
|
||||||
|
"tooltip": false,
|
||||||
|
"format": " {usage}%"
|
||||||
|
},
|
||||||
|
"memory": {
|
||||||
|
"format": " {}%"
|
||||||
|
},
|
||||||
|
"custom/layout": {
|
||||||
|
"exec": "~/.config/waybar/keyboard-layout.py",
|
||||||
|
"return-type": "json",
|
||||||
|
"format": "| <span color='#ef9f33'>{}</span>"
|
||||||
|
},
|
||||||
|
"clock": {
|
||||||
|
"tooltip": false,
|
||||||
|
"format": "| {:%d.%m.%Y %H:%M}"
|
||||||
|
},
|
||||||
|
"tray": {
|
||||||
|
"tooltip": false,
|
||||||
|
"icon-size": 18,
|
||||||
|
"spacing": 5
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
import i3ipc
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
long_to_short = {
|
||||||
|
'English (US)': 'en',
|
||||||
|
'Macedonian': 'mk',
|
||||||
|
}
|
||||||
|
|
||||||
|
def print_status(keyboard):
|
||||||
|
layout = keyboard.xkb_active_layout_name
|
||||||
|
short_code = long_to_short.get(layout, layout)
|
||||||
|
output = {"text": short_code, "tooltip": layout, "class": short_code}
|
||||||
|
print(json.dumps(output), flush=True)
|
||||||
|
|
||||||
|
def find_keyboard(sway):
|
||||||
|
# *the* keyboard is the one with more than one layout
|
||||||
|
for input_dev in sway.get_inputs():
|
||||||
|
if input_dev.type == 'keyboard' and len(input_dev.xkb_layout_names) > 1:
|
||||||
|
return input_dev
|
||||||
|
|
||||||
|
def on_input(sway, event):
|
||||||
|
if event.change == "xkb_layout" and \
|
||||||
|
event.input.identifier == sway.keyboard.identifier:
|
||||||
|
print_status(event.input)
|
||||||
|
|
||||||
|
def main():
|
||||||
|
sway = i3ipc.Connection()
|
||||||
|
sway.keyboard = find_keyboard(sway)
|
||||||
|
print_status(sway.keyboard)
|
||||||
|
|
||||||
|
sway.on(i3ipc.Event.INPUT, on_input)
|
||||||
|
sway.main()
|
||||||
|
|
||||||
|
main()
|
|
@ -0,0 +1,123 @@
|
||||||
|
* {
|
||||||
|
border: none;
|
||||||
|
border-radius: 0;
|
||||||
|
font-family: Consolas, "Material Design Icons";
|
||||||
|
font-size: 1em;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
window#waybar {
|
||||||
|
background-color: rgba(11, 11, 11, 0.8);
|
||||||
|
color: #ffffff;
|
||||||
|
transition-property: background-color;
|
||||||
|
transition-duration: .5s;
|
||||||
|
}
|
||||||
|
|
||||||
|
window#waybar.hidden {
|
||||||
|
opacity: 0.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
#window {
|
||||||
|
padding: 0 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
window {
|
||||||
|
color: rgba(217, 216, 216, 1);
|
||||||
|
background: rgba(35, 31, 32, 0.00);
|
||||||
|
}
|
||||||
|
|
||||||
|
window#waybar.solo {
|
||||||
|
color: rgba(217, 216, 216, 1);
|
||||||
|
background: rgba(35, 31, 32, 0.85);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
window#waybar.empty {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
window#waybar.solo {
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
|
||||||
|
#workspaces button {
|
||||||
|
padding: 0 5px;
|
||||||
|
background-color: transparent;
|
||||||
|
border-bottom: 2px solid rgba(180, 14, 25, 0.5);
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
#workspaces button.focused {
|
||||||
|
color: #ffffff;
|
||||||
|
background-color: #333333;
|
||||||
|
border-bottom: 2px solid #ff9600;
|
||||||
|
}
|
||||||
|
|
||||||
|
#workspaces button.urgent {
|
||||||
|
background-color: #eb4d4b;
|
||||||
|
}
|
||||||
|
|
||||||
|
#clock,
|
||||||
|
#custom-vpn,
|
||||||
|
#battery,
|
||||||
|
#cpu,
|
||||||
|
#memory,
|
||||||
|
#backlight,
|
||||||
|
#network,
|
||||||
|
#pulseaudio,
|
||||||
|
#tray,
|
||||||
|
#temperature,
|
||||||
|
#mode,
|
||||||
|
#idle_inhibitor {
|
||||||
|
padding: 0 5px;
|
||||||
|
margin: 0 4px;
|
||||||
|
background-color: transparent;
|
||||||
|
border-bottom: 2px solid #bdbd45;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
#temperature {
|
||||||
|
border-bottom: 2px solid #42a832;
|
||||||
|
}
|
||||||
|
#mode {
|
||||||
|
background-color: #00ff96;
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#pulseaudio,
|
||||||
|
#clock,
|
||||||
|
#tray,
|
||||||
|
#cpu {
|
||||||
|
border-bottom: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
#battery {
|
||||||
|
border-bottom: 2px solid #bff874;
|
||||||
|
}
|
||||||
|
|
||||||
|
#battery.charging {
|
||||||
|
border-bottom: 2px solid #00ff96;
|
||||||
|
}
|
||||||
|
|
||||||
|
#custom-vpn.down,
|
||||||
|
#temperature.critical,
|
||||||
|
#battery.critical:not(.charging) {
|
||||||
|
border-bottom: 2px solid #dd2241;
|
||||||
|
}
|
||||||
|
|
||||||
|
label:focus {
|
||||||
|
background-color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#network.disconnected {
|
||||||
|
border-bottom: 2px solid #dd2241;
|
||||||
|
}
|
||||||
|
|
||||||
|
#pulseaudio.bluetooth {
|
||||||
|
border-bottom: 2px solid #1a8cff;
|
||||||
|
}
|
||||||
|
|
||||||
|
#pulseaudio.muted {
|
||||||
|
border-bottom: 2px solid #fff569;
|
||||||
|
}
|
Loading…
Reference in New Issue