From 8b52668319e1989bb7553d9e44dd0dabdcfd9b6c Mon Sep 17 00:00:00 2001 From: Frantisek Bohacek Date: Sun, 24 Mar 2024 18:26:47 +0100 Subject: [PATCH] feat: start some services only with qtile --- modules/desktop/qtile/config/autostart.sh | 2 ++ modules/desktop/qtile/config/config.py | 2 +- modules/desktop/qtile/home.nix | 10 +++++++++- modules/services/dunst.nix | 12 +++++++++++- modules/services/flameshot.nix | 10 ++++++++++ modules/services/picom.nix | 11 ++++++++++- modules/services/redshift.nix | 9 +++++++++ 7 files changed, 52 insertions(+), 4 deletions(-) diff --git a/modules/desktop/qtile/config/autostart.sh b/modules/desktop/qtile/config/autostart.sh index e4cc7cc..576530d 100755 --- a/modules/desktop/qtile/config/autostart.sh +++ b/modules/desktop/qtile/config/autostart.sh @@ -1,5 +1,7 @@ #!/usr/bin/env sh +systemctl start --user qtile-services.target + # Browser firefox & diff --git a/modules/desktop/qtile/config/config.py b/modules/desktop/qtile/config/config.py index d4d5686..894781f 100644 --- a/modules/desktop/qtile/config/config.py +++ b/modules/desktop/qtile/config/config.py @@ -630,7 +630,7 @@ floating_layout = layout.Floating( *layout.Floating.default_float_rules, ] ) -auto_fullscreen = False +auto_fullscreen = True focus_on_window_activation = 'never' reconfigure_screens = True auto_minimize = True diff --git a/modules/desktop/qtile/home.nix b/modules/desktop/qtile/home.nix index ae8b198..45aa65a 100644 --- a/modules/desktop/qtile/home.nix +++ b/modules/desktop/qtile/home.nix @@ -18,10 +18,11 @@ in { mpris-ctld = { Unit = { Description = "Daemon for mpris-ctl cli, that will keep track of last playing media"; + PartOf = [ "qtile-services.target" ]; }; Install = { - WantedBy = [ "default.target" ]; + WantedBy = [ "qtile-services.target" ]; }; Service = { @@ -30,6 +31,13 @@ in { }; }; + systemd.user.targets.qtile-services = { + Unit = { + Description = "A target that is enabled when starting Qtile"; + Requires = [ "graphical-session.target" ]; + }; + }; + programs.autorandr = { enable = true; profiles = { diff --git a/modules/services/dunst.nix b/modules/services/dunst.nix index 377ea6f..629ec51 100644 --- a/modules/services/dunst.nix +++ b/modules/services/dunst.nix @@ -8,7 +8,17 @@ let colors = import ../themes/colors.nix; # Import colors theme in { - home.packages = [ pkgs.libnotify ]; # Dependency + home.packages = lib.mkIf config.services.dunst.enable [ pkgs.libnotify ]; # Dependency + + systemd.user.services.dunst = lib.mkIf config.services.dunst.enable { + Unit = { + PartOf = lib.mkForce [ "qtile-services.target" ]; + }; + Install = { + WantedBy = lib.mkForce [ "qtile-services.target" ]; + }; + }; + services.dunst = { enable = true; iconTheme = { # Icons diff --git a/modules/services/flameshot.nix b/modules/services/flameshot.nix index 1c4555f..846e4cd 100644 --- a/modules/services/flameshot.nix +++ b/modules/services/flameshot.nix @@ -7,6 +7,16 @@ let screensDir = "/home/${user}/screens"; in { + + systemd.user.services.flameshot = lib.mkIf config.services.flameshot.enable { + Unit = { + PartOf = lib.mkForce [ "qtile-services.target" ]; + }; + Install = { + WantedBy = lib.mkForce [ "qtile-services.target" ]; + }; + }; + services = { # sxhkd shortcut = Printscreen button (Print) flameshot = { enable = true; diff --git a/modules/services/picom.nix b/modules/services/picom.nix index 9647d4c..818ae56 100644 --- a/modules/services/picom.nix +++ b/modules/services/picom.nix @@ -4,7 +4,16 @@ { config, lib, pkgs, ... }: -{ +{ + systemd.user.services.picom = lib.mkIf config.services.picom.enable { + Unit = { + PartOf = lib.mkForce [ "qtile-services.target" ]; + }; + Install = { + WantedBy = lib.mkForce [ "qtile-services.target" ]; + }; + }; + services.picom = { enable = true; package = pkgs.picom; diff --git a/modules/services/redshift.nix b/modules/services/redshift.nix index a11789a..098eaf3 100644 --- a/modules/services/redshift.nix +++ b/modules/services/redshift.nix @@ -4,6 +4,15 @@ { config, lib, pkgs, ...}: { + systemd.user.services.redshift = lib.mkIf config.services.redshift.enable { + Unit = { + PartOf = lib.mkForce [ "qtile-services.target" ]; + }; + Install = { + WantedBy = lib.mkForce [ "qtile-services.target" ]; + }; + }; + services = { redshift = { enable = true; -- 2.48.1