refactor(hyprland): move scripts to the hyprland configuration

This commit is contained in:
Alexandre Cavalheiro 2024-09-22 01:30:11 -03:00
parent f75542ade9
commit cc8717c4ae
Signed by: wizardlink
GPG key ID: A5767B54367CFBDF
7 changed files with 115 additions and 92 deletions

View file

@ -70,71 +70,6 @@
source = ./scripts;
recursive = true;
};
".local/share/scripts/hyprland/start_services.sh" = {
executable = true;
text = # sh
''
#!/bin/sh
#
# Make sure xdg-desktop-portal-hyprland has access to what it needs
#
dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP &
#
# Start waybar.
#
waybar &
#
# Start xwaylandvideobridge
#
xwaylandvideobridge &
#
# Start wallpaper daemon
#
~/.local/share/scripts/wallpaper.sh &
#
# Start notification daemon.
#
mako &
#
# Start polkit agent
#
${pkgs.libsForQt5.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1
#
# Start kwallet service
#
kwalletd6 &
#
# Start kdeconnect daemon
#
kdeconnectd &
#
# Clipboard manager
#
wl-paste --type text --watch cliphist store &
wl-paste --type image --watch cliphist store &
#
# Start Fcitx5
#
fcitx5 &
#
# Start the blueman applet for managing bluetooth devices
#
blueman-applet &
'';
};
};
# Configure XDG

View file

@ -1,15 +1,30 @@
{ config, lib, ... }:
{
options.modules.hyprland.extraConfig = lib.mkOption {
type = lib.types.str;
default = "";
example = # hyprlang
''
monitor = DP-3, 1920x1080@74.973, 2560x0, 1
monitor = DP-2, 2560x1440@165.00301, 0x0, 1
'';
description = "Configuration to be appended to my own.";
config,
lib,
pkgs,
...
}:
let
cfg = config.modules.hyprland;
in
{
options.modules.hyprland = {
extraConfig = lib.mkOption {
type = lib.types.str;
default = "";
example = # hyprlang
''
monitor = DP-3, 1920x1080@74.973, 2560x0, 1
monitor = DP-2, 2560x1440@165.00301, 0x0, 1
'';
description = "Configuration to be appended to my own.";
};
scripts = {
screenshot.enable = lib.mkEnableOption "screenshot";
startup.enable = lib.mkEnableOption "startup";
};
};
config = {
@ -138,11 +153,23 @@
'';
};
# Set-up the scripts for services and apps.
home.packages = lib.mkIf cfg.scripts.startup.enable [
(import ./scripts/start_services.nix pkgs)
(import ./scripts/start_apps.nix pkgs)
];
# Then add the hyprland screenshot scripts.
xdg.dataFile = lib.mkIf cfg.scripts.screenshot.enable {
"scripts/hyprland/screenshot.sh".source = ./scripts/screenshot.sh;
"scripts/hyprland/screenshot_area.sh".source = ./scripts/screenshot_area.sh;
};
# Configure hyprland - we enable it in NixOS.
xdg.configFile."hypr/hyprland.conf".text = # hyprlang
''
source = $HOME/.config/hypr/frappe.conf
${config.modules.hyprland.extraConfig}
${cfg.extraConfig}
#
# Please note not all available settings / options are set here.
@ -157,10 +184,10 @@
exec-once = /etc/profiles/per-user/wizardlink/etc/profile.d/hm-session-vars.sh
# Start the core services of my desktop
exec-once = ~/.local/share/scripts/hyprland/start_services.sh
exec-once = start_services
# Open the apps I always use
exec-once = ~/.local/share/scripts/hyprland/start_apps.sh
exec-once = start_apps
# Set cursor size.
env = HYPRCURSOR_SIZE, 36

View file

@ -0,0 +1,15 @@
pkgs:
pkgs.writeShellScriptBin "start_apps" ''
# Open qbittorrent
qbittorrent &
# Open vesktop
vesktop &
# Open steam
steam &
# Open firefox
firefox
''

View file

@ -0,0 +1,59 @@
pkgs:
pkgs.writeShellScriptBin "start_services" ''
#
# Make sure xdg-desktop-portal-hyprland has access to what it needs
#
dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP &
#
# Start waybar.
#
waybar &
#
# Start xwaylandvideobridge
#
xwaylandvideobridge &
#
# Start wallpaper daemon
#
~/.local/share/scripts/wallpaper.sh &
#
# Start notification daemon.
#
mako &
#
# Start polkit agent
#
${pkgs.libsForQt5.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1 &
#
# Start kwallet service
#
kwalletd6 &
#
# Start kdeconnect daemon
#
kdeconnectd &
#
# Start Fcitx5
#
fcitx5 &
#
# Start the blueman applet for managing bluetooth devices
#
blueman-applet &
#
# Clipboard manager
#
${pkgs.wl-clipboard}/bin/wl-paste --watch cliphist store &
''

View file

@ -1,13 +0,0 @@
#!/bin/sh
# Open qbittorrent
qbittorrent &
# Open vesktop
vesktop &
# Open steam
steam &
# Open firefox
firefox