Skip to content

Commit 50cb800

Browse files
fix: protect cli commands in autoswitch
1 parent 0b4c1a4 commit 50cb800

23 files changed

Lines changed: 1225 additions & 53 deletions
Lines changed: 161 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,185 @@
11
# Short English/technical tokens that should not be treated as random layout noise.
2+
# Keep this list generic: CLI/Linux commands, tech abbreviations, and developer tokens.
3+
alias
24
api
5+
apt
6+
apt-cache
7+
apt-get
8+
awk
39
backend
10+
bash
11+
bg
12+
bind
13+
break
14+
builtin
15+
caller
16+
case
17+
cat
18+
cd
19+
chgrp
20+
chmod
21+
chown
22+
clear
423
cli
5-
css
24+
command
25+
compgen
26+
complete
27+
compopt
28+
continue
29+
cp
630
cpu
31+
css
32+
curl
33+
cut
34+
date
35+
declare
36+
df
37+
diff
38+
dig
39+
dirs
40+
disown
41+
dmesg
742
docker
43+
du
44+
echo
45+
enable
846
eng
47+
env
48+
eval
49+
exec
50+
exit
51+
export
52+
false
53+
fc
54+
fd
55+
fg
56+
file
57+
find
58+
free
959
frontend
60+
function
61+
fzf
62+
gcc
63+
gdb
64+
getopts
1065
git
66+
go
1167
gpu
68+
grep
69+
groups
70+
gzip
71+
hash
72+
head
73+
help
74+
history
1275
html
76+
htop
77+
if
78+
ip
79+
jobs
80+
journalctl
81+
jq
1382
json
83+
kill
84+
less
85+
let
1486
llm
87+
ln
88+
local
1589
log
90+
logout
91+
ls
92+
make
93+
man
1694
md
95+
mkdir
96+
mount
97+
mv
98+
nano
99+
netstat
100+
nft
101+
node
102+
npm
103+
npx
17104
pdf
105+
ping
106+
pip
107+
pip3
108+
pkill
109+
pnpm
110+
popd
111+
printf
112+
ps
113+
pushd
114+
pwd
115+
python
116+
python3
18117
ram
118+
read
119+
readarray
120+
readonly
121+
return
122+
rg
123+
rm
124+
rmdir
125+
route
126+
rsync
19127
rus
128+
rustc
129+
scp
130+
sed
131+
service
132+
set
133+
sh
134+
shift
135+
shopt
136+
sleep
137+
sort
138+
source
20139
sql
140+
ss
21141
ssd
22142
ssh
143+
ssh-add
144+
ssh-agent
145+
ssh-keygen
146+
stat
147+
su
148+
sudo
149+
suspend
150+
systemctl
151+
tail
152+
tar
153+
tee
154+
test
155+
time
156+
times
157+
tmux
158+
top
159+
touch
160+
tr
161+
trap
162+
true
163+
type
164+
typeset
165+
ulimit
166+
umask
167+
umount
168+
unalias
169+
uniq
170+
unset
171+
until
172+
unzip
23173
usb
174+
vim
24175
vpn
176+
wait
177+
wc
178+
wget
179+
which
180+
while
181+
whoami
182+
xargs
183+
yq
25184
zip
185+
zsh

extension/lay@radislabus-star.github.io/lay-impl.js

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,17 @@ function openUri(uri) {
429429
try { Gio.Subprocess.new(['xdg-open', uri], Gio.SubprocessFlags.NONE); } catch(_e) {}
430430
}
431431
}
432+
function openPreferences() {
433+
const runtimePath = `${GLib.get_home_dir()}/.local/share/gnome-shell/extensions/lay@radislabus-star.github.io/settings.js`;
434+
const projectPath = `${PROJECT_DIR}/extension/lay@radislabus-star.github.io/settings.js`;
435+
const scriptPath = GLib.file_test(runtimePath, GLib.FileTest.EXISTS) ? runtimePath : projectPath;
436+
try {
437+
Gio.Subprocess.new(
438+
['gjs', '-m', scriptPath],
439+
Gio.SubprocessFlags.NONE
440+
);
441+
} catch(_e) {}
442+
}
432443
function normalizeLayoutKind(id) {
433444
const value = String(id ?? '').trim().toLowerCase();
434445
if (!value)
@@ -678,32 +689,11 @@ class LayIndicator extends PanelMenu.Button {
678689
this.menu.addMenuItem(this._statusItem);
679690
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
680691

681-
this.menu.addMenuItem(this._switchItem('Помощь при наборе', 'typing_assist', true));
682-
this.menu.addMenuItem(this._switchItem(
683-
'Автоподмена',
684-
'auto_replace',
685-
true,
686-
AUTO_REPLACE_TOOLTIP
687-
));
688-
this.menu.addMenuItem(this._switchItem(
689-
'Запоминать правки',
690-
'learning_log',
691-
false,
692-
LEARNING_LOG_TOOLTIP
693-
));
694-
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
695-
696-
this.menu.addMenuItem(this._segmentedRow('Режим', this._engineOptions(), this._engineButtons));
697-
this.menu.addMenuItem(this._segmentedRow('Область', this._scopeOptions(), this._scopeButtons));
698-
this.menu.addMenuItem(this._safetySliderRow());
699-
700-
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
692+
this.menu.addMenuItem(this._preferencesItem());
701693
this.menu.addMenuItem(this._recentActionsMenu());
702-
this.menu.addMenuItem(this._behaviorMenu());
703-
this.menu.addMenuItem(this._expertMenu());
694+
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
704695
this.menu.addMenuItem(this._daemonSwitchItem());
705696
this.menu.addMenuItem(this._updateItem());
706-
this.menu.addMenuItem(this._aboutMenu());
707697

708698
this._refreshSelections();
709699
this._refreshStatus();
@@ -1451,6 +1441,12 @@ class LayIndicator extends PanelMenu.Button {
14511441
return item;
14521442
}
14531443

1444+
_preferencesItem() {
1445+
const item = new PopupMenu.PopupMenuItem('Настройки...');
1446+
item.connect('activate', () => openPreferences());
1447+
return item;
1448+
}
1449+
14541450
_aboutMenu() {
14551451
const item = new PopupMenu.PopupSubMenuMenuItem('О программе', false);
14561452
const block = new PopupMenu.PopupBaseMenuItem({activate: false, reactive: false, can_focus: false});

0 commit comments

Comments
 (0)