Compare commits

...

24 Commits

Author SHA1 Message Date
5e7c193a28 niri: Use caelestia quickshell 2025-12-07 15:11:56 +01:00
67f7129dac nu: Add more m subcommands 2025-12-06 16:23:01 +01:00
333bd228d4 helix: Add qml language 2025-12-06 16:22:31 +01:00
5c7e24e645 mullvad: Add nu waydroid commands 2025-11-18 17:44:25 +01:00
4ff5da379c Use helix as default editor 2025-11-18 17:37:01 +01:00
53b3e791df helix: add extend_line_above keybind 2025-11-04 11:25:05 +01:00
cf7a36c3ba Fix screenlock 2025-10-21 19:45:08 +02:00
af3ccebaae sputnik: Move monitors 2025-10-17 21:41:11 +02:00
10c12125a3 swaync: Add padding 2025-10-06 11:35:49 +02:00
6e67fa87bb helix: Add keybind 2025-10-03 14:38:29 +02:00
2628308f0b helix: Add light theme 2025-09-23 17:15:02 +02:00
bbb7add614 eww: Add ram gauge 2025-09-11 11:34:50 +02:00
5b4f97982d nu: Improve m e2e 2025-09-09 13:44:09 +02:00
96f80a024a nu: Fix ipv6 dns lookups 2025-09-03 12:58:50 +02:00
18a93fe079 nu: Add --server argument to dns command 2025-09-03 12:57:15 +02:00
8517bc121c gtk: Don't use dark theme on pinenote 2025-09-03 12:26:15 +02:00
354a7118de arch-firstinstall: Add man 2025-09-01 15:27:02 +02:00
d7b18e47b0 högtalare: New bluetooth mac 2025-08-26 13:06:45 +02:00
5ae87c8796 swaync: Move to top right 2025-08-26 13:05:55 +02:00
d395cc57c8 nu: Fix "m daemon --boringtun" 2025-08-25 17:48:39 +02:00
c910091882 nu: More mullvad helpers 2025-08-25 17:35:31 +02:00
f51a70d0a3 niri: Use qt5ct as Qt themer 2025-08-17 17:37:38 +02:00
98af89fa7d arch-firstinstall: Install qt5ct 2025-08-16 01:38:53 +02:00
952a358d91 nu: Fix completer for nu 0.106 2025-08-12 15:27:58 +02:00
20 changed files with 619 additions and 55 deletions

View File

