✨ eww(bar,cc): add a lot of scripts and modify existing
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
sink_="@DEFAULT_AUDIO_SINK@"
|
||||
source_="@DEFAULT_AUDIO_SOURCE@"
|
||||
|
||||
print_json() {
|
||||
echo "{ \"output\": $output_vol, \"source\": $source_vol }"
|
||||
}
|
||||
|
||||
get_vol() {
|
||||
echo $(wpctl get-volume $1 | awk "{print int(\$2*100)}")
|
||||
}
|
||||
|
||||
output_vol=$(get_vol $sink_)
|
||||
source_vol=$(get_vol $source_)
|
||||
|
||||
print_json
|
||||
|
||||
pactl subscribe | grep --line-buffered -e "on sink" -e "on source" | while read -r; do
|
||||
|
||||
output_vol=$(get_vol $sink_)
|
||||
source_vol=$(get_vol $source_)
|
||||
|
||||
print_json
|
||||
done
|
||||
@@ -133,7 +133,8 @@ class PlayerManager:
|
||||
"status": player.props.status.lower(),
|
||||
"title": player.get_title(),
|
||||
"artist": player.get_artist(),
|
||||
"player": player.props.player_name.lower()
|
||||
"player": player.props.player_name.lower(),
|
||||
"artUrl": player.print_metadata_prop("mpris:artUrl")
|
||||
}
|
||||
|
||||
sys.stdout.write(json.dumps(output) + "\n")
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
prev_history=$(dunstctl history)
|
||||
|
||||
while true; do
|
||||
if ! [[ $prev_history == $(dunstctl history) ]]; then
|
||||
prev_history=$(dunstctl history)
|
||||
echo "$(echo $prev_history | jq -c '.data.[]')"
|
||||
fi
|
||||
done
|
||||
@@ -0,0 +1,61 @@
|
||||
# Original Script by vimjoyer, modified by retrozinndev
|
||||
# Licensed under the MIT License, as in vimjoyer's repository and also in retrozinndev's Hyprland Dots.
|
||||
|
||||
import dbus
|
||||
import dbus.service
|
||||
from dbus.mainloop.glib import DBusGMainLoop
|
||||
from gi.repository import GLib
|
||||
import threading
|
||||
import time
|
||||
|
||||
class Notification:
|
||||
def __init__(self, app_name, summary, body, icon):
|
||||
self.app_name = app_name
|
||||
self.summary = summary
|
||||
self.body = body
|
||||
self.icon = icon
|
||||
|
||||
notifications = []
|
||||
|
||||
def remove_notification(notification):
|
||||
time.sleep(10)
|
||||
notifications.remove(notification)
|
||||
reload_output()
|
||||
|
||||
def add_notification(notification):
|
||||
notifications.insert(0, notification)
|
||||
reload_output()
|
||||
timer_thread = threading.Thread(target=remove_notification, args=(notification,))
|
||||
timer_thread.start()
|
||||
|
||||
def reload_output():
|
||||
|
||||
output = ""
|
||||
for notification in notifications:
|
||||
output = "aaaaaaaa"
|
||||
|
||||
output.replace('\n', ' ')
|
||||
print(f"{ output }", flush=True)
|
||||
|
||||
|
||||
class NotificationServer(dbus.service.Object):
|
||||
def __init__(self):
|
||||
bus_name = dbus.service.BusName("org.freedesktop.Notifications", bus=dbus.SessionBus())
|
||||
dbus.service.Object.__init__(self, bus_name, "/org/freedesktop/Notifications")
|
||||
|
||||
@dbus.service.method("org.freedesktop.Notifications", in_signature="susssasa{ss}i", out_signature="u")
|
||||
def Notify(self, app_name, replaces_id, app_icon, summary, body, actions, hints, timeout):
|
||||
add_notification(Notification(app_name, summary, body, app_icon))
|
||||
return 0
|
||||
|
||||
@dbus.service.method("org.freedesktop.Notifications", out_signature="ssss")
|
||||
def GetServerInformation(self):
|
||||
return ("Custom Notification Server", "ExampleNS", "1.0", "1.2")
|
||||
|
||||
|
||||
DBusGMainLoop(set_as_default=True)
|
||||
|
||||
if __name__ == "__main__":
|
||||
server = NotificationServer()
|
||||
mainloop = GLib.MainLoop()
|
||||
mainloop.run()
|
||||
@@ -1,39 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
default_value="5"
|
||||
audio_sink="@DEFAULT_AUDIO_SINK@"
|
||||
current_volume=$(wpctl get-volume $audio_sink)
|
||||
|
||||
|
||||
get_volume() {
|
||||
echo $(wpctl get-volume $audio_sink)
|
||||
}
|
||||
|
||||
get_json_loop() {
|
||||
while true; do
|
||||
if ! [[ $current_volume == get_volume ]]; then
|
||||
echo "{ \"volume\": $(translate_volume $current_volume) }"
|
||||
current_volume=$(get_volume)
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
set_volume() {
|
||||
wpctl set-volume $audio_sink $1
|
||||
}
|
||||
|
||||
translate_volume() {
|
||||
echo "$($1 | sed -e 's/Volume: //' -e 's/^1\./1/' -e 's/^0.//' -e 's/^00/0/')"
|
||||
}
|
||||
|
||||
increase_vol() {
|
||||
if (($(translate_volume $current_volume)+$default_value >= 100)); then
|
||||
set_volume "1.00"
|
||||
else
|
||||
set_volume "$default_value%+"
|
||||
fi
|
||||
}
|
||||
|
||||
decrease_vol() {
|
||||
set_volume "$default_value%-"
|
||||
}
|
||||
Reference in New Issue
Block a user