Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ __pycache__/

# Emacs auto backup file
*~

dots/.config/quickshell/ii/.agents/
knowledge.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ AbstractWidget {
property int contentHeight: 300
property int horizontalPadding: 200
property int verticalPadding: 200
command: [Quickshell.shellPath("scripts/images/least-busy-region-venv.sh") // Comments to force the formatter to break lines
command: [Quickshell.shellPath("scripts/run-in-venv.sh") // Comments to force the formatter to break lines
, "images/least_busy_region.py" //
, "--screen-width", Math.round(root.scaledScreenWidth) //
, "--screen-height", Math.round(root.scaledScreenHeight) //
, "--width", contentWidth //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import qs
import qs.services
import qs.modules.common
import qs.modules.common.widgets
import qs.modules.common.functions
import QtQuick
import QtQuick.Layouts
import Quickshell
Expand All @@ -18,12 +17,15 @@ Scope {
readonly property MprisPlayer activePlayer: MprisController.activePlayer
readonly property var realPlayers: MprisController.players
readonly property var meaningfulPlayers: filterDuplicatePlayers(realPlayers)
onMeaningfulPlayersChanged: {
if (meaningfulPlayers.length === 0 && GlobalStates.mediaControlsOpen) {
GlobalStates.mediaControlsOpen = false;
}
}
readonly property real osdWidth: Appearance.sizes.osdWidth
readonly property real widgetWidth: Appearance.sizes.mediaControlsWidth
readonly property real widgetHeight: Appearance.sizes.mediaControlsHeight
property real popupRounding: Appearance.rounding.screenRounding - Appearance.sizes.hyprlandGapsOut + 1
property list<real> visualizerPoints: []

function filterDuplicatePlayers(players) {
let filtered = [];
let used = new Set();
Expand Down Expand Up @@ -53,36 +55,13 @@ Scope {
return filtered;
}

Process {
id: cavaProc
running: mediaControlsLoader.active
onRunningChanged: {
if (!cavaProc.running) {
root.visualizerPoints = [];
}
}
command: ["cava", "-p", `${FileUtils.trimFileProtocol(Directories.scriptPath)}/cava/raw_output_config.txt`]
stdout: SplitParser {
onRead: data => {
// Parse `;`-separated values into the visualizerPoints array
let points = data.split(";").map(p => parseFloat(p.trim())).filter(p => !isNaN(p));
root.visualizerPoints = points;
}
}
}

Loader {
id: mediaControlsLoader
active: GlobalStates.mediaControlsOpen
onActiveChanged: {
if (!mediaControlsLoader.active && root.realPlayers.length === 0) {
GlobalStates.mediaControlsOpen = false;
}
}
active: true

sourceComponent: PanelWindow {
id: panelWindow
visible: true
visible: GlobalStates.mediaControlsOpen

exclusionMode: ExclusionMode.Ignore
exclusiveZone: 0
Expand All @@ -108,11 +87,12 @@ Scope {
item: playerColumnLayout
}

Component.onCompleted: {
GlobalFocusGrab.addDismissable(panelWindow);
}
Component.onDestruction: {
GlobalFocusGrab.removeDismissable(panelWindow);
onVisibleChanged: {
if (panelWindow.visible) {
GlobalFocusGrab.addDismissable(panelWindow);
} else {
GlobalFocusGrab.removeDismissable(panelWindow);
}
}
Connections {
target: GlobalFocusGrab
Expand All @@ -133,7 +113,6 @@ Scope {
delegate: PlayerControl {
required property MprisPlayer modelData
player: modelData
visualizerPoints: root.visualizerPoints
implicitWidth: root.widgetWidth
implicitHeight: root.widgetHeight
radius: root.popupRounding
Expand Down Expand Up @@ -192,17 +171,17 @@ Scope {
target: "mediaControls"

function toggle(): void {
mediaControlsLoader.active = !mediaControlsLoader.active;
if (mediaControlsLoader.active)
GlobalStates.mediaControlsOpen = !GlobalStates.mediaControlsOpen;
if (GlobalStates.mediaControlsOpen)
Notifications.timeoutAll();
}

function close(): void {
mediaControlsLoader.active = false;
GlobalStates.mediaControlsOpen = false;
}

function open(): void {
mediaControlsLoader.active = true;
GlobalStates.mediaControlsOpen = true;
Notifications.timeoutAll();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ Item { // Player instance
property string artFilePath: `${artDownloadLocation}/${artFileName}`
property color artDominantColor: ColorUtils.mix((colorQuantizer?.colors[0] ?? Appearance.colors.colPrimary), Appearance.colors.colPrimaryContainer, 0.8) || Appearance.m3colors.m3secondaryContainer
property bool downloaded: false
property list<real> visualizerPoints: []
property real maxVisualizerValue: 1000 // Max value in the data points
property int visualizerSmoothing: 2 // Number of points to average for smoothing
property real radius

property string displayedArtFilePath: root.downloaded ? Qt.resolvedUrl(artFilePath) : ""
Expand Down Expand Up @@ -134,16 +131,6 @@ Item { // Player instance
}
}

WaveVisualizer {
id: visualizerCanvas
anchors.fill: parent
live: root.player?.isPlaying
points: root.visualizerPoints
maxVisualizerValue: root.maxVisualizerValue
smoothing: root.visualizerSmoothing
color: blendedColors.colPrimary
}

RowLayout {
anchors.fill: parent
anchors.margins: 13
Expand Down Expand Up @@ -242,7 +229,7 @@ Item { // Player instance
anchors.fill: parent
active: root.player?.canSeek ?? false
sourceComponent: StyledSlider {
configuration: StyledSlider.Configuration.Wavy
configuration: StyledSlider.Configuration.S
highlightColor: blendedColors.colPrimary
trackColor: blendedColors.colSecondaryContainer
handleColor: blendedColors.colPrimary
Expand All @@ -262,7 +249,7 @@ Item { // Player instance
}
active: !(root.player?.canSeek ?? false)
sourceComponent: StyledProgressBar {
wavy: root.player?.isPlaying
wavy: false
highlightColor: blendedColors.colPrimary
trackColor: blendedColors.colSecondaryContainer
value: root.player?.position / root.player?.length
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ PanelWindow {

Process {
id: imageDetectionProcess
command: ["bash", "-c", `${Directories.scriptPath}/images/find-regions-venv.sh `
+ `--hyprctl `
command: ["bash", "-c", `${Directories.scriptPath}/run-in-venv.sh `
+ `images/find_regions.py --hyprctl `
+ `--image '${StringUtils.shellSingleQuoteEscape(root.screenshotPath)}' `
+ `--max-width ${Math.round(root.screen.width * root.falsePositivePreventionRatio)} `
+ `--max-height ${Math.round(root.screen.height * root.falsePositivePreventionRatio)} `]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Item {
required property string screenshotPath

readonly property string wikiLink: "https://ii.clsty.link/en/ii-qs/02usage/#setting-it-up" // TODO: write a page for this
readonly property string textColorDetectionScriptPath: Quickshell.shellPath("scripts/images/text-color-venv.sh")
readonly property string textColorDetectionScriptPath: Quickshell.shellPath("scripts/run-in-venv.sh") + " images/text_color.py"

property bool loading: true
property var visionParagraphs: []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Rectangle {
property int selectedTab: Persistent.states.sidebar.bottomGroup.tab
property int previousIndex: -1
property bool collapsed: Persistent.states.sidebar.bottomGroup.collapsed
readonly property int collapsedHeight: Math.max(
Appearance.font.pixelSize.larger + 24,
Appearance.font.pixelSize.large + 24
)
property var tabs: [
{
"type": "calendar",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import QtQuick.Layouts

Rectangle {
id: root
clip: true
radius: Appearance.rounding.normal
color: Appearance.colors.colLayer1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,46 @@ Item {
}
}

CenterWidgetGroup {
Layout.alignment: Qt.AlignHCenter
Item {
Layout.fillHeight: true
Layout.fillWidth: true
}
clip: true

BottomWidgetGroup {
Layout.alignment: Qt.AlignHCenter
Layout.fillHeight: false
Layout.fillWidth: true
Layout.preferredHeight: implicitHeight
CenterWidgetGroup {
id: centerGroup
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: bottomGroup.top
anchors.bottomMargin: root.sidebarPadding

opacity: bottomGroup.collapsed ? 1 : 0
visible: opacity > 0

Behavior on opacity {
NumberAnimation {
duration: Appearance.animation.elementMove.duration
easing.type: Appearance.animation.elementMove.type
easing.bezierCurve: Appearance.animation.elementMove.bezierCurve
}
}
}

BottomWidgetGroup {
id: bottomGroup
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
height: bottomGroup.collapsed ? bottomGroup.collapsedHeight : parent.height

Behavior on height {
NumberAnimation {
duration: Appearance.animation.elementMove.duration
easing.type: Appearance.animation.elementMove.type
easing.bezierCurve: Appearance.animation.elementMove.bezierCurve
}
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ Item {
}
}
}
}
}
17 changes: 0 additions & 17 deletions dots/.config/quickshell/ii/scripts/cava/raw_output_config.txt

This file was deleted.

16 changes: 5 additions & 11 deletions dots/.config/quickshell/ii/scripts/colors/applycolor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,12 @@ if [ ! -d "$STATE_DIR"/user/generated ]; then
fi
cd "$CONFIG_DIR" || exit

colornames=''
colorstrings=''
colorlist=()
colorvalues=()

colornames=$(cat $STATE_DIR/user/generated/material_colors.scss | cut -d: -f1)
colorstrings=$(cat $STATE_DIR/user/generated/material_colors.scss | cut -d: -f2 | cut -d ' ' -f2 | cut -d ";" -f1)
IFS=$'\n'
colorlist=($colornames) # Array of color names
colorvalues=($colorstrings) # Array of color values
while IFS=': ' read -r name value; do
colorlist+=("$name")
colorvalues+=("${value%;}")
done < "$STATE_DIR/user/generated/material_colors.scss"

apply_kitty() {
# Check if terminal escape sequence template exists
Expand All @@ -42,9 +38,7 @@ apply_kitty() {
done

# Reload
if ! pgrep -f kitty >/dev/null; then
return
fi
pidof kitty || return
kill -SIGUSR1 $(pidof kitty)
}

Expand Down
Loading