Fix notify send in ide

main
Julius Riegel 7 months ago
parent 4f0f35484d
commit f332be7c36

@ -85,6 +85,7 @@ if $env.NIX_PATH? != null {
$env.NIX_PATH = $"{{dirs.home}}/.nix-defexpr/channels:($env.NIX_PATH)"
}
{{/if-installed}}
{{#if-installed zoxide}}
zoxide init nushell | save -f ~/.zoxide.nu
{{/if-installed}}

@ -1,8 +1,5 @@
$env.PATH = ( $env.PATH
| prepend $'{{dirs.home}}/.local/bin'
{{#if-installed cargo}}
| prepend $'{{dirs.home}}/.cargo/bin'
{{/if-installed}}
{{#if-installed nenv}}
| prepend $'{{dirs.home}}/.local/share/nenv/bin'
{{/if-installed}}
@ -12,4 +9,7 @@ $env.PATH = ( $env.PATH
{{#if-installed nix}}
| prepend $'{{dirs.home}}/.nix-profile/bin'
{{/if-installed}}
{{#if-installed cargo}}
| prepend $'{{dirs.home}}/.cargo/bin'
{{/if-installed}}
)

@ -2,6 +2,7 @@
use task.nu
use dirs.nu
use render.nu
use ci.nu
const ZELLIJ_LAYOUT = ($dirs.CONFIG | path join zellij/development.toml)
@ -11,8 +12,10 @@ export def --env main [] {
wezterm cli set-tab-title $"IDE (basename)"
}
let tmpdir = init
ci watch-bg
zellij --layout $ZELLIJ_LAYOUT --session (session-name)
rm -r $tmpdir
if $env.WEZTERM_PANE? != null {
wezterm cli set-tab-title ""
}
@ -44,11 +47,12 @@ export def floating-prompt [] {
}
export def last-notification [] {
let notif = open $env.NOTIFY_FILE | str trim
let notif = open $env.NOTIFY_FILE
if ($notif | str length) == 0 {
if $notif == null {
return
}
let notif = $"(ansi {attr: bi})($notif.title)(ansi reset) ($notif.content)"
$env.NTFY_CHKSUM = (shasum $env.NOTIFY_FILE)
@ -57,12 +61,13 @@ export def last-notification [] {
if not (task group exists $group_name) {
task group add $group_name -p 4
}
task spawn -d 10sec -g $group_name {
( task spawn -d 10sec -g $group_name {
if (shasum $env.NOTIFY_FILE) == $env.NTFY_CHKSUM {
"" | save -f $env.NOTIFY_FILE
}
"null" | save -f $env.NOTIFY_FILE
}
$notif
} | ignore )
return $notif
}
export def `doc-comment java-style` [] {
@ -125,13 +130,13 @@ def create-xdg-open [tmpbin: string] {
}
def --env create-notify-send [tmpdir: string, tmpbin: string] {
$env.NOTIFY_FILE = ($tmpdir | path join "notifications.txt")
$env.NOTIFY_FILE = ($tmpdir | path join "notifications.json")
touch $env.NOTIFY_FILE
let new_ntfy = ($tmpbin | path join "notify-send")
("#!/bin/env nu
def main [title: string, content: string] {
$\"(ansi {attr: bi})($title)(ansi reset) ($content)\\n\" | save -f $env.NOTIFY_FILE
{title: $title, content: $content} | to json | save -f $env.NOTIFY_FILE
}
" | save -f $new_ntfy)
chmod +x $new_ntfy

@ -56,7 +56,7 @@ export def spawn [
)
| save --force $source_path
(pueue add --print-task-id ...$args $"nu --config '($nu.config-path)' --env-config '($nu.env-path)' ($source_path)")
(pueue add --print-task-id ...$args $"nu --config '($nu.config-path)' --env-config '($nu.env-path)' ($source_path)" | complete | get stdout)
}
# Remove tasks from the queue.

@ -1,6 +1,6 @@
$env.STARSHIP_SHELL = "nu"
$env.STARSHIP_SESSION_KEY = (random chars -l 16)
$env.PROMPT_MULTILINE_INDICATOR = (^/usr/bin/starship prompt --continuation)
$env.PROMPT_MULTILINE_INDICATOR = (^starship prompt --continuation)
# Does not play well with default character module.
# TODO: Also Use starship vi mode indicators?
@ -9,7 +9,7 @@ $env.PROMPT_INDICATOR = ""
$env.PROMPT_COMMAND = {||
# jobs are not supported
let width = (term size | get columns | into string)
^/usr/bin/starship prompt $"--cmd-duration=($env.CMD_DURATION_MS)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=($width)"
^starship prompt $"--cmd-duration=($env.CMD_DURATION_MS)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=($width)"
}
# Not well-suited for `starship prompt --right`.

@ -10,7 +10,7 @@ layout {
format_left "{command_lpl}{tabs}"
format_right "{command_rpl}"
format_center "{command_notify}"
format_space "#[bg=#181825]"
format_space ""
hide_frame_for_single_pane "true"
@ -21,17 +21,17 @@ layout {
tab_active_fullscreen "#[fg=#9399B2,bg=#181825,bold,italic] {index} {name} [] "
tab_active_sync "#[fg=#9399B2,bg=#181825,bold,italic] {index} {name} <> "
command_notify_command "nu -c \"use ide.nu; ide last-notification\""
command_notify_command "nu --no-newline -c \"use ide.nu; ide last-notification\""
command_notify_format "{stdout}"
command_notify_interval "1"
command_notify_rendermode "raw"
command_lpl_command "nu -c \"use ide.nu; ide zjstatus powerline_left\""
command_lpl_command "nu --no-newline -c \"use ide.nu; ide zjstatus powerline_left\""
command_lpl_format "{stdout}"
command_lpl_interval "1"
command_lpl_rendermode "raw"
command_rpl_command "nu -c \"use ide.nu; ide zjstatus powerline_right\""
command_rpl_command "nu --no-newline -c \"use ide.nu; ide zjstatus powerline_right\""
command_rpl_format "{stdout}"
command_rpl_interval "2"
command_rpl_rendermode "raw"

@ -7,12 +7,12 @@ if [ -n "$BASH_VERSION" ]; then
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
if [ -d "$HOME/bin" ]; then
PATH="$HOME/bin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
if [ -d "$HOME/.local/bin" ]; then
PATH="$HOME/.local/bin:$PATH"
fi
@ -20,7 +20,6 @@ if [ -d "$HOME/.cargo/env" ]; then
. "$HOME/.cargo/env"
fi
# Nix
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
@ -29,5 +28,10 @@ if [ -e '$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh' ]; then
. '$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh'
fi
# set PATH so it prioritizes ./cargo/bin over everything
if [ -d "$HOME/.local/bin" ]; then
PATH="$HOME/.cargo/bin:$PATH"
fi
export XDG_DATA_DIRS=$HOME/.nix-profile/share:$HOME/.share:"${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/}"
# End Nix

@ -60,6 +60,7 @@ config.modules = {
'meld',
'pueue',
'parallel',
'bat',
},
gui = mod {
'kdePackages.breeze-icons',

Loading…
Cancel
Save