feat: updates
This commit is contained in:
1 parent
71a9849a1b
commit
1c127b29e7
10 files changed
+119
-94
No files matched your search
@@ -25,7 +25,6 @@ PanelWindow {
|
||||
BarPill {
|
||||
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
|
||||
HyprlandWorkspaceWidget {}
|
||||
NiriWorkspaceWidget {}
|
||||
NetTrafficWidget {}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,10 @@ FloatingWindow {
|
||||
function launchSelected() {
|
||||
if (filteredApps.length === 0) return
|
||||
const id = filteredApps[selectedIndex].id
|
||||
const path = filteredApps[selectedIndex].path
|
||||
const hist = Quickshell.env("HOME") + "/.cache/quickshell/app-launcher-history"
|
||||
launchProcess.command = ["bash", "-lc", "mkdir -p ~/.cache/quickshell; { printf '%s\\n' " + shellQuote(id) + "; grep -vxF " + shellQuote(id) + " " + shellQuote(hist) + " 2>/dev/null | head -n 29; } > " + shellQuote(hist + ".tmp") + " && mv " + shellQuote(hist + ".tmp") + " " + shellQuote(hist) + "; gtk-launch " + shellQuote(id)]
|
||||
launchProcess.command = ["bash", "-c", "mkdir -p ~/.cache/quickshell; { printf '%s\\n' " + shellQuote(id) + "; grep -vxF " + shellQuote(id) + " " + shellQuote(hist) + " 2>/dev/null | head -n 29; } > " + shellQuote(hist + ".tmp") + " && mv " + shellQuote(hist + ".tmp") + " " + shellQuote(hist) + "; uwsm app " + shellQuote(path) + " > ~/.cache/quickshell/launch.log 2>&1 & disown"]
|
||||
console.log("launching: " + launchProcess.command.join(" "))
|
||||
launchProcess.running = true
|
||||
visible = false
|
||||
}
|
||||
@@ -178,8 +180,12 @@ FloatingWindow {
|
||||
Process {
|
||||
id: appList
|
||||
running: false
|
||||
command: ["python3", "-c", "import configparser,glob,os,json;\nseen={};\nhist_path=os.path.expanduser('~/.cache/quickshell/app-launcher-history');\nhist=[]\ntry:\n hist=[x.strip() for x in open(hist_path, encoding='utf-8') if x.strip()]\nexcept Exception:\n pass\nrank={v:i for i,v in enumerate(hist)}\npaths=glob.glob('/usr/share/applications/*.desktop')+glob.glob(os.path.expanduser('~/.local/share/applications/*.desktop'));\nfor p in paths:\n cp=configparser.ConfigParser(interpolation=None); cp.optionxform=str\n try: cp.read(p, encoding='utf-8')\n except Exception: continue\n if not cp.has_section('Desktop Entry'): continue\n d=cp['Desktop Entry']\n if d.get('Type','Application')!='Application' or d.get('NoDisplay','false').lower()=='true' or d.get('Hidden','false').lower()=='true': continue\n name=d.get('Name','').strip()\n if not name: continue\n did=os.path.basename(p)\n appid=did[:-8] if did.endswith('.desktop') else did\n seen[appid]={'id':appid,'name':name,'comment':d.get('Comment','').strip(),'icon':d.get('Icon','').strip(),'used': appid in rank}\nprint(json.dumps(sorted(seen.values(), key=lambda x:(rank.get(x['id'],999999), x['name'].lower()))))"]
|
||||
command: ["python3", "-c", "import configparser,glob,os,json;\nseen={};\nhist_path=os.path.expanduser('~/.cache/quickshell/app-launcher-history');\nhist=[]\ntry:\n hist=[x.strip() for x in open(hist_path, encoding='utf-8') if x.strip()]\nexcept Exception:\n pass\nrank={v:i for i,v in enumerate(hist)}\npaths=[f for d in os.environ.get('XDG_DATA_DIRS', '/usr/share').split(':') + ['~/.local/share'] for f in glob.glob(os.path.expanduser(d)+'/applications/*.desktop')];\nfor p in paths:\n cp=configparser.ConfigParser(interpolation=None); cp.optionxform=str\n try: cp.read(p, encoding='utf-8')\n except Exception: continue\n if not cp.has_section('Desktop Entry'): continue\n d=cp['Desktop Entry']\n if d.get('Type','Application')!='Application' or d.get('NoDisplay','false').lower()=='true' or d.get('Hidden','false').lower()=='true': continue\n name=d.get('Name','').strip()\n if not name: continue\n did=os.path.basename(p)\n appid=did[:-8] if did.endswith('.desktop') else did\n seen[appid]={'id':appid,'path':p,'name':name,'comment':d.get('Comment','').strip(),'icon':d.get('Icon','').strip(),'used': appid in rank}\nprint(json.dumps(sorted(seen.values(), key=lambda x:(rank.get(x['id'],999999), x['name'].lower()))))"]
|
||||
stdout: StdioCollector { onStreamFinished: { try { win.apps = JSON.parse(text) } catch(e) { win.apps = [] }; win.selectedIndex = 0 } }
|
||||
}
|
||||
Process { id: launchProcess; running: false }
|
||||
Process {
|
||||
id: launchProcess
|
||||
running: false
|
||||
command: []
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ Row {
|
||||
|
||||
property ListModel workspaces: ListModel {}
|
||||
|
||||
property bool isHyprland: (Quickshell.env("XDG_CURRENT_DESKTOP") || "").toLowerCase().indexOf("hyprland") >= 0
|
||||
|
||||
Process {
|
||||
id: process
|
||||
command: ["sh", "-c", "hyprctl activeworkspace -j | jq .id; hyprctl workspaces -j | jq -c ."]
|
||||
@@ -31,17 +33,17 @@ Row {
|
||||
});
|
||||
}
|
||||
}
|
||||
onExited: restartTimer.start()
|
||||
onExited: if (root.isHyprland) restartTimer.start()
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: restartTimer
|
||||
interval: 500
|
||||
repeat: false
|
||||
onTriggered: process.running = true
|
||||
onTriggered: if (root.isHyprland) process.running = true
|
||||
}
|
||||
|
||||
Component.onCompleted: process.running = true
|
||||
Component.onCompleted: if (root.isHyprland) process.running = true
|
||||
|
||||
Repeater {
|
||||
model: workspaces
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
import QtQuick
|
||||
import Quickshell.Io
|
||||
import qs.Theme
|
||||
|
||||
Row {
|
||||
id: root
|
||||
spacing: Theme.spacing
|
||||
|
||||
property ListModel workspaces: ListModel {}
|
||||
|
||||
Process {
|
||||
id: workspaceProcess
|
||||
running: true
|
||||
command: ["mmsg", "-w"]
|
||||
|
||||
stdout: SplitParser {
|
||||
onRead: line => {
|
||||
parseWorkspaceLine(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function parseWorkspaceLine(line) {
|
||||
const tagBinary = /^(\S+)\s+tags\s+([01]+)\s+([01]+)\s+([01]+)$/
|
||||
const match = line.match(tagBinary);
|
||||
|
||||
if (match) {
|
||||
const outputName = match[1];
|
||||
const occ = match[2];
|
||||
const sel = match[3];
|
||||
const urg = match[4];
|
||||
|
||||
workspaces.clear();
|
||||
|
||||
for (let i = 0; i < occ.length; i++) {
|
||||
const tagId = i + 1;
|
||||
const charIdx = occ.length - 1 - i;
|
||||
|
||||
const isOccupied = occ[charIdx] === '1';
|
||||
const isActive = sel[charIdx] === '1';
|
||||
const isUrgent = urg[charIdx] === '1';
|
||||
|
||||
workspaces.append({
|
||||
"tagId": tagId,
|
||||
"output": outputName,
|
||||
"isOccupied": isOccupied,
|
||||
"isActive": isActive,
|
||||
"isUrgent": isUrgent
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: workspaces
|
||||
delegate: Rectangle {
|
||||
height: Theme.barHeight - 16
|
||||
width: height
|
||||
radius: width / 2
|
||||
color: model.isActive ? Theme.mauve : (model.isOccupied ? Theme.surface1 : Theme.surface0)
|
||||
border.color: model.isUrgent ? Theme.red : "transparent"
|
||||
border.width: 2
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: model.tagId
|
||||
color: Theme.text
|
||||
font.pixelSize: Theme.fontPixelSize
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
Quickshell.execDetached(["mmsg", "-s", "-t", model.tagId]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ FloatingWindow {
|
||||
property bool mouseWasInside: false
|
||||
readonly property var actions: [
|
||||
{ name: "Lock", icon: "", hint: "hyprlock", cmd: "hyprlock", danger: false },
|
||||
{ name: "Logout", icon: "", hint: "Hyprland exit", cmd: "hyprctl dispatch exit", danger: true },
|
||||
{ name: "Logout", icon: "", hint: "loginctl terminate-user", cmd: "loginctl terminate-user $USER", danger: true },
|
||||
{ name: "Suspend", icon: "", hint: "systemctl suspend", cmd: "systemctl suspend", danger: false },
|
||||
{ name: "Reboot", icon: "", hint: "systemctl reboot", cmd: "systemctl reboot", danger: true },
|
||||
{ name: "Shutdown", icon: "", hint: "systemctl poweroff", cmd: "systemctl poweroff", danger: true }
|
||||
|
||||
@@ -7,7 +7,6 @@ StorageWidget 1.0 StorageWidget.qml
|
||||
TemperatureWidget 1.0 TemperatureWidget.qml
|
||||
AudioWidget 1.0 AudioWidget.qml
|
||||
TrayWidget 1.0 TrayWidget.qml
|
||||
NiriWorkspaceWidget 1.0 NiriWorkspaceWidget.qml
|
||||
HyprlandWorkspaceWidget 1.0 HyprlandWorkspaceWidget.qml
|
||||
ThemeSwitcherWindow 1.0 ThemeSwitcherWindow.qml
|
||||
WallpaperSwitcherWindow 1.0 WallpaperSwitcherWindow.qml
|
||||
|
||||
Reference in new issue
Block a user