forked from Shinonome/dots-hyprland
bluetooth and wifi
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import "../"
|
||||
import "root:/modules/common"
|
||||
import "root:/modules/common/widgets"
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
|
||||
QuickToggleButton {
|
||||
toggled: Bluetooth.bluetoothEnabled
|
||||
buttonIcon: Bluetooth.bluetoothConnected ? "bluetooth_connected" : Bluetooth.bluetoothEnabled ? "bluetooth" : "bluetooth_disabled"
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.RightButton | Qt.LeftButton
|
||||
onClicked: {
|
||||
if (mouse.button === Qt.LeftButton) {
|
||||
toggleBluetooth.running = true
|
||||
}
|
||||
if (mouse.button === Qt.RightButton) {
|
||||
configureBluetooth.running = true
|
||||
}
|
||||
}
|
||||
hoverEnabled: false
|
||||
propagateComposedEvents: true
|
||||
}
|
||||
Process {
|
||||
id: configureBluetooth
|
||||
command: ["bash", "-c", `${ConfigOptions.apps.bluetooth} & qs ipc call sidebarRight close`]
|
||||
}
|
||||
Process {
|
||||
id: toggleBluetooth
|
||||
command: ["bash", "-c", `bluetoothctl power ${Bluetooth.bluetoothEnabled ? "off" : "on"}`]
|
||||
onRunningChanged: {
|
||||
if(!running) {
|
||||
Bluetooth.update()
|
||||
}
|
||||
}
|
||||
}
|
||||
StyledToolTip {
|
||||
content: `${Bluetooth.bluetoothEnabled ? Bluetooth.bluetoothDeviceName : "Bluetooth"} | Right-click to configure`
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import "root:/modules/common"
|
||||
import "root:/modules/common/widgets"
|
||||
import "../"
|
||||
import Quickshell.Io
|
||||
import Quickshell
|
||||
|
||||
QuickToggleButton {
|
||||
property bool enabled: false
|
||||
buttonIcon: "gamepad"
|
||||
toggled: enabled
|
||||
onClicked: {
|
||||
enabled = !enabled
|
||||
if (enabled) {
|
||||
gameModeOn.running = true
|
||||
} else {
|
||||
gameModeOff.running = true
|
||||
}
|
||||
}
|
||||
Process {
|
||||
id: gameModeOn
|
||||
command: ['bash', '-c', `hyprctl --batch "keyword animations:enabled 0; keyword decoration:shadow:enabled 0; keyword decoration:blur:enabled 0; keyword general:gaps_in 0; keyword general:gaps_out 0; keyword general:border_size 1; keyword decoration:rounding 0; keyword general:allow_tearing 1"`]
|
||||
}
|
||||
Process {
|
||||
id: gameModeOff
|
||||
command: ['bash', '-c', `hyprctl reload`]
|
||||
}
|
||||
StyledToolTip {
|
||||
content: "Game mode"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import "root:/modules/common"
|
||||
import "root:/modules/common/widgets"
|
||||
import "../"
|
||||
import Quickshell.Io
|
||||
import Quickshell
|
||||
|
||||
QuickToggleButton {
|
||||
toggled: idleInhibitor.running
|
||||
buttonIcon: "coffee"
|
||||
onClicked: {
|
||||
idleInhibitor.running = !idleInhibitor.running
|
||||
}
|
||||
Process {
|
||||
id: idleInhibitor
|
||||
command: ["bash", "-c", "${XDG_CONFIG_HOME:-$HOME/.config}/quickshell/scripts/wayland-idle-inhibitor.py"]
|
||||
}
|
||||
StyledToolTip {
|
||||
content: "Keep system awake"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import "root:/modules/common"
|
||||
import "root:/modules/common/widgets"
|
||||
import "../"
|
||||
import Quickshell.Io
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
|
||||
QuickToggleButton {
|
||||
toggled: Network.networkName.length > 0 && Network.networkName != "lo"
|
||||
buttonIcon: toggled ? (
|
||||
Network.networkStrength > 80 ? "signal_wifi_4_bar" :
|
||||
Network.networkStrength > 60 ? "network_wifi_3_bar" :
|
||||
Network.networkStrength > 40 ? "network_wifi_2_bar" :
|
||||
Network.networkStrength > 20 ? "network_wifi_1_bar" :
|
||||
"signal_wifi_0_bar"
|
||||
) : "signal_wifi_off"
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.RightButton | Qt.LeftButton
|
||||
onClicked: {
|
||||
if (mouse.button === Qt.LeftButton) {
|
||||
toggleNetwork.running = true
|
||||
}
|
||||
if (mouse.button === Qt.RightButton) {
|
||||
configureNetwork.running = true
|
||||
}
|
||||
}
|
||||
hoverEnabled: false
|
||||
propagateComposedEvents: true
|
||||
}
|
||||
Process {
|
||||
id: configureNetwork
|
||||
command: ["bash", "-c", `${ConfigOptions.apps.network} & qs ipc call sidebarRight close`]
|
||||
}
|
||||
Process {
|
||||
id: toggleNetwork
|
||||
command: ["bash", "-c", "nmcli radio wifi | grep -q enabled && nmcli radio wifi off || nmcli radio wifi on"]
|
||||
onRunningChanged: {
|
||||
if(!running) {
|
||||
Network.update()
|
||||
}
|
||||
}
|
||||
}
|
||||
StyledToolTip {
|
||||
content: `${Network.networkName} | Right-click to configure`
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import "root:/modules/common"
|
||||
import "root:/modules/common/widgets"
|
||||
import "../"
|
||||
import Quickshell.Io
|
||||
import Quickshell
|
||||
|
||||
QuickToggleButton {
|
||||
id: nightLightButton
|
||||
property bool enabled: false
|
||||
toggled: enabled
|
||||
buttonIcon: "nightlight"
|
||||
onClicked: {
|
||||
nightLightButton.enabled = !nightLightButton.enabled
|
||||
if (enabled) {
|
||||
nightLightOn.running = true
|
||||
}
|
||||
else {
|
||||
nightLightOff.running = true
|
||||
}
|
||||
}
|
||||
Process {
|
||||
id: nightLightOn
|
||||
command: ["gammastep"]
|
||||
}
|
||||
Process {
|
||||
id: nightLightOff
|
||||
command: ["pkill", "gammastep"]
|
||||
}
|
||||
Process {
|
||||
id: updateNightLightState
|
||||
running: true
|
||||
command: ["pidof", "gammastep"]
|
||||
stdout: SplitParser {
|
||||
onRead: (data) => { // if not empty then set toggled to true
|
||||
nightLightButton.enabled = data.length > 0
|
||||
}
|
||||
}
|
||||
}
|
||||
StyledToolTip {
|
||||
content: "Night Light"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user