qs: fix actions of cavabar
This commit is contained in:
@@ -15,6 +15,8 @@ environment {
|
||||
LIBVA_DRIVER_NAME "nvidia"
|
||||
__GLX_VENDOR_LIBRARY_NAME "nvidia"
|
||||
NVD_BACKEND "nvidia"
|
||||
GBM_BACKEND "nvidia-drm";
|
||||
WLR_NO_HARDWARE_CURSORS "1";
|
||||
|
||||
// Fix Swing
|
||||
_JAVA_AWT_WM_NONREPARENTING "1"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"doNotDisturb": false
|
||||
},
|
||||
"primaryColor": "#89b4fa",
|
||||
"showLyricsBar": false,
|
||||
"showLyricsBar": true,
|
||||
"sunsetDefaultEnabled": true,
|
||||
"wifiEnabled": true
|
||||
}
|
||||
|
||||
@@ -3,12 +3,15 @@ import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import qs.Constants
|
||||
import qs.Modules.Bar.Misc
|
||||
import qs.Services
|
||||
import qs.Utils
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property int barWidth: 5
|
||||
property int barSpacing: 3
|
||||
property int mode: 0
|
||||
|
||||
implicitWidth: root.barWidth * CavaBarService.count + root.barSpacing * (CavaBarService.count - 1)
|
||||
implicitHeight: parent.height - 10
|
||||
@@ -22,7 +25,7 @@ Item {
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: CavaBarService.values
|
||||
model: mode == 2 ? Array(CavaBarService.count).fill(0.3) : CavaBarService.values
|
||||
|
||||
Rectangle {
|
||||
width: root.barWidth
|
||||
@@ -49,12 +52,26 @@ Item {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
|
||||
onClicked: (mouse) => {
|
||||
if (mouse.button === Qt.LeftButton)
|
||||
if (mouse.button === Qt.LeftButton) {
|
||||
MusicManager.playPause();
|
||||
else if (mouse.button === Qt.RightButton)
|
||||
} else if (mouse.button === Qt.RightButton) {
|
||||
SettingsService.showLyricsBar = !SettingsService.showLyricsBar;
|
||||
else if (mouse.button === Qt.MiddleButton)
|
||||
CavaBarService.forceEnable = !CavaBarService.forceEnable;
|
||||
} else if (mouse.button === Qt.MiddleButton) {
|
||||
mode = (mode + 1) % 3;
|
||||
if (mode === 0) {
|
||||
Logger.log("CavaBar", "Cava bar mode set to Auto");
|
||||
CavaBarService.forceEnable = false;
|
||||
CavaBarService.forceDisable = false;
|
||||
} else if (mode === 1) {
|
||||
Logger.log("CavaBar", "Cava bar mode set to Always On");
|
||||
CavaBarService.forceEnable = true;
|
||||
CavaBarService.forceDisable = false;
|
||||
} else if (mode === 2) {
|
||||
Logger.log("CavaBar", "Cava bar mode set to Always Off");
|
||||
CavaBarService.forceEnable = false;
|
||||
CavaBarService.forceDisable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
onWheel: function(wheel) {
|
||||
if (wheel.angleDelta.y > 0)
|
||||
|
||||
@@ -7,7 +7,8 @@ Singleton {
|
||||
id: root
|
||||
|
||||
property int count: 6
|
||||
property int forceEnable: 6
|
||||
property bool forceEnable: false
|
||||
property bool forceDisable: false
|
||||
property alias values: cavaProcess.values
|
||||
|
||||
Cava {
|
||||
@@ -15,6 +16,7 @@ Singleton {
|
||||
|
||||
count: root.count
|
||||
forceEnable: root.forceEnable
|
||||
forceDisable: root.forceDisable
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,12 +32,13 @@ Scope {
|
||||
})
|
||||
property var values: Array(count).fill(0)
|
||||
property bool forceEnable: false
|
||||
property bool forceDisable: false
|
||||
|
||||
Process {
|
||||
id: process
|
||||
|
||||
stdinEnabled: true
|
||||
running: root.forceEnable || !MusicManager.isAllPaused()
|
||||
running: !root.forceDisable && (MusicManager.isPlaying || root.forceEnable)
|
||||
command: ["cava", "-p", "/dev/stdin"]
|
||||
onExited: {
|
||||
stdinEnabled = true;
|
||||
|
||||
@@ -14,6 +14,8 @@ import subprocess
|
||||
from pathlib import Path
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
|
||||
MAX_WORKERS = 8
|
||||
|
||||
PALETTES = {
|
||||
"catppuccin-mocha": {
|
||||
"rosewater": "f5e0dc",
|
||||
@@ -45,9 +47,7 @@ SCRIPTS = {
|
||||
"nwg-look": [CONFIG_DIR / "nwg-look" / "apply-color"],
|
||||
"mako": [CONFIG_DIR / "mako" / "apply-color"],
|
||||
"niri": [CONFIG_DIR / "niri" / "apply-color"],
|
||||
"oh-my-posh": [
|
||||
CONFIG_DIR / "fish" / "apply-color-omp"
|
||||
], # borrowing fish's directory
|
||||
"oh-my-posh": [CONFIG_DIR / "fish" / "apply-color-omp"], # borrowing fish's directory
|
||||
"quickshell": [CONFIG_DIR / "quickshell" / "apply-color"],
|
||||
"rofi": [CONFIG_DIR / "rofi" / "apply-color"],
|
||||
"waybar": [CONFIG_DIR / "waybar" / "apply-color"],
|
||||
@@ -57,8 +57,8 @@ SCRIPTS = {
|
||||
],
|
||||
"yazi": [CONFIG_DIR / "yazi" / "apply-color"],
|
||||
}
|
||||
# or simply `find -L ${CONFIG_DIR} -type f -iname 'apply-color*'` to get all available scripts,
|
||||
# but I do need the exact application names anyway, so hardcoding does make some sense
|
||||
# or simply `find [-L] <CONFIG_DIR> -type f -name 'apply-color*'` to get all available scripts,
|
||||
# but I need the exact application names anyway, so hardcoding does make some sense
|
||||
|
||||
|
||||
def hex2rgb(hex_color: str) -> tuple[int, int, int]:
|
||||
@@ -318,7 +318,7 @@ def main():
|
||||
script_args = [palette_name, flavor, palette[flavor]]
|
||||
tasks = []
|
||||
|
||||
with ThreadPoolExecutor(max_workers=8) as executor:
|
||||
with ThreadPoolExecutor(max_workers=MAX_WORKERS) as executor:
|
||||
for app in apps:
|
||||
for script in SCRIPTS[app]:
|
||||
tasks.append(executor.submit(run_script, script, script_args))
|
||||
@@ -329,7 +329,7 @@ def main():
|
||||
"-a",
|
||||
"change-colortheme",
|
||||
"Colortheme Changed",
|
||||
f"Palette: {palette_name}\nFlavor: {flavor}",
|
||||
f"Palette: {palette_name}\nFlavor: {flavor}\nApplied to {len(apps)} apps",
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
Submodule config/wallpaper/Pictures/backgrounds updated: 389750ee97...abde275209
Reference in New Issue
Block a user