mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 11:36:07 +01:00
modules/android-integration: termux-reload-settings
This commit is contained in:
parent
438cf8c620
commit
e0216d3e47
6 changed files with 53 additions and 3 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
* New options under `android-integration`,
|
* New options under `android-integration`,
|
||||||
offer some of the tools familiar to Termux users:
|
offer some of the tools familiar to Termux users:
|
||||||
`am`, `termux-open`, `termux-open-url`,
|
`am`, `termux-open`, `termux-open-url`, `termux-reload-settings`,
|
||||||
`termux-setup-storage`, `termux-wake-lock`, `termux-wake-unlock`
|
`termux-setup-storage`, `termux-wake-lock`, `termux-wake-unlock`
|
||||||
and `xdg-open`.
|
and `xdg-open`.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,17 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
termux-reload-settings.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = "true";
|
||||||
|
description = lib.mdDoc ''
|
||||||
|
Provide a `termux-reload-settings` command
|
||||||
|
which applies changes to font, colorscheme or terminal
|
||||||
|
without the need to close all the sessions.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
termux-wake-lock.enable = lib.mkOption {
|
termux-wake-lock.enable = lib.mkOption {
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
|
@ -112,6 +123,7 @@ in
|
||||||
(ifD cfg.termux-setup-storage.enable termux-tools.setup_storage) ++
|
(ifD cfg.termux-setup-storage.enable termux-tools.setup_storage) ++
|
||||||
(ifD cfg.termux-open.enable termux-tools.open) ++
|
(ifD cfg.termux-open.enable termux-tools.open) ++
|
||||||
(ifD cfg.termux-open-url.enable termux-tools.open_url) ++
|
(ifD cfg.termux-open-url.enable termux-tools.open_url) ++
|
||||||
|
(ifD cfg.termux-reload-settings.enable termux-tools.reload_settings) ++
|
||||||
(ifD cfg.termux-wake-lock.enable termux-tools.wake_lock) ++
|
(ifD cfg.termux-wake-lock.enable termux-tools.wake_lock) ++
|
||||||
(ifD cfg.termux-wake-unlock.enable termux-tools.wake_unlock) ++
|
(ifD cfg.termux-wake-unlock.enable termux-tools.wake_unlock) ++
|
||||||
(ifD cfg.xdg-open.enable termux-tools.xdg_open) ++
|
(ifD cfg.xdg-open.enable termux-tools.xdg_open) ++
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,8 @@ stdenvNoCC.mkDerivation rec {
|
||||||
scripts/termux-wake-unlock.in \
|
scripts/termux-wake-unlock.in \
|
||||||
--replace @TERMUX_APP_PACKAGE@.app com.termux.app \
|
--replace @TERMUX_APP_PACKAGE@.app com.termux.app \
|
||||||
--replace @TERMUX_APP_PACKAGE@ com.termux.nix
|
--replace @TERMUX_APP_PACKAGE@ com.termux.nix
|
||||||
|
substituteInPlace scripts/termux-reload-settings.in \
|
||||||
|
--replace @TERMUX_APP_PACKAGE@ com.termux.nix
|
||||||
${gnused}/bin/sed -i 's|^am |${termux-am}/bin/am |' scripts/*
|
${gnused}/bin/sed -i 's|^am |${termux-am}/bin/am |' scripts/*
|
||||||
|
|
||||||
rm -r doc # manpage is half misleading, pulling pandoc is not worth it
|
rm -r doc # manpage is half misleading, pulling pandoc is not worth it
|
||||||
|
|
@ -53,6 +55,7 @@ stdenvNoCC.mkDerivation rec {
|
||||||
"setup_storage" # termux-setup-storage
|
"setup_storage" # termux-setup-storage
|
||||||
"open" # termux-open
|
"open" # termux-open
|
||||||
"open_url" # termux-open-url
|
"open_url" # termux-open-url
|
||||||
|
"reload_settings" # termux-reload-settings
|
||||||
"wake_lock" # termux-wake-lock
|
"wake_lock" # termux-wake-lock
|
||||||
"wake_unlock" # termux-wake-unlock
|
"wake_unlock" # termux-wake-unlock
|
||||||
"xdg_open" # xdg-open
|
"xdg_open" # xdg-open
|
||||||
|
|
@ -94,6 +97,9 @@ stdenvNoCC.mkDerivation rec {
|
||||||
mkdir -p $open_url/bin
|
mkdir -p $open_url/bin
|
||||||
mv $out/bin/termux-open-url $open_url/bin/
|
mv $out/bin/termux-open-url $open_url/bin/
|
||||||
|
|
||||||
|
mkdir -p $reload_settings/bin
|
||||||
|
mv $out/bin/termux-reload-settings $reload_settings/bin/
|
||||||
|
|
||||||
mkdir -p $wake_lock/bin
|
mkdir -p $wake_lock/bin
|
||||||
mv $out/bin/termux-wake-lock $wake_lock/bin/
|
mv $out/bin/termux-wake-lock $wake_lock/bin/
|
||||||
|
|
||||||
|
|
@ -109,7 +115,6 @@ stdenvNoCC.mkDerivation rec {
|
||||||
echo . >> expected
|
echo . >> expected
|
||||||
echo ./bin >> expected
|
echo ./bin >> expected
|
||||||
echo ./bin/termux-backup >> expected # entirely untested
|
echo ./bin/termux-backup >> expected # entirely untested
|
||||||
echo ./bin/termux-reload-settings >> expected # good candidate for fixing
|
|
||||||
echo ./share >> expected
|
echo ./share >> expected
|
||||||
echo ./share/examples >> expected
|
echo ./share/examples >> expected
|
||||||
echo ./share/examples/termux >> expected
|
echo ./share/examples/termux >> expected
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import base64
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import bootstrap_channels
|
import bootstrap_channels
|
||||||
|
|
@ -7,7 +8,7 @@ from common import screenshot, wait_for
|
||||||
|
|
||||||
def run(d):
|
def run(d):
|
||||||
OPENERS = ['termux-open', 'termux-open-url', 'xdg-open']
|
OPENERS = ['termux-open', 'termux-open-url', 'xdg-open']
|
||||||
TOOLS = ['am', 'termux-setup-storage',
|
TOOLS = ['am', 'termux-setup-storage', 'termux-reload-settings',
|
||||||
'termux-wake-lock', 'termux-wake-unlock'] + OPENERS
|
'termux-wake-lock', 'termux-wake-unlock'] + OPENERS
|
||||||
|
|
||||||
nod = bootstrap_channels.run(d)
|
nod = bootstrap_channels.run(d)
|
||||||
|
|
@ -162,3 +163,31 @@ def run(d):
|
||||||
screenshot(d, 'back')
|
screenshot(d, 'back')
|
||||||
wait_for(d, 'termux-wake-unlock')
|
wait_for(d, 'termux-wake-unlock')
|
||||||
screenshot(d, 'really-back')
|
screenshot(d, 'really-back')
|
||||||
|
|
||||||
|
# Test termux-reload-settings
|
||||||
|
assert 'text="PGUP"' in d.ui.dump_hierarchy()
|
||||||
|
assert 'text="F12"' not in d.ui.dump_hierarchy()
|
||||||
|
|
||||||
|
d('input text "mkdir ~/.termux"')
|
||||||
|
d.ui.press('enter')
|
||||||
|
cmd = 'echo "extra-keys=[[\'F12\']]" > ~/.termux/termux.properties'
|
||||||
|
cmd_base64 = base64.b64encode(cmd.encode()).decode()
|
||||||
|
d(f'input text "echo {cmd_base64} | base64 -d | bash -s"')
|
||||||
|
d.ui.press('enter')
|
||||||
|
screenshot(d, 'pre-reload')
|
||||||
|
d('input text "termux-reload-settings"')
|
||||||
|
d.ui.press('enter')
|
||||||
|
time.sleep(1)
|
||||||
|
screenshot(d, 'post-reload')
|
||||||
|
assert 'text="PGUP"' not in d.ui.dump_hierarchy()
|
||||||
|
assert 'text="F12"' in d.ui.dump_hierarchy()
|
||||||
|
|
||||||
|
d('input text "rm -r ~/.termux"')
|
||||||
|
d.ui.press('enter')
|
||||||
|
screenshot(d, 'pre-reload-back')
|
||||||
|
d('input text "termux-reload-settings"')
|
||||||
|
d.ui.press('enter')
|
||||||
|
time.sleep(1)
|
||||||
|
screenshot(d, 'post-reload-back')
|
||||||
|
assert 'text="PGUP"' in d.ui.dump_hierarchy()
|
||||||
|
assert 'text="F12"' not in d.ui.dump_hierarchy()
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ load lib
|
||||||
run ! command -v termux-setup-storage
|
run ! command -v termux-setup-storage
|
||||||
run ! command -v termux-open
|
run ! command -v termux-open
|
||||||
run ! command -v termux-open-url
|
run ! command -v termux-open-url
|
||||||
|
run ! command -v termux-reload-settings
|
||||||
run ! command -v termux-wake-lock
|
run ! command -v termux-wake-lock
|
||||||
run ! command -v termux-wake-unlock
|
run ! command -v termux-wake-unlock
|
||||||
run ! command -v xdg-open
|
run ! command -v xdg-open
|
||||||
|
|
@ -22,6 +23,7 @@ load lib
|
||||||
command -v termux-setup-storage
|
command -v termux-setup-storage
|
||||||
command -v termux-open
|
command -v termux-open
|
||||||
command -v termux-open-url
|
command -v termux-open-url
|
||||||
|
command -v termux-reload-settings
|
||||||
command -v termux-wake-lock
|
command -v termux-wake-lock
|
||||||
command -v termux-wake-unlock
|
command -v termux-wake-unlock
|
||||||
command -v xdg-open
|
command -v xdg-open
|
||||||
|
|
@ -36,6 +38,7 @@ load lib
|
||||||
command -v termux-setup-storage
|
command -v termux-setup-storage
|
||||||
command -v termux-open
|
command -v termux-open
|
||||||
command -v termux-open-url
|
command -v termux-open-url
|
||||||
|
command -v termux-reload-settings
|
||||||
command -v termux-wake-lock
|
command -v termux-wake-lock
|
||||||
command -v termux-wake-unlock
|
command -v termux-wake-unlock
|
||||||
command -v xdg-open
|
command -v xdg-open
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ _:
|
||||||
am.enable = true;
|
am.enable = true;
|
||||||
termux-open.enable = true;
|
termux-open.enable = true;
|
||||||
termux-open-url.enable = true;
|
termux-open-url.enable = true;
|
||||||
|
termux-reload-settings.enable = true;
|
||||||
termux-setup-storage.enable = true;
|
termux-setup-storage.enable = true;
|
||||||
termux-wake-lock.enable = true;
|
termux-wake-lock.enable = true;
|
||||||
termux-wake-unlock.enable = true;
|
termux-wake-unlock.enable = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue