diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index fd82361..0842838 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -10,13 +10,10 @@ ;; C-x RIGHT | LEFT : switches between buffers left and right ;; C-x b : switch to buffer with its name ;; C-x 2 | 3 : split window horizontally or vertical -;; C-x 1 : Kill djacent window -;; C-x 0 : kills current active window +;; C-x 0 : kills one window ;; C-x C-q : toggle read-only mode -;; C-M-f : Goes to next closing bracket -;; C-M-b : Goes to next opening bracket ;; M-x cd : change dir duh -;; M-y : to paste into vterm or generally(?) +;; M-y : to paste into vterm or generally ;; M-x package-list-packages RET Ux : updates packages ;; M-x eglot-inlay-hints-mode : cool info for code ;; M-ESC : Escapes corfu prompt @@ -33,7 +30,7 @@ :ensure t :init (defvar evil-mode-buffers '()) - ;; ^ Only fix for "Error in post-command-hook (evil-normal-post-command): (void-variable evil-mode-buffers)" i could find + ;; Error in post-command-hook (evil-normal-post-command): (void-variable evil-mode-buffers) ;;(setq evil-want-keybinding nil) (evil-mode 1) :config @@ -67,16 +64,16 @@ ;; Vterm (use-package vterm - :ensure t :config - (add-hook 'vterm-mode-hook (lambda () (setq evil-default-state 'emacs)))) + (add-hook 'vterm-mode-hook (lambda () (setq evil-default-state 'emacs))) + :ensure t) ;; QML (use-package qml-mode :ensure t) ;; LSP / Eglot -;;(setq eglot-ignored-server-capabilities '(:documentOnTypeFormattingProvider :documentFormattingProvider :documentRangeFormattingProvider)) +(setq eglot-ignored-server-capabilities '(:documentOnTypeFormattingProvider :documentFormattingProvider :documentRangeFormattingProvider)) ;; (add-hook 'nix-mode-hook #'eglot-ensure) ;;(for nix) (add-hook 'eglot-managed-mode-hook (lambda () (eglot-inlay-hints-mode -1))) @@ -86,7 +83,8 @@ (with-eval-after-load 'eglot (add-to-list 'eglot-server-programs '(c-mode . ("clangd"))) (add-to-list 'eglot-server-programs '(c++-mode . ("clangd"))) - (add-to-list 'eglot-server-programs '(qml-mode . ("~/Projects/Code/Random/qmlls")))) + (add-to-list 'eglot-server-programs '(qml-mode . ("~/Projects/Code/Random/qmlls"))) + (add-hook 'after-save-hook 'eglot-format)) ;; Set some basic stuff up @@ -149,6 +147,8 @@ ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(base16-theme-highlight-mode-line 'box) + '(eglot-ignored-server-capabilities + '(:documentFormattingProvider :documentRangeFormattingProvider)) '(package-selected-packages '(evil))) (custom-set-faces ;; custom-set-faces was added by Custom. diff --git a/quickshell/.config/quickshell/swayshell.qml b/quickshell/.config/quickshell/swayshell.qml index d7f6abd..d60061e 100755 --- a/quickshell/.config/quickshell/swayshell.qml +++ b/quickshell/.config/quickshell/swayshell.qml @@ -10,338 +10,326 @@ import Quickshell.Services.Pipewire import QtQuick import QtQuick.Layouts // Some credit goes to my friends Lucy and Babsi -// Zoe here, ignore the wide ass code, emacs qml-mode adds 2 on my tab-width for some reason +// Work in progress (Audio) PanelWindow { - id: root - - property color colBg: "#454545" - property color colAppBg: "#333333" - property color colFg: "#ffffff" - property string fontFamily: "Hack Nerd Font" - property int fontSize: 16 - property int appletRadHeight: 25 - property int appletSpacing: 6 - - - property int cpuUsage: 0 - property var lastCpuIdle: 0 - property var lastCpuTotal: 0 - property real ramUsage: 0.00 - - property var batCharMin: (UPower.displayDevice.timeToFull / 60).toFixed(2) - property var batDisMin: (UPower.displayDevice.timeToEmpty / 60).toFixed(2) - property var batTime: 0 - - anchors { - right: true - left: true - top:true - } - - color: "transparent" - implicitHeight: root.appletRadHeight + 5 - margins { - right: 0 // 5 - left: 0 // 5 - top: 0 // 5 - bottom: 0 - } - Rectangle { - color: root.colBg - anchors.fill: parent - // radius: root.appletRadHeight - } - - RowLayout { - id: leftRow + id: root + + property color colBg: "#64320a" + property color colAppBg: "#2d1405" + property color colFg: "#d2d2d2" + property color colDark: "#230f05" + property string fontFamily: "Noto Sans" + property int fontSize: 18 + property int appletRadHeight: 25 + property int appletSpacing: 6 + + + property int cpuUsage: 0 + property var lastCpuIdle: 0 + property var lastCpuTotal: 0 + property real ramUsage: 0.00 + property var batTime: 0 + property var batCharMin: (UPower.displayDevice.timeToFull / 60).toFixed(2) + property var batDisMin: (UPower.displayDevice.timeToEmpty / 60).toFixed(2) + + anchors { + right: true + left: true + top:true + } + + color: "transparent" + implicitHeight: root.appletRadHeight + 10 + margins { + right: 5 + left: 5 + top: 5 + bottom: 0 + } + Rectangle { + color: root.colBg + anchors.fill: parent + radius: root.appletRadHeight + } + + RowLayout { + id: leftRow + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + Item { + id: rootItem + implicitWidth: root.appletRadHeight + height: root.appletRadHeight + Row { + id: workspaceRow anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left - Item { - id: rootItem - implicitWidth: root.appletRadHeight - height: root.appletRadHeight - Row { - id: workspaceRow - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - leftPadding: 10 - - Repeater { - id: wsRepeater - model: I3.workspaces - anchors.centerIn: parent - - Rectangle { - id: workspaceNumber - property bool isOnMon: { - if (!modelData) - return false - if (!modelData.monitor) - return false - if (!rootItem.screen) - return false; - return modelData.monitor.name === rootItem.screen.name; - } - - required property var modelData - height: root.appletRadHeight * 1.1 - width: root.appletRadHeight * 1.1 - radius: root.appletRadHeight - color: root.colAppBg - Text { - anchors.centerIn: parent - text: parent.modelData.number - color: root.colFg - opacity: workspaceNumber.modelData.focused ? 1 : 0.5 - font { family: root.fontFamily; pixelSize: root.fontSize; bold: true } - } - - MouseArea { - anchors.fill: parent - onClicked: {parent.modelData.activate();} - } - } - } + leftPadding: 10 + + Repeater { + id: wsRepeater + model: I3.workspaces + anchors.centerIn: parent + property var ws: I3.workspaces + + Rectangle { + id: workspaceNumber + property bool isOnMon: { + if (!modelData) + return false + if (!modelData.monitor) + return false + if (!rootItem.screen) + return false; + return modelData.monitor.name === rootItem.screen.name; } + + required property var modelData + height: root.appletRadHeight * 1.1 + width: root.appletRadHeight * 1.1 + radius: root.appletRadHeight + color: root.colAppBg + Text { + anchors.centerIn: parent + text: parent.modelData.number + color: root.colFg + opacity: workspaceNumber.modelData.focused ? 1 : 0.5 + font { family: root.fontFamily; pixelSize: root.fontSize; bold: true } + } + + MouseArea { + anchors.fill: parent + onClicked: {parent.modelData.activate();} + } + } } - } - /* - RowLayout { - id: centerRow - spacing: root.appletSpacing - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter } - */ - RowLayout { - id: rightRow - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - spacing: root.appletSpacing - - Item { - Process { - id: cpuProc - command: ["sh", "-c", "head -1 /proc/stat"] - stdout: SplitParser { - onRead: data => { - if (!data) return - var p = data.trim().split(/\s+/) - var idle = parseInt(p[4]) + parseInt(p[5]) - var total = p.slice(1, 8).reduce((a, b) => a + parseInt(b), 0) - if (lastCpuTotal > 0) { - cpuUsage = Math.round(100 * (1 - (idle - lastCpuIdle) / (total - lastCpuTotal))) - } - lastCpuTotal = total - lastCpuIdle = idle - } - } - Component.onCompleted: running = true - } - - Process { - id: ramProc - command: ["sh", "-c", "free | grep Mem"] - stdout: SplitParser { - onRead: data => { - if (!data) return - var parts = data.trim().split(/\s+/) - var used = parseInt(parts[2]) || 0 - ramUsage = used /1048576 - } - } - Component.onCompleted: running = true - } - Timer { - interval: 2000 - running: true - repeat: true - onTriggered: { - cpuProc.running = true - ramProc.running = true - } - } - Item { - id: procItem - Row { - id: procRow - spacing: root.appletSpacing - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - leftPadding: 10 - - Loader { - id: batLoader - active: true - sourceComponent: Rectangle { - id: batRect - clip: true - color: root.colAppBg - visible: UPower.displayDevice.isPresent - implicitHeight: root.appletRadHeight - implicitWidth: batText.implicitWidth + 25 - radius: root.appletRadHeight - - function getBatStat() { - if (UPower.displayDevice.state == UPowerDeviceState.Discharging) { - batTime = Math.floor(batDisMin / 60) + "h " + ((batDisMin - (Math.floor(batDisMin / 60) * 60)).toFixed(0)) + "min" - return batTime; - } - if (UPower.displayDevice.state == UPowerDeviceState.Charging) { - batTime = Math.floor(batCharMin / 60) + "h " + ((batCharMin - (Math.floor(batCharMin / 60) * 60)).toFixed(0)) + "min" - return batTime; - } - if (UPower.displayDevice.state == UPowerDeviceState.FullyCharged) { - return "Full"; - } - } - function batStatProc() { - return Math.round(UPower.displayDevice.percentage * 100) + "%"; - } - - Text { - id: batText - anchors.centerIn: parent - color: root.colFg - text: batStatProc() + " - " + getBatStat() - font { family: root.fontFamily; pixelSize: root.fontSize; bold: true } - } - } - } - - - Rectangle { - height: root.appletRadHeight - width: cpuText.paintedWidth + 25 - radius: root.appletRadHeight - color: root.colAppBg - - Text { - id: cpuText - anchors.centerIn: parent - text: "CPU: " + cpuUsage + "%" - color: root.colFg - font { family: root.fontFamily; pixelSize: root.fontSize; bold: true } - } - } - Rectangle { - height: root.appletRadHeight - width: ramText.paintedWidth + 28 - radius: root.appletRadHeight - color: root.colAppBg - - Text { - id: ramText - anchors.centerIn: parent - text: "RAM: " + ramUsage.toFixed(2) + " GiB" - color: root.colFg - font { family: root.fontFamily; pixelSize: root.fontSize; bold: true } - } - } - Rectangle { - id: pwRect - color: root.colAppBg - property PwNode defaultAudio: Pipewire.ready ? Pipewire.preferredDefaultAudioSink : null - property bool mute: Pipewire.ready ? defaultAudio?.audio.muted : null - radius: root.appletRadHeight - implicitHeight: root.appletRadHeight - implicitWidth: pwText.implicitWidth + 25 - - PwObjectTracker { - objects: [Pipewire.ready ? Pipewire.defaultAudioSink : null] - } - - Process { - id: pavuLauncher - command: ["pavucontrol"] - running: false - } - - Text { - id: pwText - anchors.centerIn: pwRect - color: root.colFg - opacity: pwRect.defaultAudio?.audio.muted ? 0.6 : 1.0 - font { family: root.fontFamily; pixelSize: root.fontSize; bold: true } - text: pwRect.mute ? "MUT: " + Math.floor(pwRect.defaultAudio?.audio.volume * 100) + "%" : "VOL: " + Math.floor(pwRect.defaultAudio?.audio.volume * 100) + "%" - } - MouseArea { - id: clickHandler - hoverEnabled: true - acceptedButtons: Qt.LeftButton - cursorShape: Qt.PointingHandCursor - anchors.fill: pwRect - onClicked: pavuLauncher.running = true - } - } - - } - } - } - - Row { - id: clockRow - Rectangle { - id: clockRect - clip: true - implicitHeight: root.appletRadHeight - implicitWidth: clockText.implicitWidth + 25 - color: root.colAppBg - radius: root.appletRadHeight - SystemClock { - id: clock - precision: SystemClock.Seconds - } - Text { - id: clockText - anchors.centerIn: clockRect - color: root.colFg - font { family: root.fontFamily; pixelSize: root.fontSize; bold: true } - text: Qt.formatDateTime(clock.date, "yyyy.MM.dd - hh:mm:ss") - } - } - } - Row { - id: trayWholeRow - rightPadding: 10 - Rectangle { - id: trayRect - color: root.colAppBg - visible: iconRepeater.count != 0 - radius: root.appletRadHeight - Layout.fillHeight: true - implicitHeight: root.appletRadHeight - implicitWidth: iconlayout.implicitWidth + 16 - - RowLayout { - id: iconlayout - anchors.centerIn: trayRect - Repeater { - id: iconRepeater - model: SystemTray.items - delegate: WrapperMouseArea { - id: iconWrapper - required property var modelData - child: IconImage { - source: iconWrapper.modelData.icon - implicitSize: 16 - } - QsMenuAnchor { - id: menu - anchor.item: iconWrapper - menu: modelData.menu - } - acceptedButtons: Qt.LeftButton | Qt.RightButton - onClicked: mouse => { - if (mouse.button == Qt.RightButton) { - menu.open(); - } - } - } - } - } - } - } } + } +/* + RowLayout { + id: centerRow + spacing: root.appletSpacing + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + } + */ + RowLayout { + id: rightRow + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + spacing: root.appletSpacing + + Item { + + Process { + id: cpuProc + command: ["sh", "-c", "head -1 /proc/stat"] + stdout: SplitParser { + onRead: data => { + if (!data) return + var p = data.trim().split(/\s+/) + var idle = parseInt(p[4]) + parseInt(p[5]) + var total = p.slice(1, 8).reduce((a, b) => a + parseInt(b), 0) + if (lastCpuTotal > 0) { + cpuUsage = Math.round(100 * (1 - (idle - lastCpuIdle) / (total - lastCpuTotal))) + } + lastCpuTotal = total + lastCpuIdle = idle + } + } + Component.onCompleted: running = true + } + + Process { + id: ramProc + command: ["sh", "-c", "free | grep Mem"] + stdout: SplitParser { + onRead: data => { + if (!data) return + var parts = data.trim().split(/\s+/) + var used = parseInt(parts[2]) || 0 + ramUsage = used /1048576 + } + } + Component.onCompleted: running = true + } + Timer { + interval: 2000 + running: true + repeat: true + onTriggered: { + cpuProc.running = true + ramProc.running = true + } + } + Item { + id: procItem + Row { + id: procRow + spacing: root.appletSpacing + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + leftPadding: 10 + + Loader { + id: statLoader + active: true + sourceComponent: Rectangle { + id: batRect + height: root.appletRadHeight + width: batText.paintedWidth + root.appletRadHeight + radius: root.appletRadHeight + color: root.colAppBg + + function getBatStat() { + if (UPower.displayDevice.state == UPowerDeviceState.Discharging) { + batTime = Math.floor(batDisMin / 60) + "h " + ((batDisMin - (Math.floor(batDisMin / 60) * 60)).toFixed(0)) + "min" + return batTime; + } + if (UPower.displayDevice.state == UPowerDeviceState.Charging) { + batTime = Math.floor(batCharMin / 60) + "h " + ((batCharMin - (Math.floor(batCharMin / 60) * 60)).toFixed(0)) + "min" + return batTime; + } + if (UPower.displayDevice.state == UPowerDeviceState.FullyCharged) { + return "Full"; + } + } + function batStatProc() { + return Math.round(UPower.displayDevice.percentage * 100) + "%"; + } + + Text { + id: batText + anchors.centerIn: parent + color: root.colFg + text: batStatProc() + " - " + getBatStat() + font { family: root.fontFamily; pixelSize: root.fontSize; bold: true } + } + } + } + Rectangle { + height: root.appletRadHeight + width: cpuText.paintedWidth + 25 + radius: root.appletRadHeight + color: root.colAppBg + + + Text { + id: cpuText + anchors.centerIn: parent + text: "CPU: " + cpuUsage + "%" + color: root.colFg + font { family: root.fontFamily; pixelSize: root.fontSize; bold: true } + } + } + Rectangle { + height: root.appletRadHeight + width: ramText.paintedWidth + 28 + radius: root.appletRadHeight + color: root.colAppBg + + Text { + id: ramText + anchors.centerIn: parent + text: "RAM: " + ramUsage.toFixed(2) + " GiB" + color: root.colFg + font { family: root.fontFamily; pixelSize: root.fontSize; bold: true } + } + } + } + } + } + + Row { + id: clockRow + Rectangle { + height: root.appletRadHeight + width: clock.paintedWidth + root.appletRadHeight + radius: root.appletRadHeight + color: root.colAppBg + + Text { + id: clock + anchors.centerIn: parent + anchors.right: parent.right + text: Qt.formatDateTime(new Date(), "yyyy.MM.dd - HH:mm:ss") + color: root.colFg + font { family: root.fontFamily; pixelSize: root.fontSize; bold: true } + + Timer { + interval: 1000 + running: true + repeat: true + onTriggered: clock.text = Qt.formatDateTime(new Date(), "yyyy.MM.dd - HH:mm:ss") + } + } + } + } + Row { + id: trayWholeRow + rightPadding: 10 + Item{ + id: miscItem + implicitHeight: root.appletRadHeight + implicitWidth: trayRect.implicitWidth + visible: trayRepeater.count > 0 + + Rectangle { + id: trayRect + implicitHeight: root.appletRadHeight + implicitWidth: trayRow.implicitWidth + 10 + radius: root.appletRadHeight + color: root.colAppBg + anchors.centerIn: parent + + Row { + id: trayRow + spacing: root.appletSpacing + anchors.verticalCenter: parent.verticalCenter + anchors.centerIn: parent + + Repeater { + id: trayRepeater + model: SystemTray.items + + MouseArea { + id: trayMouse + property var bar: trayMouse.QsWindow.window + required property SystemTrayItem modelData + + acceptedButtons: Qt.LeftButton | Qt.RightButton + implicitWidth: 16 + implicitHeight: 16 + + onClicked: event => { + if (event.button === Qt.LeftButton) { + modelData.activate(); + } + else if (modelData.hasMenu) { + menu.open(); + } + } + + QsMenuAnchor { + id: menu + menu: trayMouse.modelData.hasMenu ? trayMouse.modelData.menu : null + anchor.item: trayMouse + } + + IconImage { + id: trayIcon + width: parent.implicitWidth + height: parent.implicitHeight + source: trayMouse.modelData.icon + anchors.centerIn: parent + } + } + } + } + } + } + } + } } diff --git a/zgit b/zgit index 6ac34e1..56262f4 100755 --- a/zgit +++ b/zgit @@ -14,7 +14,7 @@ while getopts "a:s:" o; do ;; s) s=${OPTARG} - if [ -f $s ] || [ -d $s ]; then + if [ -f $s ]; then git add $s read -p "Commit message: " commitMsg tmp="${commitMsg%\"}"