mirror of
https://github.com/kristoferssolo/solorice.git
synced 2026-02-04 06:32:03 +00:00
Update 2025-07-17
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"layer": "top", // Waybar at top layer
|
||||
/* "position": "bottom", // Waybar position (top|bottom|left|right) */
|
||||
// "position": "bottom", // Waybar position (top|bottom|left|right)
|
||||
"height": 30, // Waybar height (to be removed for auto height)
|
||||
/* "width": 1280, // Waybar width */
|
||||
// "width": 1280, // Waybar width
|
||||
"spacing": 4, // Gaps between modules (4px)
|
||||
// Choose the order of the modules
|
||||
"modules-left": ["wlr/workspaces", "custom/media"],
|
||||
@@ -13,19 +13,19 @@
|
||||
"format": "{icon}",
|
||||
"on-click": "activate",
|
||||
"format-icons": {
|
||||
/* "1": "1", */
|
||||
/* "2": "2", */
|
||||
/* "3": "3", */
|
||||
/* "4": "4", */
|
||||
/* "5": "5", */
|
||||
/* "6": "6", */
|
||||
/* "7": "7", */
|
||||
/* "8": "8", */
|
||||
/* "9": "9", */
|
||||
/* "10": "10", */
|
||||
/* "urgent": "", */
|
||||
/* "active": "", */
|
||||
/* "default": "" */
|
||||
// "1": "1",
|
||||
// "2": "2",
|
||||
// "3": "3",
|
||||
// "4": "4",
|
||||
// "5": "5",
|
||||
// "6": "6",
|
||||
// "7": "7",
|
||||
// "8": "8",
|
||||
// "9": "9",
|
||||
// "10": "10",
|
||||
// "urgent": "",
|
||||
// "active": "",
|
||||
// "default": ""
|
||||
},
|
||||
"sort-by-number": true
|
||||
},
|
||||
@@ -109,8 +109,8 @@
|
||||
},
|
||||
|
||||
"temperature": {
|
||||
/* "thermal-zone": 2, */
|
||||
/* "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input", */
|
||||
// "thermal-zone": 2,
|
||||
// "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input",
|
||||
"critical-threshold": 80,
|
||||
"format-critical": "{temperatureC}°C ",
|
||||
"format": "{temperatureC}°C ",
|
||||
@@ -118,7 +118,7 @@
|
||||
},
|
||||
|
||||
"backlight": {
|
||||
/* "device": "acpi_video1", */
|
||||
// "device": "acpi_video1",
|
||||
"format": "{percent}% {icon}",
|
||||
"format-icons": ["", "", "", "", "", "", "", "", ""],
|
||||
"on-click": "brightnessctl -q set 60%",
|
||||
@@ -137,8 +137,8 @@
|
||||
"format-charging": "{capacity}% ",
|
||||
"format-plugged": "{capacity}% ",
|
||||
"format-alt": "{time} {icon}",
|
||||
/* "format-good": "", // An empty format will hide the module */
|
||||
/* "format-full": "", */
|
||||
// "format-good": "", // An empty format will hide the module
|
||||
// "format-full": "",
|
||||
"format-icons": ["", "", "", "", ""]
|
||||
},
|
||||
|
||||
@@ -181,7 +181,7 @@
|
||||
"custom/media": {
|
||||
"format": "{icon} {}",
|
||||
"return-type": "json",
|
||||
/* "max-length": 40, */
|
||||
// "max-length": 40,
|
||||
"on-click": "playerctl play-pause",
|
||||
"on-click-right": "playerctl stop",
|
||||
"on-scroll-up": "playerctl next",
|
||||
@@ -193,9 +193,10 @@
|
||||
"escape": true,
|
||||
"smooth-scrolling-threshold": 10, // This value was tested using a trackpad, it should be lowered if using a mouse.
|
||||
"exec": "$HOME/.config/waybar/scripts/mediaplayer.py 2> /dev/null" // Script in resources folder
|
||||
/* "exec": "$HOME/.config/waybar/scripts/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name */
|
||||
// "exec": "$HOME/.config/waybar/scripts/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name */
|
||||
},
|
||||
|
||||
|
||||
"custom/weather": {
|
||||
"exec": "curl 'https://wttr.in/?format=1'",
|
||||
"interval": 600,
|
||||
240
config/waybar/config.jsonc
Normal file
240
config/waybar/config.jsonc
Normal file
@@ -0,0 +1,240 @@
|
||||
{
|
||||
"layer": "top", // Waybar at top layer
|
||||
// "position": "bottom", // Waybar position (top|bottom|left|right)
|
||||
// "position": "right",
|
||||
// "position": "left",
|
||||
// "output": "eDP-1",
|
||||
"height": 32, // Waybar height (to be removed for auto height)
|
||||
"margin-top": 4,
|
||||
"margin-left": 4,
|
||||
"margin-right": 4,
|
||||
// "width": 300, // Waybar width
|
||||
"spacing": 0, // Gaps between modules (4px)
|
||||
// Choose the order of the modules
|
||||
"modules-left": [
|
||||
"wlr/taskbar"
|
||||
],
|
||||
"modules-center": [
|
||||
"clock"
|
||||
],
|
||||
"modules-right": [
|
||||
"tray",
|
||||
"network",
|
||||
"cpu",
|
||||
"memory",
|
||||
"pulseaudio",
|
||||
"custom/waybar-media"
|
||||
],
|
||||
// "modules-right": ["cpu", "memory", "battery", "network", "tray"],
|
||||
// Modules configuration
|
||||
// "sway/workspaces": {
|
||||
// "disable-scroll": true,
|
||||
// "all-outputs": true,
|
||||
// "warp-on-scroll": false,
|
||||
// "format": "{name}: {icon}",
|
||||
// "format-icons": {
|
||||
// "1": "",
|
||||
// "2": "",
|
||||
// "3": "",
|
||||
// "4": "",
|
||||
// "5": "",
|
||||
// "urgent": "",
|
||||
// "focused": "",
|
||||
// "default": ""
|
||||
// }
|
||||
// },
|
||||
"custom/logout": {
|
||||
"format": "⏻",
|
||||
"tooltip": false,
|
||||
"on-click": "niri msg action quit"
|
||||
},
|
||||
"wlr/taskbar": {
|
||||
// "all-outputs": true,
|
||||
// "format": "{icon} {title} {short_state}",
|
||||
"format": "{icon}",
|
||||
"tooltip-format": "{title} | {app_id}",
|
||||
"on-click": "activate",
|
||||
"on-click-middle": "close",
|
||||
"on-click-right": "fullscreen"
|
||||
},
|
||||
"keyboard-state": {
|
||||
"numlock": true,
|
||||
"capslock": true,
|
||||
"format": "{name} {icon}",
|
||||
"format-icons": {
|
||||
"locked": "",
|
||||
"unlocked": ""
|
||||
}
|
||||
},
|
||||
"sway/mode": {
|
||||
"format": "<span style=\"italic\">{}</span>"
|
||||
},
|
||||
"sway/scratchpad": {
|
||||
"format": "{icon} {count}",
|
||||
"show-empty": false,
|
||||
"format-icons": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"tooltip": true,
|
||||
"tooltip-format": "{app}: {title}"
|
||||
},
|
||||
"mpd": {
|
||||
"format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ⸨{songPosition}|{queueLength}⸩ {volume}% ",
|
||||
"format-disconnected": "Disconnected ",
|
||||
"format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ",
|
||||
"unknown-tag": "N/A",
|
||||
"interval": 2,
|
||||
"consume-icons": {
|
||||
"on": " "
|
||||
},
|
||||
"random-icons": {
|
||||
"off": "<span color=\"#f53c3c\"></span> ",
|
||||
"on": " "
|
||||
},
|
||||
"repeat-icons": {
|
||||
"on": " "
|
||||
},
|
||||
"single-icons": {
|
||||
"on": "1 "
|
||||
},
|
||||
"state-icons": {
|
||||
"paused": "",
|
||||
"playing": ""
|
||||
},
|
||||
"tooltip-format": "MPD (connected)",
|
||||
"tooltip-format-disconnected": "MPD (disconnected)"
|
||||
},
|
||||
"idle_inhibitor": {
|
||||
"format": "{icon}",
|
||||
"format-icons": {
|
||||
"activated": "",
|
||||
"deactivated": ""
|
||||
}
|
||||
},
|
||||
"tray": {
|
||||
// "icon-size": 21,
|
||||
"spacing": 10
|
||||
},
|
||||
"clock": {
|
||||
"interval": 1,
|
||||
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
|
||||
"format": "{:%d.%m. %H:%M:%S}"
|
||||
},
|
||||
"cpu": {
|
||||
"format": "{usage}% ",
|
||||
"tooltip": false
|
||||
},
|
||||
"memory": {
|
||||
"format": "{}% ",
|
||||
"tooltip-format": "{used:0.1f}G/{total:0.1f}G used"
|
||||
},
|
||||
"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}",
|
||||
"format-icons": [
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
""
|
||||
]
|
||||
},
|
||||
"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": [
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
""
|
||||
]
|
||||
},
|
||||
"battery#bat2": {
|
||||
"bat": "BAT2"
|
||||
},
|
||||
"network": {
|
||||
// "interface": "wlp2*", // (Optional) To force the use of this interface
|
||||
"format-wifi": "",
|
||||
"format-ethernet": "",
|
||||
"tooltip-format": "{ifname} via {gwaddr} ",
|
||||
"format-linked": "",
|
||||
"format-disconnected": "⚠",
|
||||
"format-alt": "{ifname}: {ipaddr}/{cidr}"
|
||||
},
|
||||
"pulseaudio": {
|
||||
// "scroll-step": 1, // %, can be a float
|
||||
"format": "{volume}% {icon}",
|
||||
"format-bluetooth": "{volume}% {icon}",
|
||||
"format-bluetooth-muted": " {icon}",
|
||||
"format-muted": "",
|
||||
"format-source": "{volume}% ",
|
||||
"format-source-muted": "",
|
||||
"format-icons": {
|
||||
"headphone": "",
|
||||
"hands-free": "",
|
||||
"headset": "",
|
||||
"phone": "",
|
||||
"portable": "",
|
||||
"car": "",
|
||||
"default": [
|
||||
"",
|
||||
"",
|
||||
""
|
||||
]
|
||||
},
|
||||
"on-click": "{{terminal}} -e pulsemixer & disown"
|
||||
},
|
||||
"custom/media": {
|
||||
"format": "{icon} {}",
|
||||
"return-type": "json",
|
||||
"max-length": 40,
|
||||
"format-icons": {
|
||||
"spotify": "",
|
||||
"default": "🎜"
|
||||
},
|
||||
"escape": true,
|
||||
"exec": "$HOME/.config/waybar/scripts/mediaplayer.py 2> /dev/null" // Script in resources folder
|
||||
// "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name
|
||||
},
|
||||
"custom/waybar-media": {
|
||||
"return-type": "json",
|
||||
"exec": "waybar-media.py status",
|
||||
"on-click": "waybar-media.py playpause",
|
||||
"on-scroll-up": "waybar-media.py previous",
|
||||
"on-scroll-down": "waybar-media.py next",
|
||||
"escape": true
|
||||
},
|
||||
"custom/gpu-usage": {
|
||||
"exec": "cat /sys/devices/pci0000:00/0000:00:08.1/0000:13:00.0/gpu_busy_percent",
|
||||
"format": "GPU: {}%",
|
||||
"return-type": "",
|
||||
"interval": 1
|
||||
}
|
||||
}
|
||||
@@ -1,130 +1 @@
|
||||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
import logging
|
||||
import sys
|
||||
import signal
|
||||
import json
|
||||
import gi
|
||||
from gi.repository import Playerctl, GLib
|
||||
gi.require_version('Playerctl', '2.0')
|
||||
|
||||
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 occurrence 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)
|
||||
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
|
||||
|
||||
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()
|
||||
|
||||
23
config/waybar/rose-pine-dawn.css
Normal file
23
config/waybar/rose-pine-dawn.css
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Variant: Rosé Pine Dawn
|
||||
* Maintainer: DankChoir
|
||||
*/
|
||||
|
||||
@define-color base #faf4ed;
|
||||
@define-color surface #fffaf3;
|
||||
@define-color overlay #f2e9e1;
|
||||
|
||||
@define-color muted #9893a5;
|
||||
@define-color subtle #797593;
|
||||
@define-color text #575279;
|
||||
|
||||
@define-color love #b4637a;
|
||||
@define-color gold #ea9d34;
|
||||
@define-color rose #d7827e;
|
||||
@define-color pine #286983;
|
||||
@define-color foam #56949f;
|
||||
@define-color iris #907aa9;
|
||||
|
||||
@define-color highlightLow #f4ede8;
|
||||
@define-color highlightMed #dfdad9;
|
||||
@define-color highlightHigh #cecacd;
|
||||
23
config/waybar/rose-pine-moon.css
Normal file
23
config/waybar/rose-pine-moon.css
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Variant: Rosé Pine Moon
|
||||
* Maintainer: DankChoir
|
||||
*/
|
||||
|
||||
@define-color base #232136;
|
||||
@define-color surface #2a273f;
|
||||
@define-color overlay #393552;
|
||||
|
||||
@define-color muted #6e6a86;
|
||||
@define-color subtle #908caa;
|
||||
@define-color text #e0def4;
|
||||
|
||||
@define-color love #eb6f92;
|
||||
@define-color gold #f6c177;
|
||||
@define-color rose #ea9a97;
|
||||
@define-color pine #3e8fb0;
|
||||
@define-color foam #9ccfd8;
|
||||
@define-color iris #c4a7e7;
|
||||
|
||||
@define-color highlightLow #2a283e;
|
||||
@define-color highlightMed #44415a;
|
||||
@define-color highlightHigh #56526e;
|
||||
25
config/waybar/rose-pine.css
Normal file
25
config/waybar/rose-pine.css
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Variant: Rosé Pine
|
||||
* Maintainer: DankChoir
|
||||
*/
|
||||
|
||||
@define-color base #191724;
|
||||
@define-color surface #1f1d2e;
|
||||
@define-color overlay #26233a;
|
||||
|
||||
@define-color muted #6e6a86;
|
||||
@define-color subtle #908caa;
|
||||
@define-color text #e0def4;
|
||||
|
||||
@define-color love #eb6f92;
|
||||
@define-color gold #f6c177;
|
||||
@define-color rose #ebbcba;
|
||||
@define-color pine #31748f;
|
||||
@define-color foam #9ccfd8;
|
||||
@define-color iris #c4a7e7;
|
||||
|
||||
@define-color highlightLow #21202e;
|
||||
@define-color highlightMed #403d52;
|
||||
@define-color highlightHigh #524f67;
|
||||
|
||||
@define-color base-transparent rgba(25, 23, 36, 0.7);
|
||||
100
config/waybar/scripts/mediaplayer.py
Normal file → Executable file
100
config/waybar/scripts/mediaplayer.py
Normal file → Executable file
@@ -1,76 +1,85 @@
|
||||
#!/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
|
||||
import logging
|
||||
import signal
|
||||
import sys
|
||||
|
||||
import gi
|
||||
|
||||
gi.require_version("Playerctl", "2.0")
|
||||
from gi.repository import GLib, Playerctl
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def write_output(text, player):
|
||||
logger.info('Writing output')
|
||||
logger.info("Writing output")
|
||||
|
||||
output = {'text': text,
|
||||
'class': 'custom-' + player.props.player_name,
|
||||
'alt': player.props.player_name}
|
||||
output = {
|
||||
"text": text,
|
||||
"class": "custom-" + player.props.player_name,
|
||||
"alt": player.props.player_name,
|
||||
}
|
||||
|
||||
sys.stdout.write(json.dumps(output) + '\n')
|
||||
sys.stdout.write(json.dumps(output) + "\n")
|
||||
sys.stdout.flush()
|
||||
|
||||
|
||||
def on_play(player, status, manager):
|
||||
logger.info('Received new playback status')
|
||||
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 = ''
|
||||
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())
|
||||
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
|
||||
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):
|
||||
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')
|
||||
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))
|
||||
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)
|
||||
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')
|
||||
logger.debug("Received signal to stop, exiting")
|
||||
sys.stdout.write("\n")
|
||||
sys.stdout.flush()
|
||||
# loop.quit()
|
||||
sys.exit(0)
|
||||
@@ -80,10 +89,10 @@ def parse_arguments():
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
# Increase verbosity with every occurrence of -v
|
||||
parser.add_argument('-v', '--verbose', action='count', default=0)
|
||||
parser.add_argument("-v", "--verbose", action="count", default=0)
|
||||
|
||||
# Define for which player we're listening
|
||||
parser.add_argument('--player')
|
||||
parser.add_argument("--player")
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
@@ -92,21 +101,26 @@ def main():
|
||||
arguments = parse_arguments()
|
||||
|
||||
# Initialize logging
|
||||
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG,
|
||||
format='%(name)s %(levelname)s %(message)s')
|
||||
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)))
|
||||
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)
|
||||
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)
|
||||
@@ -114,9 +128,11 @@ def main():
|
||||
|
||||
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)
|
||||
)
|
||||
logger.debug(
|
||||
"{player} is not the filtered player, skipping it".format(
|
||||
player=player.name
|
||||
)
|
||||
)
|
||||
continue
|
||||
|
||||
init_player(manager, player)
|
||||
@@ -124,5 +140,5 @@ def main():
|
||||
loop.run()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -1,68 +1,88 @@
|
||||
@import "./rose-pine.css";
|
||||
|
||||
* {
|
||||
/* `otf-font-awesome` is required to be installed for icons */
|
||||
font-family:
|
||||
JetBrains Mono NF,
|
||||
FontAwesome,
|
||||
Roboto,
|
||||
Helvetica,
|
||||
Arial,
|
||||
sans-serif;
|
||||
font-size: 13px;
|
||||
color: #c0caf5;
|
||||
/* `otf-font-awesome` is required to be installed for icons */
|
||||
font-family:
|
||||
JetBrains Mono NF Propo,
|
||||
JetBrains Mono NF,
|
||||
FontAwesome,
|
||||
Roboto,
|
||||
Helvetica,
|
||||
Arial,
|
||||
sans-serif;
|
||||
font-size: 14px;
|
||||
/* font-feature-settings: "tnum"; */
|
||||
color: @text;
|
||||
background: @base-transparent;
|
||||
}
|
||||
|
||||
window#waybar {
|
||||
border-top: 3px solid transparent;
|
||||
color: #c0caf5;
|
||||
transition-property: background-color;
|
||||
transition-duration: 0.5s;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
#window {
|
||||
border-radius: 20px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
background: transparent;
|
||||
/* background-color: rgba(30, 30, 46, 0.5); */
|
||||
/* border-bottom: 2px solid rgba(147, 153, 178, 0.5); */
|
||||
/* border: 1px solid rgba(166, 173, 200, 1.0); */
|
||||
color: #ffffff;
|
||||
/* transition-property: background-color; */
|
||||
/* transition-duration: .5s; */
|
||||
}
|
||||
|
||||
window#waybar.hidden {
|
||||
opacity: 0.2;
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
||||
window#waybar.chromium {
|
||||
background-color: #000;
|
||||
border: none;
|
||||
/*
|
||||
window#waybar.empty {
|
||||
background-color: transparent;
|
||||
}
|
||||
window#waybar.solo {
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
*/
|
||||
|
||||
window#waybar.termite {
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
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;
|
||||
/* Use box-shadow instead of border so the text isn't offset */
|
||||
box-shadow: none;
|
||||
/* Avoid rounded borders under each button name */
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
transition-property: none;
|
||||
}
|
||||
|
||||
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
|
||||
button:hover {
|
||||
background: inherit;
|
||||
box-shadow: inset 0 3px #c0caf5;
|
||||
background: none;
|
||||
box-shadow: none;
|
||||
text-shadow: none;
|
||||
border: none;
|
||||
-gtk-icon-effect: none;
|
||||
-gtk-icon-shadow: none;
|
||||
}
|
||||
|
||||
#workspaces button {
|
||||
padding: 0 5px;
|
||||
color: #c0caf5;
|
||||
padding: 0 5px;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
#workspaces button.active {
|
||||
box-shadow: inset 0 3px #c0caf5;
|
||||
#workspaces button:hover {
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
#workspaces button.focused {
|
||||
background-color: #64727d;
|
||||
box-shadow: inset 0 -3px #ffffff;
|
||||
}
|
||||
|
||||
#workspaces button.urgent {
|
||||
background-color: #db4b4b;
|
||||
background-color: #eb4d4b;
|
||||
}
|
||||
|
||||
#mode {
|
||||
border-bottom: 3px solid #c0caf5;
|
||||
background-color: #64727d;
|
||||
border-bottom: 3px solid #ffffff;
|
||||
}
|
||||
|
||||
#clock,
|
||||
@@ -74,84 +94,249 @@ button:hover {
|
||||
#backlight,
|
||||
#network,
|
||||
#pulseaudio,
|
||||
#wireplumber,
|
||||
#custom-media,
|
||||
#tray,
|
||||
#mode,
|
||||
#idle_inhibitor,
|
||||
#scratchpad,
|
||||
#mpd,
|
||||
#custom-wireguard,
|
||||
#custom-github,
|
||||
#custom-dunst {
|
||||
padding: 0 10px;
|
||||
font-weight: bold;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
#custom-pipewire.muted {
|
||||
color: #414868;
|
||||
#mpd {
|
||||
padding: 0 10px;
|
||||
border-radius: 99px;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
#window,
|
||||
#workspaces {
|
||||
margin: 0 4px;
|
||||
margin: 0 4px;
|
||||
}
|
||||
|
||||
/* If workspaces is the leftmost module, omit left margin */
|
||||
.modules-left > widget:first-child > #workspaces {
|
||||
margin-left: 0;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
/* If workspaces is the rightmost module, omit right margin */
|
||||
.modules-right > widget:last-child > #workspaces {
|
||||
margin-right: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
#battery.charging,
|
||||
#battery.plugged {
|
||||
color: #1abc9c;
|
||||
#clock {
|
||||
/* background-color: #64727D; */
|
||||
font-weight: bold;
|
||||
/* background-color: rgba(0, 0, 0, 0.3); */
|
||||
/* border-radius: 99px; */
|
||||
}
|
||||
|
||||
#battery {
|
||||
/* background-color: #f9e2af; */
|
||||
/* color: #000000; */
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
/*
|
||||
#battery.charging, #battery.plugged {
|
||||
color: #ffffff;
|
||||
background-color: #26A65B;
|
||||
}
|
||||
|
||||
@keyframes blink {
|
||||
to {
|
||||
color: #c0caf5;
|
||||
background-color: #ffffff;
|
||||
color: #000000;
|
||||
}
|
||||
}
|
||||
|
||||
#battery.warning:not(.charging) {
|
||||
color: #e0af68;
|
||||
}
|
||||
|
||||
#battery.critical:not(.charging) {
|
||||
color: #db4b4b;
|
||||
background-color: #f53c3c;
|
||||
color: #ffffff;
|
||||
animation-name: blink;
|
||||
animation-duration: 0.5s;
|
||||
animation-timing-function: linear;
|
||||
animation-iteration-count: infinite;
|
||||
animation-direction: alternate;
|
||||
}
|
||||
*/
|
||||
|
||||
label:focus {
|
||||
background-color: #000000;
|
||||
}
|
||||
|
||||
#cpu {
|
||||
/* background-color: #f38ba8; */
|
||||
/* color: #000000; */
|
||||
border-radius: 99px 0px 0px 99px;
|
||||
padding: 0 0 0 10px;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
#memory {
|
||||
/* background-color: #fab387; */
|
||||
/* color: #000000; */
|
||||
border-radius: 0px 99px 99px 0px;
|
||||
/* padding: 0 10px 0 0; */
|
||||
}
|
||||
|
||||
#disk {
|
||||
background-color: #964b00;
|
||||
}
|
||||
|
||||
#backlight {
|
||||
background-color: #90b1b1;
|
||||
}
|
||||
|
||||
#network {
|
||||
/* background-color: #a6e3a1; */
|
||||
/* color: #000000; */
|
||||
}
|
||||
|
||||
/*
|
||||
#network.disconnected {
|
||||
background-color: #f53c3c;
|
||||
}
|
||||
*/
|
||||
|
||||
#taskbar {
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
#taskbar button {
|
||||
color: #f0f0ff;
|
||||
background-color: rgba(30, 30, 46, 0.6);
|
||||
}
|
||||
|
||||
#taskbar button:first-child {
|
||||
border-radius: 99px 0 0 99px;
|
||||
}
|
||||
|
||||
#taskbar button:last-child {
|
||||
border-radius: 0 99px 99px 0;
|
||||
}
|
||||
|
||||
#taskbar button:first-child:last-child {
|
||||
border-radius: 99px;
|
||||
}
|
||||
|
||||
#taskbar button:hover {
|
||||
background-color: rgba(49, 50, 68, 0.6);
|
||||
}
|
||||
|
||||
#taskbar button.active {
|
||||
background-color: rgba(88, 91, 112, 0.6);
|
||||
}
|
||||
|
||||
#taskbar button.active:hover {
|
||||
background-color: rgba(108, 112, 134, 0.6);
|
||||
}
|
||||
|
||||
#pulseaudio {
|
||||
background-color: #f1c40f;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
#pulseaudio.muted {
|
||||
color: #414868;
|
||||
background-color: #90b1b1;
|
||||
color: #2a5c45;
|
||||
}
|
||||
|
||||
#wireplumber {
|
||||
background-color: #fff0f5;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
#wireplumber.muted {
|
||||
background-color: #f53c3c;
|
||||
}
|
||||
|
||||
#custom-media {
|
||||
color: #41a6b5;
|
||||
min-width: 100px;
|
||||
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 {
|
||||
color: #db4b4b;
|
||||
background-color: #eb4d4b;
|
||||
}
|
||||
|
||||
#tray {
|
||||
/* background-color: #2980b9; */
|
||||
}
|
||||
|
||||
#tray > .passive {
|
||||
-gtk-icon-effect: dim;
|
||||
-gtk-icon-effect: dim;
|
||||
}
|
||||
|
||||
#tray > .needs-attention {
|
||||
-gtk-icon-effect: highlight;
|
||||
-gtk-icon-effect: highlight;
|
||||
background-color: #eb4d4b;
|
||||
}
|
||||
|
||||
#network.disconnected {
|
||||
color: #db4b4b;
|
||||
#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;
|
||||
padding: 0 5px;
|
||||
margin: 0 5px;
|
||||
min-width: 16px;
|
||||
}
|
||||
|
||||
#keyboard-state {
|
||||
background: #97e1ad;
|
||||
color: #000000;
|
||||
padding: 0 0px;
|
||||
margin: 0 5px;
|
||||
min-width: 16px;
|
||||
}
|
||||
|
||||
#keyboard-state > label {
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
#keyboard-state > label.locked {
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
#scratchpad {
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
#scratchpad.empty {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
157
config/waybar/style.css.bak
Normal file
157
config/waybar/style.css.bak
Normal file
@@ -0,0 +1,157 @@
|
||||
* {
|
||||
/* `otf-font-awesome` is required to be installed for icons */
|
||||
font-family:
|
||||
JetBrains Mono NF,
|
||||
FontAwesome,
|
||||
Roboto,
|
||||
Helvetica,
|
||||
Arial,
|
||||
sans-serif;
|
||||
font-size: 13px;
|
||||
color: #c0caf5;
|
||||
}
|
||||
|
||||
window#waybar {
|
||||
border-top: 3px solid transparent;
|
||||
color: #c0caf5;
|
||||
transition-property: background-color;
|
||||
transition-duration: 0.5s;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
#window {
|
||||
border-radius: 20px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
window#waybar.hidden {
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
||||
window#waybar.chromium {
|
||||
background-color: #000;
|
||||
border: none;
|
||||
}
|
||||
|
||||
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 #c0caf5;
|
||||
}
|
||||
|
||||
#workspaces button {
|
||||
padding: 0 5px;
|
||||
color: #c0caf5;
|
||||
}
|
||||
|
||||
#workspaces button.active {
|
||||
box-shadow: inset 0 3px #c0caf5;
|
||||
}
|
||||
|
||||
#workspaces button.urgent {
|
||||
background-color: #db4b4b;
|
||||
}
|
||||
|
||||
#mode {
|
||||
border-bottom: 3px solid #c0caf5;
|
||||
}
|
||||
|
||||
#clock,
|
||||
#battery,
|
||||
#cpu,
|
||||
#memory,
|
||||
#disk,
|
||||
#temperature,
|
||||
#backlight,
|
||||
#network,
|
||||
#pulseaudio,
|
||||
#custom-media,
|
||||
#tray,
|
||||
#mode,
|
||||
#idle_inhibitor,
|
||||
#scratchpad,
|
||||
#mpd,
|
||||
#custom-wireguard,
|
||||
#custom-github,
|
||||
#custom-dunst {
|
||||
padding: 0 10px;
|
||||
font-weight: bold;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
#custom-pipewire.muted {
|
||||
color: #414868;
|
||||
}
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
#battery.charging,
|
||||
#battery.plugged {
|
||||
color: #1abc9c;
|
||||
}
|
||||
|
||||
@keyframes blink {
|
||||
to {
|
||||
color: #c0caf5;
|
||||
}
|
||||
}
|
||||
|
||||
#battery.warning:not(.charging) {
|
||||
color: #e0af68;
|
||||
}
|
||||
|
||||
#battery.critical:not(.charging) {
|
||||
color: #db4b4b;
|
||||
animation-name: blink;
|
||||
animation-duration: 0.5s;
|
||||
animation-timing-function: linear;
|
||||
animation-iteration-count: infinite;
|
||||
animation-direction: alternate;
|
||||
}
|
||||
|
||||
#pulseaudio.muted {
|
||||
color: #414868;
|
||||
}
|
||||
|
||||
#custom-media {
|
||||
color: #41a6b5;
|
||||
min-width: 100px;
|
||||
}
|
||||
|
||||
#temperature.critical {
|
||||
color: #db4b4b;
|
||||
}
|
||||
|
||||
#tray>.passive {
|
||||
-gtk-icon-effect: dim;
|
||||
}
|
||||
|
||||
#tray>.needs-attention {
|
||||
-gtk-icon-effect: highlight;
|
||||
}
|
||||
|
||||
#network.disconnected {
|
||||
color: #db4b4b;
|
||||
}
|
||||
Reference in New Issue
Block a user