Skip to content

Instantly share code, notes, and snippets.

@harofax

harofax/config Secret

Created February 18, 2021 19:13
Show Gist options
  • Save harofax/1bb44da1e636f45d5c032c5665a2c18d to your computer and use it in GitHub Desktop.
Save harofax/1bb44da1e636f45d5c032c5665a2c18d to your computer and use it in GitHub Desktop.
waybar/config
// Global
{
"layer": "top",
"position": "top",
// If height property would be not present, it'd be calculated dynamically
//"height": 10,
"modules-left": [
"custom/launcher",
"sway/workspaces",
"sway/mode",
],
"modules-center": [
],
"modules-right": [
"custom/weather",
"network",
"memory",
"cpu",
"pulseaudio",
"custom/keyboard-layout",
"battery",
"backlight",
"clock",
"tray",
"custom/power",
],
// Modules
"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": ["", "", "", "", ""]
},
"clock": {
"interval": 10,
"format-alt": " {:%e %b %Y}", // Icon: calendar-alt
"format": "{:%H:%M}",
"tooltip-format": "{:%e %B %Y}"
},
"cpu": {
"interval": 5,
"format": " {usage}% ({load})", // Icon: microchip
"states": {
"warning": 70,
"critical": 90,
},
"on-click": "alacritty -e 'htop'",
},
"custom/keyboard-layout": {
"exec": "swaymsg -t get_inputs | grep -m1 'xkb_active_layout_name' | cut -d '\"' -f4",
// Interval set only as a fallback, as the value is updated by signal
"interval": 30,
"format": " {}", // Icon: keyboard
// Signal sent by Sway key binding (~/.config/sway/key-bindings)
"signal": 1, // SIGHUP
"tooltip": false,
"on-click": "~/.config/waybar/scripts/keyhint.sh",
},
"memory": {
"interval": 5,
"format": " {}%", // Icon: memory
"on-click": "alacritty -e 'htop'",
"states": {
"warning": 70,
"critical": 90
}
},
"network": {
"interval": 5,
"format-wifi": " {essid} ({signalStrength}%)", // Icon: wifi
"format-ethernet": " {ifname}: {ipaddr}/{cidr}", // Icon: ethernet
"format-disconnected": "⚠ Disconnected",
"tooltip-format": "{ifname}: {ipaddr}",
"on-click": "alacritty -e 'nmtui'",
},
"network#vpn": {
"interface": "tun0",
"format": "嬨 {essid} ({signalStrength}%)",
"format-disconnected": "⚠ Disconnected",
"tooltip-format": "{ifname}: {ipaddr}/{cidr}",
},
"sway/mode": {
"format": "{}",
"tooltip": false
},
"sway/window": {
"format": "{}",
"max-length": 120
},
"sway/workspaces": {
"disable-scroll": true,
"disable-markup" : false,
"all-outputs": true,
"format": " {icon} ",
//"format":"{icon}",
"format-icons": {
"1": "",
"2": "",
"3": "",
"4": "",
}
},
"pulseaudio": {
"scroll-step": 1, // %, can be a float
"format": "{volume}% {icon}",
"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",
"on-scroll-up": "pamixer -ui 2",
"on-scroll-down": "pamixer -ud 2",
},
"custom/weather": {
"exec": "~/.config/waybar/scripts/weather.sh Stockholm",
"format": "{text} {icon}",
"return-type": "json",
"interval": 6,
"tooltip-format": "{tooltip}"
},
"tray": {
"icon-size": 18,
"spacing":10,
},
"backlight": {
"interval": 5,
"format": "{icon} {percent}%",
"format-alt": "{percent}% {icon}",
"format-alt-click": "click-right",
"format-icons": ["🌕", "🌔", "🌓", "🌒", "🌑"],
"on-scroll-down": "brightnessctl -c backlight set +5%",
"on-scroll-up": "brightnessctl -c backlight set 5%-"
},
"custom/firefox": {
"format": " ",
"on-click": "exec qutebrowser",
"tooltip": false
},
"custom/terminal": {
"format": " ",
"on-click": "exec alacritty",
"tooltip": false
},
"custom/files": {
"format": " ",
"on-click": "exec thunar",
"tooltip": false
},
"custom/launcher": {
"format":"🌕 ",
"on-click": "exec wofi -c ~/.config/wofi/config -I",
"tooltip": false,
},
"custom/power": {
"format":"⏻",
"on-click": "exec ~/.config/waybar/scripts/power-menu.sh",
"tooltip": false,
},
}
"wlr/taskbar": {
"format": "{icon}",
"icon-size": 14,
"icon-theme": "Arc-Dark",
"tooltip-format": "{title}",
"on-click": "activate",
"on-click-middle": "close"
}
#!/bin/bash
LOC="$1"
# HTML encode string as %20
LOCATION=$(sed -e "s/ /%20/g" <<<"$LOC")
content=$(curl -sS "https://thisdavej.azurewebsites.net/api/weather/current?loc=$LOCATION&deg=C")
ICON=$(curl -s 'https://wttr.in/?format=1' | sed 's/[+0-9a-cA-Z°-]//g' )
# echo $ICON
TEMP=$(echo $content | jq -r '. | "\(.temperature)°\(.degType)"' | sed 's/"//g')
TOOLTIP=$(echo $content | jq -r '. | "\(.temperature)°\(.degType)\n\(.skytext)"' | sed 's/"//g')
CLASS=$(echo $content | jq .skytext)
echo "{\"text\": \"$TEMP\", \"tooltip\": \"$ICON $TOOLTIP $LOC\", \"class\": \"$CLASS\", \"icon\": \"$ICON\" }"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment