Sway: Difference between revisions

RafTeog (talk | contribs)
Onny (talk | contribs)
Add wl-togglescreens script
Line 192: Line 192:
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
hardware.opengl.enable = true;
hardware.opengl.enable = true;
</syntaxhighlight>
== Tips and tricks ==
=== Toggle monitor modes script ===
Following script toggles screen / monitor modes if executed. It can also be mapped to a specific key in Sway.
First add the Flake input required for the script<syntaxhighlight lang="nix">
{
  inputs = {
    [...]
    wl-togglescreens.url = "git+https://git.project-insanity.org/onny/wl-togglescreens.git?ref=main";
  };
  outputs = {self, nixpkgs, ...}@inputs: {
    nixosConfigurations.myhost = inputs.nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      specialArgs.inputs = inputs;
      [...]
</syntaxhighlight>Map the script binary to a specific key<syntaxhighlight lang="nix">
{ config, pkgs, lib, inputs, ... }:{
  home-manager.users.onny = {
    programs = {
      [...]
      wayland.windowManager.sway = {
        enable = true;
        config = {
          [...]
          keybindings = lib.mkOptionDefault{
            [...]
            "XF86Display" = "exec ${inputs.wl-togglescreens.packages.x86_64-linux.wl-togglescreens}/bin/wl-togglescreens";
          };
        };
      };
    };
</syntaxhighlight>
</syntaxhighlight>
[[Category:Window managers]]
[[Category:Window managers]]
[[Category:Applications]]
[[Category:Applications]]