Compare commits
2 Commits
9cad6fc050
...
configs
| Author | SHA1 | Date | |
|---|---|---|---|
|
0bffb6ad35
|
|||
|
9a3e36fcb1
|
1
configs/box
Normal file
1
configs/box
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"extends": "shell", "mountcwd": true}
|
||||||
10
configs/default
Normal file
10
configs/default
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"mount": [],
|
||||||
|
"romount": ["/etc", "/var", "/usr", "/opt"],
|
||||||
|
"symlinks": [
|
||||||
|
{"src": "usr/lib", "dst": "/lib"},
|
||||||
|
{"src": "usr/lib64", "dst": "/lib64"},
|
||||||
|
{"src": "usr/bin", "dst": "/bin"},
|
||||||
|
{"src": "usr/sbin", "dst": "/sbin"}
|
||||||
|
]
|
||||||
|
}
|
||||||
1
configs/dev
Normal file
1
configs/dev
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"extends": "shell", "romount": [".gitconfig", ".gnupg", "/run/user/1000/gnupg", ".ssh/config"], "mountcwd": true, "mount": [".ssh/known_hosts"]}
|
||||||
1
configs/gui
Normal file
1
configs/gui
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"extends": "default", "romount": [".Xauthority", "/tmp/.X11-unix", "/run/user/1000/pulse/native"], "dbus": true, "dbuscall": ["org.freedesktop.Notifications.*=@/org/freedesktop/Notifications", "org.freedesktop.portal.*=*"], "dbusbroadcast": ["org.freedesktop.portal.*=@/org/freedesktop/portal/*"]}
|
||||||
1
configs/shell
Normal file
1
configs/shell
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"extends": "default", "romount": [".oh-my-zsh", ".zsh", ".zshrc", ".zshrc-local"], "sethostname": true}
|
||||||
40
lib/args.nim
40
lib/args.nim
@@ -1,4 +1,3 @@
|
|||||||
import parseopt
|
|
||||||
import options
|
import options
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@@ -16,32 +15,25 @@ proc getProfile*(args: Args): string =
|
|||||||
|
|
||||||
return "default"
|
return "default"
|
||||||
|
|
||||||
proc parseOpt(args: var Args, key: string, value: string): bool =
|
|
||||||
case key
|
|
||||||
of "name", "n":
|
|
||||||
args.name = some(value)
|
|
||||||
of "profile", "p":
|
|
||||||
args.profile = some(value)
|
|
||||||
else:
|
|
||||||
return false
|
|
||||||
|
|
||||||
return true
|
|
||||||
|
|
||||||
proc parseArgs*(): Option[Args] =
|
proc parseArgs*(): Option[Args] =
|
||||||
var p = initOptParser()
|
|
||||||
var args = Args()
|
var args = Args()
|
||||||
var command = newSeq[string]()
|
|
||||||
|
|
||||||
while true:
|
var command = newSeq[string]()
|
||||||
p.next()
|
var i = 1
|
||||||
case p.kind
|
|
||||||
of cmdEnd: break
|
while i <= paramCount():
|
||||||
of cmdShortOption, cmdLongOption:
|
var arg = paramStr(i)
|
||||||
if p.val == "" or args.parseOpt(p.key, p.val) == false:
|
|
||||||
echo "Invalid argument ", p.val
|
if arg == "--name":
|
||||||
return
|
args.name = some(paramStr(i + 1))
|
||||||
of cmdArgument:
|
i += 2
|
||||||
command.add(p.key.string)
|
elif arg == "--profile":
|
||||||
|
args.profile = some(paramStr(i + 1))
|
||||||
|
i += 2
|
||||||
|
else:
|
||||||
|
echo arg
|
||||||
|
command.add(arg)
|
||||||
|
i += 1
|
||||||
|
|
||||||
if command.len > 0:
|
if command.len > 0:
|
||||||
args.cmd = some(command)
|
args.cmd = some(command)
|
||||||
|
|||||||
@@ -12,13 +12,15 @@ check_dir() {
|
|||||||
for application in "$dir/"*; do
|
for application in "$dir/"*; do
|
||||||
file="$(basename "$application")"
|
file="$(basename "$application")"
|
||||||
|
|
||||||
sed "s/Exec=/Exec=bwrap --name='$file' --profile=gui /gi" "$application" > "$target/$file"
|
sed "s/Exec=/Exec=bwshell --name '$file' --profile gui /gi" "$application" > "$target/$file"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
dirs=("/usr/share/applications" "$HOME/.local/share/applications")
|
dirs=("/usr/share/applications" "$HOME/.local/share/applications")
|
||||||
target="$1"
|
target="$1"
|
||||||
|
|
||||||
|
mkdir -p "$target"
|
||||||
|
|
||||||
for dir in "${dirs[@]}"; do
|
for dir in "${dirs[@]}"; do
|
||||||
check_dir "$dir"
|
check_dir "$dir"
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user