add all kde connect commands on next boot (or restart of the service set-kde-connect-commands.service) and force kill zellij and zsh before shutdown

This commit is contained in:
Lillian Violet 2025-07-20 18:18:15 +02:00
parent 26fa7c8cb9
commit d071b59473
3 changed files with 44 additions and 6 deletions

View file

@ -0,0 +1,2 @@
[General]
commands="@ByteArray({\"2574d457_7a99_40a3_8239_24407c7a074d\":{\"command\":\"loginctl unlock-session\",\"name\":\"unlock\"},\"2bbbb9cc_892a_44a1_b097_27b149387511\":{\"command\":\"bluetoothctl disconnect 38:18:4C:11:56:99\",\"name\":\"disconnect headset\"},\"35ad74aa_c1f0_4dd7_a392_2b2676105b62\":{\"command\":\"systemctl hibernate\",\"name\":\"hibernate\"},\"5dd755de_e098_4907_982d_bedba5c3511d\":{\"command\":\"loginctl lock-session\",\"name\":\"lock\"},\"6423946a_b13e_4127_a0d0_0ca38e79fa0f\":{\"command\":\"bluetoothctl connect 38:18:4C:11:56:99\",\"name\":\"connect headset\"},\"690a4134_162b_4851_83a4_bf75722c699a\":{\"command\":\"systemctl suspend\",\"name\":\"suspend\"},\"99ae3913_1757_4ed0_ad7e_91c6f5d740ef\":{\"command\":\"qdbus org.kde.kglobalaccel /component/kmix invokeShortcut \\\"mute\\\"\",\"name\":\"mute\"},\"b11480dd_19f7_49c0_9dcc_3065ddc5150b\":{\"command\":\"qdbus org.kde.kglobalaccel /component/kmix invokeShortcut \\\"mic_mute\\\"\",\"name\":\"mute mic\"},\"bd36530a_9ed5_4345_989d_189c27b3ce00\":{\"command\":\"systemctl reboot\",\"name\":\"reboot\"},\"cf6180f7_e4bd_4f15_a9d1_19ed14e99913\":{\"command\":\"file=\\\"$HOME/Images/WebcamImage_$(date \\\"+%Y%m%d_%H%M%S\\\").jpg\\\"; ffmpeg -f video4linux2 -s 1280x720 -i /dev/video0 -ss 0:0:2 -frames 1 \\\"${file}\\\" && kdeconnect-cli -d $(kdeconnect-cli -a --id-only) --share \\\"${file}\\\"\",\"name\":\"webcam to phone\"},\"d31a3cab_bb6a_459d_89fb_533d0d8fec61\":{\"command\":\"systemctl poweroff\",\"name\":\"shutdown\"},\"f08e1a64_53be_41da_b942_e05e45f1d69c\":{\"command\":\"qdbus org.kde.kglobalaccel /component/kmix invokeShortcut \\\"decrease_volume\\\"\",\"name\":\"volume down\"},\"fbd67152_2a58_4d5d_a210_982fa0eeb171\":{\"command\":\"qdbus org.kde.kglobalaccel /component/kmix invokeShortcut \\\"increase_volume\\\"\",\"name\":\"volume up\"},\"fc3adde9_7049_4166_bcda_a74d13ec91eb\":{\"command\":\"file=/tmp/$(hostname)_$(date \\\"+%Y%m%d_%H%M%S\\\").png; spectacle -bo \\\"${file}\\\" && while ! [ -f \\\"${file}\\\" ]; do sleep 0.5; done && kdeconnect-cli -d $(kdeconnect-cli -a --id-only) --share \\\"${file}\\\"\",\"name\":\"screenshot to phone\"}})"

View file

@ -1,4 +1,23 @@
{osConfig, ...}: { {
osConfig,
pkgs,
config,
...
}: {
#TODO: make the creation of the command file easier, for now this is a nice solution though
systemd.user.services."set-kde-connect-commands" = {
Install = {
WantedBy = ["default.target"];
};
Service = {
Type = "OneShot";
ExecStart = "${pkgs.writeShellScript "set-kde-connect-commands" ''
#!/run/current-system/sw/bin/bash
find ${config.home.homeDirectory}/.config/kdeconnect/ -type d -name \'kdeconnect_runcommand\' -execdir cp ${builtins.toPath ./kde-connect-commands} {}+"/config" \;
''}";
RemainAfterExit = true;
};
};
home.file.".config/kdeconnect/config" = { home.file.".config/kdeconnect/config" = {
text = '' text = ''
[General] [General]

View file

@ -154,16 +154,33 @@
fonts.packages = [ fonts.packages = [
pkgs.atkinson-hyperlegible pkgs.atkinson-hyperlegible
pkgs.atkinson-monolegible pkgs.atkinson-monolegible
pkgs.noto-fonts-emoji-blob-bin
pkgs.noto-fonts pkgs.noto-fonts
pkgs.nerd-fonts.fira-mono pkgs.nerd-fonts.fira-mono
pkgs.font-awesome pkgs.font-awesome
]; ];
# fonts.fontconfig.defaultFonts = { fonts.fontconfig = {
# emoji = ["Blobmoji"]; useEmbeddedBitmaps = true;
# monospace = ["Atkinson Monolegible"]; # defaultFonts = {
# sansSerif = ["Atkinson Hyperlegible"]; # emoji = ["Blobmoji"];
# }; # monospace = ["Atkinson Monolegible"];
# sansSerif = ["Atkinson Hyperlegible"];
# };
};
systemd.services."shutdown-zellij-zsh" = {
path = with pkgs; [killall];
enable = true;
unitConfig = {
Before = "shutdown.target";
};
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.killall}/bin/killall -SIGKILL zellij zsh";
RemainAfterExit = "yes";
};
};
networking = networking =
if config.services.vpn-ip.enable if config.services.vpn-ip.enable