@ -0,0 +1,220 @@
{
"appearance": {
"anim": {
"durations": {
"scale": 1
}
},
"font": {
"family": {
"material": "Material Symbols Rounded",
"mono": "CaskaydiaCove NF",
"sans": "Rubik"
},
"size": {
"scale": 1
}
},
"padding": {
"scale": 1
},
"rounding": {
"scale": 1
},
"spacing": {
"scale": 1
},
"transparency": {
"enabled": false,
"base": 0.85,
"layers": 0.4
}
},
"general": {
"apps": {
"terminal": [
"foot"
],
"audio": [
"pavucontrol"
]
}
},
"background": {
"desktopClock": {
"enabled": false
},
"enabled": true,
"visualiser": {
"enabled": true,
"autoHide": true,
"rounding": 1,
"spacing": 1
}
},
"bar": {
"clock": {
"showIcon": false
},
"dragThreshold": 20,
"entries": [
{
"id": "logo",
"enabled": true
},
{
"id": "workspaces",
"enabled": true
},
{
"id": "spacer",
"enabled": true
},
{
"id": "activeWindow",
"enabled": true
},
{
"id": "spacer",
"enabled": true
},
{
"id": "tray",
"enabled": true
},
{
"id": "clock",
"enabled": true
},
{
"id": "statusIcons",
"enabled": true
},
{
"id": "idleInhibitor",
"enabled": true
},
{
"id": "power",
"enabled": true
}
],
"persistent": false,
"showOnHover": true,
"status": {
"showAudio": false,
"showBattery": true,
"showBluetooth": true,
"showMicrophone": false,
"showKbLayout": false,
"showNetwork": true
},
"tray": {
"background": true,
"recolour": true
},
"workspaces": {
"activeIndicator": true,
"activeLabel": "󰮯",
"activeTrail": false,
"groupIconsByApp": true,
"groupingRespectsLayout": true,
"windowRighClickContext": true,
"label": "◦",
"occupiedBg": true,
"occupiedLabel": "⊙",
"showWindows": true,
"shown": 4,
"windowIconImage": false,
"focusedWindowBlob": true,
"windowIconGap": 0,
"windowIconSize": 30
}
},
"border": {
"rounding": 25,
"thickness": 10
},
"dashboard": {
"mediaUpdateInterval": 500,
"showOnHover": true
},
"launcher": {
"actionPrefix": ">",
"dragThreshold": 50,
"vimKeybinds": false,
"enableDangerousActions": false,
"maxShown": 8,
"maxWallpapers": 9,
"specialPrefix": "@",
"useFuzzy": {
"apps": false,
"actions": false,
"schemes": false,
"variants": false,
"wallpapers": false
},
"showOnHover": false
},
"lock": {
"recolourLogo": false
},
"notifs": {
"actionOnClick": false,
"clearThreshold": 0.3,
"defaultExpireTimeout": 5000,
"expandThreshold": 20,
"expire": false
},
"osd": {
"enabled": true,
"enableBrightness": true,
"enableMicrophone": true,
"hideDelay": 2000
},
"paths": {
"mediaGif": "root:/assets/bongocat.gif",
"sessionGif": "root:/assets/kurukuru.gif",
"wallpaperDir": "~/.config/wallpapers/"
},
"services": {
"audioIncrement": 0.1,
"defaultPlayer": "Spotify",
"gpuType": "",
"playerAliases": [
{
"from": "com.github.th_ch.youtube_music",
"to": "YT Music"
}
],
"weatherLocation": "",
"useFahrenheit": false,
"useTwelveHourClock": false,
"smartScheme": true,
"visualiserBars": 45
},
"session": {
"dragThreshold": 30,
"vimKeybinds": true,
"commands": {
"logout": [
"loginctl",
"terminate-user",
""
],
"shutdown": [
"systemctl",
"poweroff"
],
"hibernate": [
"systemctl",
"hibernate"
],
"reboot": [
"systemctl",
"reboot"
]
}
}
}

View File

