BarWidgets: All the right click contextual menus. Fix #541

This commit is contained in:
ItsLemmy
2025-11-17 22:47:17 -05:00
parent f3207b526f
commit c407edb4e9
27 changed files with 951 additions and 68 deletions
+21
View File
@@ -398,6 +398,27 @@
"clock": { "clock": {
"tooltip": "Kalender öffnen" "tooltip": "Kalender öffnen"
}, },
"context-menu": {
"clear-history": "Verlauf löschen",
"cycle-visualizer": "Zyklus-Visualisierer",
"disable-bluetooth": "Bluetooth deaktivieren",
"disable-dnd": "Bitte nicht stören deaktivieren",
"disable-wifi": "WLAN deaktivieren",
"enable-bluetooth": "Bluetooth aktivieren",
"enable-dnd": "Nicht stören aktivieren",
"enable-wifi": "WLAN aktivieren",
"next": "Nächste/r/s",
"open-calendar": "Kalender öffnen",
"open-display-settings": "Anzeigeeinstellungen",
"open-launcher": "Launcher öffnen",
"open-mixer": "Audiomischer",
"open-settings": "Einstellungen öffnen",
"pause": "Pause",
"play": "Spielen",
"previous": "Vorherige",
"toggle-mute": "Stummschaltung umschalten",
"widget-settings": "Widget-Einstellungen"
},
"dock": { "dock": {
"menu": { "menu": {
"close": "Schließen", "close": "Schließen",
+46 -29
View File
@@ -360,16 +360,16 @@
} }
}, },
"battery": { "battery": {
"charging": "Charging.", "charging": "Charging",
"charging-rate": "Charging rate: {rate} W.", "charging-rate": "Charging rate: {rate} W",
"discharging": "Discharging.", "discharging": "Discharging",
"discharging-rate": "Discharging rate: {rate} W.", "discharging-rate": "Discharging rate: {rate} W",
"health": "Health: {percent}%", "health": "Health: {percent}%",
"idle": "Idle.", "idle": "Idle",
"no-battery-detected": "No battery detected.", "no-battery-detected": "No battery detected",
"plugged-in": "Plugged in.", "plugged-in": "Plugged in",
"time-left": "Time left: {time}.", "time-left": "Time left: {time}",
"time-until-full": "Time until full: {time}." "time-until-full": "Time until full: {time}"
}, },
"bluetooth": { "bluetooth": {
"panel": { "panel": {
@@ -387,11 +387,6 @@
"title": "Bluetooth" "title": "Bluetooth"
} }
}, },
"context-menu": {
"open-mixer": "Audio mixer",
"toggle-mute": "Toggle mute",
"widget-settings": "Widget settings"
},
"calendar": { "calendar": {
"panel": { "panel": {
"week": "Week" "week": "Week"
@@ -403,6 +398,28 @@
"clock": { "clock": {
"tooltip": "Open calendar" "tooltip": "Open calendar"
}, },
"context-menu": {
"clear-history": "Clear history",
"cycle-visualizer": "Cycle visualizer",
"disable-bluetooth": "Disable Bluetooth",
"disable-dnd": "Disable Do Not Disturb",
"disable-wifi": "Disable Wi-Fi",
"enable-bluetooth": "Enable Bluetooth",
"enable-dnd": "Enable Do Not Disturb",
"enable-wifi": "Enable Wi-Fi",
"next": "Next",
"open-calendar": "Open calendar",
"open-display-settings": "Display settings",
"open-launcher": "Open launcher",
"open-mixer": "Audio mixer",
"open-settings": "Open settings",
"pause": "Pause",
"play": "Play",
"previous": "Previous",
"random-wallpaper": "Random wallpaper",
"toggle-mute": "Toggle mute",
"widget-settings": "Widget settings"
},
"dock": { "dock": {
"menu": { "menu": {
"close": "Close", "close": "Close",
@@ -1965,39 +1982,39 @@
"tooltips": { "tooltips": {
"add-widget": "Add widget", "add-widget": "Add widget",
"bluetooth-devices": "Bluetooth devices", "bluetooth-devices": "Bluetooth devices",
"brightness-at": "Brightness: {brightness}%\nRight click for settings.\nScroll to modify brightness.", "brightness-at": "Brightness: {brightness}%\nScroll to modify brightness",
"cancel-timer": "Cancel timer", "cancel-timer": "Cancel timer",
"clear-history": "Clear history", "clear-history": "Clear history",
"click-to-start-recording": "Click to start recording", "click-to-start-recording": "Click to start recording",
"click-to-stop-recording": "Click to stop recording", "click-to-stop-recording": "Click to stop recording",
"close": "Close", "close": "Close",
"connect-disconnect-devices": "Left click to connect. Right click to forget.", "connect-disconnect-devices": "Left click to connect\nRight click to forget",
"delete-notification": "Delete notification", "delete-notification": "Delete notification",
"disable-keep-awake": "Click to disable keep awake.\nScroll to adjust timeout.", "disable-keep-awake": "Click to disable keep awake.\nScroll to adjust timeout",
"do-not-disturb-disabled": "'Do not disturb' disabled", "do-not-disturb-disabled": "'Do not disturb' disabled",
"do-not-disturb-enabled": "'Do not disturb' enabled", "do-not-disturb-enabled": "'Do not disturb' enabled",
"enable-keep-awake": "Click to enable keep awake.\nScroll to adjust timeout.", "enable-keep-awake": "Click to enable keep awake.\nScroll to adjust timeout",
"forget-network": "Forget network", "forget-network": "Forget network",
"home": "Home", "home": "Home",
"input-muted": "Toggle input mute", "input-muted": "Toggle input mute",
"keep-awake": "Keep awake", "keep-awake": "Keep awake",
"keyboard-layout": "{layout} keyboard layout", "keyboard-layout": "{layout} keyboard layout",
"manage-wifi": "Manage Wi-Fi", "manage-wifi": "Manage Wi-Fi",
"microphone-volume-at": "Microphone volume at {volume}%\nLeft click for settings. Right click to toggle mute.\nScroll to modify volume.", "microphone-volume-at": "Microphone volume at {volume}%\nScroll to modify volume",
"move-to-center-section": "Move to center section", "move-to-center-section": "Move to center section",
"move-to-left-section": "Move to left section", "move-to-left-section": "Move to left section",
"move-to-right-section": "Move to right section", "move-to-right-section": "Move to right section",
"next-media": "Next media", "next-media": "Next media",
"next-month": "Next month", "next-month": "Next month",
"night-light-disabled": "Night light is disabled.\nLeft click to cycle mode.\nRight click to access settings.", "night-light-disabled": "Night light is disabled.\nLeft click to cycle mode\nRight click to access settings",
"night-light-enabled": "Night light is enabled.\nLeft click to cycle mode.\nRight click to access settings.", "night-light-enabled": "Night light is enabled.\nLeft click to cycle mode\nRight click to access settings",
"night-light-forced": "Night light is forced.\nLeft click to cycle mode.\nRight click to access settings.", "night-light-forced": "Night light is forced.\nLeft click to cycle mode\nRight click to access settings",
"night-light-not-installed": "Night light is not available.\nwlsunset is not installed.", "night-light-not-installed": "Night light is not available\nwlsunset is not installed",
"noctalia-performance-disabled": "Noctalia performance mode is disabled.\nLeft click to enable.", "noctalia-performance-disabled": "Noctalia performance mode is disabled\nLeft click to enable",
"noctalia-performance-enabled": "Noctalia performance mode is enabled.\nLeft click to disable.", "noctalia-performance-enabled": "Noctalia performance mode is enabled\nLeft click to disable",
"open-control-center": "Open control center", "open-control-center": "Open control center",
"open-notification-history-disable-dnd": "Open notification history\nRight-click to disable \"Do not disturb\".", "open-notification-history-disable-dnd": "Open notification history\nRight-click to disable \"Do not disturb\"",
"open-notification-history-enable-dnd": "Open notification history\nRight-click to enable \"Do not disturb\".", "open-notification-history-enable-dnd": "Open notification history\nRight-click to enable \"Do not disturb\"",
"open-settings": "Open settings", "open-settings": "Open settings",
"open-tray-dropdown": "Open tray dropdown", "open-tray-dropdown": "Open tray dropdown",
"open-wallpaper-selector": "Open wallpaper selector", "open-wallpaper-selector": "Open wallpaper selector",
@@ -2020,8 +2037,8 @@
"switch-to-dark-mode": "Switch to dark mode", "switch-to-dark-mode": "Switch to dark mode",
"switch-to-light-mode": "Switch to light mode", "switch-to-light-mode": "Switch to light mode",
"up": "Up", "up": "Up",
"volume-at": "Output volume at {volume}%\nLeft click for settings. Right click to toggle mute.\nScroll to modify volume.", "volume-at": "Output volume at {volume}%\nScroll to modify volume",
"wallpaper-selector": "Left click: Open wallpaper selector.\nRight click: Set random wallpaper.", "wallpaper-selector": "Left click: Open wallpaper selector.\nRight click: Set random wallpaper",
"widget-settings": "Widget settings" "widget-settings": "Widget settings"
}, },
"wallpaper": { "wallpaper": {
+21
View File
@@ -398,6 +398,27 @@
"clock": { "clock": {
"tooltip": "Abrir calendario" "tooltip": "Abrir calendario"
}, },
"context-menu": {
"clear-history": "Borrar historial",
"cycle-visualizer": "Visualizador de ciclos",
"disable-bluetooth": "Desactivar Bluetooth",
"disable-dnd": "Desactivar No molestar",
"disable-wifi": "Desactivar Wi-Fi",
"enable-bluetooth": "Activar Bluetooth",
"enable-dnd": "Activar No molestar",
"enable-wifi": "Activar Wi-Fi",
"next": "Siguiente",
"open-calendar": "Abrir calendario",
"open-display-settings": "Configuración de pantalla",
"open-launcher": "Abrir lanzador",
"open-mixer": "Mezclador de audio",
"open-settings": "Abrir ajustes",
"pause": "Pausa",
"play": "Jugar",
"previous": "Anterior",
"toggle-mute": "Activar/desactivar silencio",
"widget-settings": "Configuración del widget"
},
"dock": { "dock": {
"menu": { "menu": {
"close": "Cerrar", "close": "Cerrar",
+21
View File
@@ -398,6 +398,27 @@
"clock": { "clock": {
"tooltip": "Ouvrir le calendrier" "tooltip": "Ouvrir le calendrier"
}, },
"context-menu": {
"clear-history": "Effacer l'historique",
"cycle-visualizer": "Visualiseur de cycle",
"disable-bluetooth": "Désactiver le Bluetooth",
"disable-dnd": "Désactiver le mode Ne pas déranger",
"disable-wifi": "Désactiver le Wi-Fi",
"enable-bluetooth": "Activer le Bluetooth",
"enable-dnd": "Activer le mode Ne pas déranger",
"enable-wifi": "Activer le Wi-Fi",
"next": "Suivant",
"open-calendar": "Ouvrir le calendrier",
"open-display-settings": "Paramètres d'affichage",
"open-launcher": "Ouvrir le lanceur",
"open-mixer": "Table de mixage audio",
"open-settings": "Ouvrir les paramètres",
"pause": "Pause",
"play": "Jouer",
"previous": "Précédent",
"toggle-mute": "Activer/désactiver le mode muet",
"widget-settings": "Paramètres du widget"
},
"dock": { "dock": {
"menu": { "menu": {
"close": "Fermer", "close": "Fermer",
+21
View File
@@ -398,6 +398,27 @@
"clock": { "clock": {
"tooltip": "Kalender openen" "tooltip": "Kalender openen"
}, },
"context-menu": {
"clear-history": "Geschiedenis wissen",
"cycle-visualizer": "Cyclusvisualisatie",
"disable-bluetooth": "Bluetooth uitschakelen",
"disable-dnd": "Niet Storen uitschakelen",
"disable-wifi": "Wi-Fi uitschakelen",
"enable-bluetooth": "Bluetooth inschakelen",
"enable-dnd": "Niet Storen inschakelen",
"enable-wifi": "Wi-Fi inschakelen",
"next": "Volgende",
"open-calendar": "Open agenda",
"open-display-settings": "Beeldscherminstellingen",
"open-launcher": "Launcher openen",
"open-mixer": "Audiomixer",
"open-settings": "Instellingen openen",
"pause": "Pauze",
"play": "Spelen",
"previous": "Vorige",
"toggle-mute": "Dempen aan/uit",
"widget-settings": "Widgetinstellingen"
},
"dock": { "dock": {
"menu": { "menu": {
"close": "Sluiten", "close": "Sluiten",
+21
View File
@@ -398,6 +398,27 @@
"clock": { "clock": {
"tooltip": "Abrir calendário" "tooltip": "Abrir calendário"
}, },
"context-menu": {
"clear-history": "Limpar histórico",
"cycle-visualizer": "Visualizador de ciclo",
"disable-bluetooth": "Desativar Bluetooth",
"disable-dnd": "Desativar o Não Perturbe",
"disable-wifi": "Desativar Wi-Fi",
"enable-bluetooth": "Ativar Bluetooth",
"enable-dnd": "Ativar Não Perturbe",
"enable-wifi": "Ativar Wi-Fi",
"next": "Próximo(a)",
"open-calendar": "Abrir calendário",
"open-display-settings": "Configurações de exibição",
"open-launcher": "Abrir iniciador",
"open-mixer": "Mesa de som",
"open-settings": "Abrir configurações",
"pause": "Pausa",
"play": "Jogar",
"previous": "Anterior",
"toggle-mute": "Alternar mudo",
"widget-settings": "Configurações do widget"
},
"dock": { "dock": {
"menu": { "menu": {
"close": "Fechar", "close": "Fechar",
+21
View File
@@ -398,6 +398,27 @@
"clock": { "clock": {
"tooltip": "Открыть календарь" "tooltip": "Открыть календарь"
}, },
"context-menu": {
"clear-history": "Очистить историю",
"cycle-visualizer": "Визуализатор циклов",
"disable-bluetooth": "Отключить Bluetooth",
"disable-dnd": "Отключить режим \"Не беспокоить\"",
"disable-wifi": "Отключить Wi-Fi",
"enable-bluetooth": "Включить Bluetooth",
"enable-dnd": "Не беспокоить",
"enable-wifi": "Включить Wi-Fi",
"next": "Следующий",
"open-calendar": "Открыть календарь",
"open-display-settings": "Настройки экрана",
"open-launcher": "Открыть лаунчер",
"open-mixer": "Аудиомикшер",
"open-settings": "Открыть настройки",
"pause": "Пауза",
"play": "Играть",
"previous": "Предыдущий",
"toggle-mute": "Включить/выключить звук",
"widget-settings": "Настройки виджета"
},
"dock": { "dock": {
"menu": { "menu": {
"close": "Закрыть", "close": "Закрыть",
+21
View File
@@ -398,6 +398,27 @@
"clock": { "clock": {
"tooltip": "Takvimi aç" "tooltip": "Takvimi aç"
}, },
"context-menu": {
"clear-history": "Geçmişi temizle",
"cycle-visualizer": "Döngü görselleştirici",
"disable-bluetooth": "Bluetooth'u kapat",
"disable-dnd": "Rahatsız Etmeyin'i Kapat",
"disable-wifi": "Wi-Fi'ı kapat",
"enable-bluetooth": "Bluetooth'u etkinleştir",
"enable-dnd": "Rahatsız Etmeyin'i Etkinleştir",
"enable-wifi": "Wi-Fi'ı etkinleştir",
"next": "Sonraki",
"open-calendar": "Takvimi aç",
"open-display-settings": "Ekran ayarları",
"open-launcher": "Başlatıcıyı aç",
"open-mixer": "Ses mikseri",
"open-settings": "Ayarları aç",
"pause": "Duraklat",
"play": "Oyna",
"previous": "Önceki",
"toggle-mute": "Sesi kapat/aç",
"widget-settings": "Araç ayarları"
},
"dock": { "dock": {
"menu": { "menu": {
"close": "Kapat", "close": "Kapat",
+21
View File
@@ -398,6 +398,27 @@
"clock": { "clock": {
"tooltip": "Відкрити календар" "tooltip": "Відкрити календар"
}, },
"context-menu": {
"clear-history": "Очистити історію",
"cycle-visualizer": "Візуалізатор циклів",
"disable-bluetooth": "Вимкнути Bluetooth",
"disable-dnd": "Вимкнути режим \"Не турбувати\"",
"disable-wifi": "Вимкнути Wi-Fi",
"enable-bluetooth": "Увімкнути Bluetooth",
"enable-dnd": "Увімкнути режим \"Не турбувати\"",
"enable-wifi": "Увімкнути Wi-Fi",
"next": "Наступний",
"open-calendar": "Відкрити календар",
"open-display-settings": "Параметри дисплея",
"open-launcher": "Відкрити панель запуску",
"open-mixer": "Аудіомікшер",
"open-settings": "Відкрити налаштування",
"pause": "Пауза",
"play": "Грати",
"previous": "Попередній",
"toggle-mute": "Увімкнути/вимкнути звук",
"widget-settings": "Налаштування віджета"
},
"dock": { "dock": {
"menu": { "menu": {
"close": "Закрити", "close": "Закрити",
+21
View File
@@ -398,6 +398,27 @@
"clock": { "clock": {
"tooltip": "打开日历" "tooltip": "打开日历"
}, },
"context-menu": {
"clear-history": "清除历史记录",
"cycle-visualizer": "周期可视化工具",
"disable-bluetooth": "禁用蓝牙",
"disable-dnd": "关闭勿扰模式",
"disable-wifi": "禁用Wi-Fi",
"enable-bluetooth": "启用蓝牙",
"enable-dnd": "启用勿扰模式",
"enable-wifi": "启用 Wi-Fi",
"next": "下一个",
"open-calendar": "打开日历",
"open-display-settings": "显示设置",
"open-launcher": "打开启动器",
"open-mixer": "音频调音台",
"open-settings": "打开设置",
"pause": "暂停",
"play": "玩",
"previous": "上一个",
"toggle-mute": "切换静音",
"widget-settings": "小部件设置"
},
"dock": { "dock": {
"menu": { "menu": {
"close": "关闭", "close": "关闭",
+36 -1
View File
@@ -1,9 +1,11 @@
import QtQuick import QtQuick
import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import Quickshell import Quickshell
import Quickshell.Wayland import Quickshell.Wayland
import Quickshell.Widgets import Quickshell.Widgets
import qs.Commons import qs.Commons
import qs.Modules.Bar.Extras
import qs.Services.Compositor import qs.Services.Compositor
import qs.Services.UI import qs.Services.UI
import qs.Widgets import qs.Widgets
@@ -166,6 +168,29 @@ Item {
font.weight: Style.fontWeightMedium font.weight: Style.fontWeightMedium
} }
NPopupContextMenu {
id: contextMenu
model: [
{
"label": I18n.tr("context-menu.widget-settings"),
"action": "widget-settings",
"icon": "settings"
},
]
onTriggered: action => {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
popupMenuWindow.close();
}
if (action === "widget-settings") {
BarService.openWidgetSettings(screen, section, sectionWidgetIndex, widgetId, widgetSettings);
}
}
}
Rectangle { Rectangle {
id: windowActiveRect id: windowActiveRect
visible: root.visible visible: root.visible
@@ -409,7 +434,7 @@ Item {
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton | Qt.RightButton
onEntered: { onEntered: {
if ((windowTitle !== "") && isVerticalBar || (scrollingMode === "never")) { if ((windowTitle !== "") && isVerticalBar || (scrollingMode === "never")) {
TooltipService.show(root, windowTitle, BarService.getTooltipDirection()); TooltipService.show(root, windowTitle, BarService.getTooltipDirection());
@@ -418,6 +443,16 @@ Item {
onExited: { onExited: {
TooltipService.hide(); TooltipService.hide();
} }
onClicked: mouse => {
if (mouse.button === Qt.RightButton) {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
const pos = BarService.getContextMenuPosition(root, contextMenu.implicitWidth, contextMenu.implicitHeight);
contextMenu.openAtItem(root, pos.x, pos.y);
popupMenuWindow.showContextMenu(contextMenu);
}
}
}
} }
} }
} }
+49 -8
View File
@@ -1,6 +1,8 @@
import QtQuick import QtQuick
import QtQuick.Controls
import Quickshell import Quickshell
import qs.Commons import qs.Commons
import qs.Modules.Bar.Extras
import qs.Services.Media import qs.Services.Media
import qs.Services.UI import qs.Services.UI
import qs.Widgets import qs.Widgets
@@ -103,22 +105,61 @@ Item {
} }
} }
NPopupContextMenu {
id: contextMenu
model: [
{
"label": I18n.tr("context-menu.cycle-visualizer"),
"action": "cycle-visualizer",
"icon": "chart-column"
},
{
"label": I18n.tr("context-menu.widget-settings"),
"action": "widget-settings",
"icon": "settings"
},
]
onTriggered: action => {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
popupMenuWindow.close();
}
if (action === "cycle-visualizer") {
const types = ["linear", "mirrored", "wave"];
const currentIndex = types.indexOf(currentVisualizerType);
const nextIndex = (currentIndex + 1) % types.length;
Settings.data.audio.visualizerType = types[nextIndex];
} else if (action === "widget-settings") {
BarService.openWidgetSettings(screen, section, sectionWidgetIndex, widgetId, widgetSettings);
}
}
}
// Click to cycle through visualizer types // Click to cycle through visualizer types
MouseArea { MouseArea {
id: mouseArea id: mouseArea
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
hoverEnabled: true hoverEnabled: true
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: mouse => { onClicked: mouse => {
const types = ["linear", "mirrored", "wave"]; if (mouse.button === Qt.RightButton) {
const currentIndex = types.indexOf(currentVisualizerType); var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
const nextIndex = (currentIndex + 1) % types.length; if (popupMenuWindow) {
const newType = types[nextIndex]; const pos = BarService.getContextMenuPosition(root, contextMenu.implicitWidth, contextMenu.implicitHeight);
contextMenu.openAtItem(root, pos.x, pos.y);
// Update settings directly, maybe this should be a widget setting... popupMenuWindow.showContextMenu(contextMenu);
Settings.data.audio.visualizerType = newType; }
} else {
const types = ["linear", "mirrored", "wave"];
const currentIndex = types.indexOf(currentVisualizerType);
const nextIndex = (currentIndex + 1) % types.length;
Settings.data.audio.visualizerType = types[nextIndex];
}
} }
} }
+32
View File
@@ -1,4 +1,5 @@
import QtQuick import QtQuick
import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import Quickshell import Quickshell
import Quickshell.Services.UPower import Quickshell.Services.UPower
@@ -84,6 +85,29 @@ Item {
} }
} }
NPopupContextMenu {
id: contextMenu
model: [
{
"label": I18n.tr("context-menu.widget-settings"),
"action": "widget-settings",
"icon": "settings"
},
]
onTriggered: action => {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
popupMenuWindow.close();
}
if (action === "widget-settings") {
BarService.openWidgetSettings(screen, section, sectionWidgetIndex, widgetId, widgetSettings);
}
}
}
BarPill { BarPill {
id: pill id: pill
@@ -141,5 +165,13 @@ Item {
} }
return lines.join("\n"); return lines.join("\n");
} }
onRightClicked: {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
const pos = BarService.getContextMenuPosition(pill, contextMenu.implicitWidth, contextMenu.implicitHeight);
contextMenu.openAtItem(pill, pos.x, pos.y);
popupMenuWindow.showContextMenu(contextMenu);
}
}
} }
} }
+40 -1
View File
@@ -1,9 +1,11 @@
import QtQuick import QtQuick
import QtQuick.Controls
import Quickshell import Quickshell
import qs.Commons import qs.Commons
import qs.Modules.Bar.Extras import qs.Modules.Bar.Extras
import qs.Services.Networking import qs.Services.Networking
import qs.Services.UI import qs.Services.UI
import qs.Widgets
Item { Item {
id: root id: root
@@ -33,6 +35,36 @@ Item {
implicitWidth: pill.width implicitWidth: pill.width
implicitHeight: pill.height implicitHeight: pill.height
NPopupContextMenu {
id: contextMenu
model: [
{
"label": BluetoothService.enabled ? I18n.tr("context-menu.disable-bluetooth") : I18n.tr("context-menu.enable-bluetooth"),
"action": "toggle-bluetooth",
"icon": BluetoothService.enabled ? "bluetooth-off" : "bluetooth"
},
{
"label": I18n.tr("context-menu.widget-settings"),
"action": "widget-settings",
"icon": "settings"
},
]
onTriggered: action => {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
popupMenuWindow.close();
}
if (action === "toggle-bluetooth") {
BluetoothService.setBluetoothEnabled(!BluetoothService.enabled);
} else if (action === "widget-settings") {
BarService.openWidgetSettings(screen, section, sectionWidgetIndex, widgetId, widgetSettings);
}
}
}
BarPill { BarPill {
id: pill id: pill
@@ -57,7 +89,14 @@ Item {
forceOpen: !isBarVertical && root.displayMode === "alwaysShow" forceOpen: !isBarVertical && root.displayMode === "alwaysShow"
forceClose: isBarVertical || root.displayMode === "alwaysHide" || BluetoothService.connectedDevices.length === 0 forceClose: isBarVertical || root.displayMode === "alwaysHide" || BluetoothService.connectedDevices.length === 0
onClicked: PanelService.getPanel("bluetoothPanel", screen)?.toggle(this) onClicked: PanelService.getPanel("bluetoothPanel", screen)?.toggle(this)
onRightClicked: BluetoothService.setBluetoothEnabled(!BluetoothService.enabled) onRightClicked: {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
const pos = BarService.getContextMenuPosition(pill, contextMenu.implicitWidth, contextMenu.implicitHeight);
contextMenu.openAtItem(pill, pos.x, pos.y);
popupMenuWindow.showContextMenu(contextMenu);
}
}
tooltipText: { tooltipText: {
if (pill.text !== "") { if (pill.text !== "") {
return pill.text; return pill.text;
+39 -3
View File
@@ -1,4 +1,5 @@
import QtQuick import QtQuick
import QtQuick.Controls
import Quickshell import Quickshell
import qs.Commons import qs.Commons
import qs.Modules.Bar.Extras import qs.Modules.Bar.Extras
@@ -74,6 +75,38 @@ Item {
onTriggered: pill.hide() onTriggered: pill.hide()
} }
NPopupContextMenu {
id: contextMenu
model: [
{
"label": I18n.tr("context-menu.open-display-settings"),
"action": "open-display-settings",
"icon": "sun"
},
{
"label": I18n.tr("context-menu.widget-settings"),
"action": "widget-settings",
"icon": "settings"
},
]
onTriggered: action => {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
popupMenuWindow.close();
}
if (action === "open-display-settings") {
var settingsPanel = PanelService.getPanel("settingsPanel", screen);
settingsPanel.requestedTab = SettingsPanel.Tab.Display;
settingsPanel.open();
} else if (action === "widget-settings") {
BarService.openWidgetSettings(screen, section, sectionWidgetIndex, widgetId, widgetSettings);
}
}
}
BarPill { BarPill {
id: pill id: pill
@@ -116,9 +149,12 @@ Item {
} }
onRightClicked: { onRightClicked: {
var settingsPanel = PanelService.getPanel("settingsPanel", screen); var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
settingsPanel.requestedTab = SettingsPanel.Tab.Display; if (popupMenuWindow) {
settingsPanel.open(); const pos = BarService.getContextMenuPosition(pill, contextMenu.implicitWidth, contextMenu.implicitHeight);
contextMenu.openAtItem(pill, pos.x, pos.y);
popupMenuWindow.showContextMenu(contextMenu);
}
} }
} }
} }
+46 -4
View File
@@ -1,7 +1,9 @@
import QtQuick import QtQuick
import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import Quickshell import Quickshell
import qs.Commons import qs.Commons
import qs.Modules.Bar.Extras
import qs.Services.UI import qs.Services.UI
import qs.Widgets import qs.Widgets
@@ -115,11 +117,42 @@ Rectangle {
} }
} }
NPopupContextMenu {
id: contextMenu
model: [
{
"label": I18n.tr("context-menu.open-calendar"),
"action": "open-calendar",
"icon": "calendar"
},
{
"label": I18n.tr("context-menu.widget-settings"),
"action": "widget-settings",
"icon": "settings"
},
]
onTriggered: action => {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
popupMenuWindow.close();
}
if (action === "open-calendar") {
PanelService.getPanel("calendarPanel", screen)?.toggle(root);
} else if (action === "widget-settings") {
BarService.openWidgetSettings(screen, section, sectionWidgetIndex, widgetId, widgetSettings);
}
}
}
MouseArea { MouseArea {
id: clockMouseArea id: clockMouseArea
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
hoverEnabled: true hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.RightButton
onEntered: { onEntered: {
if (!PanelService.getPanel("calendarPanel", screen)?.active) { if (!PanelService.getPanel("calendarPanel", screen)?.active) {
TooltipService.show(root, I18n.tr("clock.tooltip"), BarService.getTooltipDirection()); TooltipService.show(root, I18n.tr("clock.tooltip"), BarService.getTooltipDirection());
@@ -128,9 +161,18 @@ Rectangle {
onExited: { onExited: {
TooltipService.hide(); TooltipService.hide();
} }
onClicked: { onClicked: mouse => {
TooltipService.hide(); TooltipService.hide();
PanelService.getPanel("calendarPanel", screen)?.toggle(this); if (mouse.button === Qt.RightButton) {
} var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
const pos = BarService.getContextMenuPosition(root, contextMenu.implicitWidth, contextMenu.implicitHeight);
contextMenu.openAtItem(root, pos.x, pos.y);
popupMenuWindow.showContextMenu(contextMenu);
}
} else {
PanelService.getPanel("calendarPanel", screen)?.toggle(this);
}
}
} }
} }
+49 -2
View File
@@ -1,8 +1,10 @@
import QtQuick import QtQuick
import QtQuick.Controls
import QtQuick.Effects import QtQuick.Effects
import Quickshell import Quickshell
import Quickshell.Widgets import Quickshell.Widgets
import qs.Commons import qs.Commons
import qs.Modules.Bar.Extras
import qs.Services.System import qs.Services.System
import qs.Services.UI import qs.Services.UI
import qs.Widgets import qs.Widgets
@@ -50,16 +52,61 @@ NIconButton {
colorBgHover: useDistroLogo ? Color.mSurfaceVariant : Color.mHover colorBgHover: useDistroLogo ? Color.mSurfaceVariant : Color.mHover
colorBorder: Color.transparent colorBorder: Color.transparent
colorBorderHover: useDistroLogo ? Color.mHover : Color.transparent colorBorderHover: useDistroLogo ? Color.mHover : Color.transparent
NPopupContextMenu {
id: contextMenu
model: [
{
"label": I18n.tr("context-menu.open-launcher"),
"action": "open-launcher",
"icon": "search"
},
{
"label": I18n.tr("context-menu.open-settings"),
"action": "open-settings",
"icon": "adjustments"
},
{
"label": I18n.tr("context-menu.widget-settings"),
"action": "widget-settings",
"icon": "settings"
},
]
onTriggered: action => {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
popupMenuWindow.close();
}
if (action === "open-launcher") {
PanelService.getPanel("launcherPanel", screen)?.toggle();
} else if (action === "open-settings") {
PanelService.getPanel("settingsPanel", screen)?.toggle();
} else if (action === "widget-settings") {
BarService.openWidgetSettings(screen, section, sectionWidgetIndex, widgetId, widgetSettings);
}
}
}
onClicked: { onClicked: {
var controlCenterPanel = PanelService.getPanel("controlCenterPanel", screen); var controlCenterPanel = PanelService.getPanel("controlCenterPanel", screen);
if (Settings.data.controlCenter.position === "close_to_bar_button") { if (Settings.data.controlCenter.position === "close_to_bar_button") {
// Willopen the panel next to the bar button. // Will open the panel next to the bar button.
controlCenterPanel?.toggle(this); controlCenterPanel?.toggle(this);
} else { } else {
controlCenterPanel?.toggle(); controlCenterPanel?.toggle();
} }
} }
onRightClicked: PanelService.getPanel("settingsPanel", screen)?.toggle() onRightClicked: {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
const pos = BarService.getContextMenuPosition(root, contextMenu.implicitWidth, contextMenu.implicitHeight);
contextMenu.openAtItem(root, pos.x, pos.y);
popupMenuWindow.showContextMenu(contextMenu);
}
}
onMiddleClicked: PanelService.getPanel("launcherPanel", screen)?.toggle() onMiddleClicked: PanelService.getPanel("launcherPanel", screen)?.toggle()
IconImage { IconImage {
+33 -4
View File
@@ -1,4 +1,5 @@
import QtQuick import QtQuick
import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
@@ -39,6 +40,29 @@ Item {
implicitWidth: pill.width implicitWidth: pill.width
implicitHeight: pill.height implicitHeight: pill.height
NPopupContextMenu {
id: contextMenu
model: [
{
"label": I18n.tr("context-menu.widget-settings"),
"action": "widget-settings",
"icon": "settings"
},
]
onTriggered: action => {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
popupMenuWindow.close();
}
if (action === "widget-settings") {
BarService.openWidgetSettings(screen, section, sectionWidgetIndex, widgetId, widgetSettings);
}
}
}
BarPill { BarPill {
id: pill id: pill
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -54,9 +78,14 @@ Item {
}) })
forceOpen: root.displayMode === "forceOpen" forceOpen: root.displayMode === "forceOpen"
forceClose: root.displayMode === "alwaysHide" forceClose: root.displayMode === "alwaysHide"
onClicked: onClicked: {}
onRightClicked: {
// You could open keyboard settings here if needed. var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
{} if (popupMenuWindow) {
const pos = BarService.getContextMenuPosition(pill, contextMenu.implicitWidth, contextMenu.implicitHeight);
contextMenu.openAtItem(pill, pos.x, pos.y);
popupMenuWindow.showContextMenu(contextMenu);
}
}
} }
} }
+42 -1
View File
@@ -1,17 +1,20 @@
import QtQuick import QtQuick
import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
import qs.Commons import qs.Commons
import qs.Modules.Bar.Extras
import qs.Modules.Panels.Settings import qs.Modules.Panels.Settings
import qs.Services.Keyboard import qs.Services.Keyboard
import qs.Services.UI import qs.Services.UI
import qs.Widgets import qs.Widgets
//import qs.Modules.Bar.Extras
Rectangle { Rectangle {
id: root id: root
property ShellScreen screen
property string widgetId: "" property string widgetId: ""
property string section: "" property string section: ""
property int sectionWidgetIndex: -1 property int sectionWidgetIndex: -1
@@ -47,6 +50,44 @@ Rectangle {
radius: Style.radiusM radius: Style.radiusM
color: Style.capsuleColor color: Style.capsuleColor
NPopupContextMenu {
id: contextMenu
model: [
{
"label": I18n.tr("context-menu.widget-settings"),
"action": "widget-settings",
"icon": "settings"
},
]
onTriggered: action => {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
popupMenuWindow.close();
}
if (action === "widget-settings") {
BarService.openWidgetSettings(screen, section, sectionWidgetIndex, widgetId, widgetSettings);
}
}
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.RightButton
onClicked: mouse => {
if (mouse.button === Qt.RightButton) {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
const pos = BarService.getContextMenuPosition(root, contextMenu.implicitWidth, contextMenu.implicitHeight);
contextMenu.openAtItem(root, pos.x, pos.y);
popupMenuWindow.showContextMenu(contextMenu);
}
}
}
}
Item { Item {
id: layout id: layout
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
+68 -9
View File
@@ -3,6 +3,7 @@ import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import Quickshell import Quickshell
import qs.Commons import qs.Commons
import qs.Modules.Bar.Extras
import qs.Services.Media import qs.Services.Media
import qs.Services.UI import qs.Services.UI
import qs.Widgets import qs.Widgets
@@ -162,6 +163,58 @@ Item {
pointSize: Style.fontSizeS * scaling pointSize: Style.fontSizeS * scaling
} }
NPopupContextMenu {
id: contextMenu
model: {
var items = [];
if (hasActivePlayer && MediaService.canPlay) {
items.push({
"label": MediaService.isPlaying ? I18n.tr("context-menu.pause") : I18n.tr("context-menu.play"),
"action": "play-pause",
"icon": MediaService.isPlaying ? "media-pause" : "media-play"
});
}
if (hasActivePlayer && MediaService.canGoPrevious) {
items.push({
"label": I18n.tr("context-menu.previous"),
"action": "previous",
"icon": "media-prev"
});
}
if (hasActivePlayer && MediaService.canGoNext) {
items.push({
"label": I18n.tr("context-menu.next"),
"action": "next",
"icon": "media-next"
});
}
items.push({
"label": I18n.tr("context-menu.widget-settings"),
"action": "widget-settings",
"icon": "settings"
});
return items;
}
onTriggered: action => {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
popupMenuWindow.close();
}
if (action === "play-pause") {
MediaService.playPause();
} else if (action === "previous") {
MediaService.previous();
} else if (action === "next") {
MediaService.next();
} else if (action === "widget-settings") {
BarService.openWidgetSettings(screen, section, sectionWidgetIndex, widgetId, widgetSettings);
}
}
}
Rectangle { Rectangle {
id: mediaMini id: mediaMini
visible: root.visible visible: root.visible
@@ -466,18 +519,24 @@ Item {
cursorShape: hasActivePlayer ? Qt.PointingHandCursor : Qt.ArrowCursor cursorShape: hasActivePlayer ? Qt.PointingHandCursor : Qt.ArrowCursor
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
onClicked: mouse => { onClicked: mouse => {
if (!hasActivePlayer || !MediaService.currentPlayer || !MediaService.canPlay) {
return;
}
if (mouse.button === Qt.LeftButton) { if (mouse.button === Qt.LeftButton) {
if (!hasActivePlayer || !MediaService.currentPlayer || !MediaService.canPlay) {
return;
}
MediaService.playPause(); MediaService.playPause();
} else if (mouse.button == Qt.RightButton) { } else if (mouse.button === Qt.RightButton) {
MediaService.next();
TooltipService.hide();
} else if (mouse.button == Qt.MiddleButton) {
MediaService.previous();
TooltipService.hide(); TooltipService.hide();
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
const pos = BarService.getContextMenuPosition(mediaMini, contextMenu.implicitWidth, contextMenu.implicitHeight);
contextMenu.openAtItem(mediaMini, pos.x, pos.y);
popupMenuWindow.showContextMenu(contextMenu);
}
} else if (mouse.button === Qt.MiddleButton) {
if (hasActivePlayer && MediaService.canGoPrevious) {
MediaService.previous();
TooltipService.hide();
}
} }
} }
+49 -4
View File
@@ -1,4 +1,5 @@
import QtQuick import QtQuick
import QtQuick.Controls
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
import Quickshell.Services.Pipewire import Quickshell.Services.Pipewire
@@ -84,6 +85,47 @@ Item {
} }
} }
function openExternalMixer() {
Quickshell.execDetached(["sh", "-c", "pwvucontrol || pavucontrol"]);
}
NPopupContextMenu {
id: contextMenu
model: [
{
"label": I18n.tr("context-menu.toggle-mute"),
"action": "toggle-mute",
"icon": AudioService.inputMuted ? "microphone-off" : "microphone"
},
{
"label": I18n.tr("context-menu.open-mixer"),
"action": "open-mixer",
"icon": "adjustments"
},
{
"label": I18n.tr("context-menu.widget-settings"),
"action": "widget-settings",
"icon": "settings"
},
]
onTriggered: action => {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
popupMenuWindow.close();
}
if (action === "toggle-mute") {
AudioService.setInputMuted(!AudioService.inputMuted);
} else if (action === "open-mixer") {
root.openExternalMixer();
} else if (action === "widget-settings") {
BarService.openWidgetSettings(screen, section, sectionWidgetIndex, widgetId, widgetSettings);
}
}
}
BarPill { BarPill {
id: pill id: pill
@@ -117,10 +159,13 @@ Item {
PanelService.getPanel("audioPanel", screen)?.toggle(this); PanelService.getPanel("audioPanel", screen)?.toggle(this);
} }
onRightClicked: { onRightClicked: {
AudioService.setInputMuted(!AudioService.inputMuted); var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
} if (popupMenuWindow) {
onMiddleClicked: { const pos = BarService.getContextMenuPosition(pill, contextMenu.implicitWidth, contextMenu.implicitHeight);
Quickshell.execDetached(["pwvucontrol"]); contextMenu.openAtItem(pill, pos.x, pos.y);
popupMenuWindow.showContextMenu(contextMenu);
}
} }
onMiddleClicked: root.openExternalMixer()
} }
} }
+46 -1
View File
@@ -4,6 +4,7 @@ import QtQuick.Layouts
import Quickshell import Quickshell
import Quickshell.Wayland import Quickshell.Wayland
import qs.Commons import qs.Commons
import qs.Modules.Bar.Extras
import qs.Services.System import qs.Services.System
import qs.Services.UI import qs.Services.UI
import qs.Widgets import qs.Widgets
@@ -56,12 +57,56 @@ NIconButton {
colorBorder: Color.transparent colorBorder: Color.transparent
colorBorderHover: Color.transparent colorBorderHover: Color.transparent
NPopupContextMenu {
id: contextMenu
model: [
{
"label": NotificationService.doNotDisturb ? I18n.tr("context-menu.disable-dnd") : I18n.tr("context-menu.enable-dnd"),
"action": "toggle-dnd",
"icon": NotificationService.doNotDisturb ? "bell" : "bell-off"
},
{
"label": I18n.tr("context-menu.clear-history"),
"action": "clear-history",
"icon": "trash"
},
{
"label": I18n.tr("context-menu.widget-settings"),
"action": "widget-settings",
"icon": "settings"
},
]
onTriggered: action => {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
popupMenuWindow.close();
}
if (action === "toggle-dnd") {
NotificationService.doNotDisturb = !NotificationService.doNotDisturb;
} else if (action === "clear-history") {
NotificationService.clearHistory();
} else if (action === "widget-settings") {
BarService.openWidgetSettings(screen, section, sectionWidgetIndex, widgetId, widgetSettings);
}
}
}
onClicked: { onClicked: {
var panel = PanelService.getPanel("notificationHistoryPanel", screen); var panel = PanelService.getPanel("notificationHistoryPanel", screen);
panel?.toggle(this); panel?.toggle(this);
} }
onRightClicked: NotificationService.doNotDisturb = !NotificationService.doNotDisturb onRightClicked: {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
const pos = BarService.getContextMenuPosition(root, contextMenu.implicitWidth, contextMenu.implicitHeight);
contextMenu.openAtItem(root, pos.x, pos.y);
popupMenuWindow.showContextMenu(contextMenu);
}
}
Loader { Loader {
anchors.right: parent.right anchors.right: parent.right
+34
View File
@@ -1,7 +1,9 @@
import QtQuick import QtQuick
import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import Quickshell import Quickshell
import qs.Commons import qs.Commons
import qs.Modules.Bar.Extras
import qs.Services.UI import qs.Services.UI
import qs.Widgets import qs.Widgets
@@ -55,5 +57,37 @@ NIconButton {
colorFg: root.iconColor colorFg: root.iconColor
colorBorder: Color.transparent colorBorder: Color.transparent
colorBorderHover: Color.transparent colorBorderHover: Color.transparent
NPopupContextMenu {
id: contextMenu
model: [
{
"label": I18n.tr("context-menu.widget-settings"),
"action": "widget-settings",
"icon": "settings"
},
]
onTriggered: action => {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
popupMenuWindow.close();
}
if (action === "widget-settings") {
BarService.openWidgetSettings(screen, section, sectionWidgetIndex, widgetId, widgetSettings);
}
}
}
onClicked: PanelService.getPanel("sessionMenuPanel", screen)?.toggle() onClicked: PanelService.getPanel("sessionMenuPanel", screen)?.toggle()
onRightClicked: {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
const pos = BarService.getContextMenuPosition(root, contextMenu.implicitWidth, contextMenu.implicitHeight);
contextMenu.openAtItem(root, pos.x, pos.y);
popupMenuWindow.showContextMenu(contextMenu);
}
}
} }
+40
View File
@@ -1,7 +1,9 @@
import QtQuick import QtQuick
import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import Quickshell import Quickshell
import qs.Commons import qs.Commons
import qs.Modules.Bar.Extras
import qs.Modules.Panels.Settings import qs.Modules.Panels.Settings
import qs.Services.System import qs.Services.System
import qs.Services.UI import qs.Services.UI
@@ -111,6 +113,44 @@ Rectangle {
radius: Style.radiusM radius: Style.radiusM
color: Style.capsuleColor color: Style.capsuleColor
NPopupContextMenu {
id: contextMenu
model: [
{
"label": I18n.tr("context-menu.widget-settings"),
"action": "widget-settings",
"icon": "settings"
},
]
onTriggered: action => {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
popupMenuWindow.close();
}
if (action === "widget-settings") {
BarService.openWidgetSettings(screen, section, sectionWidgetIndex, widgetId, widgetSettings);
}
}
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.RightButton
onClicked: mouse => {
if (mouse.button === Qt.RightButton) {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
const pos = BarService.getContextMenuPosition(root, contextMenu.implicitWidth, contextMenu.implicitHeight);
contextMenu.openAtItem(root, pos.x, pos.y);
popupMenuWindow.showContextMenu(contextMenu);
}
}
}
}
// Status indicator component definition // Status indicator component definition
Component { Component {
id: statusIndicatorComponent id: statusIndicatorComponent
+34
View File
@@ -1,7 +1,9 @@
import QtQuick import QtQuick
import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import Quickshell import Quickshell
import qs.Commons import qs.Commons
import qs.Modules.Bar.Extras
import qs.Services.UI import qs.Services.UI
import qs.Widgets import qs.Widgets
@@ -20,6 +22,30 @@ NIconButton {
colorFg: Color.mOnSurface colorFg: Color.mOnSurface
colorBorder: Color.transparent colorBorder: Color.transparent
colorBorderHover: Color.transparent colorBorderHover: Color.transparent
NPopupContextMenu {
id: contextMenu
model: [
{
"label": I18n.tr("context-menu.random-wallpaper"),
"action": "random-wallpaper",
"icon": "dice"
},
]
onTriggered: action => {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
popupMenuWindow.close();
}
if (action === "random-wallpaper") {
WallpaperService.setRandomWallpaper();
}
}
}
onClicked: { onClicked: {
var wallpaperPanel = PanelService.getPanel("wallpaperPanel", screen); var wallpaperPanel = PanelService.getPanel("wallpaperPanel", screen);
if (Settings.data.wallpaper.panelPosition === "follow_bar") { if (Settings.data.wallpaper.panelPosition === "follow_bar") {
@@ -28,4 +54,12 @@ NIconButton {
wallpaperPanel?.toggle(); wallpaperPanel?.toggle();
} }
} }
onRightClicked: {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
const pos = BarService.getContextMenuPosition(root, contextMenu.implicitWidth, contextMenu.implicitHeight);
contextMenu.openAtItem(root, pos.x, pos.y);
popupMenuWindow.showContextMenu(contextMenu);
}
}
} }
+40 -1
View File
@@ -1,9 +1,11 @@
import QtQuick import QtQuick
import QtQuick.Controls
import Quickshell import Quickshell
import qs.Commons import qs.Commons
import qs.Modules.Bar.Extras import qs.Modules.Bar.Extras
import qs.Services.Networking import qs.Services.Networking
import qs.Services.UI import qs.Services.UI
import qs.Widgets
Item { Item {
id: root id: root
@@ -33,6 +35,36 @@ Item {
implicitWidth: pill.width implicitWidth: pill.width
implicitHeight: pill.height implicitHeight: pill.height
NPopupContextMenu {
id: contextMenu
model: [
{
"label": Settings.data.network.wifiEnabled ? I18n.tr("context-menu.disable-wifi") : I18n.tr("context-menu.enable-wifi"),
"action": "toggle-wifi",
"icon": Settings.data.network.wifiEnabled ? "wifi-off" : "wifi"
},
{
"label": I18n.tr("context-menu.widget-settings"),
"action": "widget-settings",
"icon": "settings"
},
]
onTriggered: action => {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
popupMenuWindow.close();
}
if (action === "toggle-wifi") {
NetworkService.setWifiEnabled(!Settings.data.network.wifiEnabled);
} else if (action === "widget-settings") {
BarService.openWidgetSettings(screen, section, sectionWidgetIndex, widgetId, widgetSettings);
}
}
}
BarPill { BarPill {
id: pill id: pill
@@ -79,7 +111,14 @@ Item {
forceOpen: !isBarVertical && root.displayMode === "alwaysShow" forceOpen: !isBarVertical && root.displayMode === "alwaysShow"
forceClose: isBarVertical || root.displayMode === "alwaysHide" || !pill.text forceClose: isBarVertical || root.displayMode === "alwaysHide" || !pill.text
onClicked: PanelService.getPanel("wifiPanel", screen)?.toggle(this) onClicked: PanelService.getPanel("wifiPanel", screen)?.toggle(this)
onRightClicked: NetworkService.setWifiEnabled(!Settings.data.network.wifiEnabled) onRightClicked: {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
const pos = BarService.getContextMenuPosition(pill, contextMenu.implicitWidth, contextMenu.implicitHeight);
contextMenu.openAtItem(pill, pos.x, pos.y);
popupMenuWindow.showContextMenu(contextMenu);
}
}
tooltipText: { tooltipText: {
if (pill.text !== "") { if (pill.text !== "") {
return pill.text; return pill.text;
+39
View File
@@ -6,6 +6,7 @@ import QtQuick.Window
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
import qs.Commons import qs.Commons
import qs.Modules.Bar.Extras
import qs.Services.Compositor import qs.Services.Compositor
import qs.Services.UI import qs.Services.UI
import qs.Widgets import qs.Widgets
@@ -220,6 +221,29 @@ Item {
} }
} }
NPopupContextMenu {
id: contextMenu
model: [
{
"label": I18n.tr("context-menu.widget-settings"),
"action": "widget-settings",
"icon": "settings"
},
]
onTriggered: action => {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
popupMenuWindow.close();
}
if (action === "widget-settings") {
BarService.openWidgetSettings(screen, section, sectionWidgetIndex, widgetId, widgetSettings);
}
}
}
Rectangle { Rectangle {
id: workspaceBackground id: workspaceBackground
width: isVertical ? Style.capsuleHeight : parent.width width: isVertical ? Style.capsuleHeight : parent.width
@@ -229,6 +253,21 @@ Item {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.RightButton
onClicked: mouse => {
if (mouse.button === Qt.RightButton) {
var popupMenuWindow = PanelService.getPopupMenuWindow(screen);
if (popupMenuWindow) {
const pos = BarService.getContextMenuPosition(workspaceBackground, contextMenu.implicitWidth, contextMenu.implicitHeight);
contextMenu.openAtItem(workspaceBackground, pos.x, pos.y);
popupMenuWindow.showContextMenu(contextMenu);
}
}
}
}
} }
// Debounce timer for wheel interactions // Debounce timer for wheel interactions