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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions quickshell/Common/Paths.qml
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,33 @@ Singleton {

return desktopEntry && desktopEntry.name ? desktopEntry.name : appId;
}

function isAppIdMatch(id: string, target: string, desktopId: string): bool {
id = id ? String(id).toLowerCase().trim() : "";
desktopId = desktopId ? String(desktopId).toLowerCase().trim() : "";
target = target ? String(target).toLowerCase().trim() : "";
if (!target)
return false;

// 1. Substring match
if (id.includes(target) || desktopId.includes(target)) {
return true;
}

// 2. Match reverse-DNS segments (e.g. app.zen_browser.zen -> zen)
if (target.indexOf(".") !== -1) {
const parts = target.split(".");
const lastPart = parts[parts.length - 1];
if (lastPart && (id.includes(lastPart) || desktopId.includes(lastPart))) {
return true;
}
}

// 3. Bidirectional match (longer excluded name contains shorter app id)
if (id.length >= 3 && target.includes(id)) {
return true;
}

return false;
}
}
22 changes: 22 additions & 0 deletions quickshell/Common/SessionData.qml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ Singleton {
property real longitude: 0.0
property bool nightModeUseIPLocation: false
property string nightModeLocationProvider: ""
property bool nightModePaused: false
property var nightModeExcludedAppsMatchesCache: []

property bool themeModeAutoEnabled: false
property string themeModeAutoMode: "time"
Expand Down Expand Up @@ -795,6 +797,26 @@ Singleton {
saveSettings();
}

function cacheNightModeExcludedAppMatch(app: string) {
app = app ? String(app).toLowerCase().trim() : "";
var moddedList = nightModeExcludedAppsMatchesCache ? nightModeExcludedAppsMatchesCache.slice() : [];
if (!moddedList.includes(app)) {
moddedList.push(app);
nightModeExcludedAppsMatchesCache = moddedList;
saveSettings();
}
}

function resetNightModeExcludedAppsMatchesCache() {
nightModeExcludedAppsMatchesCache = [];
saveSettings();
}

function setNightModePaused(paused: bool) {
nightModePaused = paused;
saveSettings();
}

function setNightModeEnabled(enabled) {
nightModeEnabled = enabled;
saveSettings();
Expand Down
73 changes: 55 additions & 18 deletions quickshell/Common/SettingsData.qml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ Singleton {
property bool useFahrenheit: false
property string windSpeedUnit: "kmh"
property bool nightModeEnabled: false
property bool nightModeExcludeFullscreen: false
property var nightModeExcludedApps: []
property int animationSpeed: SettingsData.AnimationSpeed.Short
property int customAnimationDuration: 500
property bool syncComponentAnimationSpeeds: true
Expand Down Expand Up @@ -3161,29 +3163,64 @@ Singleton {
saveSettings();
}

function addMediaExcludePlayer(identity) {
if (identity === undefined || identity === null)
return;
var normalizedIdentity = identity.toString().trim().toLowerCase();
function setNightModeExcludeFullscreen(enabled) {
nightModeExcludeFullscreen = enabled;
saveSettings();
}

function normalizeAppId(id: string): string {
return (id && id.toString().toLowerCase().trim()) || "";
}

function addAppIdToList(identity: string, appList: list<string>): list<string> {
identity = identity ?? "";
appList = appList ?? [];
if (!identity)
return appList;

var normalizedIdentity = normalizeAppId(identity);
if (!normalizedIdentity)
return;
var list = mediaExcludePlayers ? mediaExcludePlayers.slice() : [];
var normalizedList = list.map(function (id) {
return id ? id.toString().trim().toLowerCase() : "";
});
if (normalizedList.indexOf(normalizedIdentity) >= 0)
return;
list.push(normalizedIdentity);
mediaExcludePlayers = list;
return appList;

var cleanList = appList.map(id => id ? normalizeAppId(id) : "").filter(id => id !== "");
if (cleanList.includes(normalizedIdentity))
return cleanList;

cleanList.push(normalizedIdentity);
return cleanList;
}

function removeAppIdFromList(index: int, appList: list<string>): list<string> {
var moddedList = appList ? appList.slice() : [];
if (index < 0 || index >= moddedList.length)
return moddedList;
moddedList.splice(index, 1);
return moddedList;
}

function addNightModeExcludedApp(identity: string) {
var newList = addAppIdToList(identity, nightModeExcludedApps);
nightModeExcludedApps = newList;
SessionData.resetNightModeExcludedAppsMatchesCache();
saveSettings();
}

function removeNightModeExcludedApp(index: int) {
var newList = removeAppIdFromList(index, nightModeExcludedApps);
nightModeExcludedApps = newList;
SessionData.resetNightModeExcludedAppsMatchesCache();
saveSettings();
}

function addMediaExcludePlayer(identity) {
var newList = addAppIdToList(identity, mediaExcludePlayers);
mediaExcludePlayers = newList;
saveSettings();
}

function removeMediaExcludePlayer(index) {
var list = mediaExcludePlayers ? mediaExcludePlayers.slice() : [];
if (index < 0 || index >= list.length)
return;
list.splice(index, 1);
mediaExcludePlayers = list;
var newList = removeAppIdFromList(index, mediaExcludePlayers);
mediaExcludePlayers = newList;
saveSettings();
}

Expand Down
2 changes: 2 additions & 0 deletions quickshell/Common/settings/SessionSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ var SPEC = {
longitude: { def: 0.0 },
nightModeUseIPLocation: { def: false },
nightModeLocationProvider: { def: "" },
nightModePaused: { def: "" },
nightModeExcludedAppsMatchesCache: { def: [] },

themeModeAutoEnabled: { def: false },
themeModeAutoMode: { def: "time" },
Expand Down
2 changes: 2 additions & 0 deletions quickshell/Common/settings/SettingsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ var SPEC = {
useFahrenheit: { def: false },
windSpeedUnit: { def: "kmh" },
nightModeEnabled: { def: false },
nightModeExcludeFullscreen: { def: false },
nightModeExcludedApps: { def: [] },
animationSpeed: { def: 1 },
customAnimationDuration: { def: 500 },
syncComponentAnimationSpeeds: { def: true },
Expand Down
4 changes: 3 additions & 1 deletion quickshell/Modals/Settings/SettingsContent.qml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ FocusScope {
visible: active
focus: active

sourceComponent: GammaControlTab {}
sourceComponent: GammaControlTab {
parentModal: root.parentModal
}

onActiveChanged: {
if (active && item)
Expand Down
37 changes: 29 additions & 8 deletions quickshell/Modules/Settings/AutoStartTab.qml
Original file line number Diff line number Diff line change
Expand Up @@ -353,19 +353,40 @@ Item {
desktopApps = [];
}

DankFlickable {
anchors.fill: parent
clip: true
contentHeight: mainColumn.height + Theme.spacingXL
contentWidth: width

AppBrowserPopup {
Loader {
id: popupLoader
active: false
sourceComponent: AppBrowserPopup {
id: appBrowserPopup
appsModel: root.desktopApps
parentModal: root.parentModal
onAppSelected: appId => root.newEntryDesktopId = appId
}

function recreatePopup() {
log.debug("Recreating popup");
popupLoader.active = false;
popupLoader.active = true;
}

function showPopup() {
if (!popupLoader.item) {
popupLoader.active = true;
}
popupLoader.item.show();
if (!popupLoader.item.visible) {
recreatePopup();
popupLoader.item.show();
}
}
}

DankFlickable {
anchors.fill: parent
clip: true
contentHeight: mainColumn.height + Theme.spacingXL
contentWidth: width

Column {
id: mainColumn
topPadding: 4
Expand Down Expand Up @@ -486,7 +507,7 @@ Item {
id: browseButton
text: I18n.tr("Browse")
iconName: "search"
onClicked: appBrowserPopup.show()
onClicked: popupLoader.showPopup()
}
}

Expand Down
Loading
Loading