nushell: new command akku. not yet a module
9a2a3990d53878726f906a8c69b39cf939423516
Oliver Jan Krylow <oliver@bugabinga.net> ·
unsigned
- Parent 1: a60188fdd50b
bugabingas dorkfiles
9a2a3990d53878726f906a8c69b39cf939423516
Oliver Jan Krylow <oliver@bugabinga.net> ·
unsigned
+36 / −13 text lines
+1 / −0 text lines
new file mode 100644+33 / −0 text lines
# Print information about the battery on this devicedef main [] { let device_directory = '/sys/class/power_supply/BAT0' if ( not ($device_directory | path exists) ) { print --stderr $"Could not find ($device_directory). Does this device have a battery? Maybe under another path?" return } let energy_full = (open ([$device_directory energy_full] | path join) | into int) let energy_now = (open ([$device_directory energy_now] | path join) | into int) let current_energy = $energy_now / $energy_full let current_energy_percent = $current_energy * 100 | into int let icon = battery_icon $current_energy_percent print $"($icon) ($current_energy_percent)%"}def battery_icon [ percent: int] { let index = ( ($percent | math ceil) / 10 | math floor | into int) let icons = [ ' ' ' ' ' ' ' ' ' ' ' ' ' ' '' ' ' ' ' ] return ($icons | get $index)}+0 / −10 text lines
local neovim_pane = command_pane:split { direction = 'Top', size = 0.92, args = { 'nvim', 'neovim', '-c', 'lua vim.api.nvim_set_current_dir("' .. dotfiles_path .. '/neovim' .. '")', }, } local wezterm_pane = neovim_pane:split { size = 0.42, args = { 'nvim', 'wezterm', '-c', 'lua vim.api.nvim_set_current_dir("' .. dotfiles_path .. '/wezterm' .. '")', }, } command_pane:activate()+2 / −0 text lines
+0 / −3 text lines