added application launcher arguments support
This commit is contained in:
@@ -16,16 +16,18 @@
|
|||||||
{
|
{
|
||||||
"index": 3,
|
"index": 3,
|
||||||
"name": "internet",
|
"name": "internet",
|
||||||
"exec": "firefox --new-window",
|
"exec": "firefox",
|
||||||
|
"args": ["--new-window"],
|
||||||
"environ": {
|
"environ": {
|
||||||
"MOZ_ENABLE_WAYLAND": "0"
|
"MOZ_ENABLE_WAYLAND": "1"
|
||||||
},
|
},
|
||||||
"program_name": "firefox"
|
"program_name": "firefox"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"index": 4,
|
"index": 4,
|
||||||
"name": "project",
|
"name": "project",
|
||||||
"exec": "firefox --new-window",
|
"exec": "firefox",
|
||||||
|
"args": ["--new-window"],
|
||||||
"environ": {
|
"environ": {
|
||||||
"MOZ_ENABLE_WAYLAND": "0"
|
"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)
|
run_with_systemd=$(echo $ws_data | jq '.systemd' -r)
|
||||||
void_output=$(echo $ws_data | jq '.void_output' -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' 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
|
if [[ $memory_profile != "null" ]]; then
|
||||||
max_memory=$(echo $memory_profile | jq -r '.max')
|
max_memory=$(echo $memory_profile | jq -r '.max')
|
||||||
high_memory=$(echo $memory_profile | jq -r '.high')
|
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
|
fi
|
||||||
|
|
||||||
pty=alacritty
|
pty=alacritty
|
||||||
@@ -41,7 +43,7 @@ echo "Launching application $program"
|
|||||||
if [[ $environ != "" ]]; then
|
if [[ $environ != "" ]]; then
|
||||||
for env in $environ; do
|
for env in $environ; do
|
||||||
echo "setting environment $env"
|
echo "setting environment $env"
|
||||||
export $env
|
systemd_run_args+=("--setenv=$env")
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -73,4 +75,6 @@ fi
|
|||||||
# Run programs using systemd-run to allow for resource control and capture of stdout/stderr
|
# 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
|
# 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.
|
# 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
|
||||||
|
|||||||
Reference in New Issue
Block a user