Compare commits
No commits in common. "af4aff8ef2b0310ded320af641d0c0a5a470f540" and "e246b88ae12f4ba2528d84bc1062ff0d9a28a203" have entirely different histories.
af4aff8ef2
...
e246b88ae1
3 changed files with 1 additions and 74 deletions
2
nswitch
2
nswitch
|
@ -5,8 +5,6 @@ set -E -o pipefail
|
||||||
shopt -s failglob
|
shopt -s failglob
|
||||||
export LC_ALL=C.UTF8
|
export LC_ALL=C.UTF8
|
||||||
|
|
||||||
# TODO: implement step by step update with diff in between (first build then switch)
|
|
||||||
|
|
||||||
INITIAL_PWD="$(pwd)"
|
INITIAL_PWD="$(pwd)"
|
||||||
PROJECT="$HOME/Projects/NixOS"
|
PROJECT="$HOME/Projects/NixOS"
|
||||||
GIT_PATTERN="." # "*.nix"
|
GIT_PATTERN="." # "*.nix"
|
||||||
|
|
64
s
64
s
|
@ -1,64 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
import subprocess as sp
|
|
||||||
import argparse
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
|
||||||
parser.add_argument("alias", nargs="?",
|
|
||||||
help="the replacement for the command")
|
|
||||||
parser.add_argument("arguments", nargs="*", default=[],
|
|
||||||
help="arguments that will be added to the argument")
|
|
||||||
|
|
||||||
parser.add_argument("-l", "--list", dest="list", action="store_true",
|
|
||||||
help="list mappings")
|
|
||||||
ag = parser.parse_args()
|
|
||||||
|
|
||||||
CFG = {
|
|
||||||
"offset": 10,
|
|
||||||
"mapping": {
|
|
||||||
"document": {"cmd": "sioyek", "pre_args": []},
|
|
||||||
"pdf": {"alias": "document", "pre_args": []},
|
|
||||||
|
|
||||||
"image": {"cmd": "nomacs", "pre_args": []},
|
|
||||||
|
|
||||||
"audio": {"cmd": "amberol", "pre_args": []},
|
|
||||||
"music": {"alias": "audio", "pre_args": []},
|
|
||||||
|
|
||||||
"video": {"cmd": "mpv", "pre_args": []}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def run(command, pre_args):
|
|
||||||
cmd_list = [command]
|
|
||||||
cmd_list.extend(pre_args)
|
|
||||||
cmd_list.extend(ag.arguments)
|
|
||||||
return sp.run(cmd_list)
|
|
||||||
|
|
||||||
def offset(element, offset=CFG["offset"]):
|
|
||||||
"""
|
|
||||||
calculates the amount of spaces until `offset` is reached for `element` length
|
|
||||||
"""
|
|
||||||
element_length = len(element.strip(""))
|
|
||||||
if element_length >= offset:
|
|
||||||
return ""
|
|
||||||
else:
|
|
||||||
return " " * (offset - element_length)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ag.list:
|
|
||||||
for key, value in CFG["mapping"].items():
|
|
||||||
value_str = ""
|
|
||||||
for e_key, e_value in value.items():
|
|
||||||
value_str += e_key + ": " + str(e_value) + ", "
|
|
||||||
print(key, end="")
|
|
||||||
print(offset(key), value_str.rstrip(", "))
|
|
||||||
else:
|
|
||||||
for key, value in CFG["mapping"].items():
|
|
||||||
if ag.alias in key: # matching
|
|
||||||
if "alias" in value.keys():
|
|
||||||
cmd = CFG["mapping"][value["alias"]]["cmd"]
|
|
||||||
else:
|
|
||||||
cmd = value["cmd"]
|
|
||||||
|
|
||||||
run(cmd, value["pre_args"])
|
|
|
@ -4,16 +4,9 @@ set -E -o pipefail
|
||||||
shopt -s failglob
|
shopt -s failglob
|
||||||
export LC_ALL=C.UTF8
|
export LC_ALL=C.UTF8
|
||||||
|
|
||||||
PICTURES="$HOME"
|
|
||||||
|
|
||||||
source /etc/xdg/user-dirs.defaults
|
|
||||||
source "$XDG_CONFIG_HOME/user-dirs.dirs"
|
|
||||||
|
|
||||||
mkdir -p "$PICTURES"
|
|
||||||
|
|
||||||
grim -g "$(slurp -o -r -c '#ff0000ff')" - \
|
grim -g "$(slurp -o -r -c '#ff0000ff')" - \
|
||||||
| satty \
|
| satty \
|
||||||
--filename - \
|
--filename - \
|
||||||
--fullscreen \
|
--fullscreen \
|
||||||
--initial-tool "crop" \
|
--initial-tool "crop" \
|
||||||
--output-filename "$PICTURES/Screenshots/satty-$(date '+%Y%m%d-%H:%M:%S').png"
|
--output-filename "$HOME/Media/Pictures/Screenshots/satty-$(date '+%Y%m%d-%H:%M:%S').png"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue