add sway config to tree (etc)

This commit is contained in:
Vladan Popovic 2022-12-27 23:16:55 +01:00
parent e93bcf8baf
commit 394063b9d2
14 changed files with 573 additions and 233 deletions

View file

@ -1,95 +1,90 @@
{
"layer": "top",
"position": "bottom",
"height": 24,
"modules-left": ["sway/workspaces", "idle_inhibitor", "sway/mode"],
"modules-center": ["sway/window"],
"modules-right": [ "pulseaudio", "backlight", "network", "cpu", "memory", "battery#bat0", "battery#bat1",
"tray", "sway/language", "clock" ],
"sway/workspaces": {
"disable-scroll": true,
"all-outputs": true,
"format": "{index} {name}"
"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
},
"sway/mode": {
"format": "{}"
"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": ["🔊"]
},
"sway/language": {
"format": "{}",
"max-length": 50
},
"tray": {
// "icon-size": 21,
"spacing": 10
},
"clock": {
"tooltip-format": "{:%A\n%d %B %Y\n%H:%M}",
"format": "{:%a %d %b %H:%M}",
"format-alt": "{:%H:%M}"
},
"cpu": {
"format": "{usage:2}% "
},
"memory": {
"format": "{}% "
},
"battery#bat0": {
"bat": "BAT0",
"name": "BAT0",
"states": {
"warning": 20,
"critical": 10
},
"format": "{capacity}% {icon}",
"format-icons": ["", "", "", "", ""]
},
"battery#bat1": {
"bat": "BAT1",
"name": "BAT1",
"states": {
"warning": 20,
"critical": 10
},
"format": "{capacity}% {icon}",
"format-icons": ["", "", "", "", ""]
},
"network": {
"interval": 1,
"max-width": 50,
// "interface": "wlp2s0", // (Optional) To force the use of this interface
"format-wifi": "",
"format-ethernet": "{bandwidthUpBits} {bandwidthDownBits} ",
"format-disconnected": "⚠",
"tooltip-format-wifi": " {essid}: {frequency}Mhz ({signalStrength}%)\n{bandwidthUpBits}\n{bandwidthDownBits}",
"tooltip-format-ethernet": " {ifname}: {ipaddr}/{cidr}",
"tooltip-format-disconnected": "⚠ Disconnected"
},
"pulseaudio": {
//"scroll-step": 1,
"format": "{volume}% {icon}",
"format-bluetooth": "{volume}% {icon}",
"format-muted": "",
"format-icons": {
"headphones": "",
"handsfree": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", ""]
},
"on-click": "pavucontrol"
},
"backlight": {
"device": "intel_backlight",
"format": "{percent}% {icon}",
"format-icons": ["", ""]
},
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": "",
"deactivated": ""
}
}
"on-click": "pavucontrol"
},
"cpu": {
"interval": 5,
"tooltip": false,
"format": " {usage}%"
},
"memory": {
"format": " {}%"
},
"custom/layout": {
"exec": "/etc/xdg/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
}
}

View file

@ -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()

View file

@ -1,14 +1,13 @@
* {
border: none;
border-radius: 0;
font-family: Roboto, Helvetica, Arial, sans-serif;
font-size: 13px;
font-family: Consolas, "Material Design Icons";
font-size: 1em;
min-height: 0;
}
window#waybar {
background-color: rgba(43, 48, 59, 0.5);
border-bottom: 3px solid rgba(100, 114, 125, 0.5);
background-color: rgba(11, 11, 11, 0.8);
color: #ffffff;
transition-property: background-color;
transition-duration: .5s;
@ -18,6 +17,20 @@ 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;
@ -27,187 +40,84 @@ window#waybar.solo {
}
*/
window#waybar.termite {
background-color: #3F3F3F;
}
window#waybar.chromium {
background-color: #000000;
border: none;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
#workspaces button {
padding: 0 5px;
background-color: transparent;
color: #ffffff;
border-bottom: 3px solid transparent;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
#workspaces button:hover {
background: rgba(0, 0, 0, 0.2);
box-shadow: inherit;
border-bottom: 3px solid #ffffff;
border-bottom: 2px solid rgba(180, 14, 25, 0.5);
color: #999999;
}
#workspaces button.focused {
background-color: #64727D;
border-bottom: 3px solid #ffffff;
color: #ffffff;
background-color: #333333;
border-bottom: 2px solid #ff9600;
}
#workspaces button.urgent {
background-color: #eb4d4b;
}
#mode {
background-color: #64727D;
border-bottom: 3px solid #ffffff;
}
#clock,
#custom-vpn,
#battery,
#cpu,
#memory,
#temperature,
#backlight,
#network,
#pulseaudio,
#custom-media,
#tray,
#temperature,
#mode,
#idle_inhibitor {
padding: 0 10px;
padding: 0 5px;
margin: 0 4px;
background-color: transparent;
border-bottom: 2px solid #bdbd45;
color: #ffffff;
}
#clock {
padding: 0 10px;
color: #ffffff;
background-color: #64727D;
#temperature {
border-bottom: 2px solid #42a832;
}
#mode {
background-color: #00ff96;
color: #000000;
}
#battery .BAT0 {
margin-left: 9px;
}
#battery .BAT1 {
margin-right: 9px;
#pulseaudio,
#clock,
#tray,
#cpu {
border-bottom: transparent;
}
#battery {
padding: 0 10px;
background-color: #ffffff;
color: #000000;
border-bottom: 2px solid #bff874;
}
#battery.charging {
color: #ffffff;
background-color: #26A65B;
}
@keyframes blink {
to {
background-color: #ffffff;
color: #000000;
}
border-bottom: 2px solid #00ff96;
}
#custom-vpn.down,
#temperature.critical,
#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;
border-bottom: 2px solid #dd2241;
}
label:focus {
background-color: #000000;
}
#cpu {
background-color: #2ecc71;
color: #000000;
}
#memory {
background-color: #9b59b6;
}
#backlight {
background-color: #90b1b1;
}
#network {
background-color: #2980b9;
}
#network.disconnected {
background-color: #f53c3c;
border-bottom: 2px solid #dd2241;
}
#pulseaudio {
background-color: #f1c40f;
color: #000000;
#pulseaudio.bluetooth {
border-bottom: 2px solid #1a8cff;
}
#pulseaudio.muted {
background-color: #90b1b1;
color: #2a5c45;
border-bottom: 2px solid #fff569;
}
#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;
}
#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;
}
#custom-layout {
background-color: #ecf0f1;
color: #2d3436;
min-width: 2em;
}