fixed launcher nav + headroom completion
This commit is contained in:
1 parent
51dc5e80c4
commit
5f3a44f82d
6 files changed
+87
-160
No files matched your search
@@ -1,46 +1 @@
|
|||||||
# Print an optspec for argparse to handle cmd's options that are independent of any subcommand.
|
complete --keep-order --exclusive --command enqs-guard --arguments "(COMPLETE=fish enqs-guard -- (commandline --current-process --tokenize --cut-at-cursor) (commandline --current-token))"
|
||||||
function __fish_enqs_guard_global_optspecs
|
|
||||||
string join \n h/help V/version
|
|
||||||
end
|
|
||||||
|
|
||||||
function __fish_enqs_guard_needs_command
|
|
||||||
# Figure out if the current invocation already has a command.
|
|
||||||
set -l cmd (commandline -opc)
|
|
||||||
set -e cmd[1]
|
|
||||||
argparse -s (__fish_enqs_guard_global_optspecs) -- $cmd 2>/dev/null
|
|
||||||
or return
|
|
||||||
if set -q argv[1]
|
|
||||||
# Also print the command, so this can be used to figure out what it is.
|
|
||||||
echo $argv[1]
|
|
||||||
return 1
|
|
||||||
end
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
|
|
||||||
function __fish_enqs_guard_using_subcommand
|
|
||||||
set -l cmd (__fish_enqs_guard_needs_command)
|
|
||||||
test -z "$cmd"
|
|
||||||
and return 1
|
|
||||||
contains -- $cmd[1] $argv
|
|
||||||
end
|
|
||||||
|
|
||||||
complete -c enqs-guard -n "__fish_enqs_guard_needs_command" -s h -l help -d 'Print help (see more with \'--help\')'
|
|
||||||
complete -c enqs-guard -n "__fish_enqs_guard_needs_command" -s V -l version -d 'Print version'
|
|
||||||
complete -c enqs-guard -n "__fish_enqs_guard_needs_command" -f -a "hook" -d 'Answer as a PreToolUse hook; reads the event from stdin (Claude Code)'
|
|
||||||
complete -c enqs-guard -n "__fish_enqs_guard_needs_command" -f -a "session-start" -d 'Answer as a SessionStart hook (Claude Code)'
|
|
||||||
complete -c enqs-guard -n "__fish_enqs_guard_needs_command" -f -a "status" -d 'Show the current guard state'
|
|
||||||
complete -c enqs-guard -n "__fish_enqs_guard_needs_command" -f -a "init" -d 'Create a configuration template'
|
|
||||||
complete -c enqs-guard -n "__fish_enqs_guard_needs_command" -f -a "mode" -d 'Set what the guard does'
|
|
||||||
complete -c enqs-guard -n "__fish_enqs_guard_needs_command" -f -a "add" -d 'Put a project on one of the lists'
|
|
||||||
complete -c enqs-guard -n "__fish_enqs_guard_needs_command" -f -a "remove" -d 'Take a project off one of the lists'
|
|
||||||
complete -c enqs-guard -n "__fish_enqs_guard_needs_command" -f -a "check" -d 'Check whether a path is blocked'
|
|
||||||
complete -c enqs-guard -n "__fish_enqs_guard_needs_command" -f -a "completions" -d 'Print a tab completion script for a shell'
|
|
||||||
complete -c enqs-guard -n "__fish_enqs_guard_using_subcommand hook" -s h -l help -d 'Print help'
|
|
||||||
complete -c enqs-guard -n "__fish_enqs_guard_using_subcommand session-start" -s h -l help -d 'Print help'
|
|
||||||
complete -c enqs-guard -n "__fish_enqs_guard_using_subcommand status" -s h -l help -d 'Print help'
|
|
||||||
complete -c enqs-guard -n "__fish_enqs_guard_using_subcommand init" -s h -l help -d 'Print help'
|
|
||||||
complete -c enqs-guard -n "__fish_enqs_guard_using_subcommand mode" -s h -l help -d 'Print help (see more with \'--help\')'
|
|
||||||
complete -c enqs-guard -n "__fish_enqs_guard_using_subcommand add" -s h -l help -d 'Print help'
|
|
||||||
complete -c enqs-guard -n "__fish_enqs_guard_using_subcommand remove" -s h -l help -d 'Print help'
|
|
||||||
complete -c enqs-guard -n "__fish_enqs_guard_using_subcommand check" -s h -l help -d 'Print help'
|
|
||||||
complete -c enqs-guard -n "__fish_enqs_guard_using_subcommand completions" -s h -l help -d 'Print help'
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
complete --keep-order --exclusive --command enqs-headroom --arguments "(COMPLETE=fish enqs-headroom -- (commandline --current-process --tokenize --cut-at-cursor) (commandline --current-token))"
|
||||||
@@ -1,70 +1 @@
|
|||||||
# Print an optspec for argparse to handle cmd's options that are independent of any subcommand.
|
complete --keep-order --exclusive --command enqs-jail --arguments "(COMPLETE=fish enqs-jail -- (commandline --current-process --tokenize --cut-at-cursor) (commandline --current-token))"
|
||||||
function __fish_enqs_jail_global_optspecs
|
|
||||||
string join \n h/help V/version
|
|
||||||
end
|
|
||||||
|
|
||||||
function __fish_enqs_jail_needs_command
|
|
||||||
# Figure out if the current invocation already has a command.
|
|
||||||
set -l cmd (commandline -opc)
|
|
||||||
set -e cmd[1]
|
|
||||||
argparse -s (__fish_enqs_jail_global_optspecs) -- $cmd 2>/dev/null
|
|
||||||
or return
|
|
||||||
if set -q argv[1]
|
|
||||||
# Also print the command, so this can be used to figure out what it is.
|
|
||||||
echo $argv[1]
|
|
||||||
return 1
|
|
||||||
end
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
|
|
||||||
function __fish_enqs_jail_using_subcommand
|
|
||||||
set -l cmd (__fish_enqs_jail_needs_command)
|
|
||||||
test -z "$cmd"
|
|
||||||
and return 1
|
|
||||||
contains -- $cmd[1] $argv
|
|
||||||
end
|
|
||||||
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_needs_command" -s h -l help -d 'Print help (see more with \'--help\')'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_needs_command" -s V -l version -d 'Print version'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_needs_command" -f -a "register" -d 'Register a directory as a jail'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_needs_command" -f -a "unregister" -d 'Remove a registration'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_needs_command" -f -a "list" -d 'Show the registered jails'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_needs_command" -f -a "show" -d 'Show the settings a jail would run under'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_needs_command" -f -a "check" -d 'Check the prerequisites'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_needs_command" -f -a "allow" -d 'Re-open one path inside a jail'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_needs_command" -f -a "escape" -d 'Let one command run outside the sandbox, leaving the jail'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_needs_command" -f -a "revoke" -d 'Take a grant back'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_needs_command" -f -a "grants" -d 'Show the exceptions in force for a jail'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_needs_command" -f -a "completions" -d 'Print a tab completion script for a shell'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_needs_command" -f -a "run" -d 'Start a session in a registered jail'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand register" -l name -d 'The name of the jail; the directory name by default' -r
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand register" -l toolchain -d 'Toolchain whose caches stay readable; detected from the project when not given' -r
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand register" -l deny-read -d 'Path hidden inside the jail; replaces the default list' -r
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand register" -l allow-read -d 'Path that stays readable inside the jail (repeatable)' -r
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand register" -l allow-write -d 'Path that stays writable inside the jail (repeatable)' -r
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand register" -l add-dir -d 'Additional working directory inside the jail (repeatable)' -r
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand register" -l claude-config-dir -d 'Claude profile the session runs under, e.g. ~/.claude-work' -r
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand register" -l no-git -d 'Do not release the git configuration'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand register" -l no-default-deny -d 'Do not use the default deny list'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand register" -l force -d 'Overwrite an existing registration of this name'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand register" -s h -l help -d 'Print help'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand unregister" -s h -l help -d 'Print help'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand list" -s h -l help -d 'Print help'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand show" -s h -l help -d 'Print help'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand check" -s h -l help -d 'Print help'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand allow" -l for -d 'How long it should last, e.g. 30m, 2h, 7d' -r
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand allow" -l reason -d 'Why it was needed, kept with the grant' -r
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand allow" -l jail -d 'The jail; the current directory when left out' -r
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand allow" -l write -d 'Make it writable as well as readable'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand allow" -l once -d 'Only for the next session'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand allow" -s h -l help -d 'Print help'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand escape" -l for -d 'How long it should last, e.g. 30m, 2h, 7d' -r
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand escape" -l reason -d 'Why it was needed, kept with the grant' -r
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand escape" -l jail -d 'The jail; the current directory when left out' -r
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand escape" -l once -d 'Only for the next session'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand escape" -s h -l help -d 'Print help'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand revoke" -l jail -d 'The jail; the current directory when left out' -r
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand revoke" -s h -l help -d 'Print help'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand grants" -s h -l help -d 'Print help'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand completions" -s h -l help -d 'Print help'
|
|
||||||
complete -c enqs-jail -n "__fish_enqs_jail_using_subcommand run" -s h -l help -d 'Print help'
|
|
||||||
@@ -11,10 +11,14 @@ import "root:/services"
|
|||||||
//
|
//
|
||||||
// TYPING is always typing. Navigation lives on the arrows and on Ctrl+J/K so
|
// TYPING is always typing. Navigation lives on the arrows and on Ctrl+J/K so
|
||||||
// that nothing you can type is ever stolen from you — except in select mode,
|
// that nothing you can type is ever stolen from you — except in select mode,
|
||||||
// which you enter deliberately (the first arrow press does it) and which hands
|
// which hands h/j/k/l over to navigation. That is the compromise the vim keys
|
||||||
// h/j/k/l over to navigation until you press Escape or Backspace. That is the
|
// need: a launcher whose input eats `j` is a launcher you cannot use to find
|
||||||
// compromise the vim keys need: a launcher whose input eats `j` is a launcher
|
// Jellyfin.
|
||||||
// you cannot use to find Jellyfin.
|
//
|
||||||
|
// Select mode is vim's normal mode, and the modes change the way vim changes
|
||||||
|
// them: Escape leaves insert, `i` (or `a`) goes back into it without leaving
|
||||||
|
// an `i` behind, and Escape from select mode — with no insert left to leave —
|
||||||
|
// ends the prompt. Unbound keys in select mode are eaten, not typed.
|
||||||
//
|
//
|
||||||
// The other half of the grammar is the argument. Type a URL and the list turns
|
// The other half of the grammar is the argument. Type a URL and the list turns
|
||||||
// into "open this with…", already sorted so the system default is row zero —
|
// into "open this with…", already sorted so the system default is row zero —
|
||||||
@@ -27,7 +31,10 @@ PanelWindow {
|
|||||||
required property var modelData
|
required property var modelData
|
||||||
screen: modelData
|
screen: modelData
|
||||||
|
|
||||||
|
// Only the screen that had focus when the launcher was asked for shows it;
|
||||||
|
// the other copies stay dormant so the query is never typed into thin air.
|
||||||
readonly property bool open: Actions.launcherOpen
|
readonly property bool open: Actions.launcherOpen
|
||||||
|
&& Actions.launcherScreen === modelData.name
|
||||||
visible: root.open || closeAnim.running
|
visible: root.open || closeAnim.running
|
||||||
|
|
||||||
WlrLayershell.layer: WlrLayer.Overlay
|
WlrLayershell.layer: WlrLayer.Overlay
|
||||||
@@ -403,14 +410,14 @@ PanelWindow {
|
|||||||
font.letterSpacing: 3
|
font.letterSpacing: 3
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
text: root.selectMode
|
text: root.selectMode
|
||||||
? "H J K L MOVE L PIN ESC TYPE"
|
? "J K MOVE L PIN H UNPIN i TYPE ESC QUIT"
|
||||||
: root.mode === "dmenu"
|
: root.mode === "dmenu"
|
||||||
? "⏎ CHOOSE ESC CANCEL ↑↓ SELECT"
|
? "⏎ CHOOSE ESC SELECT ↑↓ MOVE"
|
||||||
: root.mode === "clip"
|
: root.mode === "clip"
|
||||||
? "⏎ COPY ESC BACK ↑↓ SELECT"
|
? "⏎ COPY ESC SELECT ↑↓ MOVE"
|
||||||
: root.pinned
|
: root.pinned
|
||||||
? "⏎ OPEN ESC UNPIN ↑↓ PICK"
|
? "⏎ OPEN ESC SELECT ↑↓ PICK"
|
||||||
: "TAB PIN > SHELL = CALC : CLIPBOARD"
|
: "ESC SELECT TAB PIN > SHELL = CALC : CLIP"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -422,16 +429,23 @@ PanelWindow {
|
|||||||
|
|
||||||
const ctrl = (event.modifiers & Qt.ControlModifier) !== 0;
|
const ctrl = (event.modifiers & Qt.ControlModifier) !== 0;
|
||||||
|
|
||||||
// Escape peels one layer at a time: select mode, then the pin, then
|
// Escape is the mode key, and it means what it means in vim: leave
|
||||||
// the launcher. Nothing about it is ever a surprise.
|
// insert. From select mode there is nothing left to leave but the
|
||||||
|
// launcher itself, so the second press ends the prompt.
|
||||||
if (event.key === Qt.Key_Escape) {
|
if (event.key === Qt.Key_Escape) {
|
||||||
if (root.selectMode) root.selectMode = false;
|
if (!root.selectMode && root.results.length > 0) root.selectMode = true;
|
||||||
else if (root.pinned) root.unpin();
|
|
||||||
else Actions.closeLauncher();
|
else Actions.closeLauncher();
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// …and Ctrl+C still walks out in one press, from wherever you are.
|
||||||
|
if (ctrl && event.key === Qt.Key_C) {
|
||||||
|
Actions.closeLauncher();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
|
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
|
||||||
root.activate();
|
root.activate();
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
@@ -446,7 +460,6 @@ PanelWindow {
|
|||||||
|
|
||||||
if (event.key === Qt.Key_Down || (ctrl && event.key === Qt.Key_J)
|
if (event.key === Qt.Key_Down || (ctrl && event.key === Qt.Key_J)
|
||||||
|| (ctrl && event.key === Qt.Key_N)) {
|
|| (ctrl && event.key === Qt.Key_N)) {
|
||||||
root.selectMode = true;
|
|
||||||
root.move(1);
|
root.move(1);
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
return;
|
return;
|
||||||
@@ -454,7 +467,6 @@ PanelWindow {
|
|||||||
|
|
||||||
if (event.key === Qt.Key_Up || (ctrl && event.key === Qt.Key_K)
|
if (event.key === Qt.Key_Up || (ctrl && event.key === Qt.Key_K)
|
||||||
|| (ctrl && event.key === Qt.Key_P)) {
|
|| (ctrl && event.key === Qt.Key_P)) {
|
||||||
root.selectMode = true;
|
|
||||||
root.move(-1);
|
root.move(-1);
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
return;
|
return;
|
||||||
@@ -468,14 +480,23 @@ PanelWindow {
|
|||||||
|
|
||||||
if (!root.selectMode) return;
|
if (!root.selectMode) return;
|
||||||
|
|
||||||
// Select mode. The letters navigate; anything else drops you back into
|
// Select mode. The letters are commands, not text: `i` and `a` go back
|
||||||
// the input, having typed nothing, so a mistyped `d` costs one press
|
// to insert without leaving an `i` behind, and everything unclaimed is
|
||||||
// rather than a mangled query.
|
// swallowed rather than typed, so a stray `d` costs nothing at all.
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case Qt.Key_J: root.move(1); event.accepted = true; return;
|
case Qt.Key_J: root.move(1); event.accepted = true; return;
|
||||||
case Qt.Key_K: root.move(-1); event.accepted = true; return;
|
case Qt.Key_K: root.move(-1); event.accepted = true; return;
|
||||||
case Qt.Key_L: root.pin(); event.accepted = true; return;
|
case Qt.Key_L: root.pin(); event.accepted = true; return;
|
||||||
case Qt.Key_H: root.unpin(); event.accepted = true; return;
|
case Qt.Key_H: root.unpin(); event.accepted = true; return;
|
||||||
|
case Qt.Key_I:
|
||||||
|
case Qt.Key_A:
|
||||||
|
root.selectMode = false;
|
||||||
|
input.forceActiveFocus();
|
||||||
|
// `a` appends, `i` leaves the cursor where it was — the same
|
||||||
|
// distinction, for the same reason.
|
||||||
|
if (event.key === Qt.Key_A) input.cursorPosition = input.text.length;
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
case Qt.Key_G:
|
case Qt.Key_G:
|
||||||
root.selected = (event.modifiers & Qt.ShiftModifier)
|
root.selected = (event.modifiers & Qt.ShiftModifier)
|
||||||
? root.results.length - 1 : 0;
|
? root.results.length - 1 : 0;
|
||||||
@@ -484,11 +505,13 @@ PanelWindow {
|
|||||||
return;
|
return;
|
||||||
case Qt.Key_Backspace:
|
case Qt.Key_Backspace:
|
||||||
root.selectMode = false;
|
root.selectMode = false;
|
||||||
|
input.forceActiveFocus();
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.text !== "") root.selectMode = false;
|
// Anything else in select mode is a command nobody bound. Eat it.
|
||||||
|
if (event.text !== "") event.accepted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------- animation
|
// ------------------------------------------------------------- animation
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ pragma Singleton
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
|
import Quickshell.Hyprland
|
||||||
import "root:/services"
|
import "root:/services"
|
||||||
|
|
||||||
// Shell-wide UI state and the handful of external commands the shell fires.
|
// Shell-wide UI state and the handful of external commands the shell fires.
|
||||||
@@ -22,14 +23,29 @@ Singleton {
|
|||||||
// "https://…"` is an open-with dialog for anything that can run a command.
|
// "https://…"` is an open-with dialog for anything that can run a command.
|
||||||
property string launcherSeed: ""
|
property string launcherSeed: ""
|
||||||
|
|
||||||
|
// A launcher window exists on every screen, but only one of them is being
|
||||||
|
// typed at. Latch the focused monitor at open time so the window appears
|
||||||
|
// there alone — latched rather than live, because the launcher itself takes
|
||||||
|
// keyboard focus and because a window should not hop mid-query.
|
||||||
|
property string launcherScreen: ""
|
||||||
|
|
||||||
signal osdRequested(string kind)
|
signal osdRequested(string kind)
|
||||||
|
|
||||||
function togglePowerMenu() { root.powerMenuOpen = !root.powerMenuOpen; }
|
function togglePowerMenu() { root.powerMenuOpen = !root.powerMenuOpen; }
|
||||||
function closePowerMenu() { root.powerMenuOpen = false; }
|
function closePowerMenu() { root.powerMenuOpen = false; }
|
||||||
function lock() { root.powerMenuOpen = false; root.lockRequested = true; }
|
function lock() { root.powerMenuOpen = false; root.lockRequested = true; }
|
||||||
|
|
||||||
|
function focusedScreenName(): string {
|
||||||
|
return Hyprland.focusedMonitor?.name
|
||||||
|
?? Quickshell.screens[0]?.name
|
||||||
|
?? "";
|
||||||
|
}
|
||||||
|
|
||||||
function toggleLauncher() {
|
function toggleLauncher() {
|
||||||
if (!root.launcherOpen) root.launcherSeed = "";
|
if (!root.launcherOpen) {
|
||||||
|
root.launcherSeed = "";
|
||||||
|
root.launcherScreen = root.focusedScreenName();
|
||||||
|
}
|
||||||
root.launcherOpen = !root.launcherOpen;
|
root.launcherOpen = !root.launcherOpen;
|
||||||
}
|
}
|
||||||
function closeLauncher() { root.launcherOpen = false; }
|
function closeLauncher() { root.launcherOpen = false; }
|
||||||
@@ -38,31 +54,25 @@ Singleton {
|
|||||||
function dmenuLauncher(inPath: string, outPath: string, prompt: string) {
|
function dmenuLauncher(inPath: string, outPath: string, prompt: string) {
|
||||||
Apps.beginDmenu(inPath, outPath, prompt);
|
Apps.beginDmenu(inPath, outPath, prompt);
|
||||||
root.launcherSeed = "";
|
root.launcherSeed = "";
|
||||||
|
root.launcherScreen = root.focusedScreenName();
|
||||||
root.launcherOpen = false;
|
root.launcherOpen = false;
|
||||||
root.launcherOpen = true;
|
root.launcherOpen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function promptLauncher(seed: string) {
|
function promptLauncher(seed: string) {
|
||||||
root.launcherSeed = seed;
|
root.launcherSeed = seed;
|
||||||
|
root.launcherScreen = root.focusedScreenName();
|
||||||
root.launcherOpen = false;
|
root.launcherOpen = false;
|
||||||
root.launcherOpen = true;
|
root.launcherOpen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------- commands
|
// ------------------------------------------------------------- commands
|
||||||
// Each slot gets its own Process so a slow one cannot cancel another.
|
// Detached, because nothing here is ever read back. Rotating a fixed set of
|
||||||
Process { id: slotA }
|
// `Process` slots only moves the collision: `uwsm app` lives as long as the
|
||||||
Process { id: slotB }
|
// app it started, so the fourth launch reclaims the first slot and kills the
|
||||||
Process { id: slotC }
|
// app still holding it — and a shell reload kills every one of them at once.
|
||||||
|
|
||||||
property int _slot: 0
|
|
||||||
|
|
||||||
function run(argv: var) {
|
function run(argv: var) {
|
||||||
const slots = [slotA, slotB, slotC];
|
Quickshell.execDetached(argv);
|
||||||
const p = slots[root._slot % slots.length];
|
|
||||||
root._slot++;
|
|
||||||
p.running = false;
|
|
||||||
p.command = argv;
|
|
||||||
p.running = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function launch(app: string) {
|
function launch(app: string) {
|
||||||
|
|||||||
@@ -311,19 +311,19 @@ Singleton {
|
|||||||
root._remember(item.key);
|
root._remember(item.key);
|
||||||
|
|
||||||
if (arg === "") {
|
if (arg === "") {
|
||||||
proc.exec(["uwsm", "app", "--", item.key]);
|
Quickshell.execDetached(["uwsm", "app", "--", item.key]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (root.fieldRe.test(item.exec || "")) {
|
if (root.fieldRe.test(item.exec || "")) {
|
||||||
proc.exec(["uwsm", "app", "--", item.key, arg]);
|
Quickshell.execDetached(["uwsm", "app", "--", item.key, arg]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const argv = root._tokenize(item.exec || "")
|
const argv = root._tokenize(item.exec || "")
|
||||||
.filter(t => !root.anyFieldRe.test(t));
|
.filter(t => !root.anyFieldRe.test(t));
|
||||||
if (argv.length === 0) {
|
if (argv.length === 0) {
|
||||||
proc.exec(["uwsm", "app", "--", item.key]);
|
Quickshell.execDetached(["uwsm", "app", "--", item.key]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
argv.push(arg);
|
argv.push(arg);
|
||||||
@@ -333,7 +333,7 @@ Singleton {
|
|||||||
const name = item.key.replace(".desktop", "").replace(/[^a-zA-Z0-9_-]/g, "-");
|
const name = item.key.replace(".desktop", "").replace(/[^a-zA-Z0-9_-]/g, "-");
|
||||||
const head = ["uwsm", "app", "-a", name];
|
const head = ["uwsm", "app", "-a", name];
|
||||||
if (item.terminal) head.push("-T");
|
if (item.terminal) head.push("-T");
|
||||||
proc.exec(head.concat(["--"]).concat(argv));
|
Quickshell.execDetached(head.concat(["--"]).concat(argv));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exec lines are shell-ish but not shell: the spec allows double quotes and
|
// Exec lines are shell-ish but not shell: the spec allows double quotes and
|
||||||
@@ -367,17 +367,24 @@ Singleton {
|
|||||||
|
|
||||||
function runShell(line: string, inTerminal: bool): void {
|
function runShell(line: string, inTerminal: bool): void {
|
||||||
if (line.trim() === "") return;
|
if (line.trim() === "") return;
|
||||||
if (inTerminal) proc.exec(["uwsm", "app", "-T", "--", "sh", "-c", line]);
|
if (inTerminal) Quickshell.execDetached(["uwsm", "app", "-T", "--", "sh", "-c", line]);
|
||||||
else proc.exec(["uwsm", "app", "--", "sh", "-c", line]);
|
else Quickshell.execDetached(["uwsm", "app", "--", "sh", "-c", line]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function copy(text: string): void {
|
function copy(text: string): void {
|
||||||
proc.exec(["wl-copy", "--", text]);
|
Quickshell.execDetached(["wl-copy", "--", text]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fire-and-forget. Each call replaces the last, which is fine because uwsm
|
// Everything above spawns through `Quickshell.execDetached` rather than a
|
||||||
// has already handed the app off to systemd by the time it exits.
|
// `Process`, and it has to. `uwsm app` does not exit once the scope is up —
|
||||||
Process { id: proc }
|
// it stays on as the scope's main process for as long as the app lives. A
|
||||||
|
// shared `Process` therefore never goes idle, so the next `exec()` kills the
|
||||||
|
// previous uwsm, systemd tears down the scope with it, and launching the
|
||||||
|
// second app closes the first. Shell reload did the same thing to every app
|
||||||
|
// at once, since `manageLifetime` kills the child when the object goes away.
|
||||||
|
//
|
||||||
|
// A detached spawn is owned by nobody here, which is exactly right: once
|
||||||
|
// uwsm has the scope, the shell has no further business in that lifetime.
|
||||||
|
|
||||||
// ----------------------------------------------------------------- dmenu
|
// ----------------------------------------------------------------- dmenu
|
||||||
// The launcher can stand in for `fuzzel --dmenu`, which is what lets fuzzel
|
// The launcher can stand in for `fuzzel --dmenu`, which is what lets fuzzel
|
||||||
@@ -494,7 +501,7 @@ Singleton {
|
|||||||
// wl-copy without being round-tripped through a QML string.
|
// wl-copy without being round-tripped through a QML string.
|
||||||
function pasteClip(item: var): void {
|
function pasteClip(item: var): void {
|
||||||
if (!/^[0-9]+$/.test(item.clipId)) return;
|
if (!/^[0-9]+$/.test(item.clipId)) return;
|
||||||
proc.exec(["sh", "-c", "cliphist decode " + item.clipId + " | wl-copy"]);
|
Quickshell.execDetached(["sh", "-c", "cliphist decode " + item.clipId + " | wl-copy"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function searchClips(term: string): var {
|
function searchClips(term: string): var {
|
||||||
|
|||||||
Reference in new issue
Block a user