summaryrefslogtreecommitdiff
path: root/.config/nushell
diff options
context:
space:
mode:
authorWriterV2 <primary-v2@protonmail.com>2026-04-03 22:46:48 +0200
committerWriterV2 <primary-v2@protonmail.com>2026-04-03 22:46:48 +0200
commita1ec4771740d321df4480e8a7224fa10b59f0569 (patch)
tree5e97e8ced79b4fea057fab6e76f80849c053e401 /.config/nushell
Update repo with git init directly in home dir
Diffstat (limited to '.config/nushell')
-rw-r--r--.config/nushell/config.nu889
-rw-r--r--.config/nushell/documents.nu4
-rw-r--r--.config/nushell/dv.nu25
-rw-r--r--.config/nushell/notes.nu41
-rw-r--r--.config/nushell/phone.nu6
-rw-r--r--.config/nushell/reading-order.nu142
-rw-r--r--.config/nushell/remarkable.nu18
-rw-r--r--.config/nushell/screen.nu17
-rw-r--r--.config/nushell/wishlist.nu183
-rw-r--r--.config/nushell/youtube.nu7
10 files changed, 1332 insertions, 0 deletions
diff --git a/.config/nushell/config.nu b/.config/nushell/config.nu
new file mode 100644
index 0000000..99f311b
--- /dev/null
+++ b/.config/nushell/config.nu
@@ -0,0 +1,889 @@
+let completer = {|spans|
+ fish --command $'complete "--do-complete=($spans | str join " ")"'
+ | from tsv --flexible --noheaders --no-infer
+ | rename value description
+}
+
+let dark_theme = {
+ separator: white
+ leading_trailing_space_bg: { attr: n }
+ header: green_bold
+ empty: blue
+
+
+
+ bool: light_cyan
+ int: white
+ filesize: cyan
+ duration: white
+ date: purple
+ range: white
+ float: white
+ string: white
+ nothing: white
+ binary: white
+ cell-path: white
+ row_index: green_bold
+ record: white
+ list: white
+ block: white
+ hints: dark_gray
+ search_result: { bg: red fg: white }
+ shape_and: purple_bold
+ shape_binary: purple_bold
+ shape_block: blue_bold
+ shape_bool: light_cyan
+ shape_closure: green_bold
+ shape_custom: green
+ shape_datetime: cyan_bold
+ shape_directory: cyan
+ shape_external: cyan
+ shape_externalarg: green_bold
+ shape_external_resolved: light_yellow_bold
+ shape_filepath: cyan
+ shape_flag: blue_bold
+ shape_float: purple_bold
+
+ shape_garbage: { fg: white bg: red attr: b}
+ shape_globpattern: cyan_bold
+ shape_int: purple_bold
+ shape_internalcall: cyan_bold
+ shape_keyword: cyan_bold
+ shape_list: cyan_bold
+ shape_literal: blue
+ shape_match_pattern: green
+ shape_matching_brackets: { attr: u }
+ shape_nothing: light_cyan
+ shape_operator: yellow
+ shape_or: purple_bold
+ shape_pipe: purple_bold
+ shape_range: yellow_bold
+ shape_record: cyan_bold
+ shape_redirection: purple_bold
+ shape_signature: green_bold
+ shape_string: green
+ shape_string_interpolation: cyan_bold
+ shape_table: blue_bold
+ shape_variable: purple
+ shape_vardecl: purple
+}
+
+let light_theme = {
+
+ separator: dark_gray
+ leading_trailing_space_bg: { attr: n }
+ header: green_bold
+ empty: blue
+
+
+
+ bool: dark_cyan
+ int: dark_gray
+ filesize: cyan_bold
+ duration: dark_gray
+ date: purple
+ range: dark_gray
+ float: dark_gray
+ string: dark_gray
+ nothing: dark_gray
+ binary: dark_gray
+ cell-path: dark_gray
+ row_index: green_bold
+ record: dark_gray
+ list: dark_gray
+ block: dark_gray
+ hints: dark_gray
+ search_result: { fg: white bg: red }
+ shape_and: purple_bold
+ shape_binary: purple_bold
+ shape_block: blue_bold
+ shape_bool: light_cyan
+ shape_closure: green_bold
+ shape_custom: green
+ shape_datetime: cyan_bold
+ shape_directory: cyan
+ shape_external: cyan
+ shape_externalarg: green_bold
+ shape_external_resolved: light_purple_bold
+ shape_filepath: cyan
+ shape_flag: blue_bold
+ shape_float: purple_bold
+
+ shape_garbage: { fg: white bg: red attr: b}
+ shape_globpattern: cyan_bold
+ shape_int: purple_bold
+ shape_internalcall: cyan_bold
+ shape_keyword: cyan_bold
+ shape_list: cyan_bold
+ shape_literal: blue
+ shape_match_pattern: green
+ shape_matching_brackets: { attr: u }
+ shape_nothing: light_cyan
+ shape_operator: yellow
+ shape_or: purple_bold
+ shape_pipe: purple_bold
+ shape_range: yellow_bold
+ shape_record: cyan_bold
+ shape_redirection: purple_bold
+ shape_signature: green_bold
+ shape_string: green
+ shape_string_interpolation: cyan_bold
+ shape_table: blue_bold
+ shape_variable: purple
+ shape_vardecl: purple
+}
+
+
+
+
+
+
+
+$env.config = {
+ show_banner: false
+
+ ls: {
+ use_ls_colors: true
+ clickable_links: true
+ }
+
+ rm: {
+ always_trash: false
+ }
+
+ table: {
+ mode: rounded
+ index_mode: always
+ show_empty: true
+ padding: { left: 1, right: 1 }
+ trim: {
+ methodology: wrapping
+ wrapping_try_keep_words: true
+ truncating_suffix: "..."
+ }
+ header_on_separator: false
+
+ }
+
+ error_style: "fancy"
+
+
+
+
+ datetime_format: {
+
+
+ }
+
+ explore: {
+ status_bar_background: { fg: "#1D1F21", bg: "#C4C9C6" },
+ command_bar_text: { fg: "#C4C9C6" },
+ highlight: { fg: "black", bg: "yellow" },
+ status: {
+ error: { fg: "white", bg: "red" },
+ warn: {}
+ info: {}
+ },
+ table: {
+ split_line: { fg: "#404040" },
+ selected_cell: { bg: light_blue },
+ selected_row: {},
+ selected_column: {},
+ },
+ }
+
+ history: {
+ max_size: 100_000
+ sync_on_enter: true
+ file_format: "plaintext"
+ isolation: false
+ }
+
+ completions: {
+ case_sensitive: false
+ quick: true
+ partial: true
+ algorithm: "prefix"
+ external: {
+ enable: true
+ max_results: 100
+ completer: $completer
+ }
+ use_ls_colors: true
+ }
+
+ filesize: {
+ unit: "metric"
+ }
+
+ cursor_shape: {
+ emacs: line
+ vi_insert: block
+ vi_normal: underscore
+ }
+
+ color_config: $dark_theme
+ footer_mode: "auto"
+ float_precision: 2
+ buffer_editor: ""
+ use_ansi_coloring: true
+ bracketed_paste: true
+ edit_mode: emacs
+ shell_integration: {
+
+ osc2: true
+
+ osc7: true
+
+ osc8: true
+
+ osc9_9: false
+
+
+
+
+
+
+ osc133: true
+
+
+
+
+
+
+
+
+ osc633: true
+
+ reset_application_mode: true
+ }
+ render_right_prompt_on_last_line: false
+ use_kitty_protocol: false
+ highlight_resolved_externals: false
+ recursion_limit: 50
+
+ plugins: {}
+
+ plugin_gc: {
+
+ default: {
+ enabled: true
+ stop_after: 10sec
+ }
+ plugins: {
+
+ #
+
+
+
+ }
+ }
+
+ hooks: {
+ pre_prompt: [{ null }]
+ pre_execution: [{ null }]
+ env_change: {
+ PWD: [{|before, after| null }]
+ }
+ display_output: "if (term size).columns >= 100 { table -e } else { table }"
+ command_not_found: { null }
+ }
+
+ menus: [
+ {
+ name: completion_menu
+ only_buffer_difference: false
+ marker: "| "
+ type: {
+ layout: columnar
+ columns: 4
+ col_width: 20
+ col_padding: 2
+ }
+ style: {
+ text: green
+ selected_text: { attr: r }
+ description_text: yellow
+ match_text: { attr: u }
+ selected_match_text: { attr: ur }
+ }
+ }
+ {
+ name: ide_completion_menu
+ only_buffer_difference: false
+ marker: "| "
+ type: {
+ layout: ide
+ min_completion_width: 0,
+ max_completion_width: 50,
+ max_completion_height: 10,
+ padding: 0,
+ border: true,
+ cursor_offset: 0,
+ description_mode: "prefer_right"
+ min_description_width: 0
+ max_description_width: 50
+ max_description_height: 10
+ description_offset: 1
+ correct_cursor_pos: false
+ }
+ style: {
+ text: green
+ selected_text: { attr: r }
+ description_text: yellow
+ match_text: { attr: u }
+ selected_match_text: { attr: ur }
+ }
+ }
+ {
+ name: history_menu
+ only_buffer_difference: true
+ marker: "? "
+ type: {
+ layout: list
+ page_size: 10
+ }
+ style: {
+ text: green
+ selected_text: green_reverse
+ description_text: yellow
+ }
+ }
+ {
+ name: help_menu
+ only_buffer_difference: true
+ marker: "? "
+ type: {
+ layout: description
+ columns: 4
+ col_width: 20
+ col_padding: 2
+ selection_rows: 4
+ description_rows: 10
+ }
+ style: {
+ text: green
+ selected_text: green_reverse
+ description_text: yellow
+ }
+ }
+ ]
+
+ keybindings: [
+ {
+ name: completion_menu
+ modifier: none
+ keycode: tab
+ mode: [emacs vi_normal vi_insert]
+ event: {
+ until: [
+ { send: menu name: completion_menu }
+ { send: menunext }
+ { edit: complete }
+ ]
+ }
+ }
+ {
+ name: ide_completion_menu
+ modifier: control
+ keycode: char_n
+ mode: [emacs vi_normal vi_insert]
+ event: {
+ until: [
+ { send: menu name: ide_completion_menu }
+ { send: menunext }
+ { edit: complete }
+ ]
+ }
+ }
+ {
+ name: history_menu
+ modifier: control
+ keycode: char_r
+ mode: [emacs, vi_insert, vi_normal]
+ event: { send: menu name: history_menu }
+ }
+ {
+ name: help_menu
+ modifier: none
+ keycode: f1
+ mode: [emacs, vi_insert, vi_normal]
+ event: { send: menu name: help_menu }
+ }
+ {
+ name: completion_previous_menu
+ modifier: shift
+ keycode: backtab
+ mode: [emacs, vi_normal, vi_insert]
+ event: { send: menuprevious }
+ }
+ {
+ name: next_page_menu
+ modifier: control
+ keycode: char_x
+ mode: emacs
+ event: { send: menupagenext }
+ }
+ {
+ name: undo_or_previous_page_menu
+ modifier: control
+ keycode: char_z
+ mode: emacs
+ event: {
+ until: [
+ { send: menupageprevious }
+ { edit: undo }
+ ]
+ }
+ }
+ {
+ name: escape
+ modifier: none
+ keycode: escape
+ mode: [emacs, vi_normal, vi_insert]
+ event: { send: esc }
+ }
+ {
+ name: cancel_command
+ modifier: control
+ keycode: char_c
+ mode: [emacs, vi_normal, vi_insert]
+ event: { send: ctrlc }
+ }
+ {
+ name: quit_shell
+ modifier: control
+ keycode: char_d
+ mode: [emacs, vi_normal, vi_insert]
+ event: { send: ctrld }
+ }
+ {
+ name: clear_screen
+ modifier: control
+ keycode: char_l
+ mode: [emacs, vi_normal, vi_insert]
+ event: { send: clearscreen }
+ }
+ {
+ name: search_history
+ modifier: control
+ keycode: char_q
+ mode: [emacs, vi_normal, vi_insert]
+ event: { send: searchhistory }
+ }
+ {
+ name: open_command_editor
+ modifier: control
+ keycode: char_o
+ mode: [emacs, vi_normal, vi_insert]
+ event: { send: openeditor }
+ }
+ {
+ name: move_up
+ modifier: none
+ keycode: up
+ mode: [emacs, vi_normal, vi_insert]
+ event: {
+ until: [
+ { send: menuup }
+ { send: up }
+ ]
+ }
+ }
+ {
+ name: move_down
+ modifier: none
+ keycode: down
+ mode: [emacs, vi_normal, vi_insert]
+ event: {
+ until: [
+ { send: menudown }
+ { send: down }
+ ]
+ }
+ }
+ {
+ name: move_left
+ modifier: none
+ keycode: left
+ mode: [emacs, vi_normal, vi_insert]
+ event: {
+ until: [
+ { send: menuleft }
+ { send: left }
+ ]
+ }
+ }
+ {
+ name: move_right_or_take_history_hint
+ modifier: none
+ keycode: right
+ mode: [emacs, vi_normal, vi_insert]
+ event: {
+ until: [
+ { send: historyhintcomplete }
+ { send: menuright }
+ { send: right }
+ ]
+ }
+ }
+ {
+ name: move_one_word_left
+ modifier: control
+ keycode: left
+ mode: [emacs, vi_normal, vi_insert]
+ event: { edit: movewordleft }
+ }
+ {
+ name: move_one_word_right_or_take_history_hint
+ modifier: control
+ keycode: right
+ mode: [emacs, vi_normal, vi_insert]
+ event: {
+ until: [
+ { send: historyhintwordcomplete }
+ { edit: movewordright }
+ ]
+ }
+ }
+ {
+ name: move_to_line_start
+ modifier: none
+ keycode: home
+ mode: [emacs, vi_normal, vi_insert]
+ event: { edit: movetolinestart }
+ }
+ {
+ name: move_to_line_start
+ modifier: control
+ keycode: char_a
+ mode: [emacs, vi_normal, vi_insert]
+ event: { edit: movetolinestart }
+ }
+ {
+ name: move_to_line_end_or_take_history_hint
+ modifier: none
+ keycode: end
+ mode: [emacs, vi_normal, vi_insert]
+ event: {
+ until: [
+ { send: historyhintcomplete }
+ { edit: movetolineend }
+ ]
+ }
+ }
+ {
+ name: move_to_line_end_or_take_history_hint
+ modifier: control
+ keycode: char_e
+ mode: [emacs, vi_normal, vi_insert]
+ event: {
+ until: [
+ { send: historyhintcomplete }
+ { edit: movetolineend }
+ ]
+ }
+ }
+ {
+ name: move_to_line_start
+ modifier: control
+ keycode: home
+ mode: [emacs, vi_normal, vi_insert]
+ event: { edit: movetolinestart }
+ }
+ {
+ name: move_to_line_end
+ modifier: control
+ keycode: end
+ mode: [emacs, vi_normal, vi_insert]
+ event: { edit: movetolineend }
+ }
+ {
+ name: move_up
+ modifier: control
+ keycode: char_p
+ mode: [emacs, vi_normal, vi_insert]
+ event: {
+ until: [
+ { send: menuup }
+ { send: up }
+ ]
+ }
+ }
+ {
+ name: move_down
+ modifier: control
+ keycode: char_t
+ mode: [emacs, vi_normal, vi_insert]
+ event: {
+ until: [
+ { send: menudown }
+ { send: down }
+ ]
+ }
+ }
+ {
+ name: delete_one_character_backward
+ modifier: none
+ keycode: backspace
+ mode: [emacs, vi_insert]
+ event: { edit: backspace }
+ }
+ {
+ name: delete_one_word_backward
+ modifier: control
+ keycode: backspace
+ mode: [emacs, vi_insert]
+ event: { edit: backspaceword }
+ }
+ {
+ name: delete_one_character_forward
+ modifier: none
+ keycode: delete
+ mode: [emacs, vi_insert]
+ event: { edit: delete }
+ }
+ {
+ name: delete_one_character_forward
+ modifier: control
+ keycode: delete
+ mode: [emacs, vi_insert]
+ event: { edit: delete }
+ }
+ {
+ name: delete_one_character_backward
+ modifier: control
+ keycode: char_h
+ mode: [emacs, vi_insert]
+ event: { edit: backspace }
+ }
+ {
+ name: delete_one_word_backward
+ modifier: control
+ keycode: char_w
+ mode: [emacs, vi_insert]
+ event: { edit: backspaceword }
+ }
+ {
+ name: move_left
+ modifier: none
+ keycode: backspace
+ mode: vi_normal
+ event: { edit: moveleft }
+ }
+ {
+ name: newline_or_run_command
+ modifier: none
+ keycode: enter
+ mode: emacs
+ event: { send: enter }
+ }
+ {
+ name: move_left
+ modifier: control
+ keycode: char_b
+ mode: emacs
+ event: {
+ until: [
+ { send: menuleft }
+ { send: left }
+ ]
+ }
+ }
+ {
+ name: move_right_or_take_history_hint
+ modifier: control
+ keycode: char_f
+ mode: emacs
+ event: {
+ until: [
+ { send: historyhintcomplete }
+ { send: menuright }
+ { send: right }
+ ]
+ }
+ }
+ {
+ name: redo_change
+ modifier: control
+ keycode: char_g
+ mode: emacs
+ event: { edit: redo }
+ }
+ {
+ name: undo_change
+ modifier: control
+ keycode: char_z
+ mode: emacs
+ event: { edit: undo }
+ }
+ {
+ name: paste_before
+ modifier: control
+ keycode: char_y
+ mode: emacs
+ event: { edit: pastecutbufferbefore }
+ }
+ {
+ name: cut_word_left
+ modifier: control
+ keycode: char_w
+ mode: emacs
+ event: { edit: cutwordleft }
+ }
+ {
+ name: cut_line_to_end
+ modifier: control
+ keycode: char_k
+ mode: emacs
+ event: { edit: cuttoend }
+ }
+ {
+ name: cut_line_from_start
+ modifier: control
+ keycode: char_u
+ mode: emacs
+ event: { edit: cutfromstart }
+ }
+ {
+ name: swap_graphemes
+ modifier: control
+ keycode: char_t
+ mode: emacs
+ event: { edit: swapgraphemes }
+ }
+ {
+ name: move_one_word_left
+ modifier: alt
+ keycode: left
+ mode: emacs
+ event: { edit: movewordleft }
+ }
+ {
+ name: move_one_word_right_or_take_history_hint
+ modifier: alt
+ keycode: right
+ mode: emacs
+ event: {
+ until: [
+ { send: historyhintwordcomplete }
+ { edit: movewordright }
+ ]
+ }
+ }
+ {
+ name: move_one_word_left
+ modifier: alt
+ keycode: char_b
+ mode: emacs
+ event: { edit: movewordleft }
+ }
+ {
+ name: move_one_word_right_or_take_history_hint
+ modifier: alt
+ keycode: char_f
+ mode: emacs
+ event: {
+ until: [
+ { send: historyhintwordcomplete }
+ { edit: movewordright }
+ ]
+ }
+ }
+ {
+ name: delete_one_word_forward
+ modifier: alt
+ keycode: delete
+ mode: emacs
+ event: { edit: deleteword }
+ }
+ {
+ name: delete_one_word_backward
+ modifier: alt
+ keycode: backspace
+ mode: emacs
+ event: { edit: backspaceword }
+ }
+ {
+ name: delete_one_word_backward
+ modifier: alt
+ keycode: char_m
+ mode: emacs
+ event: { edit: backspaceword }
+ }
+ {
+ name: cut_word_to_right
+ modifier: alt
+ keycode: char_d
+ mode: emacs
+ event: { edit: cutwordright }
+ }
+ {
+ name: upper_case_word
+ modifier: alt
+ keycode: char_u
+ mode: emacs
+ event: { edit: uppercaseword }
+ }
+ {
+ name: lower_case_word
+ modifier: alt
+ keycode: char_l
+ mode: emacs
+ event: { edit: lowercaseword }
+ }
+ {
+ name: capitalize_char
+ modifier: alt
+ keycode: char_c
+ mode: emacs
+ event: { edit: capitalizechar }
+ }
+
+ {
+ name: copy_selection_system
+ modifier: control_shift
+ keycode: char_c
+ mode: emacs
+ event: { edit: copyselection }
+ }
+ {
+ name: cut_selection_system
+ modifier: control_shift
+ keycode: char_x
+ mode: emacs
+ event: { edit: cutselection }
+ }
+ {
+ name: select_all
+ modifier: control_shift
+ keycode: char_a
+ mode: emacs
+ event: { edit: selectall }
+ }
+ ]
+}
+
+alias _rg = rg
+export def --wrapped rg [...rest] {
+ mut result = ''
+ if ($in != null) {
+ $result = (print $in | _rg ...$rest)
+ } else {
+ $result = (_rg ...$rest)
+ }
+ $result | lines | parse "{File}:{Result}" | update Result { |row| ($row.Result | str replace --all $rest.0 $'(ansi gb)($rest.0)(ansi reset)') } | sort-by File
+}
+
+
+use ~/.cache/starship/init.nu
+use documents.nu
+use remarkable.nu
+use notes.nu
+use dv.nu
+use onepiece.nu
+use youtube.nu
+use phone.nu
+use screen.nu
+use wishlist.nu
+use reading-order.nu
diff --git a/.config/nushell/documents.nu b/.config/nushell/documents.nu
new file mode 100644
index 0000000..3293d70
--- /dev/null
+++ b/.config/nushell/documents.nu
@@ -0,0 +1,4 @@
+export def scan [] {
+ sudo scanimage --format=pdf --output-file $"/mnt/files/Documents/Scans/(date now | format date "%FT%T").pdf" --progress
+}
+
diff --git a/.config/nushell/dv.nu b/.config/nushell/dv.nu
new file mode 100644
index 0000000..e5e382a
--- /dev/null
+++ b/.config/nushell/dv.nu
@@ -0,0 +1,25 @@
+export def record [name: string] {
+ let location: path = $env.MISCPATH | path join / rawdv $name
+ mkdir $location
+ cd $location
+ dvgrab -a
+}
+
+export def collect-to-mp4 [dvdirectory: string, name: string] {
+ let location: path = $env.MISCPATH | path join / rawdv $dvdirectory
+ let output_location: path = $env.MISCPATH | path join output
+ cd $location
+ let file_list = "tmp_file_list.txt"
+ ls **/*.dv
+ | get name
+ | each { |path| $"file '($path)'"}
+ | save $file_list
+ ffmpeg -f concat -safe 0 -i $file_list -c:v libx264 -crf 23 -preset medium $"($name).mp4"
+ mv $"($name).mp4" $output_location
+ rm $file_list
+}
+
+export def record-and-save [name: string] {
+ record $name
+ collect-to-mp4 $name $name
+}
diff --git a/.config/nushell/notes.nu b/.config/nushell/notes.nu
new file mode 100644
index 0000000..c591063
--- /dev/null
+++ b/.config/nushell/notes.nu
@@ -0,0 +1,41 @@
+def open-db-in-memory [] {
+ if ($env.NOTES_DB_PATH | path exists) {
+ stor import --file-name (get-db-path)
+ } else {
+ stor reset
+ stor create -t "note" -c {created: datetime, text: str}
+ stor export --file-name (get-db-path)
+ }
+}
+
+def save-db-to-file [] {
+ rm $env.NOTES_DB_PATH
+ stor export --file-name $env.NOTES_DB_PATH
+}
+
+export def add [text: string] {
+ open-db-in-memory
+ stor insert -t note -d { created: (date now), text: ($text) }
+ save-db-to-file
+}
+
+export def browse [--before: datetime, --after: datetime] {
+ open-db-in-memory
+ let before_filter = if ($before != null) {
+ $before
+ } else {
+ date now
+ }
+
+ let after_filter = if ($after != null) {
+ $after
+ } else {
+ "0001-01-01" | into datetime
+ }
+
+ let notes = open $env.NOTES_DB_PATH | get note | where {|row|
+ ($row.created | into datetime) < $before_filter and ($row.created | into datetime) > $after_filter
+ }
+
+ $notes
+}
diff --git a/.config/nushell/phone.nu b/.config/nushell/phone.nu
new file mode 100644
index 0000000..ef62a80
--- /dev/null
+++ b/.config/nushell/phone.nu
@@ -0,0 +1,6 @@
+export def camera-as-webcam [
+ direction: string # 'front' or 'back'
+] {
+ scrcpy --v4l2-sink=/dev/video0 -m1024 --video-source=camera --no-audio --camera-facing ($direction)
+}
+
diff --git a/.config/nushell/reading-order.nu b/.config/nushell/reading-order.nu
new file mode 100644
index 0000000..d02d351
--- /dev/null
+++ b/.config/nushell/reading-order.nu
@@ -0,0 +1,142 @@
+export def "books add" [
+ name: string, # name of the book
+ author: string, # name of the book's author
+ --finished # mark the book already read - default: false
+] {
+ let book_id = random uuid
+ {
+ id: $book_id,
+ name: $name,
+ author: $author
+ finished: ($finished | default false)
+ } | into sqlite $env.READINGORDER_DB_PATH -t books
+
+ print $"Added ($name) successfully to list of books."
+ books show --id $book_id
+}
+
+export def "books show" [
+ --id: string, # id of the book, identify using `reading-order books show --explore`
+ --explore # show in nushell explorer
+] {
+ if not ($env.READINGORDER_DB_PATH | path exists) {
+ print "List of books is empty. If it shouldn't be empty, check the READINGORDER_DB_PATH environment variable."
+ return
+ }
+ mut books = open $env.READINGORDER_DB_PATH | get books
+
+ if $id != null {
+ $books = $books | where id == $id
+ }
+
+ if ($explore) {
+ return ($books | explore -p)
+ }
+
+ return $books
+}
+
+export def "books set-name" [
+ id: string, # id of the book, identify using `reading-order books show --explore`
+ name: string
+] {
+ if not ($env.READINGORDER_DB_PATH | path exists) {
+ print "List of books is empty. If it shouldn't be empty, check the READINGORDER_DB_PATH environment variable."
+ return
+ }
+ open $env.READINGORDER_DB_PATH | query db "UPDATE books SET name = ? WHERE id = ?" -p [$name, $id]
+ print $"Updated name for book with id ($id) successfully."
+ books show --id $id
+}
+
+export def "books set-author-name" [
+ id: string, # id of the book, identify using `reading-order books show --explore`
+ author: string
+] {
+ if not ($env.READINGORDER_DB_PATH | path exists) {
+ print "List of books is empty. If it shouldn't be empty, check the READINGORDER_DB_PATH environment variable."
+ return
+ }
+ open $env.READINGORDER_DB_PATH | query db "UPDATE books SET author = ? WHERE id = ?" -p [$author, $id]
+ print $"Updated author name for book with id ($id) successfully."
+ books show --id $id
+}
+
+export def "books set-finished" [
+ id: string, # id of the book, identify using `reading-order books show --explore`
+ finished: bool = true,
+] {
+ if not ($env.READINGORDER_DB_PATH | path exists) {
+ print "List of books is empty. If it shouldn't be empty, check the READINGORDER_DB_PATH environment variable."
+ return
+ }
+ open $env.READINGORDER_DB_PATH | query db "UPDATE books SET finished = ? WHERE id = ?" -p [$finished, $id]
+ print $"Updated finished status for book with id ($id) successfully."
+ books show --id $id
+}
+
+# Add a reading order
+export def add [
+ book1_id: string, # id of the book to be read before book 2, identify using `reading-order books show --explore`
+ book2_id: string, # id of the book to be read after book 1, identify using `reading-order books show --explore`
+] {
+ let reading_order_id = random uuid
+ {
+ id: $reading_order_id,
+ book1: $book1_id,
+ book2: $book2_id,
+ } | into sqlite $env.READINGORDER_DB_PATH
+
+ print $"Added reading order successfully."
+ show --id $reading_order_id
+}
+
+export def show [
+ --id: string, # id of the book, identify using `reading-order books show --explore`
+ --explore # show in nushell explorer
+] {
+ if not ($env.READINGORDER_DB_PATH | path exists) {
+ print "List of books is empty. If it shouldn't be empty, check the READINGORDER_DB_PATH environment variable."
+ return
+ }
+
+ mut reading_orders = open $env.READINGORDER_DB_PATH | get main
+
+ if $id != null {
+ return ($reading_orders | where id == $id)
+ }
+
+ if ($explore) {
+ return ($reading_orders | explore -p)
+ }
+
+ return $reading_orders
+}
+
+export def read-next [] {
+ if not ($env.READINGORDER_DB_PATH | path exists) {
+ print "List of books is empty. If it shouldn't be empty, check the READINGORDER_DB_PATH environment variable."
+ return
+ }
+
+ let reading_orders = open $env.READINGORDER_DB_PATH | get main
+ mut books = open $env.READINGORDER_DB_PATH | get books | where { |book|
+ if $book.finished == 1 {
+ return false
+ }
+
+
+ for order in $reading_orders {
+ if $order.book2 != $book.id {
+ continue
+ }
+ let book_to_read_before = books show --id $order.book1
+ if $book_to_read_before.finished != 1 {
+ return false
+ }
+ }
+ return true
+
+ }
+ return $books
+}
diff --git a/.config/nushell/remarkable.nu b/.config/nushell/remarkable.nu
new file mode 100644
index 0000000..8a5522c
--- /dev/null
+++ b/.config/nushell/remarkable.nu
@@ -0,0 +1,18 @@
+export def upload [file: path] {
+ let filename = ($file | path parse | get stem)
+ let extension = ($file | path parse | get extension)
+ curl $"http://($env.REMARKABLE_IP)/upload" -H "Origin: http://192.168.178.24" -H "Referer: http://192.168.178.24" -H 'Connection: keep-alive' -F $"file=@($file);filename=($filename);type=application/($extension)"
+}
+
+export def download [collection_id?: string] {
+ curl $"http://($env.REMARKABLE_IP)/documents/($collection_id)"
+ | from json
+ | select VissibleName ID Type
+ | input list
+ | if $in.Type == 'DocumentType' {
+ let name = $in.VissibleName;
+ curl $"http://($env.REMARKABLE_IP)/download/($in.ID)/pdf" | save -f $"($name | str snake-case).pdf"
+ } else {
+ download $in.ID
+ }
+}
diff --git a/.config/nushell/screen.nu b/.config/nushell/screen.nu
new file mode 100644
index 0000000..88c72f5
--- /dev/null
+++ b/.config/nushell/screen.nu
@@ -0,0 +1,17 @@
+export def shot [] {
+ maim -s $"($env.SCREENS_PATH)/(date now | format date %s)-screen.png"
+}
+
+export def shoot [--duration: int, --delay: int] {
+ mut args = []
+
+ if $duration != null {
+ $args = $args | append "-t" | append $duration
+ }
+ if $delay != null {
+ $args = $args | append $"-ss" | append $delay
+ }
+
+
+ ffmpeg -video_size 1900x1080 -framerate 25 -f x11grab -i :0.0+0,0 -f alsa -ac 2 -i pulse -acodec aac -vf setpts=N/FR/TB ...$args $"($env.RECORDINGS_PATH)(date now | format date %s)-recording.mp4"
+}
diff --git a/.config/nushell/wishlist.nu b/.config/nushell/wishlist.nu
new file mode 100644
index 0000000..10cc0f5
--- /dev/null
+++ b/.config/nushell/wishlist.nu
@@ -0,0 +1,183 @@
+export def add [
+ name: string, # name of the item
+ --comment: string, # comment for the item
+ --sources: list<string>, # a source to acquire the item, typically a URL
+ --importance: int # a number to indicate the importance, choose the scaling yourself, default: 0
+] {
+ let item_id = random uuid
+ {
+ id: $item_id,
+ name: $name,
+ comment: ($comment | default ''),
+ acquired: false,
+ importance: ($importance | default 0)
+ } | into sqlite $env.WISHLIST_DB_PATH
+
+ print $"Added ($name) successfully to the wishlist."
+
+ if $sources != null and ($sources | length) > 0 {
+ $sources | each { |source|
+ let link_id = random uuid
+ {
+ id: (random uuid),
+ item_id: $item_id,
+ content: $source
+ } | into sqlite $env.WISHLIST_DB_PATH -t sources
+ }
+ print $"Added sources for ($name) successfully."
+ }
+ show --id $item_id
+}
+
+export def show [
+ --id: string, # id of the item, identify using `wishlist show --explore`
+ --explore # show in nushell explorer
+] {
+ if not ($env.WISHLIST_DB_PATH | path exists) {
+ print "Wishlist is empty. If it shouldn't be empty, check the WISHLIST_DB_PATH environment variable."
+ return
+ }
+ mut wishlist = open $env.WISHLIST_DB_PATH | get main
+
+ if $id != null {
+ $wishlist = $wishlist | where id == $id
+ }
+
+ if ($explore) {
+ return ($wishlist | explore -p)
+ }
+
+ return $wishlist
+}
+
+export def set-comment [
+ id: string, # id of the item, identify using `wishlist show --explore`
+ comment: string
+] {
+ if not ($env.WISHLIST_DB_PATH | path exists) {
+ print "Wishlist database was not found. If this shouldn't happen, check the WISHLIST_DB_PATH environment variable."
+ return
+ }
+
+ open $env.WISHLIST_DB_PATH | query db "UPDATE main SET comment = ? WHERE id = ?" -p [$comment, $id]
+ print $"Updated comment for item with id ($id) successfully."
+ show --id $id
+}
+
+export def set-importance [
+ id: string, # id of the item, identify using `wishlist show --explore`
+ importance: int
+] {
+ if not ($env.WISHLIST_DB_PATH | path exists) {
+ print "Wishlist database was not found. If this shouldn't happen, check the WISHLIST_DB_PATH environment variable."
+ return
+ }
+
+ open $env.WISHLIST_DB_PATH | query db "UPDATE main SET importance = ? WHERE id = ?" -p [$importance, $id]
+ print $"Updated importance for item with id ($id) successfully."
+ show --id $id
+}
+
+export def check [
+ id: string, # id of the item, identify using `wishlist show --explore`
+] {
+ if not ($env.WISHLIST_DB_PATH | path exists) {
+ print "Wishlist database was not found. If this shouldn't happen, check the WISHLIST_DB_PATH environment variable."
+ return
+ }
+
+ open $env.WISHLIST_DB_PATH | query db "UPDATE main SET acquired = true WHERE id = ?" -p [$id]
+ print $"Checked off item with id ($id) successfully."
+ show --id $id
+
+}
+
+export def remove [
+ id: string, # id of the item, identify using `wishlist show --explore`
+] {
+ if not ($env.WISHLIST_DB_PATH | path exists) {
+ print "Wishlist database was not found. If this shouldn't happen, check the WISHLIST_DB_PATH environment variable."
+ return
+ }
+
+ open $env.WISHLIST_DB_PATH | query db "DELETE FROM main WHERE id = ?" -p [$id]
+ print $"Removed item with id ($id) successfully."
+ show
+}
+
+# Get the highest value of importance in the wishlist
+export def highest-importance [] {
+ show | get importance | reduce { |it, acc| if ($it > $acc) { $it } else { $acc }}
+}
+
+# Get the lowest value of importance in the wishlist
+export def lowest-importance [] {
+ show | get importance | reduce { |it, acc| if ($it < $acc) { $it } else { $acc }}
+}
+
+export def "sources show" [
+ --id: string, # id of the source, identify using `wishlist sources show --explore`
+ --item-id: string, # id of the item, identify using `wishlist show --explore`
+ --explore # show in nushell explorer
+] {
+ if not ($env.WISHLIST_DB_PATH | path exists) {
+ print "Wishlist database was not found. If this shouldn't happen, check the WISHLIST_DB_PATH environment variable."
+ return
+ }
+
+ mut sources = open $env.WISHLIST_DB_PATH | get sources
+
+ if $id != null {
+ $sources = $sources | where id == $id
+ } else if $item_id != null {
+ $sources = $sources | where item_id == $item_id
+ }
+
+ if ($explore) {
+ return ($sources | explore -p)
+ }
+
+ return $sources
+}
+
+export def "sources add" [
+ content: string # content of the source to acquire the item, typically a URL
+ item_id: string, # id of the item, identify using `wishlist show --explore`
+] {
+ let source_id = random uuid
+ {
+ id: $source_id,
+ item_id: $item_id,
+ content: $content,
+ } | into sqlite $env.WISHLIST_DB_PATH -t sources
+ print $"Added new source to item with id ($item_id) successfully."
+ sources show --id $source_id
+}
+
+export def "sources update" [
+ id: string # id of the source, identify using `wishlist sources show --explore`
+ content: string # new content for the given source
+] {
+ if not ($env.WISHLIST_DB_PATH | path exists) {
+ print "Wishlist database was not found. If this shouldn't happen, check the WISHLIST_DB_PATH environment variable."
+ return
+ }
+
+ open $env.WISHLIST_DB_PATH | query db "UPDATE sources SET content = ? WHERE id = ?" -p [$content, $id]
+ print $"Updated source with id ($id) successfully."
+ sources show --id $id
+}
+
+export def "sources remove" [
+ id: string, # id of the source, identify using `wishlist sources show --explore`
+] {
+ if not ($env.WISHLIST_DB_PATH | path exists) {
+ print "Wishlist database was not found. If this shouldn't happen, check the WISHLIST_DB_PATH environment variable."
+ return
+ }
+
+ open $env.WISHLIST_DB_PATH | query db "DELETE FROM sources WHERE id = ?" -p [$id]
+ print $"Removed source with id ($id) successfully."
+ sources show
+}
+
diff --git a/.config/nushell/youtube.nu b/.config/nushell/youtube.nu
new file mode 100644
index 0000000..c34b21b
--- /dev/null
+++ b/.config/nushell/youtube.nu
@@ -0,0 +1,7 @@
+export def download [video_url: string] {
+ yt-dlp --cookies-from-browser firefox --downloader aria2c --downloader-args '-c -j 3 -x 3 -s 3 -k 1M' --sponsorblock-mark default --sponsorblock-remove sponsor --restrict-filenames -P $"($env.MISCPATH)/Youtube/" --output '%(channel)s_%(channel_id)s/%(playlist|Misc)s/%(upload_date)s.%(id)s.%(title)s.%(ext)s' $video_url
+}
+
+export def stream [video_url: string] {
+ yt-dlp --cookies-from-browser firefox --downloader aria2c --downloader-args '-c -j 3 -x 3 -s 3 -k 1M' --sponsorblock-mark default --sponsorblock-remove sponsor $video_url -o - | ffplay -
+}