diff --git a/home/macbook-nixos.nix b/home/macbook-nixos.nix index 5e9cdaa..88f1807 100644 --- a/home/macbook-nixos.nix +++ b/home/macbook-nixos.nix @@ -1,7 +1,17 @@ { pkgs, config, lib, ... }: let - discord = pkgs.armcord; + discord = pkgs.armcord.overrideAttrs (attrs: { + postInstall = '' + # Wrap the startup command + makeWrapper $out/opt/ArmCord/armcord $out/bin/armcord \ + "''${gappsWrapperArgs[@]}" \ + --prefix XDG_DATA_DIRS : "${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}/" \ + --add-flags "--ozone-platform=wayland --enable-features=UseOzonePlatform --enable-features=WebRTCPipeWireCapturer" \ + --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath attrs.buildInputs}" \ + --suffix PATH : ${lib.makeBinPath [ pkgs.xdg-utils ]} + ''; + }); in { imports = [ diff --git a/home/modules/programs/my-sway/default.nix b/home/modules/programs/my-sway/default.nix index 0f18a9e..58e871e 100644 --- a/home/modules/programs/my-sway/default.nix +++ b/home/modules/programs/my-sway/default.nix @@ -203,6 +203,7 @@ in "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'"; # Launcher "${mod}+space" = "exec rofi -show drun"; + "${mod}+tab" = "exec ${./rofi-window.py}"; } // { ## Splits "${mod}+v" = "split v"; @@ -325,6 +326,11 @@ in (if cfg.enableLaptopBars then '' # Lock screen on lid close bindswitch lid:off exec ${cfg.lockCmd} + + # Gesture bindings + bindgesture swipe:3:right workspace prev + bindgesture swipe:3:left workspace next + bindgesture swipe:3:up exec ${./rofi-window.py} '' else "") + '' ## swayfx stuff # Rounded corners diff --git a/home/modules/programs/my-sway/rofi-window.py b/home/modules/programs/my-sway/rofi-window.py new file mode 100755 index 0000000..bb103e4 --- /dev/null +++ b/home/modules/programs/my-sway/rofi-window.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 + +import subprocess +import json + +treeP = subprocess.run(["swaymsg", "-t", "get_tree"], stdout=subprocess.PIPE, text=True, check=True) + +tree = json.loads(treeP.stdout) + +def get_instance(node): + if 'app_id' in node and node['app_id'] != None: + return node['app_id'] + elif 'window_properties' in node: + return node['window_properties']['class'] + return "??" + +def get_apps(node): + if 'pid' in node: + return [("[%s] %s"%(get_instance(node), node['name']), node['pid'])] + else: + return (app for n in node['nodes'] for app in get_apps(n)) + +apps = dict(get_apps(tree)) + +keys = '\n'.join(apps.keys()) + +rofi = subprocess.run(["rofi", "-dmenu", "-i", "-p", "Switch to Window"], stdout=subprocess.PIPE, text=True, check=True, input=keys) + +selected = rofi.stdout.strip() + +if selected in apps: + subprocess.run(["swaymsg", "[pid = %d]" % apps[selected], "focus"], check=True)