diff --git a/defaults/user-configuration/fhauser/applications/default.nix b/defaults/user-configuration/fhauser/applications/default.nix index 556263b..a87be1b 100644 --- a/defaults/user-configuration/fhauser/applications/default.nix +++ b/defaults/user-configuration/fhauser/applications/default.nix @@ -18,6 +18,7 @@ ./alacritty.nix ./shell.nix ./swaylock.nix + ./kanshi.nix ]; home-manager.users.fhauser.home.packages = with pkgs; [ # Networking diff --git a/defaults/user-configuration/fhauser/applications/kanshi.nix b/defaults/user-configuration/fhauser/applications/kanshi.nix new file mode 100644 index 0000000..ab0b7ca --- /dev/null +++ b/defaults/user-configuration/fhauser/applications/kanshi.nix @@ -0,0 +1,47 @@ +{ pkgs, lib, config, ... }: { + home-manager.users.fhauser.services.kanshi = { + enable = true; + profiles = let + backgroundPicturePath = "~/pictures/backgrounds"; + backgroundCommand = '' + #swaymsg "output * bg `find ${backgroundPicturePath} -type f | shuf -n 1` fill" + ''; + mkScreen = (screen: { + criteria = screen; + status = "enable"; + scale = 1.0; + }); + in rec { + #mobile.exec = backgroundCommand; + mobile.outputs = [ + (mkScreen "Unknown 0x08CE 0x00000000" // { + position = "0,0"; + scale = 2.0; + }) + ]; + home-dock.outputs = mobile.outputs ++ [ + (mkScreen "Dell Inc. DELL P2720DC 22JPK53" // { + position = "1920,0"; + scale = 1.0; + status = "enable"; + }) + ]; + office-dock.outputs = mobile.outputs ++ [ + (mkScreen "Dell Inc. DELL P2720DC BRKPK53" // { position = "1920,0"; }) + (mkScreen "Dell Inc. DELL P2720DC 22JPK53" // { position = "4480,0"; }) + ]; + home-pc.outputs = [ + (mkScreen "Dell Inc. DELL P2720DC 22JPK53" // { position = "0,0"; }) + (mkScreen "Unknown HP Z27 CN482201RP" // { + position = "2560,0"; + scale = 1.5; + }) + ]; + home-pc-row.outputs = home-pc.outputs ++ [ + (mkScreen "Ancor Communications Inc ASUS VS247 B3LMTF180900" // { + position = "5120,0"; + }) + ]; + }; + }; +} diff --git a/defaults/user-configuration/fhauser/applications/scripts.nix b/defaults/user-configuration/fhauser/applications/scripts.nix index 0b4cfe4..0a8b434 100644 --- a/defaults/user-configuration/fhauser/applications/scripts.nix +++ b/defaults/user-configuration/fhauser/applications/scripts.nix @@ -59,4 +59,7 @@ let echo "Starting '$COMMAND' in env '$ENV_FILE'" ${pkgs.nix}/bin/nix-shell ''${ENV_FILE} --run "$COMMAND" ''; -in { home-manager.users.fhauser.home.packages = [ passbemenu threema-vpn threema-env ]; } +in { + home-manager.users.fhauser.home.packages = + [ passbemenu threema-vpn threema-env ]; +} diff --git a/defaults/user-configuration/fhauser/default.nix b/defaults/user-configuration/fhauser/default.nix index c76f103..2ed1b0d 100644 --- a/defaults/user-configuration/fhauser/default.nix +++ b/defaults/user-configuration/fhauser/default.nix @@ -6,6 +6,7 @@ ./applications ./work ./i3.nix + ./mimetypes.nix ]; home-manager.users.fhauser.home.stateVersion = config.system.stateVersion; } diff --git a/defaults/user-configuration/fhauser/mimetypes.nix b/defaults/user-configuration/fhauser/mimetypes.nix new file mode 100644 index 0000000..913343b --- /dev/null +++ b/defaults/user-configuration/fhauser/mimetypes.nix @@ -0,0 +1,58 @@ +{ pkgs, lib, config, ... }: { + + home-manager.users.fhauser.xdg.mimeApps = rec { + enable = true; + associations.added = defaultApplications; + defaultApplications = let + browser = [ "firefox.desktop" ]; + email = [ "org.gnome.Evolution.desktop" ]; + doc-editor = [ "writer.desktop" ]; + sheet-editor = [ "calc.desktop" ]; + presentation-editor = [ "impress.desktop" ]; + pdf = [ "org.gnome.Evince.desktop" ]; + image = [ "org.gnome.eog.desktop" ]; + image-vector = [ "org.inkscape.Inkscape.desktop" ]; + ebooks = [ "calibre-ebook-viewer.desktop" ]; + code-general = [ "codium.desktop" ]; + video = [ "vlc.desktop" ]; + in { + "text/html" = browser; + "x-scheme-handler/http" = browser; + "x-scheme-handler/https" = browser; + "x-scheme-handler/chrome" = browser; + "application/xhtml+xml" = browser; + "application/x-extension-htm" = browser; + "application/x-extension-html" = browser; + "application/x-extension-shtml" = browser; + "application/x-extension-xhtml" = browser; + "application/x-extension-xht" = browser; + "x-scheme-handler/mailto" = email; + "x-scheme-handler/msteams" = [ "teams.desktop" ]; + + "application/vnd.openxmlformats-officedocument.wordprocessingml.document" = + doc-editor; + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" = + sheet-editor; + "application/vnd.openxmlformats-officedocument.presentationml.presentation" = + presentation-editor; + "application/vnd.oasis.opendocument.presentation" = presentation-editor; + "application/pdf" = pdf; + "application/x-extension-pdf" = pdf; + "application/epub+zip" = ebooks; + + "text/plain" = code-general; + "application/json" = code-general; + "text/markdown" = code-general; + + "image/png" = image; + "image/jpg" = image; + "image/jpeg" = image; + "image/x-tga" = image; + "image/tiff" = image; + "image/x-canon-cr2" = image; + "image/svg+xml" = image-vector; + + "video/mp4" = video; + }; + }; +} diff --git a/defaults/user-configuration/fhauser/sway.nix b/defaults/user-configuration/fhauser/sway.nix index e14fe1b..f25b8bd 100644 --- a/defaults/user-configuration/fhauser/sway.nix +++ b/defaults/user-configuration/fhauser/sway.nix @@ -4,6 +4,11 @@ programs.sway.enable = true; services.gnome3.gnome-remote-desktop.enable = true; environment.systemPackages = with pkgs; [ pipewire_0_2 ]; + systemd.user.services.pipewire.environment.XDG_CURRENT_DESKTOP = "sway"; + systemd.user.services.xdg-desktop-portal-wlr.environment.XDG_CURRENT_DESKTOP = + "sway"; + # systemd.user.services.xdg-desktop-portal-wlr.script = "${pkgs.xdg-desktop-portal-wlr}/libexec/xdg-desktop-portal-wlr"; + # systemd.user.services.xdg-desktop-portal-wlr.scriptArgs = "--output=DP-1"; # TODO: Extract this ***** home-manager.users.fhauser = let adhereTheSwayTarget = { Install.WantedBy = lib.mkForce [ "sway-session.target" ]; @@ -17,6 +22,7 @@ ${pkgs.bemenu}/bin/bemenu -m $active_screen --list 20 --ignorecase --prompt 'Start: ' | \ xargs swaymsg exec -- ''; + homeManagerConfig = config.home-manager.users.fhauser; in rec { home.packages = with pkgs; [ sway-contrib.grimshot @@ -35,7 +41,9 @@ xwayland = true; wrapperFeatures = { gtk = true; }; extraSessionCommands = '' - export XDG_CURRENT_DESKTOP=Unity + #export XDG_CURRENT_DESKTOP=Unity + export XDG_CURRENT_DESKTOP=sway + export XDG_SESSION_TYPE="wayland" export _JAVA_AWT_WM_NONREPARENTING=1 export SSH_AUTH_SOCK=/run/user/1000/gnupg/S.gpg-agent.ssh # TODO: Migrate export QT_QPA_PLATFORM=wayland @@ -122,88 +130,33 @@ ''; }; - services.kanshi = { - enable = true; - profiles = let - backgroundPicturePath = "~/pictures/backgrounds"; - mkScreen = (screen: { - criteria = screen; - status = "enable"; - scale = 1.0; - }); - in rec { - #mobile.exec = '' - # swaymsg "output * bg `find ${backgroundPicturePath} -type f | shuf -n 1` fill"''; - mobile.outputs = [ - (mkScreen "Unknown 0x08CE 0x00000000" // { - position = "0,0"; - scale = 2.0; - }) - ]; - #home-dock.exec = mobile.exec; - home-dock.outputs = [ - (mkScreen "Unknown 0x08CE 0x00000000" // { - status = "enable"; - scale = 2.0; - position = "0,0"; - }) - (mkScreen "Dell Inc. DELL P2720DC 22JPK53" // { - position = "1920,0"; - scale = 1.0; - status = "enable"; - }) - #(mkScreen "Dell Inc. DELL P2720DC 6JRRK53" // { - # position = "2560,0"; - # #position = "4480,0"; - # scale = 1.0; - # status = "enable"; - #}) - ]; - #chur-dock.outputs = [ - # (mkScreen "Unknown 0x08CE 0x00000000" // { - # position = "0,0"; - # scale = 2.0; - # }) - # (mkScreen "Dell Inc. DELL P2720DC 22JPK53" // { - # position = "1920,0"; - # }) - #]; - #office-dock.exec = mobile.exec; - office-dock.outputs = [ - (mkScreen "Unknown 0x08CE 0x00000000" // { - position = "0,0"; - scale = 2.0; - }) - (mkScreen "Dell Inc. DELL P2720DC BRKPK53" // { - position = "1920,0"; - }) - (mkScreen "Dell Inc. DELL P2720DC 22JPK53" // { - position = "4480,0"; - }) - ]; - home-pc.outputs = [ - (mkScreen "Dell Inc. DELL P2720DC 22JPK53" // { position = "0,0"; }) - (mkScreen "Unknown HP Z27 CN482201RP" // { - position = "2560,0"; - scale = 1.5; - }) - ]; - }; - }; # TODO: Move these services elsewhere services.network-manager-applet.enable = true; - systemd.user.services.network-manager-applet = adhereTheSwayTarget; services.nextcloud-client.enable = true; - systemd.user.services.nextcloud-client = adhereTheSwayTarget // { - Service.ExecStart = - lib.mkForce "${pkgs.nextcloud-client}/bin/nextcloud --background"; - Unit.After = [ "waybar.service" ]; # For trayicon to work - }; # TODO: Test and upstream services.owncloud-client.enable = true; - systemd.user.services.owncloud-client = adhereTheSwayTarget // { - Unit.After = [ "waybar.service" ]; # For trayicon to work - }; services.pasystray.enable = true; + + systemd.user.services.network-manager-applet = adhereTheSwayTarget; + systemd.user.services.nextcloud-client = adhereTheSwayTarget // { + # For trayicon to work: + Unit.After = [ "waybar.service" ]; + Service = { + ExecStart = + lib.mkForce "${pkgs.nextcloud-client}/bin/nextcloud --background"; + ExecStartPre = "${pkgs.coreutils}/bin/sleep 3"; + Environment = lib.mkForce + "PATH=${homeManagerConfig.home.profileDirectory}/bin XDG_CURRENT_DESKTOP=Unity"; + }; + }; + systemd.user.services.owncloud-client = adhereTheSwayTarget // { + # For trayicon to work: + Unit.After = [ "waybar.service" ]; + Service = { + ExecStartPre = "${pkgs.coreutils}/bin/sleep 3"; + Environment = lib.mkForce + "PATH=${homeManagerConfig.home.profileDirectory}/bin XDG_CURRENT_DESKTOP=Unity"; + }; + }; systemd.user.services.pasystray = adhereTheSwayTarget; gtk = { @@ -217,61 +170,5 @@ }; dconf.settings = { "org/gnome/desktop/interface".menus-have-icons = true; }; - - xdg.mimeApps = rec { - enable = true; - associations.added = defaultApplications; - defaultApplications = let - browser = [ "firefox.desktop" ]; - email = [ "org.gnome.Evolution.desktop" ]; - doc-editor = [ "writer.desktop" ]; - sheet-editor = [ "calc.desktop" ]; - presentation-editor = [ "impress.desktop" ]; - pdf = [ "org.gnome.Evince.desktop " ]; - image = [ "org.gnome.eog.desktop" ]; - image-vector = [ "org.inkscape.Inkscape.desktop" ]; - ebooks = [ "calibre-ebook-viewer.desktop" ]; - code-general = [ "codium.desktop" ]; - video = [ "vlc.desktop" ]; - in { - "text/html" = browser; - "x-scheme-handler/http" = browser; - "x-scheme-handler/https" = browser; - "x-scheme-handler/chrome" = browser; - "application/xhtml+xml" = browser; - "application/x-extension-htm" = browser; - "application/x-extension-html" = browser; - "application/x-extension-shtml" = browser; - "application/x-extension-xhtml" = browser; - "application/x-extension-xht" = browser; - "x-scheme-handler/mailto" = email; - "x-scheme-handler/msteams" = [ "teams.desktop" ]; - - "application/vnd.openxmlformats-officedocument.wordprocessingml.document" = - doc-editor; - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" = - sheet-editor; - "application/vnd.openxmlformats-officedocument.presentationml.presentation" = - presentation-editor; - "application/vnd.oasis.opendocument.presentation" = presentation-editor; - "application/pdf" = pdf; - "application/x-extension-pdf" = pdf; - "application/epub+zip" = ebooks; - - "text/plain" = code-general; - "application/json" = code-general; - "text/markdown" = code-general; - - "image/png" = image; - "image/jpg" = image; - "image/jpeg" = image; - "image/x-tga" = image; - "image/tiff" = image; - "image/x-canon-cr2" = image; - "image/svg+xml" = image-vector; - - "video/mp4" = video; - }; - }; }; }