mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
autofmt
This commit is contained in:
@@ -8,7 +8,6 @@ import qs.Commons
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
|
||||
property bool isLoaded: false
|
||||
property string langCode: ""
|
||||
property string systemDetectedLangCode: ""
|
||||
|
||||
@@ -665,24 +665,22 @@ ColumnLayout {
|
||||
}
|
||||
}
|
||||
NCheckbox {
|
||||
label: "Vicinae"
|
||||
description: ProgramCheckerService.vicinaeAvailable
|
||||
? I18n.tr("settings.color-scheme.templates.programs.vicinae.description", {
|
||||
"filepath": "~/.local/share/vicinae/themes/matugen.toml"
|
||||
})
|
||||
: I18n.tr("settings.color-scheme.templates.programs.vicinae.description-missing", {
|
||||
"app": "vicinae"
|
||||
})
|
||||
checked: Settings.data.templates.vicinae
|
||||
enabled: ProgramCheckerService.vicinaeAvailable
|
||||
opacity: ProgramCheckerService.vicinaeAvailable ? 1.0 : 0.6
|
||||
onToggled: checked => {
|
||||
if (ProgramCheckerService.vicinaeAvailable) {
|
||||
Settings.data.templates.vicinae = checked
|
||||
AppThemeService.generate()
|
||||
}
|
||||
}
|
||||
}
|
||||
label: "Vicinae"
|
||||
description: ProgramCheckerService.vicinaeAvailable ? I18n.tr("settings.color-scheme.templates.programs.vicinae.description", {
|
||||
"filepath": "~/.local/share/vicinae/themes/matugen.toml"
|
||||
}) : I18n.tr("settings.color-scheme.templates.programs.vicinae.description-missing", {
|
||||
"app": "vicinae"
|
||||
})
|
||||
checked: Settings.data.templates.vicinae
|
||||
enabled: ProgramCheckerService.vicinaeAvailable
|
||||
opacity: ProgramCheckerService.vicinaeAvailable ? 1.0 : 0.6
|
||||
onToggled: checked => {
|
||||
if (ProgramCheckerService.vicinaeAvailable) {
|
||||
Settings.data.templates.vicinae = checked
|
||||
AppThemeService.generate()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Miscellaneous
|
||||
|
||||
@@ -204,20 +204,24 @@ ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
label: I18n.tr("settings.general.language.select.label")
|
||||
description: I18n.tr("settings.general.language.select.description")
|
||||
model: [
|
||||
{ "key": "", "name": I18n.tr("settings.general.language.select.auto-detect") + " (" + I18n.systemDetectedLangCode + ")" }
|
||||
].concat(I18n.availableLanguages.map(function(langCode) {
|
||||
return { "key": langCode, "name": langCode }
|
||||
}))
|
||||
model: [{
|
||||
"key": "",
|
||||
"name": I18n.tr("settings.general.language.select.auto-detect") + " (" + I18n.systemDetectedLangCode + ")"
|
||||
}].concat(I18n.availableLanguages.map(function (langCode) {
|
||||
return {
|
||||
"key": langCode,
|
||||
"name": langCode
|
||||
}
|
||||
}))
|
||||
currentKey: Settings.data.general.language
|
||||
onSelected: key => {
|
||||
Settings.data.general.language = key
|
||||
if (key === "") {
|
||||
I18n.detectLanguage() // Re-detect system language if "Automatic" is selected
|
||||
} else {
|
||||
I18n.setLanguage(key) // Set specific language
|
||||
}
|
||||
}
|
||||
Settings.data.general.language = key
|
||||
if (key === "") {
|
||||
I18n.detectLanguage() // Re-detect system language if "Automatic" is selected
|
||||
} else {
|
||||
I18n.setLanguage(key) // Set specific language
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,8 +70,8 @@ Singleton {
|
||||
"vicinae": {
|
||||
"input": "vicinae.toml",
|
||||
"outputs": [{
|
||||
"path": "~/.local/share/vicinae/themes/matugen.toml"
|
||||
}],
|
||||
"path": "~/.local/share/vicinae/themes/matugen.toml"
|
||||
}],
|
||||
"postProcess": () => `cp -n ${Quickshell.shellDir}/Assets/noctalia.svg ~/.local/share/vicinae/themes/noctalia.svg && ${colorsApplyScript} vicinae\n`
|
||||
}
|
||||
})
|
||||
|
||||
@@ -97,8 +97,8 @@ Singleton {
|
||||
"kittyAvailable": ["which", "kitty"],
|
||||
"ghosttyAvailable": ["which", "ghostty"],
|
||||
"footAvailable": ["which", "foot"],
|
||||
"fuzzelAvailable": ["which", "fuzzel"],
|
||||
"vicinaeAvailable": ["which", "vicinae"],
|
||||
"fuzzelAvailable": ["which", "fuzzel"],
|
||||
"vicinaeAvailable": ["which", "vicinae"],
|
||||
"app2unitAvailable": ["which", "app2unit"],
|
||||
"gpuScreenRecorderAvailable": ["sh", "-c", "command -v gpu-screen-recorder >/dev/null 2>&1 || (command -v flatpak >/dev/null 2>&1 && flatpak list --app | grep -q 'com.dec05eba.gpu_screen_recorder')"],
|
||||
"wlsunsetAvailable": ["which", "wlsunset"]
|
||||
|
||||
+106
-106
@@ -39,8 +39,8 @@ Popup {
|
||||
function openFilePicker() {
|
||||
if (!root.currentPath)
|
||||
root.currentPath = root.initialPath
|
||||
shouldResetSelection = true
|
||||
open()
|
||||
shouldResetSelection = true
|
||||
open()
|
||||
}
|
||||
|
||||
function getFileIcon(fileName) {
|
||||
@@ -92,18 +92,18 @@ Popup {
|
||||
function formatFileSize(bytes) {
|
||||
if (bytes === 0)
|
||||
return "0 B"
|
||||
const k = 1024, sizes = ["B", "KB", "MB", "GB", "TB"]
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(k))
|
||||
return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + " " + sizes[i]
|
||||
const k = 1024, sizes = ["B", "KB", "MB", "GB", "TB"]
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(k))
|
||||
return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + " " + sizes[i]
|
||||
}
|
||||
|
||||
function confirmSelection() {
|
||||
if (filePickerPanel.currentSelection.length === 0)
|
||||
return
|
||||
|
||||
root.selectedPaths = filePickerPanel.currentSelection
|
||||
root.accepted(filePickerPanel.currentSelection)
|
||||
root.close()
|
||||
root.selectedPaths = filePickerPanel.currentSelection
|
||||
root.accepted(filePickerPanel.currentSelection)
|
||||
root.close()
|
||||
}
|
||||
|
||||
function updateFilteredModel() {
|
||||
@@ -126,14 +126,14 @@ Popup {
|
||||
if (root.selectionMode === "folders" && !fileIsDir)
|
||||
continue
|
||||
|
||||
if (searchText === "" || fileName.toLowerCase().includes(searchText)) {
|
||||
filteredModel.append({
|
||||
"fileName": fileName,
|
||||
"filePath": filePath,
|
||||
"fileIsDir": fileIsDir,
|
||||
"fileSize": fileSize
|
||||
})
|
||||
}
|
||||
if (searchText === "" || fileName.toLowerCase().includes(searchText)) {
|
||||
filteredModel.append({
|
||||
"fileName": fileName,
|
||||
"filePath": filePath,
|
||||
"fileIsDir": fileIsDir,
|
||||
"fileSize": fileSize
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,19 +165,19 @@ Popup {
|
||||
focus: true
|
||||
|
||||
Keys.onPressed: event => {
|
||||
if (event.modifiers & Qt.ControlModifier && event.key === Qt.Key_F) {
|
||||
filePickerPanel.showSearchBar = !filePickerPanel.showSearchBar
|
||||
if (filePickerPanel.showSearchBar)
|
||||
Qt.callLater(() => searchInput.forceActiveFocus())
|
||||
event.accepted = true
|
||||
} else if (event.key === Qt.Key_Escape && filePickerPanel.showSearchBar) {
|
||||
filePickerPanel.showSearchBar = false
|
||||
filePickerPanel.searchText = ""
|
||||
filePickerPanel.filterText = ""
|
||||
root.updateFilteredModel()
|
||||
event.accepted = true
|
||||
}
|
||||
}
|
||||
if (event.modifiers & Qt.ControlModifier && event.key === Qt.Key_F) {
|
||||
filePickerPanel.showSearchBar = !filePickerPanel.showSearchBar
|
||||
if (filePickerPanel.showSearchBar)
|
||||
Qt.callLater(() => searchInput.forceActiveFocus())
|
||||
event.accepted = true
|
||||
} else if (event.key === Qt.Key_Escape && filePickerPanel.showSearchBar) {
|
||||
filePickerPanel.showSearchBar = false
|
||||
filePickerPanel.searchText = ""
|
||||
filePickerPanel.filterText = ""
|
||||
root.updateFilteredModel()
|
||||
event.accepted = true
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
@@ -473,11 +473,11 @@ Popup {
|
||||
bottomMargin: Style.marginS
|
||||
|
||||
ScrollBar.vertical: scrollBarComponent.createObject(gridView, {
|
||||
"parent": gridView,
|
||||
"x": gridView.mirrored ? 0 : gridView.width - width,
|
||||
"y": 0,
|
||||
"height": gridView.height
|
||||
})
|
||||
"parent": gridView,
|
||||
"x": gridView.mirrored ? 0 : gridView.width - width,
|
||||
"y": 0,
|
||||
"height": gridView.height
|
||||
})
|
||||
|
||||
delegate: Rectangle {
|
||||
id: gridItem
|
||||
@@ -533,8 +533,8 @@ Popup {
|
||||
property bool isImage: {
|
||||
if (model.fileIsDir)
|
||||
return false
|
||||
const ext = model.fileName.split('.').pop().toLowerCase()
|
||||
return ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg', 'ico'].includes(ext)
|
||||
const ext = model.fileName.split('.').pop().toLowerCase()
|
||||
return ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg', 'ico'].includes(ext)
|
||||
}
|
||||
|
||||
Image {
|
||||
@@ -574,10 +574,10 @@ Popup {
|
||||
color: {
|
||||
if (isSelected)
|
||||
return Color.mSecondary
|
||||
else if (mouseArea.containsMouse)
|
||||
return model.fileIsDir ? Color.mOnTertiary : Color.mOnTertiary
|
||||
else
|
||||
return model.fileIsDir ? Color.mPrimary : Color.mOnSurfaceVariant
|
||||
else if (mouseArea.containsMouse)
|
||||
return model.fileIsDir ? Color.mOnTertiary : Color.mOnTertiary
|
||||
else
|
||||
return model.fileIsDir ? Color.mPrimary : Color.mOnSurfaceVariant
|
||||
}
|
||||
anchors.centerIn: parent
|
||||
visible: !iconContainer.isImage || thumbnail.status !== Image.Ready
|
||||
@@ -608,10 +608,10 @@ Popup {
|
||||
color: {
|
||||
if (isSelected)
|
||||
return Color.mSecondary
|
||||
else if (mouseArea.containsMouse)
|
||||
return Color.mOnTertiary
|
||||
else
|
||||
return Color.mOnSurfaceVariant
|
||||
else if (mouseArea.containsMouse)
|
||||
return Color.mOnTertiary
|
||||
else
|
||||
return Color.mOnSurfaceVariant
|
||||
}
|
||||
pointSize: Style.fontSizeS
|
||||
font.weight: isSelected ? Style.fontWeightBold : Style.fontWeightRegular
|
||||
@@ -630,37 +630,37 @@ Popup {
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
|
||||
onClicked: mouse => {
|
||||
if (mouse.button === Qt.LeftButton) {
|
||||
if (model.fileIsDir) {
|
||||
// In folder mode, single click selects the folder
|
||||
if (root.selectionMode === "folders") {
|
||||
filePickerPanel.currentSelection = [model.filePath]
|
||||
}
|
||||
// In file mode, single click on folder does nothing (must double-click to enter)
|
||||
} else {
|
||||
// Single click on file selects it (only in file mode)
|
||||
if (root.selectionMode === "files") {
|
||||
filePickerPanel.currentSelection = [model.filePath]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mouse.button === Qt.LeftButton) {
|
||||
if (model.fileIsDir) {
|
||||
// In folder mode, single click selects the folder
|
||||
if (root.selectionMode === "folders") {
|
||||
filePickerPanel.currentSelection = [model.filePath]
|
||||
}
|
||||
// In file mode, single click on folder does nothing (must double-click to enter)
|
||||
} else {
|
||||
// Single click on file selects it (only in file mode)
|
||||
if (root.selectionMode === "files") {
|
||||
filePickerPanel.currentSelection = [model.filePath]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onDoubleClicked: mouse => {
|
||||
if (mouse.button === Qt.LeftButton) {
|
||||
if (model.fileIsDir) {
|
||||
// Double-click on folder always navigates into it
|
||||
folderModel.folder = "file://" + model.filePath
|
||||
root.currentPath = model.filePath
|
||||
} else {
|
||||
// Double-click on file selects and confirms (only in file mode)
|
||||
if (root.selectionMode === "files") {
|
||||
filePickerPanel.currentSelection = [model.filePath]
|
||||
root.confirmSelection()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mouse.button === Qt.LeftButton) {
|
||||
if (model.fileIsDir) {
|
||||
// Double-click on folder always navigates into it
|
||||
folderModel.folder = "file://" + model.filePath
|
||||
root.currentPath = model.filePath
|
||||
} else {
|
||||
// Double-click on file selects and confirms (only in file mode)
|
||||
if (root.selectionMode === "files") {
|
||||
filePickerPanel.currentSelection = [model.filePath]
|
||||
root.confirmSelection()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -680,9 +680,9 @@ Popup {
|
||||
color: {
|
||||
if (filePickerPanel.currentSelection.includes(model.filePath))
|
||||
return Color.mSecondary
|
||||
if (mouseArea.containsMouse)
|
||||
return Color.mTertiary
|
||||
return Color.transparent
|
||||
if (mouseArea.containsMouse)
|
||||
return Color.mTertiary
|
||||
return Color.transparent
|
||||
}
|
||||
radius: Style.radiusS
|
||||
Behavior on color {
|
||||
@@ -728,37 +728,37 @@ Popup {
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
|
||||
onClicked: mouse => {
|
||||
if (mouse.button === Qt.LeftButton) {
|
||||
if (model.fileIsDir) {
|
||||
// In folder mode, single click selects the folder
|
||||
if (root.selectionMode === "folders") {
|
||||
filePickerPanel.currentSelection = [model.filePath]
|
||||
}
|
||||
// In file mode, single click on folder does nothing (must double-click to enter)
|
||||
} else {
|
||||
// Single click on file selects it (only in file mode)
|
||||
if (root.selectionMode === "files") {
|
||||
filePickerPanel.currentSelection = [model.filePath]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mouse.button === Qt.LeftButton) {
|
||||
if (model.fileIsDir) {
|
||||
// In folder mode, single click selects the folder
|
||||
if (root.selectionMode === "folders") {
|
||||
filePickerPanel.currentSelection = [model.filePath]
|
||||
}
|
||||
// In file mode, single click on folder does nothing (must double-click to enter)
|
||||
} else {
|
||||
// Single click on file selects it (only in file mode)
|
||||
if (root.selectionMode === "files") {
|
||||
filePickerPanel.currentSelection = [model.filePath]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onDoubleClicked: mouse => {
|
||||
if (mouse.button === Qt.LeftButton) {
|
||||
if (model.fileIsDir) {
|
||||
// Double-click on folder always navigates into it
|
||||
folderModel.folder = "file://" + model.filePath
|
||||
root.currentPath = model.filePath
|
||||
} else {
|
||||
// Double-click on file selects and confirms (only in file mode)
|
||||
if (root.selectionMode === "files") {
|
||||
filePickerPanel.currentSelection = [model.filePath]
|
||||
root.confirmSelection()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mouse.button === Qt.LeftButton) {
|
||||
if (model.fileIsDir) {
|
||||
// Double-click on folder always navigates into it
|
||||
folderModel.folder = "file://" + model.filePath
|
||||
root.currentPath = model.filePath
|
||||
} else {
|
||||
// Double-click on file selects and confirms (only in file mode)
|
||||
if (root.selectionMode === "files") {
|
||||
filePickerPanel.currentSelection = [model.filePath]
|
||||
root.confirmSelection()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -816,7 +816,7 @@ Popup {
|
||||
Component.onCompleted: {
|
||||
if (!root.currentPath)
|
||||
root.currentPath = root.initialPath
|
||||
folderModel.folder = "file://" + root.currentPath
|
||||
folderModel.folder = "file://" + root.currentPath
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+39
-39
@@ -75,31 +75,31 @@ ColumnLayout {
|
||||
propagateComposedEvents: false
|
||||
|
||||
onPressed: mouse => {
|
||||
mouse.accepted = true
|
||||
// Focus the input and position cursor
|
||||
input.forceActiveFocus()
|
||||
var inputPos = mapToItem(inputContainer, mouse.x, mouse.y)
|
||||
if (inputPos.x >= 0 && inputPos.x <= inputContainer.width) {
|
||||
var textPos = inputPos.x - Style.marginM
|
||||
if (textPos >= 0 && textPos <= input.width) {
|
||||
input.cursorPosition = input.positionAt(textPos, input.height / 2)
|
||||
}
|
||||
}
|
||||
}
|
||||
mouse.accepted = true
|
||||
// Focus the input and position cursor
|
||||
input.forceActiveFocus()
|
||||
var inputPos = mapToItem(inputContainer, mouse.x, mouse.y)
|
||||
if (inputPos.x >= 0 && inputPos.x <= inputContainer.width) {
|
||||
var textPos = inputPos.x - Style.marginM
|
||||
if (textPos >= 0 && textPos <= input.width) {
|
||||
input.cursorPosition = input.positionAt(textPos, input.height / 2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onReleased: mouse => {
|
||||
mouse.accepted = true
|
||||
}
|
||||
mouse.accepted = true
|
||||
}
|
||||
onDoubleClicked: mouse => {
|
||||
mouse.accepted = true
|
||||
input.selectAll()
|
||||
}
|
||||
mouse.accepted = true
|
||||
input.selectAll()
|
||||
}
|
||||
onPositionChanged: mouse => {
|
||||
mouse.accepted = true
|
||||
}
|
||||
mouse.accepted = true
|
||||
}
|
||||
onWheel: wheel => {
|
||||
wheel.accepted = true
|
||||
}
|
||||
wheel.accepted = true
|
||||
}
|
||||
}
|
||||
|
||||
// Container for the actual text field
|
||||
@@ -167,32 +167,32 @@ ColumnLayout {
|
||||
property int selectionStart: 0
|
||||
|
||||
onPressed: mouse => {
|
||||
mouse.accepted = true
|
||||
input.forceActiveFocus()
|
||||
var pos = input.positionAt(mouse.x, mouse.y)
|
||||
input.cursorPosition = pos
|
||||
selectionStart = pos
|
||||
}
|
||||
mouse.accepted = true
|
||||
input.forceActiveFocus()
|
||||
var pos = input.positionAt(mouse.x, mouse.y)
|
||||
input.cursorPosition = pos
|
||||
selectionStart = pos
|
||||
}
|
||||
|
||||
onPositionChanged: mouse => {
|
||||
if (mouse.buttons & Qt.LeftButton) {
|
||||
mouse.accepted = true
|
||||
var pos = input.positionAt(mouse.x, mouse.y)
|
||||
input.select(selectionStart, pos)
|
||||
}
|
||||
}
|
||||
if (mouse.buttons & Qt.LeftButton) {
|
||||
mouse.accepted = true
|
||||
var pos = input.positionAt(mouse.x, mouse.y)
|
||||
input.select(selectionStart, pos)
|
||||
}
|
||||
}
|
||||
|
||||
onDoubleClicked: mouse => {
|
||||
mouse.accepted = true
|
||||
input.selectAll()
|
||||
}
|
||||
mouse.accepted = true
|
||||
input.selectAll()
|
||||
}
|
||||
|
||||
onReleased: mouse => {
|
||||
mouse.accepted = true
|
||||
}
|
||||
mouse.accepted = true
|
||||
}
|
||||
onWheel: wheel => {
|
||||
wheel.accepted = true
|
||||
}
|
||||
wheel.accepted = true
|
||||
}
|
||||
}
|
||||
}
|
||||
NIconButton {
|
||||
|
||||
Reference in New Issue
Block a user