added application launcher arguments support
This commit is contained in:
parent
4caaf6d872
commit
c8223147f5
@ -16,16 +16,18 @@
|
||||
{
|
||||
"index": 3,
|
||||
"name": "internet",
|
||||
"exec": "firefox --new-window",
|
||||
"exec": "firefox",
|
||||
"args": ["--new-window"],
|
||||
"environ": {
|
||||
"MOZ_ENABLE_WAYLAND": "0"
|
||||
"MOZ_ENABLE_WAYLAND": "1"
|
||||
},
|
||||
"program_name": "firefox"
|
||||
},
|
||||
{
|
||||
"index": 4,
|
||||
"name": "project",
|
||||
"exec": "firefox --new-window",
|
||||
"exec": "firefox",
|
||||
"args": ["--new-window"],
|
||||
"environ": {
|
||||
"MOZ_ENABLE_WAYLAND": "0"
|
||||
},
|
||||
|
||||
@ -16,13 +16,15 @@ memory_profile=$(echo $ws_data | jq '.memory_profile' -c)
|
||||
run_with_systemd=$(echo $ws_data | jq '.systemd' -r)
|
||||
void_output=$(echo $ws_data | jq '.void_output' -r)
|
||||
IFS=$'\n' environ=($(echo $ws_data | jq '.environ | to_entries | map("\(.key)=\(.value|tostring)") | .[]' -r 2> /dev/null))
|
||||
IFS=$'\n' args=($(echo $ws_data | jq '.args | .[]' -r 2> /dev/null))
|
||||
|
||||
systemd_run_args=""
|
||||
systemd_run_args=()
|
||||
|
||||
if [[ $memory_profile != "null" ]]; then
|
||||
max_memory=$(echo $memory_profile | jq -r '.max')
|
||||
high_memory=$(echo $memory_profile | jq -r '.high')
|
||||
systemd_run_args+="--property=MemoryAccounting=yes --property=MemoryMax=${max_memory} --property=MemoryHigh=${high_memory}"
|
||||
|
||||
systemd_run_args+=("--property=MemoryAccounting=yes" "--property=MemoryMax=${max_memory}" "--property=MemoryHigh=${high_memory}")
|
||||
fi
|
||||
|
||||
pty=alacritty
|
||||
@ -41,7 +43,7 @@ echo "Launching application $program"
|
||||
if [[ $environ != "" ]]; then
|
||||
for env in $environ; do
|
||||
echo "setting environment $env"
|
||||
export $env
|
||||
systemd_run_args+=("--setenv=$env")
|
||||
done
|
||||
fi
|
||||
|
||||
@ -73,4 +75,6 @@ fi
|
||||
# Run programs using systemd-run to allow for resource control and capture of stdout/stderr
|
||||
# We're using a service instead of a scope because scopes don't capture output, and wrapping
|
||||
# the call in systemd-cat is more complicated than just using a service.
|
||||
exec systemd-run --user $=systemd_run_args --unit="$program_name-$$" --description="$program_name" --slice=gui.slice -- $=program
|
||||
echo exec systemd-run --user $=systemd_run_args --unit="$program_name-$$" --description="$program_name" --slice=gui.slice -- $program $args
|
||||
|
||||
exec systemd-run --user $=systemd_run_args --unit="$program_name-$$" --description="$program_name" --slice=gui.slice -- $program $args
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user