From 674825df0f105f0294b7686a09e59b8b5132df59 Mon Sep 17 00:00:00 2001 From: Konstantin Koslowski Date: Fri, 7 May 2021 21:36:28 +0200 Subject: [PATCH] sway: replace swaybar/i3status-rs with waybar --- README.md | 3 +- bin/mediaplayer.py | 127 ++++++++++++++++++++++++++++++++++ bin/waybar | 13 ++++ config | 19 +---- i3status.d/7DPQTN2.toml | 63 ----------------- i3status.d/90PKL63.toml | 64 ----------------- i3status.d/annoyance.toml | 53 -------------- i3status.d/material.toml | 66 ------------------ i3status.d/silence.toml | 58 ---------------- i3status.d/theme.toml | 21 ------ waybar.d/7DPQTN2.conf | 142 ++++++++++++++++++++++++++++++++++++++ waybar.d/90PKL63.conf | 142 ++++++++++++++++++++++++++++++++++++++ waybar.d/annoyance.conf | 139 +++++++++++++++++++++++++++++++++++++ waybar.d/silence.conf | 142 ++++++++++++++++++++++++++++++++++++++ waybar.d/style.css | 76 ++++++++++++++++++++ 15 files changed, 783 insertions(+), 345 deletions(-) create mode 100755 bin/mediaplayer.py create mode 100755 bin/waybar delete mode 100644 i3status.d/7DPQTN2.toml delete mode 100644 i3status.d/90PKL63.toml delete mode 100644 i3status.d/annoyance.toml delete mode 100644 i3status.d/material.toml delete mode 100644 i3status.d/silence.toml delete mode 100644 i3status.d/theme.toml create mode 100644 waybar.d/7DPQTN2.conf create mode 100644 waybar.d/90PKL63.conf create mode 100644 waybar.d/annoyance.conf create mode 100644 waybar.d/silence.conf create mode 100644 waybar.d/style.css diff --git a/README.md b/README.md index 8cfd33f..ac53a92 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,7 @@ install required packages ``` -$ sudo pacman -S sway swayidle swaylock i3status-rust grim slurp swappy wl-clipboard wofi fzf imv -$ yay -S persway +$ sudo pacman -S sway swayidle swaylock waybar grim slurp swappy wl-clipboard wofi fzf imv ``` ![screenshot](sway.png) diff --git a/bin/mediaplayer.py b/bin/mediaplayer.py new file mode 100755 index 0000000..cf3df4b --- /dev/null +++ b/bin/mediaplayer.py @@ -0,0 +1,127 @@ +#!/usr/bin/env python3 +import argparse +import logging +import sys +import signal +import gi +import json +gi.require_version('Playerctl', '2.0') +from gi.repository import Playerctl, GLib + +logger = logging.getLogger(__name__) + + +def write_output(text, player): + logger.info('Writing output') + + output = {'text': text, + 'class': 'custom-' + player.props.player_name, + 'alt': player.props.player_name} + + sys.stdout.write(json.dumps(output) + '\n') + sys.stdout.flush() + + +def on_play(player, status, manager): + logger.info('Received new playback status') + on_metadata(player, player.props.metadata, manager) + + +def on_metadata(player, metadata, manager): + logger.info('Received new metadata') + track_info = '' + + if player.props.player_name == 'spotify' and \ + 'mpris:trackid' in metadata.keys() and \ + ':ad:' in player.props.metadata['mpris:trackid']: + track_info = 'AD PLAYING' + elif player.get_artist() != '' and player.get_title() != '': + track_info = '{artist} - {title}'.format(artist=player.get_artist(), + title=player.get_title()) + else: + track_info = player.get_title() + + if player.props.status != 'Playing' and track_info: + track_info = ' ' + track_info + write_output(track_info, player) + + +def on_player_appeared(manager, player, selected_player=None): + if player is not None and (selected_player is None or player.name == selected_player): + init_player(manager, player) + else: + logger.debug("New player appeared, but it's not the selected player, skipping") + + +def on_player_vanished(manager, player): + logger.info('Player has vanished') + sys.stdout.write('\n') + sys.stdout.flush() + + +def init_player(manager, name): + logger.debug('Initialize player: {player}'.format(player=name.name)) + player = Playerctl.Player.new_from_name(name) + player.connect('playback-status', on_play, manager) + player.connect('metadata', on_metadata, manager) + manager.manage_player(player) + on_metadata(player, player.props.metadata, manager) + + +def signal_handler(sig, frame): + logger.debug('Received signal to stop, exiting') + sys.stdout.write('\n') + sys.stdout.flush() + # loop.quit() + sys.exit(0) + + +def parse_arguments(): + parser = argparse.ArgumentParser() + + # Increase verbosity with every occurence of -v + parser.add_argument('-v', '--verbose', action='count', default=0) + + # Define for which player we're listening + parser.add_argument('--player') + + return parser.parse_args() + + +def main(): + arguments = parse_arguments() + + # Initialize logging + logging.basicConfig(stream=sys.stderr, level=logging.DEBUG, + format='%(name)s %(levelname)s %(message)s') + + # Logging is set by default to WARN and higher. + # With every occurrence of -v it's lowered by one + logger.setLevel(max((3 - arguments.verbose) * 10, 0)) + + # Log the sent command line arguments + logger.debug('Arguments received {}'.format(vars(arguments))) + + manager = Playerctl.PlayerManager() + loop = GLib.MainLoop() + + manager.connect('name-appeared', lambda *args: on_player_appeared(*args, arguments.player)) + manager.connect('player-vanished', on_player_vanished) + + signal.signal(signal.SIGINT, signal_handler) + signal.signal(signal.SIGTERM, signal_handler) + + for player in manager.props.player_names: + if arguments.player is not None and arguments.player != player.name: + logger.debug('{player} is not the filtered player, skipping it' + .format(player=player.name) + ) + continue + + init_player(manager, player) + + loop.run() + + +if __name__ == '__main__': + main() diff --git a/bin/waybar b/bin/waybar new file mode 100755 index 0000000..1f5ec79 --- /dev/null +++ b/bin/waybar @@ -0,0 +1,13 @@ +#!/usr/bin/env sh + +CONFIG_DIR=$HOME/.config/sway/waybar.d +CONFIG=$CONFIG_DIR/$(hostname).conf +STYLE=$CONFIG_DIR/style.css + +# Terminate already running bar instances +pkill -SIGUSR2 -x waybar + +if [ $? -ne 0 ]; then + waybar -c $CONFIG -s $STYLE +fi + diff --git a/config b/config index 89b85e7..063cf33 100644 --- a/config +++ b/config @@ -29,7 +29,6 @@ set $font Cascadia Code PL Regular 10 set $menu wofi --show drun --prompt applications set $search_cmd $HOME/.config/sway/bin/sway_search - # # Host Specific # @@ -299,23 +298,7 @@ for_window [class="Signal" window_type="normal"] exec sh -c "sleep 1"; mark c; f # # Status Bar: # -# Read `man 5 sway-bar` for more information about this section. -bar { - position top - gaps 3 5 - status_command i3status-rs $HOME/.config/sway/i3status.d/$(hostname).toml - font $font - colors { - separator #666666 - background #222222 - statusline #dddddd - focused_workspace #0088CC #0088CC #ffffff - active_workspace #333333 #333333 #ffffff - inactive_workspace #333333 #333333 #888888 - urgent_workspace #2f343a #900000 #ffffff - } -} - +exec_always $HOME/.config/sway/bin/waybar # # Autostart # diff --git a/i3status.d/7DPQTN2.toml b/i3status.d/7DPQTN2.toml deleted file mode 100644 index f8893ce..0000000 --- a/i3status.d/7DPQTN2.toml +++ /dev/null @@ -1,63 +0,0 @@ -[theme] -file = "/home/koslowski/.config/sway/i3status.d/theme.toml" - -[icons] -file = "/home/koslowski/.config/sway/i3status.d/material.toml" - -[[block]] -block = "cpu" -interval = 1 -format = "{barchart} {utilization}" - -[[block]] -block = "memory" -format_mem = "{mem_used}/{mem_total}GB ({mem_used_percents})" -format_swap = "{swap_used}MB/{swap_total}MB({swap_used_percents})" -display_type = "memory" -icons = true -clickable = true -interval = 5 -warning_mem = 80 -warning_swap = 80 -critical_mem = 95 -critical_swap = 95 - -[[block]] -block = "networkmanager" -on_click = "termite -t nmtui -e nmtui" -interface_name_exclude = ["br\\-[0-9a-f]{12}", "docker\\d+"] -interface_name_include = [] - -[[block]] -block = "sound" -step_width = 3 -on_click = "$HOME/.config/sway/bin/sway_volume gui" - -[[block]] -block = "bluetooth" -mac = "4C:87:5D:0D:0F:4F" -on_click = "termite -e bluetoothctl" - -[[block]] -block = "music" -player = "Plexamp" -buttons = ["play", "next"] -on_collapsed_click = "Plexamp.AppImage" - -[[block]] -block = "battery" -interval = 10 -format = "{percentage} {time}" - -[[block]] -block = "weather" -format = "{location}: {weather} {temp}, {wind} m/s {direction}" -autolocate = true -service = { name = "openweathermap", api_key = "2a4ce7726b2f1731ec04418e64800e92", city_id = "2950159", units = "metric" } - -[[block]] -block = "time" -format = "%Y/%m/%d %R" -timezone = "Europe/Berlin" -interval = 60 -locale = "de_DE" diff --git a/i3status.d/90PKL63.toml b/i3status.d/90PKL63.toml deleted file mode 100644 index 96cb2cb..0000000 --- a/i3status.d/90PKL63.toml +++ /dev/null @@ -1,64 +0,0 @@ -[theme] -file = "/home/koslowski/.config/sway/i3status.d/theme.toml" - -[icons] -file = "/home/koslowski/.config/sway/i3status.d/material.toml" - -[[block]] -block = "cpu" -interval = 1 -format = "{barchart} {utilization}" - -[[block]] -block = "memory" -format_mem = "{mem_used}/{mem_total}GB ({mem_used_percents})" -format_swap = "{swap_used}MB/{swap_total}MB({swap_used_percents})" -display_type = "memory" -icons = true -clickable = true -interval = 5 -warning_mem = 80 -warning_swap = 80 -critical_mem = 95 -critical_swap = 95 - -[[block]] -block = "networkmanager" -on_click = "termite -t nmtui -e nmtui" -interface_name_exclude = ["br\\-[0-9a-f]{12}", "docker\\d+"] -interface_name_include = [] - -[[block]] -block = "sound" -step_width = 3 -on_click = "$HOME/.config/sway/bin/sway_volume gui" - -[[block]] -block = "bluetooth" -mac = "04:52:C7:C7:C8:DB" -on_click = "termite -e bluetoothctl" - -[[block]] -block = "music" -player = "Plexamp" -buttons = ["play", "next"] -on_collapsed_click = "Plexamp.AppImage" - -[[block]] -block = "battery" -interval = 10 -format = "{percentage} {time}" - -[[block]] -block = "weather" -format = "{location}: {weather} {temp}, {wind} m/s {direction}" -autolocate = true -service = { name = "openweathermap", api_key = "2a4ce7726b2f1731ec04418e64800e92", city_id = "2950159", units = "metric" } - -[[block]] -block = "time" -format = "%Y/%m/%d %R" -timezone = "Europe/Berlin" -interval = 60 -locale = "de_DE" - diff --git a/i3status.d/annoyance.toml b/i3status.d/annoyance.toml deleted file mode 100644 index 1d3229b..0000000 --- a/i3status.d/annoyance.toml +++ /dev/null @@ -1,53 +0,0 @@ -[theme] -file = "/home/konni/.config/sway/i3status.d/theme.toml" - -[icons] -file = "/home/konni/.config/sway/i3status.d/material.toml" - -[[block]] -block = "cpu" -interval = 1 -format = "{barchart} {utilization}" - -[[block]] -block = "memory" -format_mem = "{mem_used}/{mem_total}GB ({mem_used_percents})" -format_swap = "{swap_used}MB/{swap_total}MB({swap_used_percents})" -display_type = "memory" -icons = true -clickable = true -interval = 5 -warning_mem = 80 -warning_swap = 80 -critical_mem = 95 -critical_swap = 95 - -[[block]] -block = "networkmanager" -on_click = "termite -t nmtui -e nmtui" -interface_name_exclude = ["br\\-[0-9a-f]{12}", "docker\\d+"] -interface_name_include = [] - -[[block]] -block = "sound" -step_width = 3 -on_click = "$HOME/.config/sway/bin/sway_volume gui" - -[[block]] -block = "music" -player = "Plexamp" -buttons = ["play", "next"] -on_collapsed_click = "Plexamp.AppImage" - -[[block]] -block = "weather" -format = "{location}: {weather} {temp}, {wind} m/s {direction}" -autolocate = true -service = { name = "openweathermap", api_key = "2a4ce7726b2f1731ec04418e64800e92", city_id = "2950159", units = "metric" } - -[[block]] -block = "time" -format = "%Y/%m/%d %R" -timezone = "Europe/Berlin" -interval = 60 -locale = "de_DE" diff --git a/i3status.d/material.toml b/i3status.d/material.toml deleted file mode 100644 index c0c1fe8..0000000 --- a/i3status.d/material.toml +++ /dev/null @@ -1,66 +0,0 @@ -## Material Design icons by Google -## https://fonts.google.com/icons -bat_charging = "\ue1a3" # battery_charging_full -bat_discharging = "\ue19c" # battery_alert -bat_empty = "\ue19c" # battery_alert -bat_full = "\ue1a4" # battery_full -bat_half = "\ue1a5" # battery_std -bat_quarter = "\ue1a5" -bat_three_quarters = "\ue1a5" -bat_not_available = "\ue1a6" # battery_unknown -bell = "\ue7f4" # notifications -bell-slash = "\ue7f8" # notifications_paused -bluetooth = "\ue1a7" # bluetooth -calendar = "\ue935" # calendar_today -cogs = "\ue8b8" # settings -cpu = "\ue640" # network_check -disk_drive = "\ue1db" # storage -docker = "\ue532" # directions_boat -github = "\ue86f" # code -gpu = "\ue333" # tv -headphones = "\ue60f" # bluetooth_audio -joystick = "\ue30f" # gamepad -keyboard = "\ue312" # keyboard -mail = "\ue0be" # email -memory_mem = "\ue322" # memory -memory_swap = "\ue8d4" # swap_horiz -mouse = "\ue323" # mouse -music = "\ue405" # music_note -music_next = "\ue044" # skip_next -music_pause = "\ue034" # skip_next -music_play = "\ue037" # play_arrow -music_prev = "\ue045" # skip_previous -net_loopback = "LO" -notification = "\ue7f7" # notifications_active -phone = "\ue324" # phone_android -phone_disconnected = "\ue339" # device_unknown -ping = "\ue62a" # system_update -pomodoro = "\U0001f345" -resolution = "\uf152" # crop-square-rounded -tasks = "\ue8f9" -thermometer = "\ue1ff" # device_thermostat -time = "\ue192" # access_time -toggle_off = "\ue836" # radio_button_on -toggle_on = "\ue837" # radio_button_on -update = "\ue8d7" # system_update_alt -uptime = "\ue425" # timer -volume_empty = "\ue04e" # volume_mute -volume_full = "\ue050" # volume_up -volume_half = "\ue04d" # volume_down -volume_muted = "\ue04f" # volume_off -microphone_full = "\ue029" # mic -microphone_half = "\ue029" # mic -microphone_empty = "\ue02a" # mic_none -microphone_muted = "\ue02b" # mic_off -## material -# weather_clouds = "\ue42d" # wb_cloudy -# weather_default = "\ue42d" # wb_cloudy -# weather_sun = "\ue430" # wb_sunny -## awesome5 -weather_clouds = "\uf0c2" -weather_default = "\uf0c2" # Cloud symbol as default -weather_rain = "\uf043" -weather_snow = "\uf2dc" -weather_sun = "\uf185" -weather_thunder = "\uf0e7" -xrandr = "\ue31e" diff --git a/i3status.d/silence.toml b/i3status.d/silence.toml deleted file mode 100644 index 56449a5..0000000 --- a/i3status.d/silence.toml +++ /dev/null @@ -1,58 +0,0 @@ -[theme] -file = "/home/konni/.config/sway/i3status.d/theme.toml" - -[icons] -file = "/home/konni/.config/sway/i3status.d/material.toml" - -[[block]] -block = "cpu" -interval = 1 -format = "{barchart} {utilization}" - -[[block]] -block = "memory" -format_mem = "{mem_used}/{mem_total}GB ({mem_used_percents})" -format_swap = "{swap_used}MB/{swap_total}MB({swap_used_percents})" -display_type = "memory" -icons = true -clickable = true -interval = 5 -warning_mem = 80 -warning_swap = 80 -critical_mem = 95 -critical_swap = 95 - -[[block]] -block = "networkmanager" -on_click = "termite -t nmtui -e nmtui" -interface_name_exclude = ["br\\-[0-9a-f]{12}", "docker\\d+"] -interface_name_include = [] - -[[block]] -block = "sound" -step_width = 3 -on_click = "$HOME/.config/sway/bin/sway_volume gui" - -[[block]] -block = "music" -player = "Plexamp" -buttons = ["play", "next"] -on_collapsed_click = "Plexamp.AppImage" - -[[block]] -block = "battery" -interval = 10 -format = "{percentage} {time}" - -[[block]] -block = "weather" -format = "{location}: {weather} {temp}, {wind} m/s {direction}" -autolocate = true -service = { name = "openweathermap", api_key = "2a4ce7726b2f1731ec04418e64800e92", city_id = "2950159", units = "metric" } - -[[block]] -block = "time" -format = "%Y/%m/%d %R" -timezone = "Europe/Berlin" -interval = 60 -locale = "de_DE" diff --git a/i3status.d/theme.toml b/i3status.d/theme.toml deleted file mode 100644 index f8a378e..0000000 --- a/i3status.d/theme.toml +++ /dev/null @@ -1,21 +0,0 @@ -idle_bg = "#222222" -idle_fg = "#888888" - -info_bg = "#222222" -info_fg = "#888888" - -good_bg = "#222222" -good_fg = "#888888" - -warning_bg = "#222222" -warning_fg = "#888888" - -critical_bg = "#222222" -critical_fg = "#888888" - -separator = "\u2770" -separator_bg = "auto" -separator_fg = "#268bd2" - -alternating_tint_bg = "#000000" -alternating_tint_fg = "#000000" diff --git a/waybar.d/7DPQTN2.conf b/waybar.d/7DPQTN2.conf new file mode 100644 index 0000000..3f1c090 --- /dev/null +++ b/waybar.d/7DPQTN2.conf @@ -0,0 +1,142 @@ +// vi: ft=jsonc +{ + "layer": "top", + "height": 25, + "modules-left": [ + "sway/workspaces" + ], + "modules-center": [ + "sway/window" + ], + "modules-right": [ + "custom/separator", + "pulseaudio", + "custom/media", + "custom/separator", + "network#wl0", + "network#en0", + "network#vpn0", + "custom/separator", + "cpu", + "memory", + "custom/separator", + "backlight", + "custom/separator", + "battery", + "custom/separator", + "clock", + "tray" + ], + "custom/separator": { + "format": "" + }, + "custom/media": { + "format": "{icon} {}", + "return-type": "json", + "max-length": 40, + "format-icons": { + "chromium": " ", + "firefox": " ", + "Plexamp": "", + "default": " " + }, + "escape": true, + "exec": "$HOME/.config/sway/bin/mediaplayer.py 2> /dev/null", + "exec-if": "pgrep plexamp" + }, + "clock": { + "format": "{:%a, %d %b %H:%M}", + "tooltip-format": "{:%Y %B}\n{calendar}" + }, + "cpu": { + "format": " {usage}%", + "states": { + "warning": 70, + "critical": 90 + } + }, + "memory": { + "format": " {}%", + "states": { + "warning": 70, + "critical": 90 + } + }, + "backlight": { + "format": "{icon} {percent}%", + "format-icons": [""] + }, + "battery": { + "bat": "BAT0", + "design-capacity": true, + "states": { + "warning": 30, + "critical": 15 + }, + "format": "{icon} {capacity}%", + "format-charging": " {capacity}%", + "format-icons": ["", "", "", "", ""] + }, + "network#wl0": { + "interval": 2, + "interface": "wl0", + "format": "{ifname}", + "format-wifi": "{ifname} {essid} ({signalStrength}%)", + "format-ethernet": "{ifname}", + "format-linked": "{ifname}", + "format-disconnected": "{ifname} ", + "tooltip-format": "{ifname}\n\t{ipaddr}/{cidr}\n  \t{bandwidthDownBits}\n  \t{bandwidthUpBits}", + "tooltip-format-linked": "{ifname} linked", + "tooltip-format-disconnected": "{ifname} disconnected", + "on-click": "foot -T float nmtui" + }, + "network#en0": { + "interval": 2, + "interface": "en0", + "format": "{ifname}", + "format-wifi": " {essid} ({signalStrength}%)", + "format-ethernet": "{ifname}", + "format-linked": "{ifname}", + "format-disconnected": "{ifname}", + "tooltip-format": "{ifname}\n\t{ipaddr}/{cidr}\n  \t{bandwidthDownBits}\n  \t{bandwidthUpBits}", + "tooltip-format-linked": "{ifname} linked", + "tooltip-format-disconnected": "{ifname} disconnected", + "on-click": "foot -T float nmtui" + }, + "network#vpn0": { + "interval": 2, + "interface": "vpn0", + "format": "{ifname}", + "format-wifi": " {essid} ({signalStrength}%)", + "format-ethernet": "{ifname}", + "format-linked": "{ifname}", + "format-disconnected": " {ifname}", + "tooltip-format": "{ifname}\n\t{ipaddr}/{cidr}\n  \t{bandwidthDownBits}\n  \t{bandwidthUpBits}", + "tooltip-format-linked": "{ifname} linked", + "tooltip-format-disconnected": "{ifname} disconnected", + "on-click": "foot -T float nmtui" + }, + "pulseaudio": { + "format": "{icon} {volume}% {format_source}", + "format-bluetooth": "{icon} {volume}% {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": "pkill -x pavucontrol || pavucontrol" + }, + "tray": { + "padding": 10, + "spacing": 10 + } +} + diff --git a/waybar.d/90PKL63.conf b/waybar.d/90PKL63.conf new file mode 100644 index 0000000..3f1c090 --- /dev/null +++ b/waybar.d/90PKL63.conf @@ -0,0 +1,142 @@ +// vi: ft=jsonc +{ + "layer": "top", + "height": 25, + "modules-left": [ + "sway/workspaces" + ], + "modules-center": [ + "sway/window" + ], + "modules-right": [ + "custom/separator", + "pulseaudio", + "custom/media", + "custom/separator", + "network#wl0", + "network#en0", + "network#vpn0", + "custom/separator", + "cpu", + "memory", + "custom/separator", + "backlight", + "custom/separator", + "battery", + "custom/separator", + "clock", + "tray" + ], + "custom/separator": { + "format": "" + }, + "custom/media": { + "format": "{icon} {}", + "return-type": "json", + "max-length": 40, + "format-icons": { + "chromium": " ", + "firefox": " ", + "Plexamp": "", + "default": " " + }, + "escape": true, + "exec": "$HOME/.config/sway/bin/mediaplayer.py 2> /dev/null", + "exec-if": "pgrep plexamp" + }, + "clock": { + "format": "{:%a, %d %b %H:%M}", + "tooltip-format": "{:%Y %B}\n{calendar}" + }, + "cpu": { + "format": " {usage}%", + "states": { + "warning": 70, + "critical": 90 + } + }, + "memory": { + "format": " {}%", + "states": { + "warning": 70, + "critical": 90 + } + }, + "backlight": { + "format": "{icon} {percent}%", + "format-icons": [""] + }, + "battery": { + "bat": "BAT0", + "design-capacity": true, + "states": { + "warning": 30, + "critical": 15 + }, + "format": "{icon} {capacity}%", + "format-charging": " {capacity}%", + "format-icons": ["", "", "", "", ""] + }, + "network#wl0": { + "interval": 2, + "interface": "wl0", + "format": "{ifname}", + "format-wifi": "{ifname} {essid} ({signalStrength}%)", + "format-ethernet": "{ifname}", + "format-linked": "{ifname}", + "format-disconnected": "{ifname} ", + "tooltip-format": "{ifname}\n\t{ipaddr}/{cidr}\n  \t{bandwidthDownBits}\n  \t{bandwidthUpBits}", + "tooltip-format-linked": "{ifname} linked", + "tooltip-format-disconnected": "{ifname} disconnected", + "on-click": "foot -T float nmtui" + }, + "network#en0": { + "interval": 2, + "interface": "en0", + "format": "{ifname}", + "format-wifi": " {essid} ({signalStrength}%)", + "format-ethernet": "{ifname}", + "format-linked": "{ifname}", + "format-disconnected": "{ifname}", + "tooltip-format": "{ifname}\n\t{ipaddr}/{cidr}\n  \t{bandwidthDownBits}\n  \t{bandwidthUpBits}", + "tooltip-format-linked": "{ifname} linked", + "tooltip-format-disconnected": "{ifname} disconnected", + "on-click": "foot -T float nmtui" + }, + "network#vpn0": { + "interval": 2, + "interface": "vpn0", + "format": "{ifname}", + "format-wifi": " {essid} ({signalStrength}%)", + "format-ethernet": "{ifname}", + "format-linked": "{ifname}", + "format-disconnected": " {ifname}", + "tooltip-format": "{ifname}\n\t{ipaddr}/{cidr}\n  \t{bandwidthDownBits}\n  \t{bandwidthUpBits}", + "tooltip-format-linked": "{ifname} linked", + "tooltip-format-disconnected": "{ifname} disconnected", + "on-click": "foot -T float nmtui" + }, + "pulseaudio": { + "format": "{icon} {volume}% {format_source}", + "format-bluetooth": "{icon} {volume}% {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": "pkill -x pavucontrol || pavucontrol" + }, + "tray": { + "padding": 10, + "spacing": 10 + } +} + diff --git a/waybar.d/annoyance.conf b/waybar.d/annoyance.conf new file mode 100644 index 0000000..7102e29 --- /dev/null +++ b/waybar.d/annoyance.conf @@ -0,0 +1,139 @@ +// vi: ft=jsonc +{ + "layer": "top", + "height": 25, + "modules-left": [ + "sway/workspaces" + ], + "modules-center": [ + "sway/window" + ], + "modules-right": [ + "custom/separator", + "pulseaudio", + "custom/media", + "custom/separator", + "network#en0", + "network#vpn0", + "custom/separator", + "cpu", + "memory", + "custom/separator", + "backlight", + "custom/separator", + "clock", + "tray" + ], + "custom/separator": { + "format": "" + }, + "custom/media": { + "format": "{icon} {}", + "return-type": "json", + "max-length": 40, + "format-icons": { + "chromium": " ", + "firefox": " ", + "Plexamp": "", + "default": " " + }, + "escape": true, + "exec": "$HOME/.config/sway/bin/mediaplayer.py 2> /dev/null", + "exec-if": "pgrep plexamp" + }, + "clock": { + "format": "{:%a, %d %b %H:%M}", + "tooltip-format": "{:%Y %B}\n{calendar}" + }, + "cpu": { + "format": " {usage}%", + "states": { + "warning": 70, + "critical": 90 + } + }, + "memory": { + "format": " {}%", + "states": { + "warning": 70, + "critical": 90 + } + }, + "backlight": { + "format": "{icon} {percent}%", + "format-icons": [""] + }, + "battery": { + "bat": "BAT0", + "design-capacity": true, + "states": { + "warning": 30, + "critical": 15 + }, + "format": "{icon} {capacity}%", + "format-charging": " {capacity}%", + "format-icons": ["", "", "", "", ""] + }, + "network#wl0": { + "interval": 2, + "interface": "wl0", + "format": "{ifname}", + "format-wifi": "{ifname} {essid} ({signalStrength}%)", + "format-ethernet": "{ifname}", + "format-linked": "{ifname}", + "format-disconnected": "{ifname} ", + "tooltip-format": "{ifname}\n\t{ipaddr}/{cidr}\n  \t{bandwidthDownBits}\n  \t{bandwidthUpBits}", + "tooltip-format-linked": "{ifname} linked", + "tooltip-format-disconnected": "{ifname} disconnected", + "on-click": "foot -T float nmtui" + }, + "network#en0": { + "interval": 2, + "interface": "en0", + "format": "{ifname}", + "format-wifi": " {essid} ({signalStrength}%)", + "format-ethernet": "{ifname}", + "format-linked": "{ifname}", + "format-disconnected": "{ifname}", + "tooltip-format": "{ifname}\n\t{ipaddr}/{cidr}\n  \t{bandwidthDownBits}\n  \t{bandwidthUpBits}", + "tooltip-format-linked": "{ifname} linked", + "tooltip-format-disconnected": "{ifname} disconnected", + "on-click": "foot -T float nmtui" + }, + "network#vpn0": { + "interval": 2, + "interface": "vpn0", + "format": "{ifname}", + "format-wifi": " {essid} ({signalStrength}%)", + "format-ethernet": "{ifname}", + "format-linked": "{ifname}", + "format-disconnected": " {ifname}", + "tooltip-format": "{ifname}\n\t{ipaddr}/{cidr}\n  \t{bandwidthDownBits}\n  \t{bandwidthUpBits}", + "tooltip-format-linked": "{ifname} linked", + "tooltip-format-disconnected": "{ifname} disconnected", + "on-click": "foot -T float nmtui" + }, + "pulseaudio": { + "format": "{icon} {volume}% {format_source}", + "format-bluetooth": "{icon} {volume}% {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": "pkill -x pavucontrol || pavucontrol" + }, + "tray": { + "padding": 10, + "spacing": 10 + } +} + diff --git a/waybar.d/silence.conf b/waybar.d/silence.conf new file mode 100644 index 0000000..3f1c090 --- /dev/null +++ b/waybar.d/silence.conf @@ -0,0 +1,142 @@ +// vi: ft=jsonc +{ + "layer": "top", + "height": 25, + "modules-left": [ + "sway/workspaces" + ], + "modules-center": [ + "sway/window" + ], + "modules-right": [ + "custom/separator", + "pulseaudio", + "custom/media", + "custom/separator", + "network#wl0", + "network#en0", + "network#vpn0", + "custom/separator", + "cpu", + "memory", + "custom/separator", + "backlight", + "custom/separator", + "battery", + "custom/separator", + "clock", + "tray" + ], + "custom/separator": { + "format": "" + }, + "custom/media": { + "format": "{icon} {}", + "return-type": "json", + "max-length": 40, + "format-icons": { + "chromium": " ", + "firefox": " ", + "Plexamp": "", + "default": " " + }, + "escape": true, + "exec": "$HOME/.config/sway/bin/mediaplayer.py 2> /dev/null", + "exec-if": "pgrep plexamp" + }, + "clock": { + "format": "{:%a, %d %b %H:%M}", + "tooltip-format": "{:%Y %B}\n{calendar}" + }, + "cpu": { + "format": " {usage}%", + "states": { + "warning": 70, + "critical": 90 + } + }, + "memory": { + "format": " {}%", + "states": { + "warning": 70, + "critical": 90 + } + }, + "backlight": { + "format": "{icon} {percent}%", + "format-icons": [""] + }, + "battery": { + "bat": "BAT0", + "design-capacity": true, + "states": { + "warning": 30, + "critical": 15 + }, + "format": "{icon} {capacity}%", + "format-charging": " {capacity}%", + "format-icons": ["", "", "", "", ""] + }, + "network#wl0": { + "interval": 2, + "interface": "wl0", + "format": "{ifname}", + "format-wifi": "{ifname} {essid} ({signalStrength}%)", + "format-ethernet": "{ifname}", + "format-linked": "{ifname}", + "format-disconnected": "{ifname} ", + "tooltip-format": "{ifname}\n\t{ipaddr}/{cidr}\n  \t{bandwidthDownBits}\n  \t{bandwidthUpBits}", + "tooltip-format-linked": "{ifname} linked", + "tooltip-format-disconnected": "{ifname} disconnected", + "on-click": "foot -T float nmtui" + }, + "network#en0": { + "interval": 2, + "interface": "en0", + "format": "{ifname}", + "format-wifi": " {essid} ({signalStrength}%)", + "format-ethernet": "{ifname}", + "format-linked": "{ifname}", + "format-disconnected": "{ifname}", + "tooltip-format": "{ifname}\n\t{ipaddr}/{cidr}\n  \t{bandwidthDownBits}\n  \t{bandwidthUpBits}", + "tooltip-format-linked": "{ifname} linked", + "tooltip-format-disconnected": "{ifname} disconnected", + "on-click": "foot -T float nmtui" + }, + "network#vpn0": { + "interval": 2, + "interface": "vpn0", + "format": "{ifname}", + "format-wifi": " {essid} ({signalStrength}%)", + "format-ethernet": "{ifname}", + "format-linked": "{ifname}", + "format-disconnected": " {ifname}", + "tooltip-format": "{ifname}\n\t{ipaddr}/{cidr}\n  \t{bandwidthDownBits}\n  \t{bandwidthUpBits}", + "tooltip-format-linked": "{ifname} linked", + "tooltip-format-disconnected": "{ifname} disconnected", + "on-click": "foot -T float nmtui" + }, + "pulseaudio": { + "format": "{icon} {volume}% {format_source}", + "format-bluetooth": "{icon} {volume}% {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": "pkill -x pavucontrol || pavucontrol" + }, + "tray": { + "padding": 10, + "spacing": 10 + } +} + diff --git a/waybar.d/style.css b/waybar.d/style.css new file mode 100644 index 0000000..6d2db53 --- /dev/null +++ b/waybar.d/style.css @@ -0,0 +1,76 @@ +@define-color background rgba(20, 20, 20, 0.8); +@define-color foreground #ebdbb2; +@define-color black #222222; +@define-color yellow #fabd2f; +@define-color red #fb4934; +@define-color green #b8bb26; +@define-color blue #268bd2; + +* { + border: none; + border-radius: 0; + font-family: Input, "Font Awesome 5 Free"; + font-size: 13px; + min-height: 0; +} + +window#waybar { + background: @background; + color: @foreground; + transition-property: background-color; + transition-duration: 0.5s; +} + +#workspaces button { + padding: 0 10px; + background: transparent; + color: @foreground; + border-bottom: 3px solid transparent; +} + +#workspaces button.focused { + color: @blue; + border-bottom: 3px solid @blue; +} + +#workspaces button.urgent { + border-bottom: 3px solid @yellow; +} + +/* normal */ +#backlight, +#battery, +#clock, +#cpu, +#custom-media, +#memory, +#network, +#pulseaudio, +#workspaces { + padding: 0 6px; + margin: 0 6px; +} + +/* good */ +#battery.full { + border-bottom: 3px solid @green; +} + +/* focus */ +#battery.charging { + border-bottom: 3px solid @blue; +} + +/* warning */ +#battery.warning, +#cpu.warning, +#memory.warning { + border-bottom: 3px solid @yellow; +} + +/* critical */ +#battery.critical, +#cpu.critical, +#memory.critical { + border-bottom: 3px solid @red; +}