From 2179468cafeef715675e168b436f81d43f3efb84 Mon Sep 17 00:00:00 2001 From: bbedward Date: Mon, 8 Sep 2025 17:26:15 -0400 Subject: [PATCH] add open-topbar-on-overview for niri --- Common/SettingsData.qml | 18 ++++++++----- Modules/Settings/TopBarTab.qml | 46 ++++++++++++++++++++++++++++++++++ Modules/TopBar/TopBar.qml | 2 +- README.md | 4 +-- 4 files changed, 61 insertions(+), 9 deletions(-) diff --git a/Common/SettingsData.qml b/Common/SettingsData.qml index fae2ff78..b9b6e576 100644 --- a/Common/SettingsData.qml +++ b/Common/SettingsData.qml @@ -89,6 +89,7 @@ Singleton { property real cornerRadius: 12 property bool notificationOverlayEnabled: false property bool topBarAutoHide: false + property bool topBarOpenOnOverview: false property bool topBarVisible: true property real topBarSpacing: 4 property real topBarBottomGap: 0 @@ -252,6 +253,7 @@ Singleton { cornerRadius = settings.cornerRadius !== undefined ? settings.cornerRadius : 12 notificationOverlayEnabled = settings.notificationOverlayEnabled !== undefined ? settings.notificationOverlayEnabled : false topBarAutoHide = settings.topBarAutoHide !== undefined ? settings.topBarAutoHide : false + topBarOpenOnOverview = settings.topBarOpenOnOverview !== undefined ? settings.topBarOpenOnOverview : false topBarVisible = settings.topBarVisible !== undefined ? settings.topBarVisible : true notificationTimeoutLow = settings.notificationTimeoutLow !== undefined ? settings.notificationTimeoutLow : 5000 notificationTimeoutNormal = settings.notificationTimeoutNormal !== undefined ? settings.notificationTimeoutNormal : 5000 @@ -348,6 +350,7 @@ Singleton { "cornerRadius": cornerRadius, "notificationOverlayEnabled": notificationOverlayEnabled, "topBarAutoHide": topBarAutoHide, + "topBarOpenOnOverview": topBarOpenOnOverview, "topBarVisible": topBarVisible, "topBarSpacing": topBarSpacing, "topBarBottomGap": topBarBottomGap, @@ -776,12 +779,10 @@ Singleton { // This preserves the user's existing qt6ct configuration return } - var script = "mkdir -p " + _configDir + "/qt5ct " + _configDir + "/qt6ct " + _configDir + "/environment.d 2>/dev/null || true\n" + "update_qt_config() {\n" + " local config_file=\"$1\"\n" - + " local theme_name=\"$2\"\n" + " if [ -f \"$config_file\" ]; then\n" + " if grep -q '^\\[Appearance\\]' \"$config_file\"; then\n" + " awk -v theme=\"$theme_name\" '\n" + " BEGIN { in_appearance = 0; icon_theme_added = 0 }\n" + " /^\\[Appearance\\]/ { in_appearance = 1; print; next }\n" + " /^\\[/ && !/^\\[Appearance\\]/ { \n" + " if (in_appearance && !icon_theme_added) { \n" - + " print \"icon_theme=\" theme; icon_theme_added = 1 \n" + " } \n" + " in_appearance = 0; print; next \n" + " }\n" + " in_appearance && /^icon_theme=/ { \n" + " if (!icon_theme_added) { \n" + " print \"icon_theme=\" theme; icon_theme_added = 1 \n" + " } \n" - + " next \n" + " }\n" + " { print }\n" + " END { if (in_appearance && !icon_theme_added) print \"icon_theme=\" theme }\n" + " ' \"$config_file\" > \"$config_file.tmp\" && mv \"$config_file.tmp\" \"$config_file\"\n" + " else\n" + " printf '\\n[Appearance]\\nicon_theme=%s\\n' \"$theme_name\" >> \"$config_file\"\n" + " fi\n" - + " else\n" + " printf '[Appearance]\\nicon_theme=%s\\n' \"$theme_name\" > \"$config_file\"\n" + " fi\n" + "}\n" + "update_qt_config " + _configDir + "/qt5ct/qt5ct.conf " + _shq( - qtThemeName) + "\n" + "update_qt_config " + _configDir + "/qt6ct/qt6ct.conf " + _shq(qtThemeName) + "\n" + "rm -rf " + home + "/.cache/icon-cache " + home + "/.cache/thumbnails 2>/dev/null || true\n" + var script = "mkdir -p " + _configDir + "/qt5ct " + _configDir + "/qt6ct " + _configDir + "/environment.d 2>/dev/null || true\n" + "update_qt_icon_theme() {\n" + " local config_file=\"$1\"\n" + + " local theme_name=\"$2\"\n" + " if [ -f \"$config_file\" ]; then\n" + " if grep -q '^\\[Appearance\\]' \"$config_file\"; then\n" + " if grep -q '^icon_theme=' \"$config_file\"; then\n" + " sed -i \"s/^icon_theme=.*/icon_theme=$theme_name/\" \"$config_file\"\n" + " else\n" + " sed -i \"/^\\[Appearance\\]/a icon_theme=$theme_name\" \"$config_file\"\n" + " fi\n" + + " else\n" + " printf '\\n[Appearance]\\nicon_theme=%s\\n' \"$theme_name\" >> \"$config_file\"\n" + " fi\n" + " else\n" + " printf '[Appearance]\\nicon_theme=%s\\n' \"$theme_name\" > \"$config_file\"\n" + " fi\n" + "}\n" + "update_qt_icon_theme " + _configDir + "/qt5ct/qt5ct.conf " + _shq( + qtThemeName) + "\n" + "update_qt_icon_theme " + _configDir + "/qt6ct/qt6ct.conf " + _shq(qtThemeName) + "\n" + "rm -rf " + home + "/.cache/icon-cache " + home + "/.cache/thumbnails 2>/dev/null || true\n" Quickshell.execDetached(["sh", "-lc", script]) } @@ -876,6 +877,11 @@ Singleton { saveSettings() } + function setTopBarOpenOnOverview(enabled) { + topBarOpenOnOverview = enabled + saveSettings() + } + function setTopBarVisible(visible) { topBarVisible = visible saveSettings() diff --git a/Modules/Settings/TopBarTab.qml b/Modules/Settings/TopBarTab.qml index 54382a5e..3860f288 100644 --- a/Modules/Settings/TopBarTab.qml +++ b/Modules/Settings/TopBarTab.qml @@ -577,6 +577,52 @@ Item { } } } + + Row { + width: parent.width + spacing: Theme.spacingM + visible: SettingsData.topBarAutoHide && CompositorService.isNiri + + DankIcon { + name: "fullscreen" + size: Theme.iconSize + color: Theme.primary + anchors.verticalCenter: parent.verticalCenter + } + + Column { + width: parent.width - Theme.iconSize - Theme.spacingM + - overviewToggle.width - Theme.spacingM + spacing: Theme.spacingXS + anchors.verticalCenter: parent.verticalCenter + + StyledText { + text: "Open on Overview" + font.pixelSize: Theme.fontSizeLarge + font.weight: Font.Medium + color: Theme.surfaceText + } + + StyledText { + text: "Always show the top bar when Niri's overview is open" + font.pixelSize: Theme.fontSizeSmall + color: Theme.surfaceVariantText + wrapMode: Text.WordWrap + width: parent.width + } + } + + DankToggle { + id: overviewToggle + + anchors.verticalCenter: parent.verticalCenter + checked: SettingsData.topBarOpenOnOverview + onToggled: toggled => { + return SettingsData.setTopBarOpenOnOverview( + toggled) + } + } + } } } diff --git a/Modules/TopBar/TopBar.qml b/Modules/TopBar/TopBar.qml index aa222bd4..dd3acd56 100644 --- a/Modules/TopBar/TopBar.qml +++ b/Modules/TopBar/TopBar.qml @@ -139,7 +139,7 @@ PanelWindow { property real backgroundTransparency: SettingsData.topBarTransparency property bool autoHide: SettingsData.topBarAutoHide - property bool reveal: SettingsData.topBarVisible && (!autoHide || topBarMouseArea.containsMouse || hasActivePopout) + property bool reveal: SettingsData.topBarVisible && (!autoHide || topBarMouseArea.containsMouse || hasActivePopout || (SettingsData.topBarOpenOnOverview && CompositorService.isNiri && NiriService.inOverview)) property var notepadInstance: null property bool notepadInstanceVisible: notepadInstance?.notepadVisible ?? false diff --git a/README.md b/README.md index 14003f79..0c3fcbaf 100644 --- a/README.md +++ b/README.md @@ -207,7 +207,7 @@ mkdir ~/.config/quickshell && git clone https://github.com/AvengeMedia/DankMater **3.2. Install latest dms CLI** ```bash -ARCH=amd64 curl -L https://github.com/AvengeMedia/danklinux/releases/latest/download/dms-${ARCH}.gz | gunzip | sudo tee /usr/local/bin/dms > /dev/null && sudo chmod +x /usr/local/bin/dms +sudo sh -c "curl -L https://github.com/AvengeMedia/danklinux/releases/latest/download/dms-$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').gz | gunzip | tee /usr/local/bin/dms > /dev/null && chmod +x /usr/local/bin/dms" ``` **4. Optional Features (system monitoring, clipboard history, brightness controls, etc.)** @@ -231,7 +231,7 @@ sudo dnf copr enable heus-sueh/packages && sudo dnf install matugen `dgop` is available via AUR and a nix flake, other distributions can install it manually. ```bash -ARCH=amd64 curl -L https://github.com/AvengeMedia/dgop/releases/latest/download/dgop-linux-${ARCH}.gz | gunzip | sudo tee /usr/local/bin/dgop > /dev/null && sudo chmod +x /usr/local/bin/dgop +sudo sh -c "curl -L https://github.com/AvengeMedia/dgop/releases/latest/download/dgop-linux-$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').gz | gunzip | tee /usr/local/bin/dgop > /dev/null && chmod +x /usr/local/bin/dgop" ``` **Optional Requirement Overview**