From 03afe6c90afd60a5712bf28721a97103be9d4435 Mon Sep 17 00:00:00 2001 From: Alexander Bantyev Date: Tue, 12 May 2020 20:59:15 +0300 Subject: [PATCH] Switch to home-manager configs for sway and mako --- modules/applications/sylpheed.nix | 2 +- modules/applications/weechat.nix | 2 +- modules/default.nix | 2 +- modules/workspace/i3/workspace-layouts.pl | 54 ---------------------- modules/workspace/i3blocks/default.nix | 2 +- modules/workspace/mako.nix | 14 +++++- modules/workspace/rclone.nix | 2 +- modules/workspace/{i3 => sway}/default.nix | 9 ++-- 8 files changed, 24 insertions(+), 63 deletions(-) delete mode 100755 modules/workspace/i3/workspace-layouts.pl rename modules/workspace/{i3 => sway}/default.nix (97%) diff --git a/modules/applications/sylpheed.nix b/modules/applications/sylpheed.nix index b00b539..0d9d43f 100644 --- a/modules/applications/sylpheed.nix +++ b/modules/applications/sylpheed.nix @@ -1,7 +1,7 @@ { pkgs, config, ... }: { home-manager.users.balsoft = { home.packages = [ pkgs.sylpheed ]; - xsession.windowManager.i3.config.startup = [ + wayland.windowManager.sway.config.startup = [ { command = "${pkgs.sylpheed}/bin/sylpheed"; } diff --git a/modules/applications/weechat.nix b/modules/applications/weechat.nix index be8262d..0ffa2dc 100644 --- a/modules/applications/weechat.nix +++ b/modules/applications/weechat.nix @@ -804,7 +804,7 @@ in { ''; home.packages = [ weechat ]; - xsession.windowManager.i3.config.startup = [{ + wayland.windowManager.sway.config.startup = [{ command = "${config.defaultApplications.term.cmd} -e ${weechat}/bin/weechat"; }]; diff --git a/modules/default.nix b/modules/default.nix index 50f5b85..265eb22 100755 --- a/modules/default.nix +++ b/modules/default.nix @@ -10,7 +10,7 @@ device: ./applications/yt-utilities.nix ./applications/firefox.nix ./workspace/autofs.nix - ./workspace/i3 + ./workspace/sway ./workspace/i3blocks ./workspace/zsh.nix ./workspace/gtk.nix diff --git a/modules/workspace/i3/workspace-layouts.pl b/modules/workspace/i3/workspace-layouts.pl deleted file mode 100755 index 45a59f5..0000000 --- a/modules/workspace/i3/workspace-layouts.pl +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env nix-shell -#!nix-shell -p perlPackages.AnyEvent perlPackages.AnyEventI3 perl -i perl -# vim:ts=4:sw=4:expandtab -# © 2012 Michael Stapelberg -# Licensed under BSD license, see https://github.com/i3/i3/blob/next/LICENSE -# -# Append this line to your i3 config file: -# exec_always ~/per-workspace-layout.pl -# -# Then, change the %layouts hash like you want your workspaces to be set up. -# This script requires i3 >= v4.4 for the extended workspace event. - -use strict; -use warnings; -use AnyEvent; -use AnyEvent::I3; -use v5.10; -use utf8; - -my %layouts = ( - '' => 'tabbed', - '' => 'tabbed', -); - -my $i3 = i3(); - -die "Could not connect to i3: $!" unless $i3->connect->recv(); - -die "Could not subscribe to the workspace event: $!" unless - $i3->subscribe({ - workspace => sub { - my ($msg) = @_; - return unless $msg->{change} eq 'focus'; - die "Your version of i3 is too old. You need >= v4.4" - unless exists($msg->{current}); - my $ws = $msg->{current}; - - my $name = $ws->{name}; - my $con_id = $ws->{id}; - - return unless exists $layouts{$name}; - - $i3->command(qq|[con_id="$con_id"] layout | . $layouts{$name}); - }, - _error => sub { - my ($msg) = @_; - say "AnyEvent::I3 error: $msg"; - say "Exiting."; - exit 1; - }, - })->recv->{success}; - -# Run forever. -AnyEvent->condvar->recv diff --git a/modules/workspace/i3blocks/default.nix b/modules/workspace/i3blocks/default.nix index 511dcb1..68b615a 100644 --- a/modules/workspace/i3blocks/default.nix +++ b/modules/workspace/i3blocks/default.nix @@ -3,7 +3,7 @@ with import ../../../support.nix { inherit pkgs config lib; }; with lib; let scripts = import ./scripts pkgs config; in { - home-manager.users.balsoft.xsession.windowManager.i3.extraConfig = '' + home-manager.users.balsoft.wayland.windowManager.sway.extraConfig = '' bar { id top font pango:Material Icons 11, Roboto Mono 11 diff --git a/modules/workspace/mako.nix b/modules/workspace/mako.nix index 28372c2..f1f24a5 100644 --- a/modules/workspace/mako.nix +++ b/modules/workspace/mako.nix @@ -1,4 +1,16 @@ { pkgs, config, ...}: { - home-manager.users.balsoft.xsession.windowManager.i3.config.startup = [ { command = "${pkgs.mako}/bin/mako --layer overlay --font 'Roboto 13' --width 500 --height 80 --default-timeout 10000 --max-visible 10 --background-color '${config.themes.colors.bg}' --text-color '${config.themes.colors.fg}' --border-color '${config.themes.colors.blue}'"; } ]; + home-manager.users.balsoft.programs.mako = { + enable = true; + layer = "overlay"; + font = "Roboto 13"; + width = 500; + height = 80; + defaultTimeout = 10000; + maxVisible = 10; + backgroundColor = config.themes.colors.bg; + textColor = config.themes.colors.fg; + borderColor = config.themes.colors.blue; + progressColor = "over ${config.themes.colors.green}"; + }; } diff --git a/modules/workspace/rclone.nix b/modules/workspace/rclone.nix index 1c1fa51..b3b7e1e 100644 --- a/modules/workspace/rclone.nix +++ b/modules/workspace/rclone.nix @@ -13,7 +13,7 @@ mkdir -p 'Dropbox' || true ''; }; - xsession.windowManager.i3.config.startup = [ + wayland.windowManager.sway.config.startup = [ { command = "${pkgs.rclone}/bin/rclone mount google:/ '/home/balsoft/cloud/Google Drive' --daemon"; diff --git a/modules/workspace/i3/default.nix b/modules/workspace/sway/default.nix similarity index 97% rename from modules/workspace/i3/default.nix rename to modules/workspace/sway/default.nix index 44b8965..68088ee 100755 --- a/modules/workspace/i3/default.nix +++ b/modules/workspace/sway/default.nix @@ -7,9 +7,8 @@ let in { environment.sessionVariables._JAVA_AWT_WM_NONREPARENTING = "1"; - home-manager.users.balsoft.xsession.windowManager.i3 = { + home-manager.users.balsoft.wayland.windowManager.sway = { enable = true; - package = pkgs.i3-gaps; config = rec { assigns = { "" = [ { class = "Chromium"; } { app_id = "firefox"; } { class = "Firefox"; } ]; @@ -69,7 +68,7 @@ in { } ]; }; - startup = map (a: { notification = false; } // a) [ + startup = [ { command = apps.browser.cmd; } { command = "${pkgs.kdeconnect}/libexec/kdeconnectd"; } { @@ -190,6 +189,10 @@ in { "121" = "exec ${pkgs.pamixer}/bin/pamixer -t"; }; workspaceLayout = "tabbed"; + workspaceAutoBackAndForth = true; + }; + wrapperFeatures = { + gtk = true; }; extraConfig = '' output * bg ${thm.bg} solid_color