dotfiles bugabingas dorkfiles
owned by bugabinga
README Source History Refs Reviews Compare Notes Search Review guide Scope dev commands from Nushell
16a99c463b75e9a26b01063506fbe3fedd625ec1
Oliver Jan Krylow <oliver@bugabinga.net > · 9 Jul 2026
unsigned
Browse files Compare with HEAD
Changed files (4) niri/cfg/keybinds.kdl Modified +4 / −5 text lines
8 8 Mod +Return
hotkey-overlay-title =
"Open a Terminal: Wezterm" {
9 - spawn "uwsm" "app" "-s" "work.slice" "--" "wezterm" "start" "--always-new-process" 9 + spawn "uwsm" "app" "-s" "app-graphical.slice" "--" "wezterm" "start" "--always-new-process" 11 11 Mod +Space
hotkey-overlay-title =
"Nuguland: launcher" {
12 12 spawn "uwsm" "app" "-s" "session-graphical.slice" "--" "qs" "ipc" "-c" "nuguland" "call" "nuguland" "openLauncher" 21 21 spawn "uwsm" "app" "-s" "app-graphical.slice" "--" "firefox" 23 23 Mod +A
hotkey-overlay-title =
"Open Mail: aerc" {
24 - spawn "uwsm" "app" "-s" "work.slice" "--" "wezterm" "start" "--always-new-process" "--class" "aerc" "--" "aerc" 24 + spawn "uwsm" "app" "-s" "app-graphical.slice" "--" "wezterm" "start" "--always-new-process" "--class" "aerc" "--" "aerc" 26 26 Mod +XF86Mail
hotkey-overlay-title =
"Open Mail: aerc" {
27 - spawn "uwsm" "app" "-s" "work.slice" "--" "wezterm" "start" "--always-new-process" "--class" "aerc" "--" "aerc" 27 + spawn "uwsm" "app" "-s" "app-graphical.slice" "--" "wezterm" "start" "--always-new-process" "--class" "aerc" "--" "aerc" 29 29 Mod +ALT+L
hotkey-overlay-title =
"Nuguland: lock" {
30 30 spawn "uwsm" "app" "-s" "session-graphical.slice" "--" "qs" "ipc" "-c" "nuguland" "call" "nuguland" "lockRequest" 39 39 spawn "uwsm" "app" "-s" "session-graphical.slice" "--" "sh" "-c" "niri msg action focus-column-right; niri msg action move-column-to-last; niri msg action focus-window-previous" 41 41 Mod +E
hotkey-overlay-title =
"File Manager: Yazi" {
42 - spawn "uwsm" "app" "-s" "work.slice" "--" "wezterm" "start" "--always-new-process" "--" "yazi" 42 + spawn "uwsm" "app" "-s" "app-graphical.slice" "--" "wezterm" "start" "--always-new-process" "--" "yazi" 44 44 XF86AudioRaiseVolume allow-when-locked =true {
45 45 spawn "uwsm" "app" "-s" "session-graphical.slice" "--" "qs" "ipc" "-c" "nuguland" "call" "volume" "increase" +3 / −0 text lines
24 25 use std/util
"path add" 31 32 source (
$nu.default-config-dir | path join
'secrets.nu' )
32 33 source (
$nu.default-config-dir | path join
"zoxide.nu" )
33 34 source (
$nu.default-config-dir | path join
"modules" "completion.nu" )
nushell/modules/work_scope.nu Added new file mode 100644+87 / −0 text lines
1 + const GENERATED_FILE =
"zzz-work-scope.nu" 3 + def quote [value: string] {
7 + def validate-command-name [name: string] {
8 + if not (
$name =~
'^[A-Za-z0-9_.+-]+$' ) {
9 + print -e $
"work_scope refuses invalid command name: ($name)" 14 + def existing-definitions [name: string] {
15 + let prefix = $
"($name) " 18 + |
where {|cmd|
$cmd.name ==
$name or (
$cmd.name | str starts-with
$prefix )}
23 + |
where {|alias|
$alias.name ==
$name }
27 + {commands:
$commands , aliases:
$aliases }
30 + def assert-unwrapped [name: string] {
31 + validate-command-name
$name 32 + let existing = (existing-definitions
$name )
34 + if ((
$existing.commands | length) >
0 ) or ((
$existing.aliases | length) >
0 ) {
35 + print -e $
"work_scope refuses to wrap ($name); existing Nu definitions: commands=($existing.commands | to nuon), aliases=($existing.aliases | to nuon)" 40 + def wrapper-
source [name: string, slice: string] {
41 + let quoted_name = (quote
$name )
42 + let quoted_slice = (quote
$slice )
45 + "# generated by work_scope.nu; edit work_scope.nuon instead" 47 + "@complete external" 48 + $
"def --wrapped ($quoted_name) [...args] {" 49 + $
" let command = ($quoted_name)" 50 + $
" let slice = ($quoted_slice)" 52 + ' if $nu.os-info.family == "unix" and (which systemd-run | is-not-empty) {' 53 + ' ^systemd-run --user --scope --same-dir --collect --quiet $"--slice=($slice)" $command ...$args' 55 + " run-external $command ...$args" 58 + ] | str join (char nl)
61 + export def generate [] {
62 + let config_path = (
$nu.default-config-dir | path join modules work_scope.nuon)
63 + if not (
$config_path | path exists) {
64 + print -e $
"work_scope config missing: ($config_path)" 68 + let config = (open
$config_path )
69 + let commands = (
$config.commands ? | default [])
70 + let slice = (
$config.slice ? | default
"work.slice" )
71 + let vendor_dir = (
$nu.vendor-autoload-dirs | last)
72 + let generated_path = (
$vendor_dir | path join
$GENERATED_FILE )
74 + for command
in $commands {
75 + assert-unwrapped
$command 82 + |
each {|command| wrapper-
source $command $slice }
83 + | str join (char nl)
86 + $body | save --force
$generated_path nushell/modules/work_scope.nuon Added new file mode 100644+22 / −0 text lines