@ -40,6 +40,7 @@
(speaker) (speaker)
(temperature) (temperature)
(battery) (battery)
(ram)
(box :class "thingy" (systray :orientation "v")) (box :class "thingy" (systray :orientation "v"))
(color_scheme) (color_scheme)
(xwayland) (xwayland)
@ -138,6 +139,21 @@
(label :text "${current_temp / 1000}°") (label :text "${current_temp / 1000}°")
)) ))
(defwidget ram []
(box :orientation "v"
:valign "end"
:class "thingy"
(label :text "RAM")
(circular-progress
:thickness 4.0
:value {EWW_RAM.used_mem_perc}
:class {
EWW_RAM?.used_mem_perc > 80 ? "battery-gauge low" :
"battery-gauge"
}
)
))
(defwidget battery [] (defwidget battery []
(box :orientation "v" (box :orientation "v"
:valign "end" :valign "end"

View File

@ -1,2 +1,4 @@
{% if hostname != "pinenote" %}
[Settings] [Settings]
gtk-application-prefer-dark-theme = true gtk-application-prefer-dark-theme = true
{% end %}

View File

@ -1,2 +1,5 @@
{% if hostname != "pinenote" %}
[Settings] [Settings]
gtk-application-prefer-dark-theme = true gtk-application-prefer-dark-theme = true
{% end %}

View File

@ -1,10 +0,0 @@
theme = "gruvbox"
[editor]
auto-format = true
#line-number = "relative"
[editor.cursor-shape]
insert = "bar"
normal = "block"
select = "underline"

View File

@ -0,0 +1,21 @@
{% if light %}
theme = "gruvbox_light"
{% else %}
theme = "gruvbox"
{% end %}
[editor]
auto-format = true
#line-number = "relative"
[editor.cursor-shape]
insert = "bar"
normal = "block"
select = "underline"
[keys.select]
X = "extend_line_above" # Extend the selection with the line above the selection
[keys.normal]
X = "extend_line_above" # Extend the selection with the line above the selection
C-n = "extend_search_next" # Add next search result to selection

View File

@ -1,2 +1,6 @@
[[language]] [[language]]
name = "rust" name = "rust"
diagnostic-severity = "info" # don't show hints
[language-server.qmlls]
command = "qmlls6"

View File

Before

Width:  |  Height:  |  Size: 156 KiB

After

Width:  |  Height:  |  Size: 156 KiB

View File

@ -51,7 +51,7 @@ input-field {
# ferris image in the center # ferris image in the center
image { image {
monitor = monitor =
path = ~/.config/wallpapers/ferris-stamp.png path = ~/.config/hypr/ferris-stamp.png
rounding = 0 rounding = 0
size = 300 size = 300
position = 0, 0 position = 0, 0

View File

@ -6,6 +6,7 @@
environment { environment {
DISPLAY ":0" DISPLAY ":0"
ELECTRON_OZONE_PLATFORM_HINT "auto" ELECTRON_OZONE_PLATFORM_HINT "auto"
QT_QPA_PLATFORMTHEME "qt5ct"
} }
// https://github.com/YaLTeR/niri/wiki/Configuration:-Input // https://github.com/YaLTeR/niri/wiki/Configuration:-Input
@ -37,13 +38,19 @@ clipboard {
// `niri msg outputs` // `niri msg outputs`
output "Microstep MSI MAG342CQR DB6H262101804" { output "Microstep MSI MAG342CQR DB6H262101804" {
mode "3440x1440@144.000" mode "3440x1440@144.000"
position x=0 y=0 position x=1152 y=387
scale 1.25 scale 1.25
} }
output "Dell Inc. DELL U2724DE 1MV5L04" { output "Dell Inc. DELL U2724DE 1MV5L04" {
mode "2560x1440@120.000" mode "2560x1440@120.000"
position x=0 y=0
transform "270"
scale 1.25 scale 1.25
// layout {
// gaps 0
// }
} }
output "eDP-1" { output "eDP-1" {
@ -60,7 +67,23 @@ output "DP-2" {
// https://github.com/YaLTeR/niri/wiki/Configuration:-Layout // https://github.com/YaLTeR/niri/wiki/Configuration:-Layout
layout { layout {
// Set gaps around windows in logical pixels. // Set gaps around windows in logical pixels.
{% if hostname == "sputnik" %}
gaps 2 // TODO: fix output-specific layout
{% else %}
gaps 12 gaps 12
{% end %}
// Struts shrink the area occupied by windows, similarly to layer-shell panels.
// You can think of them as a kind of outer gaps. They are set in logical pixls.
// Left and right struts will cause the next window to the side to always be visible.
// Top and bottom struts will simply add outer gaps in addition to the area occupied by
// layer-shell panels and regular gaps.
struts {
left -12
right -12
top -12
bottom -12
}
// When to center a column when changing focus, options are: // When to center a column when changing focus, options are:
// - "never", default behavior, focusing an off-screen column will keep at the left // - "never", default behavior, focusing an off-screen column will keep at the left
@ -102,26 +125,11 @@ layout {
// active-gradient from="#ffbb66" to="#ffc880" angle=45 relative-to="workspace-view" // active-gradient from="#ffbb66" to="#ffc880" angle=45 relative-to="workspace-view"
// inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view" // inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view"
} }
// Struts shrink the area occupied by windows, similarly to layer-shell panels.
// You can think of them as a kind of outer gaps. They are set in logical pixls.
// Left and right struts will cause the next window to the side to always be visible.
// Top and bottom struts will simply add outer gaps in addition to the area occupied by
// layer-shell panels and regular gaps.
struts {
// left 64
// right 64
// top 64
// bottom 64
}
} }
spawn-at-startup "hyprpaper" spawn-at-startup "hyprpaper"
spawn-at-startup "eww" "daemon"
spawn-at-startup "eww" "open" "bar0"
spawn-at-startup "eww" "open" "bar1"
spawn-at-startup "swayidle" "-w" // ~/.config/swayidle/config spawn-at-startup "swayidle" "-w" // ~/.config/swayidle/config
spawn-at-startup "swaync" // ~/.config/swaync spawn-at-startup "qs" "-p" "/etc/quickshell/niri-caelestia-shell"
// Uncomment this line to ask the clients to omit their client-side decorations if possible. // Uncomment this line to ask the clients to omit their client-side decorations if possible.
// If the client will specifically ask for CSD, the request will be honored. // If the client will specifically ask for CSD, the request will be honored.
@ -248,7 +256,7 @@ vec4 close_color(vec3 coords_geo, vec3 size_geo) {
// https://github.com/YaLTeR/niri/wiki/Configuration:-Window-Rules // https://github.com/YaLTeR/niri/wiki/Configuration:-Window-Rules
window-rule { window-rule {
geometry-corner-radius 16 geometry-corner-radius 22
clip-to-geometry true clip-to-geometry true
} }
@ -326,9 +334,11 @@ binds {
// shows a list of important hotkeys. // shows a list of important hotkeys.
Mod+Shift+Plus { show-hotkey-overlay; } Mod+Shift+Plus { show-hotkey-overlay; }
Mod+Return { spawn "alacritty"; } Mod+Return { spawn "ghostty"; }
Mod+D { spawn "fuzzel"; } Mod+Plus { spawn "loginctl" "lock-session"; }
Mod+Plus { spawn "loginctl lock-session"; }
// TODO: why do i have to use spawn-sh?
Mod+D { spawn "qs" "-p" "/etc/quickshell/niri-caelestia-shell" "ipc" "call" "drawers" "toggle" "launcher"; }
// You can also use a shell: // You can also use a shell:
// Mod+T { spawn "bash" "-c" "notify-send hello && exec alacritty"; } // Mod+T { spawn "bash" "-c" "notify-send hello && exec alacritty"; }

View File

@ -7,22 +7,18 @@
# And here is the theme collection # And here is the theme collection
# https://github.com/nushell/nu_scripts/tree/main/themes # https://github.com/nushell/nu_scripts/tree/main/themes
# Use fish for external completion
let fish_completer = {|spans| let fish_completer = {|spans|
# if the current command is an alias, get it's expansion fish --command $"complete '--do-complete=($spans | str replace --all "'" "\\'" | str join ' ')'"
let expanded_alias = (scope aliases | where name == $spans.0 | get -i 0 | get -i expansion) | from tsv --flexible --noheaders --no-infer
| rename value description
# overwrite | update value {|row|
let spans = (if $expanded_alias != null { let value = $row.value
# put the first word of the expanded alias first in the span let need_quote = ['\' ',' '[' ']' '(' ')' ' ' '\t' "'" '"' "`"] | any {$in in $value}
$spans | skip 1 | prepend ($expanded_alias | split row " " | take 1) if ($need_quote and ($value | path exists)) {
} else { $spans }) let expanded_path = if ($value starts-with ~) {$value | path expand --no-symlink} else {$value}
$'"($expanded_path | str replace --all "\"" "\\\"")"'
} else {$value}
fish --command $'complete "--do-complete=($spans | str join " ")"' }
| $"value(char tab)description(char newline)" + $in
| from tsv --flexible --no-infer
} }
source theme.nu source theme.nu

View File

@ -101,7 +101,7 @@ if ("XDG_RUNTIME_DIR" in $env) {
$env.GPG_TTY = (tty) $env.GPG_TTY = (tty)
$env.BROWSER = "firefox" $env.BROWSER = "firefox"
$env.EDITOR = "nvim" $env.EDITOR = "helix"
$env.DEFMT_LOG = "info" $env.DEFMT_LOG = "info"
$env.MOZ_ENABLE_WAYLAND = "1" $env.MOZ_ENABLE_WAYLAND = "1"
$env.VOLTA_HOME = $"($env.HOME)/.volta" $env.VOLTA_HOME = $"($env.HOME)/.volta"

View File

@ -1,7 +1,7 @@
{ {
"$schema": "/etc/xdg/swaync/configSchema.json", "$schema": "/etc/xdg/swaync/configSchema.json",
"positionX": "left", "positionX": "right",
"positionY": "bottom", "positionY": "top",
"control-center-margin-top": 10, "control-center-margin-top": 10,
"control-center-margin-bottom": 10, "control-center-margin-bottom": 10,
"control-center-margin-left": 10, "control-center-margin-left": 10,

View File

@ -33,6 +33,7 @@
border: 2px solid @noti-border-color; border: 2px solid @noti-border-color;
border-radius: 12px; border-radius: 12px;
margin: 6px 8px 0px 0px; margin: 6px 8px 0px 0px;
padding: 4px;
} }
.notification-content { .notification-content {

44
tree/.face Normal file
View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="120"
height="120"
viewBox="0 0 31.75 31.75"
version="1.1"
id="svg8"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs
id="defs2" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
style="display:inline">
<path
style="fill:#ffffff;stroke-width:0.177246"
d="m 13.134179,31.651166 c -1.367874,-0.18043 -3.4872278,-0.85238 -4.780367,-1.51563 -1.871747,-0.96002 -4.179215,-3.22966 -5.0074297,-4.92534 -1.5914865,-3.25839 -1.6801158,-7.72336 -0.2278948,-11.48085 1.0247424,-2.65144 2.7098602,-4.5706201 5.4768881,-6.2376401 4.4640374,-2.6894 6.9208324,-4.59636 8.5218534,-6.61464 0.435944,-0.54955 0.851411,-0.9404 0.923263,-0.86855 0.34663,0.34663 0.709996,2.45556 0.596276,3.46071 l -0.118698,1.04918 0.543199,-0.3868 c 0.298763,-0.21273 0.754695,-0.66407 1.013185,-1.00297 0.258491,-0.3389 0.531184,-0.55268 0.605988,-0.47507 0.277608,0.28804 0.872923,2.3693 0.872923,3.05181 0,0.78189 -0.07309,0.70941 2.140938,2.12277 3.360595,2.14527 5.28622,5.2741001 5.845846,9.4985401 0.238089,1.79727 0.119928,4.12317 -0.289284,5.69424 -0.438918,1.68512 -1.295306,3.20011 -2.596637,4.59356 -2.715779,2.90803 -6.119638,4.1954 -10.928887,4.13338 -1.132683,-0.0146 -2.298705,-0.0581 -2.591161,-0.0967 z m 5.683631,-1.1265 c 5.074026,-0.89873 8.492767,-3.70496 9.49005,-7.7898 0.358508,-1.46844 0.317005,-5.28368 -0.07569,-6.95754 -0.594746,-2.53514 -2.005266,-4.78931 -3.64922,-5.8318801 -1.428352,-0.90583 -1.561881,-0.82384 -2.840659,1.7442101 -0.615739,1.23654 -1.777129,3.21756 -2.580868,4.40229 l -1.461342,2.15404 0.927607,0.3153 c 1.188141,0.40386 2.476979,1.20634 2.848748,1.77373 0.272049,0.4152 0.269021,0.4806 -0.04735,1.02231 -0.778356,1.33273 -2.272203,1.79512 -5.849412,1.81056 l -2.340153,0.0101 -2.489801,2.46697 c -2.6276133,2.60352 -2.8788341,3.03045 -2.0880964,3.54856 1.8126654,1.18771 7.0732674,1.8772 10.1561944,1.33115 z m 3.183004,-13.17071 c -0.205126,-0.14999 -0.329285,-0.4602 -0.329285,-0.8227 0,-0.96498 1.087198,-1.43355 1.715448,-0.73934 0.872429,0.96402 -0.338235,2.3283 -1.386163,1.56204 z m -3.186586,4.78402 c 1.133944,-0.30198 1.619925,-0.56299 1.85054,-0.9939 0.246861,-0.46126 -0.269147,-0.94676 -1.770094,-1.66543 -1.062457,-0.50872 -1.296906,-0.55176 -3.013183,-0.55311 -1.794444,-0.001 -1.910137,0.0225 -3.231141,0.66815 -1.860639,0.90936 -2.118197,1.48499 -0.948717,2.12031 1.182601,0.64245 5.357705,0.89133 7.112595,0.42398 z m -5.26747,-0.96936 c -1.113796,-0.13246 -1.303724,-0.23853 -1.149022,-0.64168 0.08921,-0.23246 0.582443,-0.27351 3.286452,-0.27351 1.749822,0 3.307658,0.0484 3.461858,0.10758 0.350902,0.13466 0.365077,0.53097 0.02367,0.66198 -0.432127,0.16582 -4.555272,0.2726 -5.622968,0.14563 z m -3.7845902,-3.81466 c 0.7343882,-0.537 0.2478022,-1.88618 -0.6802563,-1.88618 -0.5030742,0 -0.9992445,0.51278 -0.9992445,1.03268 0,0.90987 0.9453857,1.39029 1.6795008,0.8535 z"
id="path865" />
<path
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 7.5967544,-6.2400058 c 0,0 -0.041418,0.1031026 -0.02862,0.2093299 0.012798,0.1062273 0.084435,0.1741091 0.084435,0.1741091 l -0.083147,0.088222 c 0,0 -0.1053512,-0.138166 -0.073877,-0.2774823 0.031474,-0.1393166 0.1012092,-0.1941783 0.101209,-0.1941787 z"
id="path1039" />
</g>
<g
id="layer2"
style="display:none" />
<g
id="layer3"
style="display:none" />
</svg>

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -12,7 +12,7 @@
rebase = true rebase = true
[core] [core]
editor = nvim editor = helix
[init] [init]
defaultBranch = master defaultBranch = master

View File

@ -30,6 +30,7 @@ sudo pacman --needed -S \
i2c-tools \ i2c-tools \
lazygit \ lazygit \
luarocks \ luarocks \
man-db man-pages \
neovim \ neovim \
nerd-fonts \ nerd-fonts \
niri \ niri \
@ -39,6 +40,7 @@ sudo pacman --needed -S \
nushell \ nushell \
openbsd-netcat \ openbsd-netcat \
pamixer \ pamixer \
qt5ct \
qt5-wayland \ qt5-wayland \
qt6-wayland \ qt6-wayland \
ripgrep \ ripgrep \

View File

@ -5,7 +5,7 @@ set -x
notify-send "Connecting to Högtalare" notify-send "Connecting to Högtalare"
bluetoothctl power on bluetoothctl power on
if bluetoothctl connect 04:FE:A1:71:4C:70; then if bluetoothctl connect E8:26:CF:33:2D:BA; then
notify-send "Connected" notify-send "Connected"
else else
notify-send "Failed to connect to Högtalare" notify-send "Failed to connect to Högtalare"

View File

@ -9,4 +9,4 @@ if ps -e | grep " $LOCKPROG\$"
exit 1 exit 1
end end
$LOCKPROG $argv ba $LOCKPROG $argv

View File

@ -1,5 +1,5 @@
# Get a Mullvad api access token from an account number # Get a Mullvad api access token from an account number
def m-token [ def "m token" [
account: string # Mullvad account number account: string # Mullvad account number
] { ] {
(http post https://api.mullvad.net/auth/v1/token (http post https://api.mullvad.net/auth/v1/token
@ -8,7 +8,7 @@ def m-token [
} }
# Add a device to a mullvad account # Add a device to a mullvad account
def m-add-device [ def "m add device" [
account: string # Mullvad account number account: string # Mullvad account number
] { ] {
let token = (m-token $account) let token = (m-token $account)
@ -23,3 +23,258 @@ def m-add-device [
kind: "App", kind: "App",
}) })
} }
# Get mullvad-daemon system path
def "m daemon path" []: nothing -> string {
match (uname).kernel-name {
Linux => "/usr/bin/mullvad-daemon",
Darwin => "/Applications/Mullvad VPN.app/Contents/Resources/mullvad-daemon",
_ => (panic "Unknown Kernel"),
}
}
# Return true if mullvad-daemon is running
def "m daemon is-running" [
# Only return true if mullvad-daemon is running as a launch daemon
--system (-s),
] {
let procs = (^ps aux | lines)
if $system {
$procs | any { |line| $line =~ (m daemon path) }
} else {
$procs | any { |line| $line =~ "mullvad-daemon" }
}
}
def dns [
--server (-s): string,
name: string,
] {
# HACK: turn the optional argument into a list. not sure how to pass it to nslookup otherwise.
let server = ([$server] | compact)
let ipv4 = (dig $name A | lines | skip until {|l| $l =~ "ANSWER SECTION" } | skip 1 | take until { |l| $l == "" } | split column "\t" -c | rename host ttl _ type addr) | reject _
let ipv6 = (dig $name AAAA | lines | skip until {|l| $l =~ "ANSWER SECTION" } | skip 1 | take until { |l| $l == "" } | split column "\t" -c | rename host ttl _ type addr) | reject _
$ipv4 | append $ipv6
}
# Build and run mullvad-daemon
def "m daemon" [
--release (-r)
# Force userspace wireguard
--userwg
# Use wireguard-go over GotaTun
--wggo
# Use stagemole
--stagemole
# Attach GDB
--gdb
# Add counters and such to nft rules
--debug-fw
] {
mut daemon_args = []
mut cargo_flags = []
mut envs = [
MULLVAD_RESOURCE_DIR=./dist-assets/
]
if $release {
$cargo_flags ++= [--release]
}
if $stagemole {
$cargo_flags ++= [--features api-override]
$envs ++= [
MULLVAD_API_HOST=api.stagemole.eu
MULLVAD_API_ADDR=(dns api.stagemole.eu | where type == A | get 0.addr):443
]
}
if $debug_fw {
$envs ++= [TALPID_FIREWALL_DEBUG=1]
}
if $userwg {
$envs ++= [TALPID_FORCE_USERSPACE_WIREGUARD=1]
}
if $wggo {
$cargo_flags ++= [--features wireguard-go]
}
if (m daemon is-running --system) {
print "daemon is loaded, stopping..."
match (uname).kernel-name {
Linux => {
sudo systemctl stop mullvad-daemon
},
Darwin => {
sudo launchctl unload -w /Library/LaunchDaemons/net.mullvad.daemon.plist
},
_ => (panic "Unknown Kernel"),
}
} else if (m daemon is-running) {
print "mulvad-daemon is running in another terminal"
return
}
if $gdb {
$daemon_args ++= [gdb --args]
}
let daemon_path = if $release {
$daemon_args ++= [$"($env.CARGO_TARGET_DIR)/release/mullvad-daemon"]
} else {
$daemon_args ++= [$"($env.CARGO_TARGET_DIR)/debug/mullvad-daemon"]
}
# increase verbosity
$daemon_args ++= ["-vv"]
cargo b ...$cargo_flags
sudo ...$envs ...$daemon_args
}
def "m android cli" [
...args
] {
let socket_filename = "rpc-socket"
sudo MULLVAD_RPC_SOCKET_PATH=(sudo fd $socket_filename ~/.local/share/waydroid) mullvad ...$args
}
def "m android start" [
] {
print "starting net.mullvad.mullvadvpn"
adb shell am start -n net.mullvad.mullvadvpn/.ui.MainActivity;
# TODO: the waydroid cli is bork in the nix flake
# waydroid app launch net.mullvad.mullvadvpn
}
def "m android stop" [
] {
let app_pid = (ps | where name =~ mullvadvpn | get -o pid.0)
if $app_pid != null {
print $"kill net.mullvad.mullvadvpn [($app_pid)]"
sudo kill $app_pid
} else {
print "net.mullvad.mullvadvpn is not running"
}
}
def "m android run" [
] {
print "hack: making sure we're disconnected"
do --ignore-errors { m android cli disconnect }
print "compiling apk"
./gradlew installOssProdDebug
m android start
}
def "m android reload-daemon" [
] {
let daemon_path = (fd libmullvad_jni.so ~/.local/share/waydroid/ | lines | get -o 0)
if $daemon_path == null {
print "Can't find libmullvad_jni.so, hot-reload not available. Is the app installed?"
exit
}
m android stop
print "re-compiling libmullvad_jni.so"
./gradlew app:cargoBuildX86_64;
print "Executing hot-swap!"
sudo cp ~/.cargo/target/x86_64-linux-android/debug/libmullvad_jni.so $daemon_path;
m android start
}
def "m e2e list" [
...args
] {
print "Building test utils"
cargo b --target aarch64-apple-darwin
let test_manager = $"($env.CARGO_TARGET_DIR)/aarch64-apple-darwin/debug/test-manager"
print "Listing tests"
^$test_manager list-tests ...$args | from tsv | into int priority | sort-by priority name
}
def "m e2e run" [
account: string
vm: string
--skip: list<string>
--display (-d)
...tests
] {
let commit = (git rev-parse HEAD | take 6 | decode)
print $"Current commit: ($commit)"
let dist = "../dist"
print $"Looking in ($dist)"
let pkg_ext = match (uname).kernel-name {
"Linux" => "rpm", # TODO: rpm
"Darwin" => "pkg",
_ => (panic "Unknown kernel"),
}
let target = match (uname).kernel-name {
"Linux" => "x86_64-unknown-linux-musl",
"Darwin" => "aarch64-apple-darwin",
_ => (panic "Unknown kernel"),
}
let pkgs = (ls $dist | where name =~ $".*\\.($pkg_ext)")
let pkgs = ($pkgs | where name =~ $commit)
if ($pkgs | is-empty) {
print $"No .($pkg_ext) for current commit found."
print "Run ./build.sh"
return
}
if ($pkgs | length) > 1 {
print $"Multiple .($pkg_ext):s for current commit found."
print "Make sure there's only one"
print ...$pkgs
return
}
let pkg = ($pkgs | get 0.name)
print $"Using ($pkg)"
print "Building test utils"
cargo b --release --target $target -p test-runner -p connection-checker
cargo b -p test-manager
let test_manager = $"($env.CARGO_TARGET_DIR)/debug/test-manager"
let bin_dir = $"($env.CARGO_TARGET_DIR)/($target)/release/"
mut args = [
--vm $vm
--account $account
--app-package $pkg
--runner-dir $bin_dir
]
if $display {
$args ++= [--display]
}
for s in $skip {
$args ++= ["--skip" $s]
}
let args = $args
print "Running tests"
RUST_LOG=debug ^$test_manager run-tests -v ...$args ...$tests
}