Compare commits
30
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47562185f1 | ||
|
|
4f49575069 | ||
|
|
8c6662871a | ||
|
|
b2d5c0d5fb | ||
|
|
f1d01cadf8 | ||
|
|
ecf00de898 | ||
|
|
f488f22def | ||
|
|
1bf0f0bfc1 | ||
|
|
504c5ac484 | ||
|
|
bd59a8e457 | ||
|
|
095839c45a | ||
|
|
8352ba5a56 | ||
|
|
f2e8d8a144 | ||
|
|
3cd6807681 | ||
|
|
0b20e8eb85 | ||
|
|
b9a455347d | ||
|
|
5b23111eb3 | ||
|
|
c77020dc69 | ||
|
|
4d2c99df65 | ||
|
|
230537699d | ||
|
|
776d25df0f | ||
|
|
dcd583f1fa | ||
|
|
4b4159371d | ||
|
|
426b96a27e | ||
|
|
9f8d774efd | ||
|
|
896264c062 | ||
|
|
a046c5b3e0 | ||
|
|
c1e1540ab9 | ||
|
|
0a0d8130d0 | ||
|
|
e5e1d34e5c |
@@ -3,3 +3,4 @@ Colors.qml
|
||||
modules/wlogout/scripts/helper.sh
|
||||
config/path/ConfigPath.qml
|
||||
config/path/WallpaperPath.qml
|
||||
modules/notification/assets/notification.ogg
|
||||
@@ -20,8 +20,6 @@ $HOME/Pictures/Wallpapers/
|
||||
- [ImageMagick (resizing & blurring)](https://github.com/ImageMagick/ImageMagick)
|
||||
|
||||
## Other Software:
|
||||
### Logout:
|
||||
- [wlogout](https://github.com/ArtsyMacaw/wlogout)
|
||||
- [nmcli (Recommended for Wifi)](https://github.com/ushiboy/nmcli)
|
||||
|
||||
## TO Enable Sub Programs:
|
||||
@@ -30,9 +28,16 @@ Add the Lines to your ```~/.config/hypr/hyprland.conf``` keep in mind that you m
|
||||
```bind = $mainMod SHIFT, W, global, quickshell:Wallpaper```
|
||||
### JLearner
|
||||
```bind = $mainMod SHIFT, J, global, quickshell:JLearner```
|
||||
### WLogout
|
||||
```bind = $mainMod SHIFT, L, global, quickshell:WLogout```
|
||||
|
||||
# TODO:
|
||||
|
||||
- Volume Contol
|
||||
- Notes
|
||||
- wofi
|
||||
|
||||
### Inspirations
|
||||
- [quickshell-examples](https://github.com/quickshell-mirror/quickshell-examples)
|
||||
- [caelestia-shell](https://github.com/caelestia-dots/shell)
|
||||
- [TheLinuxGuy](https://www.youtube.com/@TheLinuxGuy-btw)
|
||||
@@ -0,0 +1,9 @@
|
||||
Notification
|
||||
AppLauncher (WOFI)
|
||||
Volume (Mic+Speaker)
|
||||
Akku (connected devices mice...)
|
||||
Background/Wallpaper
|
||||
Notes
|
||||
Network (NMCli)
|
||||
reload-popup
|
||||
WIN+Tab (shows Graphically all monitors and workspaces with Icon for app)
|
||||
+13
-3
@@ -1,8 +1,12 @@
|
||||
pragma Singleton
|
||||
import QtQuick 2.15
|
||||
import QtQuick
|
||||
import Quickshell.Hyprland
|
||||
import "./path"
|
||||
|
||||
QtObject {
|
||||
// Not really usable since it is not updating when changed
|
||||
property var focusedMonitor: Hyprland.focusedMonitor
|
||||
|
||||
readonly property string configDir: ConfigPath.path
|
||||
readonly property string wallpaperDir: WallpaperPath.wallpaperDir
|
||||
|
||||
@@ -16,6 +20,11 @@ QtObject {
|
||||
function font_size_small(spaceHeight) { return Math.floor(spaceHeight * 0.625) }
|
||||
function font_size_tiny(spaceHeight) { return Math.floor(spaceHeight * 0.4) }
|
||||
|
||||
function screen_height_to_font_tiny(screenHeight) {return Math.round(9 * screenHeight / 1080)}
|
||||
function screen_height_to_font_small(screenHeight) {return Math.round(12 * screenHeight / 1080)}
|
||||
function screen_height_to_font_medium(screenHeight) {return Math.round(16 * screenHeight / 1080)}
|
||||
function screen_height_to_font_big(screenHeight) {return Math.round(22 * screenHeight / 1080)}
|
||||
|
||||
readonly property int small_radius: 8
|
||||
readonly property int radius: 16
|
||||
function small_radius_fun(barHeight) { return Math.floor(barHeight / 8) }
|
||||
@@ -24,6 +33,7 @@ QtObject {
|
||||
readonly property int border_width: 2
|
||||
|
||||
readonly property string font: "CodeNewRoman Nerd Font"
|
||||
readonly property string jfont: "Noto Sans JP"
|
||||
|
||||
function big_font_size(value) {
|
||||
return value * 0.6
|
||||
@@ -56,8 +66,6 @@ QtObject {
|
||||
readonly property int reload_interval: 10000
|
||||
readonly property int fast_reload_interval: 1000
|
||||
|
||||
|
||||
|
||||
function maxTextWidth(maxNum, texts) {
|
||||
let maxWidth = 0;
|
||||
|
||||
@@ -66,4 +74,6 @@ QtObject {
|
||||
|
||||
return maxWidth;
|
||||
}
|
||||
|
||||
property string debug: "Notification"
|
||||
}
|
||||
@@ -105,6 +105,15 @@ download \
|
||||
"$SCRIPT_DIR/modules/jl/assets/correct.svg" \
|
||||
"correct.svg"
|
||||
|
||||
# ----------------------------
|
||||
# Sounds
|
||||
# ----------------------------
|
||||
|
||||
download \
|
||||
"https://raw.githubusercontent.com/akx/Notifications/master/OGG/Chord.ogg" \
|
||||
"$SCRIPT_DIR/modules/notification/assets/notification.ogg" \
|
||||
"notification.ogg"
|
||||
|
||||
# ----------------------------
|
||||
# Nerd Font
|
||||
# ----------------------------
|
||||
|
||||
+10
-2
@@ -2,6 +2,7 @@ import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
import "./widgets"
|
||||
import "./states/Idle"
|
||||
import "../../config"
|
||||
|
||||
PanelWindow {
|
||||
@@ -25,6 +26,10 @@ PanelWindow {
|
||||
right: 0
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
IdleState.panelWindow = panel
|
||||
}
|
||||
|
||||
Rectangle { // Bar
|
||||
id: bar
|
||||
anchors.fill: parent
|
||||
@@ -68,10 +73,13 @@ PanelWindow {
|
||||
|
||||
// TODO: Add bluetooth, network, audio, power, maybe HW monitor
|
||||
Tray{}
|
||||
NotificationButton {}
|
||||
// AudioSource{}
|
||||
AudioSink{}
|
||||
Battery{}
|
||||
Network {}
|
||||
Network{}
|
||||
IdleButton {}
|
||||
PowerButton {}
|
||||
PowerButton{}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
if [ "$1" = "--status" ]; then
|
||||
if pgrep -x "hypridle" >/dev/null; then
|
||||
echo 1
|
||||
else
|
||||
echo 0
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if pgrep -x "hypridle" >/dev/null; then
|
||||
killall hypridle
|
||||
else
|
||||
hypridle &
|
||||
fi
|
||||
@@ -0,0 +1,36 @@
|
||||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Services.Pipewire
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
PwObjectTracker {
|
||||
objects: [ Pipewire.defaultAudioSink ]
|
||||
}
|
||||
|
||||
property var audioSink: Pipewire.defaultAudioSink
|
||||
|
||||
property bool exists: audioSink != null
|
||||
property bool mute: audioSink?.audio?.muted ?? false
|
||||
property real volume: Math.round((audioSink?.audio?.volume ?? 0) * 1000) / 10
|
||||
|
||||
property bool volumeChanged: false
|
||||
|
||||
Connections {
|
||||
target: audioSink?.audio
|
||||
|
||||
function onVolumeChanged() {
|
||||
root.volumeChanged = true;
|
||||
hideTimer.restart();
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: hideTimer
|
||||
interval: 2000
|
||||
onTriggered: root.volumeChanged = false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Services.Pipewire
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property var audioSource: Pipewire.defaultAudioSource
|
||||
|
||||
property bool exists: audioSource != null && audioSource.ready
|
||||
property bool mute: audioSource?.audio?.muted ?? false
|
||||
property real volume: Math.round((audioSource?.audio?.volume ?? 0) * 1000) / 10
|
||||
|
||||
property bool volumeChanged: false
|
||||
|
||||
PwObjectTracker {
|
||||
objects: [ root.audioSource ]
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: root.audioSource?.audio
|
||||
|
||||
function onVolumeChanged() {
|
||||
root.volumeChanged = true;
|
||||
hideTimer.restart();
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: hideTimer
|
||||
interval: 2000
|
||||
onTriggered: root.volumeChanged = false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
singleton Sink DefaultSinkState.qml
|
||||
singleton Source DefaultSourceState.qml
|
||||
@@ -2,27 +2,32 @@ pragma Singleton
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import Quickshell.Wayland
|
||||
import "../../../../config"
|
||||
|
||||
Item {
|
||||
property int idle: 0
|
||||
// true = inhibit idle (prevent hypridle/lock/dpms), false = allow idle
|
||||
property bool idle: false
|
||||
property bool isIdle: idleMonitor.isIdle
|
||||
|
||||
Process {
|
||||
id: statusScript
|
||||
command: ["sh", "-c", Config.configDir + "/modules/bar/scripts/Idle.sh --status"]
|
||||
running: true
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
idle = this.text.trim() === "0" ? 1 : 0
|
||||
}
|
||||
}
|
||||
property PanelWindow panelWindow: null
|
||||
|
||||
IdleInhibitor {
|
||||
id: idleInhibitor
|
||||
window: panelWindow
|
||||
enabled: IdleState.idle
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 5000
|
||||
running: true
|
||||
repeat: true
|
||||
triggeredOnStart: true
|
||||
onTriggered: statusScript.running = true
|
||||
IdleMonitor {
|
||||
id: idleMonitor
|
||||
enabled: true
|
||||
timeout: 30
|
||||
respectInhibitors: true
|
||||
}
|
||||
|
||||
// may need this in hypridle.conf
|
||||
// general {
|
||||
// ignore_wayland_inhibit = false # Make sure this is false or omitted
|
||||
// ignore_dbus_inhibit=false
|
||||
// }
|
||||
}
|
||||
@@ -15,9 +15,9 @@ QtObject {
|
||||
property string uploadSpeed: ""
|
||||
property string ping: ""
|
||||
|
||||
property var downloadHistory: []
|
||||
property var uploadHistory: []
|
||||
property var pingHistory: []
|
||||
property var downloadHistory: [{time: Date.now() - 60000, value: 0}, {time: Date.now(), value: 0}]
|
||||
property var uploadHistory: [{time: Date.now() - 60000, value: 0}, {time: Date.now(), value: 0}]
|
||||
property var pingHistory: [{time: Date.now() - 60000, value: 0}, {time: Date.now(), value: 0}]
|
||||
property int _maxHistory: 60
|
||||
property bool internetAvailable: Networking.connectivity === NetworkConnectivity.Full
|
||||
property bool vpnConnected: false
|
||||
@@ -34,6 +34,7 @@ QtObject {
|
||||
property real _prevTxBytes: 0
|
||||
property var _prevUpdateTime: 0
|
||||
property string _trafficActiveDevice: ""
|
||||
property string _lastNetworkSignature: ""
|
||||
|
||||
readonly property var networking: Networking
|
||||
|
||||
@@ -53,11 +54,32 @@ QtObject {
|
||||
return ""
|
||||
}
|
||||
|
||||
property var _pendingDevices: []
|
||||
|
||||
function updateAll() {
|
||||
updateNetworks(true)
|
||||
updateStats()
|
||||
}
|
||||
|
||||
function updateNetworks(force) {
|
||||
var connected = findAllConnectedDevices()
|
||||
_pendingDevices = connected
|
||||
|
||||
var sig = ""
|
||||
for (var i = 0; i < connected.length; i++) {
|
||||
var dev = connected[i]
|
||||
sig += dev.name + ":" + dev.type + ":" + dev.connected
|
||||
if (dev.type === DeviceType.Wifi) {
|
||||
var nets = dev.networks.values
|
||||
for (var j = 0; j < nets.length; j++) {
|
||||
if (nets[j].connected) {
|
||||
sig += ":" + nets[j].name
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
sig += ";"
|
||||
}
|
||||
|
||||
if (!force && sig === _lastNetworkSignature) return
|
||||
_lastNetworkSignature = sig
|
||||
|
||||
activeConnections.clear()
|
||||
var hasWifi = false
|
||||
@@ -109,7 +131,6 @@ QtObject {
|
||||
|
||||
if (trafficDev) {
|
||||
_trafficActiveDevice = trafficDev.name
|
||||
trafficScript.running = true
|
||||
}
|
||||
|
||||
root.computeStatus(hasWired, hasWifi, bestWifiSignal)
|
||||
@@ -117,13 +138,27 @@ QtObject {
|
||||
if (connected.length > 0) {
|
||||
ipv4Script.running = true
|
||||
}
|
||||
|
||||
networkDetailScript.running = true
|
||||
}
|
||||
|
||||
function updateStats() {
|
||||
if (!_trafficActiveDevice) return
|
||||
statsScript.running = true
|
||||
}
|
||||
|
||||
property Timer networkTimer: Timer {
|
||||
interval: 10000
|
||||
interval: 5000
|
||||
repeat: true
|
||||
running: true
|
||||
onTriggered: root.updateAll()
|
||||
onTriggered: root.updateNetworks()
|
||||
}
|
||||
|
||||
property Timer statsTimer: Timer {
|
||||
interval: 1000
|
||||
repeat: true
|
||||
running: true
|
||||
onTriggered: root.updateStats()
|
||||
}
|
||||
|
||||
property Process ipv4Script: Process {
|
||||
@@ -161,16 +196,8 @@ QtObject {
|
||||
}
|
||||
}
|
||||
|
||||
property Process trafficScript: Process {
|
||||
property Process networkDetailScript: Process {
|
||||
command: ["sh", "-c",
|
||||
"echo '===TRAFFIC==='; " +
|
||||
"DEV=\"" + root._trafficActiveDevice + "\"; " +
|
||||
"if [ -n \"$DEV\" ]; then " +
|
||||
" echo \"RX_BYTES=$(cat /sys/class/net/$DEV/statistics/rx_bytes 2>/dev/null || echo 0)\"; " +
|
||||
" echo \"TX_BYTES=$(cat /sys/class/net/$DEV/statistics/tx_bytes 2>/dev/null || echo 0)\"; " +
|
||||
"fi; " +
|
||||
"echo '===PING==='; " +
|
||||
"ping -c 1 -W 2 1.1.1.1 2>/dev/null | awk -F/ '/rtt/{print $5}' || echo ''; " +
|
||||
"echo '===VPN_ALL==='; " +
|
||||
"nmcli -t -f NAME,TYPE connection show 2>/dev/null | grep -i vpn || true; " +
|
||||
"echo '===VPN_ACTIVE==='; " +
|
||||
@@ -182,7 +209,117 @@ QtObject {
|
||||
]
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: root.parseOutput(text.trim())
|
||||
onStreamFinished: root.parseNetworkDetails(text.trim())
|
||||
}
|
||||
}
|
||||
|
||||
function parseNetworkDetails(output) {
|
||||
var sections = output.split("===TAILSCALE_IP===")
|
||||
var tailscaleIpSection = sections.length > 1 ? sections[1].trim() : ""
|
||||
|
||||
var beforeTsIp = sections[0]
|
||||
sections = beforeTsIp.split("===TAILSCALE_EXISTS===")
|
||||
var tailscaleExistsSection = sections.length > 1 ? sections[1].trim() : ""
|
||||
|
||||
var beforeTsExist = sections[0]
|
||||
sections = beforeTsExist.split("===VPN_ACTIVE===")
|
||||
var vpnActiveSection = sections.length > 1 ? sections[1].trim() : ""
|
||||
|
||||
var beforeVpnActive = sections[0]
|
||||
sections = beforeVpnActive.split("===VPN_ALL===")
|
||||
var vpnAllSection = sections.length > 1 ? sections[1].trim() : ""
|
||||
|
||||
root.vpnExists = vpnAllSection.length > 0
|
||||
if (vpnActiveSection) {
|
||||
root.vpnConnected = true
|
||||
var vpnLines = vpnActiveSection.split("\n")
|
||||
if (vpnLines.length > 0) {
|
||||
root.vpnName = vpnLines[0].split(":")[0] || ""
|
||||
}
|
||||
} else {
|
||||
root.vpnConnected = false
|
||||
root.vpnName = ""
|
||||
root.vpnIp = ""
|
||||
}
|
||||
|
||||
root.tailscaleExists = tailscaleExistsSection.indexOf("EXISTS") >= 0
|
||||
if (tailscaleIpSection) {
|
||||
root.tailscaleConnected = true
|
||||
root.tailscaleIp = tailscaleIpSection
|
||||
} else {
|
||||
root.tailscaleConnected = false
|
||||
root.tailscaleIp = ""
|
||||
}
|
||||
}
|
||||
|
||||
property Process statsScript: Process {
|
||||
command: ["sh", "-c",
|
||||
"echo '===TRAFFIC==='; " +
|
||||
"DEV=\"" + root._trafficActiveDevice + "\"; " +
|
||||
"if [ -n \"$DEV\" ]; then " +
|
||||
" echo \"RX_BYTES=$(cat /sys/class/net/$DEV/statistics/rx_bytes 2>/dev/null || echo 0)\"; " +
|
||||
" echo \"TX_BYTES=$(cat /sys/class/net/$DEV/statistics/tx_bytes 2>/dev/null || echo 0)\"; " +
|
||||
"fi; " +
|
||||
"echo '===PING==='; " +
|
||||
"ping -c 1 -W 2 1.1.1.1 2>/dev/null | awk -F/ '/rtt/{print $5}' || echo ''"
|
||||
]
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: root.parseStats(text.trim())
|
||||
}
|
||||
}
|
||||
|
||||
function parseStats(output) {
|
||||
var sections = output.split("===PING===")
|
||||
root.ping = sections.length > 1 ? sections[1].trim() : ""
|
||||
|
||||
var pingVal = parseFloat(root.ping)
|
||||
if (!isNaN(pingVal) && pingVal > 0) {
|
||||
var pingHist = root.pingHistory.slice()
|
||||
pingHist.push({time: Date.now(), value: pingVal})
|
||||
if (pingHist.length > root._maxHistory) pingHist.shift()
|
||||
root.pingHistory = pingHist
|
||||
}
|
||||
|
||||
var trafficSection = sections[0].replace("===TRAFFIC===", "").trim()
|
||||
|
||||
if (trafficSection) {
|
||||
var trafficLines = trafficSection.split("\n")
|
||||
var rxBytes = 0
|
||||
var txBytes = 0
|
||||
for (var t = 0; t < trafficLines.length; t++) {
|
||||
var tline = trafficLines[t].trim()
|
||||
if (tline.indexOf("RX_BYTES=") === 0) rxBytes = parseFloat(tline.substring("RX_BYTES=".length))
|
||||
else if (tline.indexOf("TX_BYTES=") === 0) txBytes = parseFloat(tline.substring("TX_BYTES=".length))
|
||||
}
|
||||
|
||||
if (root._prevRxBytes > 0 && root._prevUpdateTime > 0) {
|
||||
var now = Date.now()
|
||||
var interval = (now - root._prevUpdateTime) / 1000
|
||||
if (interval > 0) {
|
||||
var dlBytes = (rxBytes - root._prevRxBytes) / interval
|
||||
var ulBytes = (txBytes - root._prevTxBytes) / interval
|
||||
root.downloadSpeed = root.formatSpeed(dlBytes)
|
||||
root.uploadSpeed = root.formatSpeed(ulBytes)
|
||||
|
||||
var dlHist = root.downloadHistory.slice()
|
||||
dlHist.push({time: now, value: dlBytes})
|
||||
if (dlHist.length > root._maxHistory) dlHist.shift()
|
||||
root.downloadHistory = dlHist
|
||||
|
||||
var ulHist = root.uploadHistory.slice()
|
||||
ulHist.push({time: now, value: ulBytes})
|
||||
if (ulHist.length > root._maxHistory) ulHist.shift()
|
||||
root.uploadHistory = ulHist
|
||||
}
|
||||
} else {
|
||||
root.downloadSpeed = ""
|
||||
root.uploadSpeed = ""
|
||||
}
|
||||
|
||||
root._prevRxBytes = rxBytes
|
||||
root._prevTxBytes = txBytes
|
||||
root._prevUpdateTime = Date.now()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,100 +351,6 @@ QtObject {
|
||||
return bytesPerSec.toFixed(0) + " B/s"
|
||||
}
|
||||
|
||||
function parseOutput(output) {
|
||||
var sections = output.split("===TAILSCALE_IP===")
|
||||
var tailscaleIpSection = sections.length > 1 ? sections[1].trim() : ""
|
||||
|
||||
var beforeTsIp = sections[0]
|
||||
sections = beforeTsIp.split("===TAILSCALE_EXISTS===")
|
||||
var tailscaleExistsSection = sections.length > 1 ? sections[1].trim() : ""
|
||||
|
||||
var beforeTsExist = sections[0]
|
||||
sections = beforeTsExist.split("===VPN_ACTIVE===")
|
||||
var vpnActiveSection = sections.length > 1 ? sections[1].trim() : ""
|
||||
|
||||
var beforeVpnActive = sections[0]
|
||||
sections = beforeVpnActive.split("===VPN_ALL===")
|
||||
var vpnAllSection = sections.length > 1 ? sections[1].trim() : ""
|
||||
|
||||
var beforeVpnAll = sections[0]
|
||||
sections = beforeVpnAll.split("===PING===")
|
||||
root.ping = sections.length > 1 ? sections[1].trim() : ""
|
||||
|
||||
var pingVal = parseFloat(root.ping)
|
||||
if (!isNaN(pingVal) && pingVal > 0) {
|
||||
var pingHist = root.pingHistory.slice()
|
||||
pingHist.push(pingVal)
|
||||
if (pingHist.length > root._maxHistory) pingHist.shift()
|
||||
root.pingHistory = pingHist
|
||||
}
|
||||
|
||||
var beforePing = sections[0]
|
||||
sections = beforePing.split("===TRAFFIC===")
|
||||
var trafficSection = sections.length > 1 ? sections[1].trim() : ""
|
||||
|
||||
if (trafficSection) {
|
||||
var trafficLines = trafficSection.split("\n")
|
||||
var rxBytes = 0
|
||||
var txBytes = 0
|
||||
for (var t = 0; t < trafficLines.length; t++) {
|
||||
var tline = trafficLines[t].trim()
|
||||
if (tline.indexOf("RX_BYTES=") === 0) rxBytes = parseFloat(tline.substring("RX_BYTES=".length))
|
||||
else if (tline.indexOf("TX_BYTES=") === 0) txBytes = parseFloat(tline.substring("TX_BYTES=".length))
|
||||
}
|
||||
|
||||
if (root._prevRxBytes > 0 && root._prevUpdateTime > 0) {
|
||||
var now = Date.now()
|
||||
var interval = (now - root._prevUpdateTime) / 1000
|
||||
if (interval > 0) {
|
||||
var dlBytes = (rxBytes - root._prevRxBytes) / interval
|
||||
var ulBytes = (txBytes - root._prevTxBytes) / interval
|
||||
root.downloadSpeed = root.formatSpeed(dlBytes)
|
||||
root.uploadSpeed = root.formatSpeed(ulBytes)
|
||||
|
||||
var dlHist = root.downloadHistory.slice()
|
||||
dlHist.push(dlBytes)
|
||||
if (dlHist.length > root._maxHistory) dlHist.shift()
|
||||
root.downloadHistory = dlHist
|
||||
|
||||
var ulHist = root.uploadHistory.slice()
|
||||
ulHist.push(ulBytes)
|
||||
if (ulHist.length > root._maxHistory) ulHist.shift()
|
||||
root.uploadHistory = ulHist
|
||||
}
|
||||
} else {
|
||||
root.downloadSpeed = ""
|
||||
root.uploadSpeed = ""
|
||||
}
|
||||
|
||||
root._prevRxBytes = rxBytes
|
||||
root._prevTxBytes = txBytes
|
||||
root._prevUpdateTime = Date.now()
|
||||
}
|
||||
|
||||
root.vpnExists = vpnAllSection.length > 0
|
||||
if (vpnActiveSection) {
|
||||
root.vpnConnected = true
|
||||
var vpnLines = vpnActiveSection.split("\n")
|
||||
if (vpnLines.length > 0) {
|
||||
root.vpnName = vpnLines[0].split(":")[0] || ""
|
||||
}
|
||||
} else {
|
||||
root.vpnConnected = false
|
||||
root.vpnName = ""
|
||||
root.vpnIp = ""
|
||||
}
|
||||
|
||||
root.tailscaleExists = tailscaleExistsSection.indexOf("EXISTS") >= 0
|
||||
if (tailscaleIpSection) {
|
||||
root.tailscaleConnected = true
|
||||
root.tailscaleIp = tailscaleIpSection
|
||||
} else {
|
||||
root.tailscaleConnected = false
|
||||
root.tailscaleIp = ""
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
root.updateAll()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
import QtQuick
|
||||
import "../../../config"
|
||||
import "../states/Audio"
|
||||
import Quickshell.Hyprland
|
||||
|
||||
MouseArea {
|
||||
id: audioButton
|
||||
|
||||
width: Math.max(audioRow.width + Config.spacing_fun(height)*3.5, height)
|
||||
height: bar.height
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
enabled: Sink.exists
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: audioButton.containsMouse ? Colors.tertiary : Qt.alpha(Colors.tertiaryContainer, 0.25)
|
||||
radius: Config.radius_fun(audioButton.height)
|
||||
border.width: Config.border_width
|
||||
border.color: audioButton.containsMouse ? Colors.tertiaryContainer_fg
|
||||
: Colors.secondaryContainer_fg
|
||||
|
||||
Row {
|
||||
id: audioRow
|
||||
width: audioSourceText.width + audioSinkText.width + audioPercentageText.width + Config.spacing_fun(height)*2
|
||||
height: parent.height
|
||||
spacing: Config.spacing_fun(height)/2
|
||||
anchors.centerIn: parent
|
||||
|
||||
Text {
|
||||
id: audioSourceText
|
||||
text: (Source.mute ? "" :
|
||||
"")
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
font.pixelSize: Config.iconSize(bar.height)
|
||||
font.family: Config.font
|
||||
color: audioButton.containsMouse ? Colors.tertiary_fg : Colors.primary
|
||||
rightPadding: Config.spacing_fun(height)*1.5
|
||||
}
|
||||
|
||||
Text {
|
||||
id: audioSinkText
|
||||
text: (Sink.mute ? "" :
|
||||
Sink.volume > 60 ? "" :
|
||||
Sink.volume > 30 ? "" :
|
||||
"")
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
font.pixelSize: Config.iconSize(bar.height)
|
||||
font.family: Config.font
|
||||
color: audioButton.containsMouse ? Colors.tertiary_fg : Colors.primary
|
||||
}
|
||||
|
||||
Text {
|
||||
id: audioPercentageText
|
||||
text: Sink.volume + "%"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
font.pixelSize: Config.iconSize(bar.height)
|
||||
font.family: Config.font
|
||||
color: audioButton.containsMouse ? Colors.tertiary_fg : Colors.primary
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import QtQuick
|
||||
import "../../../config"
|
||||
import "../states/Audio"
|
||||
|
||||
MouseArea {
|
||||
id: audioButton
|
||||
|
||||
width: Math.max(audioText.width + Config.spacing_fun(height)*2, height)
|
||||
height: bar.height
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
enabled: Sink.exists
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: audioButton.containsMouse ? Colors.tertiary : Qt.alpha(Colors.tertiaryContainer, 0.25)
|
||||
radius: Config.radius_fun(audioButton.height)
|
||||
border.width: Config.border_width
|
||||
border.color: audioButton.containsMouse ? Colors.tertiaryContainer_fg
|
||||
: Colors.secondaryContainer_fg
|
||||
|
||||
Text {
|
||||
id: audioText
|
||||
text: (Source.mute ? "" :
|
||||
"")
|
||||
anchors.centerIn: parent
|
||||
font.pixelSize: Config.iconSize(bar.height)
|
||||
font.family: Config.font
|
||||
color: audioButton.containsMouse ? Colors.tertiary_fg : Colors.primary
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,15 +13,13 @@ MouseArea {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
|
||||
onClicked: {
|
||||
var newState = IdleState.idle ? 0 : 1
|
||||
console.log("[IdleButton] Toggling idle: " + (newState ? "enabled" : "disabled"))
|
||||
idleToggleProc.startDetached()
|
||||
IdleState.idle = newState
|
||||
IdleState.idle = !IdleState.idle
|
||||
console.log("[IdleButton] Toggling idle: " + (IdleState.idle ? "enabled" : "disabled"))
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: idleButton.containsMouse ? Colors.tertiary : Qt.alpha(Colors.tertiaryContainer, 0.25)
|
||||
color: idleButton.containsMouse ? Colors.tertiary : IdleState.isIdle ? Qt.alpha(Colors.secondary, 0.25) : Qt.alpha(Colors.tertiaryContainer, 0.25)
|
||||
radius: Config.radius_fun(idleButton.height)
|
||||
border.width: Config.border_width
|
||||
border.color: (
|
||||
@@ -42,10 +40,4 @@ MouseArea {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: idleToggleProc
|
||||
command: ["sh", "-c", Config.configDir + "/modules/bar/scripts/Idle.sh"]
|
||||
running: false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Widgets
|
||||
import Quickshell.Io
|
||||
import "../../notification/notificationServer/"
|
||||
import "../../../config"
|
||||
|
||||
MouseArea {
|
||||
id: notificationButton
|
||||
width: Math.max(bar.height, notificationText.width + Config.spacing)
|
||||
height: bar.height
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
|
||||
onClicked: {
|
||||
NotificationS.soundEnabled = !NotificationS.soundEnabled
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "transparent"
|
||||
radius: Config.radius_fun(notificationButton.height)
|
||||
|
||||
Text {
|
||||
id: notificationText
|
||||
anchors.centerIn: parent
|
||||
// text: Quickshell.iconPath("discord")
|
||||
text: NotificationS.soundEnabled ? "" : ""
|
||||
font.pixelSize: Config.bigIconSize(bar.height)
|
||||
font.family: Config.font
|
||||
color: Colors.secondaryContainer_fg
|
||||
}
|
||||
|
||||
// Image{
|
||||
// id: iconImage
|
||||
// source: Quickshell.iconPath("discord")
|
||||
// width: Config.bigIconSize(notificationButton.height)
|
||||
// height: Config.bigIconSize(notificationButton.height)
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ Item {
|
||||
property var values: []
|
||||
property color lineColor: Colors.primary
|
||||
property color fillColor: Qt.alpha(Colors.primary, 0.15)
|
||||
property int pointCount: 60
|
||||
property real windowMs: 60000
|
||||
property real minWidth: 120
|
||||
property real graphHeight: 30
|
||||
|
||||
@@ -25,26 +25,34 @@ Item {
|
||||
var data = root.values
|
||||
if (!data || data.length < 2) return
|
||||
|
||||
var displayCount = Math.min(data.length, root.pointCount)
|
||||
var startIdx = data.length - displayCount
|
||||
var slice = data.slice(startIdx)
|
||||
var now = Date.now()
|
||||
var windowStart = now - root.windowMs
|
||||
|
||||
var maxVal = 0
|
||||
for (var i = 0; i < slice.length; i++) {
|
||||
if (slice[i] > maxVal) maxVal = slice[i]
|
||||
}
|
||||
if (maxVal === 0) maxVal = 1
|
||||
|
||||
var stepX = width / (slice.length - 1)
|
||||
var padY = 2
|
||||
var drawH = height - padY * 2
|
||||
|
||||
var maxVal = 0
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
if (data[i].time >= windowStart && data[i].value > maxVal)
|
||||
maxVal = data[i].value
|
||||
}
|
||||
if (maxVal === 0) maxVal = 1
|
||||
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(0, height - padY - (slice[0] / maxVal) * drawH)
|
||||
for (var j = 1; j < slice.length; j++) {
|
||||
var x = j * stepX
|
||||
var y = height - padY - (slice[j] / maxVal) * drawH
|
||||
ctx.lineTo(x, y)
|
||||
var started = false
|
||||
for (var j = 0; j < data.length; j++) {
|
||||
var pt = data[j]
|
||||
if (pt.time < windowStart) continue
|
||||
|
||||
var x = ((pt.time - windowStart) / root.windowMs) * width
|
||||
var y = height - padY - (pt.value / maxVal) * drawH
|
||||
|
||||
if (!started) {
|
||||
ctx.moveTo(x, y)
|
||||
started = true
|
||||
} else {
|
||||
ctx.lineTo(x, y)
|
||||
}
|
||||
}
|
||||
ctx.strokeStyle = root.lineColor
|
||||
ctx.lineWidth = 1.5
|
||||
|
||||
@@ -75,12 +75,12 @@ Row { // Workspace Row
|
||||
edges: Edges.Top | Edges.Left
|
||||
gravity: Edges.Bottom | Edges.Right
|
||||
adjustment: PopupAdjustment.FlipX | PopupAdjustment.SlideY
|
||||
onAnchoring: {
|
||||
rect.x = trayArea.clickX
|
||||
rect.y = trayArea.clickY
|
||||
rect.w = 1
|
||||
rect.h = 1
|
||||
}
|
||||
// onAnchoring: {
|
||||
// rect.x = trayArea.clickX
|
||||
// rect.y = trayArea.clickY
|
||||
// rect.w = 1
|
||||
// rect.h = 1
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,8 +69,12 @@ Rectangle {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
console.log("[Workspaces] Switch to workspace: " + workspaceData.id)
|
||||
Hyprland.dispatch("workspace " + workspaceData.id)
|
||||
Hyprland.dispatch("hl.dsp.focus({ workspace = "+workspaceData.id+" })")
|
||||
if (Hyprland.usingLua) {
|
||||
Hyprland.dispatch("hl.dsp.focus({ workspace = "+workspaceData.id+" })")
|
||||
} else {
|
||||
Hyprland.dispatch("workspace " + workspaceData.id)
|
||||
}
|
||||
Hyprland.refreshWorkspaces()
|
||||
}
|
||||
|
||||
Row {
|
||||
|
||||
@@ -94,7 +94,7 @@ PanelWindow {
|
||||
function switchModeChooser() {
|
||||
all_invisible()
|
||||
languageChooser.visible = true
|
||||
languageChooser.start()
|
||||
// languageChooser.start()
|
||||
}
|
||||
|
||||
function switch_KanaVoicing() {
|
||||
|
||||
@@ -7,10 +7,10 @@ import Quickshell.Io
|
||||
Item { // container, invisible
|
||||
id: jLoader
|
||||
|
||||
Loader {
|
||||
LazyLoader {
|
||||
id: jLearnerLoader
|
||||
active: false
|
||||
sourceComponent: JLearner { id: jLearner }
|
||||
JLearner { id: jLearner }
|
||||
}
|
||||
|
||||
GlobalShortcut {
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Services.Notifications
|
||||
import "../../config"
|
||||
import "./notificationServer"
|
||||
|
||||
PanelWindow {
|
||||
// mask: Region {}
|
||||
|
||||
id: notificationWindow
|
||||
|
||||
focusable: true
|
||||
|
||||
anchors.top: true
|
||||
anchors.left: true
|
||||
|
||||
// implicitHeight: screen.height/6
|
||||
implicitHeight: Math.max(contentHeight+(content.spacing*(notificationListModel.count-1)), 0)
|
||||
implicitWidth: contentWidth
|
||||
|
||||
|
||||
color: "transparent"
|
||||
|
||||
ListModel {
|
||||
id: notificationListModel
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: NotificationS
|
||||
|
||||
function onNotificationReceived(notification) {
|
||||
if (!NotificationS.correctMonitor(screen))
|
||||
return
|
||||
if (NotificationS.correctMonitor(screen)) {
|
||||
Config.debug == "Notification" && console.log("[NotificationWindow " + Hyprland.monitorFor(screen).activeWorkspace.id + "]: This notification belongs to me! ")
|
||||
notificationListModel.append({notificationData: notification})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
|
||||
border.width: Config.border_width
|
||||
border.color: Colors.primary
|
||||
color: "transparent"
|
||||
|
||||
Column {
|
||||
id: content
|
||||
anchors.fill: parent
|
||||
spacing: -2
|
||||
|
||||
Repeater {
|
||||
id: notificationRepeater
|
||||
model: notificationListModel
|
||||
|
||||
delegate: NotificationBody {
|
||||
required property int index
|
||||
required property var notificationData
|
||||
screen: notificationWindow.screen
|
||||
|
||||
notification: notificationData
|
||||
|
||||
onDismissed: function(notification, dismiss) {
|
||||
const appName = notification.appName
|
||||
const id = notification.id
|
||||
const summary = notification.summary
|
||||
if (dismiss) {
|
||||
Config.debug == "Notification" && console.log("[NotificationWindow " + Hyprland.monitorFor(screen).activeWorkspace.id + "]: Dissmiss: " + appName + " " + id + " - " + summary)
|
||||
if (notification.tracked) {notification.dismiss()}
|
||||
notificationListModel.remove(index)
|
||||
} else {
|
||||
Config.debug == "Notification" && console.log("[NotificationWindow " + Hyprland.monitorFor(screen).activeWorkspace.id + "]: Close: " + appName + " " + id + " - " + summary)
|
||||
notificationListModel.remove(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
onItemAdded: updateContentSize()
|
||||
onItemRemoved: updateContentSize()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
property real contentWidth: 0
|
||||
property real contentHeight: 0
|
||||
|
||||
function updateContentSize() {
|
||||
let width = 0
|
||||
let height = 0
|
||||
|
||||
for (let i = 0; i < notificationRepeater.count; ++i) {
|
||||
let item = notificationRepeater.itemAt(i)
|
||||
|
||||
if (item) {
|
||||
width = Math.max(width, item.width)
|
||||
height += item.height
|
||||
}
|
||||
}
|
||||
|
||||
contentWidth = width
|
||||
contentHeight = height
|
||||
Config.debug == "Notification" && console.log("[updateContentSize] contentWidth:", contentWidth, "contentHeight:", contentHeight)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,399 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import "../../config"
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
//TODO: urgency, expireTimeoutText, ...
|
||||
|
||||
required property var notification
|
||||
required property var screen
|
||||
property var urgency: (notification.urgency ?? notification.hints["urgency"]) != null ? (notification.urgency ?? notification.hints["urgency"]) + 1 : 0
|
||||
|
||||
property bool closing: false
|
||||
|
||||
property real duration: (
|
||||
notification.expireTimeout > 0 ? notification.expireTimeout*1000 :
|
||||
urgency ? urgency * 2000 :
|
||||
5000
|
||||
)
|
||||
|
||||
signal dismissed(var notification, bool dismiss)
|
||||
|
||||
implicitWidth: screen.width/7
|
||||
// implicitHeight: screen.height/7
|
||||
implicitHeight: contentRowRectangle.height+(actionRowRectangle.visible?actionRowRectangle.height:0)+(inlineReplyRectangle.visible?inlineReplyRectangle.height:0)+(progressBar.visible?progressBar.height:0)
|
||||
|
||||
color: textBGColor
|
||||
border.width: Config.border_width
|
||||
border.color: textColor
|
||||
|
||||
property string textColor: urgency != 3 ? Colors.primary : Colors.tertiary
|
||||
property string textBGColor: urgency != 3 ? Qt.alpha(Colors.primaryContainer, 0.75) : Qt.alpha(Colors.tertiaryContainer, 0.75)
|
||||
|
||||
function closeNotification(dismiss){
|
||||
if (closing) {
|
||||
return
|
||||
}
|
||||
closing = true
|
||||
root.dismissed(root.notification, dismiss)
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: root.notification
|
||||
function onClosed(reason){
|
||||
// It is known that it can be triggered twice and delete multiple Index but since it is only temporary display and the chance is low it is ignored
|
||||
root.closeNotification(false)
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
root.closeNotification(false)
|
||||
}
|
||||
}
|
||||
Column {
|
||||
id: contentColumn
|
||||
anchors.fill: parent
|
||||
spacing: 0
|
||||
// spacing: Config.spacing
|
||||
Rectangle{
|
||||
id: contentRowRectangle
|
||||
height: Math.max(iconRectangle.height, contentRectangle.height)+contentRow.anchors.margins*2
|
||||
width: parent.width
|
||||
color: "transparent"
|
||||
border.width: Config.border_width
|
||||
border.color: textColor
|
||||
|
||||
MouseArea {
|
||||
id: closingMouseArea
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
anchors.margins: Config.spacing
|
||||
|
||||
width: closeIconText.implicitHeight + Config.spacing
|
||||
height: closeIconText.implicitHeight + Config.spacing
|
||||
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: Config.radius
|
||||
color: parent.containsMouse ? Colors.errorContainer : "transparent"
|
||||
|
||||
border.width: Config.border_width
|
||||
border.color: parent.containsMouse ? Colors.error : textColor
|
||||
|
||||
Text {
|
||||
id: closeIconText
|
||||
anchors.centerIn: parent
|
||||
text: "✕"; // or "✕"
|
||||
font.family: Config.font
|
||||
font.pixelSize: Config.screen_height_to_font_small(screen.height)
|
||||
color: parent.parent.containsMouse ? Colors.error_fg : textColor
|
||||
}
|
||||
}
|
||||
onClicked: function(mouse){
|
||||
mouse.accepted=true
|
||||
root.closeNotification(true)
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
id: contentRow
|
||||
anchors.fill: parent
|
||||
anchors.margins: 10
|
||||
spacing: Config.spacing*4
|
||||
width: parent.width
|
||||
|
||||
// Left side: icon + icon information
|
||||
Rectangle{
|
||||
id: iconRectangle
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
color: "transparent"
|
||||
Column {
|
||||
id: iconColumn
|
||||
// height: Math.max(childrenRect.height, contentBodyColumn.height)
|
||||
width: 1.25*iconImage.width
|
||||
spacing: Config.spacing
|
||||
|
||||
Image {
|
||||
id: iconImage
|
||||
|
||||
width: screen.width/30
|
||||
height: iconImage.width
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
source: (
|
||||
notification.appIcon ? Quickshell.iconPath(notification.appIcon) :
|
||||
notification.image ? notification.image :
|
||||
Quickshell.iconPath(DesktopEntries.byId(notification.desktopEntry).icon) ? Quickshell.iconPath(DesktopEntries.byId(notification.desktopEntry).icon) :
|
||||
Quickshell.iconPath("notifications")
|
||||
)
|
||||
|
||||
fillMode: Image.PreserveAspectFit
|
||||
asynchronous: true
|
||||
}
|
||||
|
||||
Text {
|
||||
id: summaryText
|
||||
// height: implicitHeight + font.pixelSize + Config.spacing
|
||||
|
||||
text: root.notification.summary
|
||||
visible: root.notification.summary ? true : false
|
||||
width: iconColumn.width
|
||||
font.family: Config.font
|
||||
font.pixelSize: Config.screen_height_to_font_small(screen.height)
|
||||
color: textColor
|
||||
|
||||
wrapMode: Text.Wrap
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Right side: notification information
|
||||
Rectangle{
|
||||
id: contentRectangle
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
color: "transparent"
|
||||
|
||||
Column {
|
||||
id: contentBodyColumn
|
||||
width: root.width - iconColumn.width
|
||||
spacing: Config.spacing
|
||||
|
||||
Text {
|
||||
id: bodyText
|
||||
text: root.notification.body
|
||||
visible: root.notification.body ? true : false
|
||||
|
||||
width: contentBodyColumn.width
|
||||
font.family: Config.font
|
||||
font.pixelSize: Config.screen_height_to_font_tiny(screen.height)
|
||||
color: textColor
|
||||
wrapMode: Text.Wrap
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
id: actionRowRectangle
|
||||
width: root.width
|
||||
height: Config.screen_height_to_font_tiny(screen.height)+2*Config.spacing
|
||||
border.width: Config.border_width
|
||||
border.color: textColor
|
||||
color: "transparent"
|
||||
visible: notification.actions.length > 0
|
||||
Row{
|
||||
id: actionsRow
|
||||
spacing: Config.spacing
|
||||
anchors.fill: parent
|
||||
anchors.margins: Config.spacing
|
||||
|
||||
Repeater {
|
||||
id: notificationActionRepeater
|
||||
model: notification.actions
|
||||
|
||||
delegate: MouseArea{
|
||||
id: actionMouseArea
|
||||
width: actionsRow.width/notification.actions.length
|
||||
height: actionRectangle.height
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
|
||||
Rectangle {
|
||||
id: actionRectangle
|
||||
width: parent.width
|
||||
height: actionRow.height
|
||||
color: actionMouseArea.containsMouse ? Colors.secondaryContainer_fg : Colors.secondaryContainer
|
||||
border.color: actionMouseArea.containsMouse ? Colors.secondary_fg : Colors.secondary
|
||||
border.width: Config.border_width
|
||||
radius: Config.radius_fun(actionRectangle.height)*2
|
||||
|
||||
Row{
|
||||
id: actionRow
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
anchors.centerIn: parent
|
||||
|
||||
Image{
|
||||
id: actionIcon
|
||||
visible: notification.hasActionIcons
|
||||
}
|
||||
|
||||
Text {
|
||||
text: modelData.text
|
||||
width: Math.min(actionRectangle.width - (actionIcon.visible ? actionIcon.width : 0), implicitWidth)
|
||||
font.family: Config.font
|
||||
font.pixelSize: Config.screen_height_to_font_tiny(screen.height)
|
||||
color: actionMouseArea.containsMouse ? Colors.secondary_fg : Colors.secondary
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onClicked: function(mouse){
|
||||
mouse.accepted=true
|
||||
modelData.invoke()
|
||||
// resident check is allready in .invoke()
|
||||
root.closeNotification(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: inlineReplyRectangle
|
||||
width: root.width
|
||||
height: Config.screen_height_to_font_small(screen.height)+2*Config.spacing
|
||||
border.width: Config.border_width
|
||||
border.color: textColor
|
||||
color: "transparent"
|
||||
visible: notification.hasInlineReply
|
||||
|
||||
function sendReply(message) {
|
||||
notification.sendInlineReply(message)
|
||||
inlineReplyTextField.focus = false
|
||||
// resident check is allready in .invoke()
|
||||
root.closeNotification(false)
|
||||
}
|
||||
|
||||
Row {
|
||||
id: inlineReplyRow
|
||||
spacing: Config.spacing
|
||||
anchors.fill: parent
|
||||
anchors.margins: Config.spacing
|
||||
TextField {
|
||||
id: inlineReplyTextField
|
||||
width: parent.width - inlineReplyButtonMouseArea.width
|
||||
height: inlineReplyButtonText.height
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
placeholderText: notification.hints["x-kde-reply-placeholder-text"] != null ? notification.hints["x-kde-reply-placeholder-text"] : notification.inlineReplyPlaceholder
|
||||
placeholderTextColor: inlineReplyTextField.activeFocus ? Colors.secondary_fg : Colors.secondary
|
||||
font.family: Config.font
|
||||
leftPadding: Config.spacing
|
||||
|
||||
background: Rectangle {
|
||||
radius: Config.radius
|
||||
color: inlineReplyTextField.activeFocus ? Colors.tertiary_fg : Colors.primary_fg
|
||||
border.color: inlineReplyTextField.activeFocus ? Colors.tertiary : Colors.primary
|
||||
border.width: Config.border_width
|
||||
}
|
||||
|
||||
onAccepted: {
|
||||
console.log("[NotificationBodyInlineReply]: Enter pressed:", inlineReplyTextField.text)
|
||||
inlineReplyRectangle.sendReply(inlineReplyTextField.text)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: inlineReplyButtonMouseArea
|
||||
width: inlineReplyButtonText.width + 2*Config.spacing
|
||||
height: inlineReplyButtonText.height
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
Rectangle {
|
||||
id: inlineReplyButtonRectangle
|
||||
width: inlineReplyButtonText.width + 2*Config.spacing
|
||||
height: inlineReplyButtonText.height
|
||||
color: inlineReplyButtonMouseArea.containsMouse ? Colors.secondaryContainer_fg : Colors.secondaryContainer
|
||||
border.color: inlineReplyButtonMouseArea.containsMouse ? Colors.secondary_fg : Colors.secondary
|
||||
border.width: Config.border_width
|
||||
radius: inlineReplyButtonRectangle.height*0.5
|
||||
Text {
|
||||
id: inlineReplyButtonText
|
||||
text: "SEND"
|
||||
font.family: Config.font
|
||||
font.pixelSize: Config.screen_height_to_font_small(screen.height)
|
||||
color: inlineReplyButtonMouseArea.containsMouse ? Colors.secondary_fg : Colors.secondary
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
onClicked: function(mouse){
|
||||
mouse.accepted=true;
|
||||
console.log("[NotificationBodyInlineReply]: Pressed SEND:", inlineReplyTextField.text)
|
||||
inlineReplyRectangle.sendReply(inlineReplyTextField.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Timeout progress bar
|
||||
Rectangle {
|
||||
id: progressBar
|
||||
// anchors.bottom: parent.bottom
|
||||
// anchors.left: parent.left
|
||||
height: Config.screen_height_to_font_tiny(screen.height)
|
||||
color: textColor
|
||||
visible: root.duration > 0
|
||||
|
||||
property real progress: 1.0
|
||||
width: parent.width * progress
|
||||
|
||||
NumberAnimation on progress {
|
||||
id: anim
|
||||
running: root.duration > 0
|
||||
from: 1.0
|
||||
to: 0.0
|
||||
duration: root.duration
|
||||
paused: mouseArea.containsMouse || closingMouseArea.containsMouse || inlineReplyButtonMouseArea.containsMouse
|
||||
|
||||
onFinished: root.closeNotification(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if(Config.debug == "Notification"){
|
||||
console.log("\x1b[31m[NotificationBody]:"+"\x1b[0m")
|
||||
console.log("\x1b[31m\t"+"notification.inlineReplyPlaceholder: " + notification.inlineReplyPlaceholder +"\x1b[0m")
|
||||
console.log("\x1b[31m\t"+"notification.body: " + notification.body+"\x1b[0m")
|
||||
console.log("\x1b[31m\t"+"notification.lastGeneration: " + notification.lastGeneration+"\x1b[0m")
|
||||
console.log("\x1b[31m\t"+"notification.appName: " + notification.appName+"\x1b[0m")
|
||||
console.log("\x1b[31m\t"+"notification.image: " + notification.image+"\x1b[0m")
|
||||
console.log("\x1b[31m\t"+"notification.expireTimeout: " + notification.expireTimeout+"\x1b[0m")
|
||||
console.log("\x1b[31m\t"+"notification.resident: " + notification.resident+"\x1b[0m")
|
||||
console.log("\x1b[31m\t"+"notification.id: " + notification.id+"\x1b[0m")
|
||||
console.log("\x1b[31m\t"+"notification.actions: " + notification.actions+"\x1b[0m")
|
||||
if (notification.actions != []) {
|
||||
for (const notificationAction of notification.actions) {
|
||||
console.log("\x1b[31m\t"+"notification.actions: "+ notificationAction+"\x1b[0m")
|
||||
console.log("\x1b[31m\t"+"notification.actions.text: "+ notificationAction.text+"\x1b[0m")
|
||||
console.log("\x1b[31m\t"+"notification.actions.identifier: "+ notificationAction.identifier+"\x1b[0m")
|
||||
}
|
||||
}
|
||||
console.log("\x1b[31m\t"+"notification.urgency: " + notification.urgency+"\x1b[0m")
|
||||
console.log("\x1b[31m\t"+"notification.appIcon: " + notification.appIcon + " | " + Quickshell.iconPath(notification.appIcon)+"\x1b[0m")
|
||||
console.log("\x1b[31m\t"+"notification.desktopEntry: " + notification.desktopEntry+"\x1b[0m")
|
||||
console.log("\x1b[31m\t"+"notification.hints: " + notification.hints+"\x1b[0m")
|
||||
for (const item of Object.keys(notification.hints)) {
|
||||
console.log("\x1b[31m\t"+"notification.hints[\""+ item +"\"]: " + notification.hints[item]+"\x1b[0m")
|
||||
}
|
||||
console.log("\x1b[31m\t"+"notification.summary: " + notification.summary+"\x1b[0m")
|
||||
console.log("\x1b[31m\t"+"notification.transient: " + notification.transient+"\x1b[0m")
|
||||
console.log("\x1b[31m\t"+"notification.hasInlineReply: " + notification.hasInlineReply+"\x1b[0m")
|
||||
console.log("\x1b[31m\t"+"notification.hasActionIcons: " + notification.hasActionIcons+"\x1b[0m")
|
||||
|
||||
console.log("\x1b[31m\t"+"image.source: " + iconImage.source+"\x1b[0m")
|
||||
console.log("\x1b[31m\t"+"urgency: " + urgency+"\x1b[0m")
|
||||
console.log("\x1b[31m\t"+"duration: " + duration+"\x1b[0m")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import "./notificationServer"
|
||||
|
||||
|
||||
Item {
|
||||
id: notification_root
|
||||
Repeater { // Bars
|
||||
model: Quickshell.screens
|
||||
delegate: Loader {
|
||||
active: true // loads object
|
||||
sourceComponent: Notification {screen: modelData} // creates instance of bar component
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
console.log("[NotificationLoader]:", NotificationS)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Services.Notifications
|
||||
import "../../../config"
|
||||
|
||||
Item {
|
||||
id: notificationServerState
|
||||
|
||||
property var focusedMonitor: null
|
||||
property var newestNotification: null
|
||||
property bool soundEnabled: true
|
||||
|
||||
signal notificationReceived(var notification)
|
||||
|
||||
function correctMonitor(screen) {
|
||||
return (Hyprland.monitorFor(screen) === focusedMonitor)
|
||||
}
|
||||
|
||||
Process {
|
||||
id: notificationSound
|
||||
command: ["pw-play", "--volume", "0.25", Config.configDir + "/modules/notification/assets/notification.ogg"]
|
||||
function play() {
|
||||
if (running)
|
||||
return
|
||||
Config.debug == "Notification" && console.log(
|
||||
"[NotificationSound] Playing:", Config.configDir + "/modules/notification/assets/notification.ogg"
|
||||
)
|
||||
notificationSound.startDetached()
|
||||
}
|
||||
}
|
||||
|
||||
NotificationServer {
|
||||
id: notificationServer
|
||||
|
||||
actionsSupported: true
|
||||
bodyHyperlinksSupported: true
|
||||
bodyImagesSupported: true
|
||||
actionIconsSupported: true
|
||||
imageSupported: true
|
||||
persistenceSupported: true
|
||||
bodyMarkupSupported: true
|
||||
inlineReplySupported: true
|
||||
|
||||
onNotification: function(notification) {
|
||||
// if(notification.lastGeneration){
|
||||
// console.log(
|
||||
// "[NotificationServer] Closing Notification:",
|
||||
// notification.appName, notification.id, notification.summary, notification.body
|
||||
// )
|
||||
// notification.dismiss()
|
||||
// return
|
||||
// }
|
||||
notification.tracked = true
|
||||
Config.debug == "Notification" && console.log(
|
||||
"[NotificationServer] Notification received:",
|
||||
notification.appName, notification.id, notification.summary, notification.body
|
||||
)
|
||||
|
||||
let timer = notificationTimerComponent.createObject(
|
||||
notificationServerState,
|
||||
{ notification: notification }
|
||||
)
|
||||
|
||||
Hyprland.refreshMonitors()
|
||||
timer.start()
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: notificationTimerComponent
|
||||
|
||||
Timer {
|
||||
required property var notification
|
||||
|
||||
interval: 2000
|
||||
repeat: false
|
||||
|
||||
onTriggered: {
|
||||
focusedMonitor = Hyprland.focusedMonitor
|
||||
notificationReceived(notification)
|
||||
if(!notification.lastGeneration && notificationServerState.soundEnabled){
|
||||
notificationSound.play()
|
||||
}
|
||||
|
||||
destroy()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
focusedMonitor = Hyprland.focusedMonitor
|
||||
Config.debug == "Notification" && console.log("[NotificationServer]: Component completed")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
singleton NotificationS NotificationServer.qml
|
||||
@@ -0,0 +1,89 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Widgets
|
||||
import '../bar/states/Audio'
|
||||
import "../../config"
|
||||
|
||||
LazyLoader {
|
||||
active: Sink.volumeChanged
|
||||
|
||||
|
||||
PanelWindow {
|
||||
// Since the panel's screen is unset, it will be picked by the compositor
|
||||
// when the window is created. Most compositors pick the current active monitor.
|
||||
|
||||
anchors.bottom: true
|
||||
margins.bottom: screen.height / 5
|
||||
exclusiveZone: 0
|
||||
|
||||
implicitWidth: Config.focusedMonitor.width/5
|
||||
implicitHeight: Config.focusedMonitor.height/40
|
||||
color: "transparent"
|
||||
|
||||
// An empty click mask prevents the window from blocking mouse events.
|
||||
mask: Region {}
|
||||
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: height / 2
|
||||
color: "transparent"
|
||||
|
||||
RowLayout {
|
||||
anchors {
|
||||
fill: parent
|
||||
leftMargin: 10
|
||||
rightMargin: 15
|
||||
}
|
||||
|
||||
Text {
|
||||
Layout.alignment: Qt.AlignLeft
|
||||
rightPadding: (text == "" || text == "" ? font.pixelSize/4 : text == "" ? font.pixelSize/6 : 0)
|
||||
leftPadding: (text == "" || text == "" ? -font.pixelSize/15 : 0)
|
||||
|
||||
text: (
|
||||
Sink.mute ? "" :
|
||||
Sink.volume > 60 ? "" :
|
||||
Sink.volume > 30 ? "" :
|
||||
Sink.volume > 0 ? "" :
|
||||
"")
|
||||
font.pixelSize: 30
|
||||
|
||||
color: Colors.primary
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
// Stretches to fill all left-over space
|
||||
Layout.fillWidth: true
|
||||
|
||||
implicitHeight: 10
|
||||
radius: 20
|
||||
color: "#50ffffff"
|
||||
|
||||
Rectangle {
|
||||
anchors {
|
||||
left: parent.left
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
|
||||
implicitWidth: parent.width * (Sink.volume/100/1.5 ?? 0)
|
||||
radius: parent.radius
|
||||
|
||||
color: Sink.volume/100 > 1 ? Colors.tertiary : Colors.primary
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
Layout.alignment: Qt.AlignRight
|
||||
|
||||
text: Sink.volume + "%"
|
||||
font.pixelSize: 30
|
||||
|
||||
color: Colors.primary
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Widgets
|
||||
import '../bar/states/Audio'
|
||||
import "../../config"
|
||||
|
||||
LazyLoader {
|
||||
active: Source.volumeChanged
|
||||
|
||||
|
||||
PanelWindow {
|
||||
// Since the panel's screen is unset, it will be picked by the compositor
|
||||
// when the window is created. Most compositors pick the current active monitor.
|
||||
|
||||
anchors.bottom: true
|
||||
margins.bottom: screen.height / 5 - implicitHeight
|
||||
exclusiveZone: 0
|
||||
|
||||
implicitWidth: Config.focusedMonitor.width/5
|
||||
implicitHeight: Config.focusedMonitor.height/40
|
||||
color: "transparent"
|
||||
|
||||
// An empty click mask prevents the window from blocking mouse events.
|
||||
mask: Region {}
|
||||
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: height / 2
|
||||
color: "transparent"
|
||||
|
||||
RowLayout {
|
||||
anchors {
|
||||
fill: parent
|
||||
leftMargin: 10
|
||||
rightMargin: 15
|
||||
}
|
||||
|
||||
Text {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
|
||||
text: Source.mute ? "" : ""
|
||||
font.pixelSize: 30
|
||||
|
||||
color: Colors.primary
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
// Stretches to fill all left-over space
|
||||
Layout.fillWidth: true
|
||||
|
||||
implicitHeight: 10
|
||||
radius: 20
|
||||
color: "#50ffffff"
|
||||
|
||||
Rectangle {
|
||||
anchors {
|
||||
left: parent.left
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
implicitWidth: parent.width * (Source.volume/100 ?? 0)
|
||||
radius: parent.radius
|
||||
|
||||
color: Colors.primary
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
Layout.alignment: Qt.AlignRight
|
||||
|
||||
text: Source.volume + "%"
|
||||
font.pixelSize: 30
|
||||
|
||||
color: Colors.primary
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,7 +62,7 @@ Variants {
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
console.log("clicked ???, closing Wallpaper Picker")
|
||||
console.log("clicked Background, closing Wallpaper Picker")
|
||||
wlogoutLoader.active = false
|
||||
}
|
||||
GridLayout {
|
||||
|
||||
@@ -8,10 +8,10 @@ import "../../config"
|
||||
Item { // container, invisible
|
||||
id: wlLoader
|
||||
|
||||
Loader {
|
||||
LazyLoader {
|
||||
id: wlogoutLoader
|
||||
active: false
|
||||
sourceComponent: Wlogout {
|
||||
Wlogout {
|
||||
id: wLogout
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ PanelWindow {
|
||||
|
||||
color: "white"
|
||||
placeholderTextColor: "#888"
|
||||
font.family: Config.font
|
||||
|
||||
background: Rectangle {
|
||||
|
||||
@@ -64,10 +65,10 @@ PanelWindow {
|
||||
border.width: 1
|
||||
}
|
||||
|
||||
Keys.onReleased: {
|
||||
Keys.onReleased: (event) => {
|
||||
if (event.key === Qt.Key_Escape) {
|
||||
console.log("Escape pressed inside TextField")
|
||||
console.log("Pressed Escape, closing Wallpaper Picker")
|
||||
// console.log("Pressed Escape, closing Wallpaper Picker")
|
||||
// wallpaperLoader.active = false
|
||||
filterText.text = ""
|
||||
filterText.focus = false
|
||||
@@ -75,6 +76,13 @@ PanelWindow {
|
||||
pickerScope.focus = true
|
||||
}
|
||||
}
|
||||
onAccepted: {
|
||||
console.log("Enter pressed inside TextField")
|
||||
filterText.text = ""
|
||||
filterText.focus = false
|
||||
event.accepted = true
|
||||
pickerScope.focus = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,10 +16,10 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
LazyLoader {
|
||||
id: wallpaperLoader
|
||||
active: false
|
||||
sourceComponent: WallpaperPicker { id: wPicker }
|
||||
WallpaperPicker { id: wPicker }
|
||||
}
|
||||
|
||||
GlobalShortcut {
|
||||
@@ -30,7 +30,7 @@ Item {
|
||||
// generateThumbs.startDetached()
|
||||
generateThumbs.running = true
|
||||
console.log("Pressed Meta+Shift+W (Hyprland global shortcut)")
|
||||
wallpaperLoader.active = !wallpaperLoader.active
|
||||
wallpaperLoader.activeAsync = !wallpaperLoader.active
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,12 @@ import Quickshell //for PanelWindow
|
||||
import Quickshell.Hyprland
|
||||
import QtQuick //for Text
|
||||
import "./modules/bar"
|
||||
import "./modules/notification"
|
||||
import "./modules/wp"
|
||||
import "./modules/wlogout"
|
||||
import "./modules/jl"
|
||||
import "./modules/background"
|
||||
import "./modules/volumeOSD"
|
||||
|
||||
ShellRoot {
|
||||
id: root
|
||||
@@ -15,6 +17,9 @@ ShellRoot {
|
||||
// Bar
|
||||
BarLoader {}
|
||||
|
||||
// Notifications
|
||||
NotificationLoader {}
|
||||
|
||||
//Wallpaper picker
|
||||
WallpaperPickerLoader {}
|
||||
|
||||
@@ -26,9 +31,21 @@ ShellRoot {
|
||||
id : wlLoader
|
||||
}
|
||||
|
||||
Background {}
|
||||
//VolumeChangeOSD
|
||||
SourceOSD {}
|
||||
SinkOSD {}
|
||||
|
||||
// Background {}
|
||||
|
||||
function openWlogout() {
|
||||
wlLoader.openWlogout()
|
||||
}
|
||||
|
||||
GlobalShortcut {
|
||||
name: "QsReload"
|
||||
|
||||
onPressed: {
|
||||
Quickshell.reload(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user