Commit graph

87 commits

Author SHA1 Message Date
novenary e3582e5151 sway: unfail units before starting session target
Sometimes services can fail. Failed services will generally not be
restarted by systemd. To start previously failed services we can
just reset their failed state before starting our session target.

GNOME and Plasma do the same thing.

See: https://github.com/alebastr/sway-systemd/pull/11
2024-07-05 17:10:02 +03:00
novenary b7b55e285c sway: stop sway-session.target on exit
This ensures graphical-session.target is properly cycled, and that all
of its members are restarted on consecutive runs.
2024-07-05 17:10:02 +03:00
sg-qwt 269cc18d94
sway: fix systemd variables example 2024-07-04 03:43:38 +08:00
Andrew Marshall 3a435342e2
sway: check config file validity
Helps avoid successful build but Sway failing to start.

To meaningfully test this, I had to actually use `pkgs.sway` in the
test rather than the stub, but left all other tests using the stub and
changed them to skipping the test.

We need to pass `--unsupported-gpu` as Sway checks for `nvidia` in
`/proc/modules`, and the Nix sandbox has `/proc/modules` available.
2024-04-19 23:16:55 +02:00
Andrew Marshall 95888b153c
sway: writeText -> writeTextFile
The latter is more flexible and shall be used soon, splitting this
change out for simpler diff later.
2024-04-19 23:11:30 +02:00
Ivan Leshchenko 31c77dcc2e
sway: systemd customization 2024-04-19 17:15:54 +02:00
Sebastian Sellmeier 8d9fde0fba
i3/sway: remove sebtm maintainer 2024-03-06 14:26:46 +01:00
Emily 4c0357ff87
sway: fix workspace 10 missing from default config (#4636)
workspace 10 is part of upstream's default config, but was missing in home-manager.

The initial "sway: add module" PR (02d6040003) went through multiple iterations and had workspace 10 included for a brief moment.
Until the author removed it in a force-push commenting

> Have removed the last change which added bound ${modifer}+0 to workspace number 10 as this messed up workspace numbering in sway.

The reason might have been, that sway used to sort the workspaces in the order they appeared in the config.

Attribute sets in nix are sorted, but not "naturally sorted", meaning `bindsym Mod1+0 workspace number 10` comes before `bindsym Mod1+0 workspace number 1`.

It's unclear if that's what really happened. A workaround would have been to use `lib.lists.naturalSort` in `keybindingsStr`.

But I cannot reproduce this anymore in any way.
I assume this has been fixed many years ago by now.

upstream config: 020a572ed6/config.in (L113-L134)
2024-02-10 19:59:52 +01:00
Jared Baur d9c869681d
sway: include cursor environment variables
DBus activated services such as mako use the XCURSOR_THEME and
XCURSOR_SIZE environment variables to decide how to show the cursor,
so without these, the cursor may not match the rest of the desktop
when hovering over (in this example) mako notification surfaces.
2024-01-18 00:30:06 +01:00
Sefa Eyeoglu e0c70942c0
programs.sway: separate trayOutput values for sway (#4489)
Fixes nix-community/home-manager#4488

The default config for sway generates a bar block with tray_output primary. But wayland (or sway, take your pick?) has no concept of a primary display so this just results in no tray anywhere.

A better default is "*" which puts the tray on every monitor, since sway can do so without issue.

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2023-09-23 20:53:45 +02:00
Emily 9f9e277b60 treewide: remove now-redundant lib.mdDoc calls
These (and the `*MD` functions apart from `literalMD`) are now no-ops
in nixpkgs and serve no purpose other than to add additional noise and
potentially mislead people into thinking unmarked DocBook documentation
will still be accepted.

Note that if backporting changes including documentation to 23.05,
the `mdDoc` calls will need to be re-added.

To reproduce this commit, run:

    $ NIX_PATH=nixpkgs=flake:nixpkgs/e7e69199f0372364a6106a1e735f68604f4c5a25 \
      nix shell nixpkgs#coreutils \
      -c find . -name '*.nix' \
      -exec nix run -- github:emilazy/nix-doc-munge/98dadf1f77351c2ba5dcb709a2a171d655f15099 \
      --strip {} +
    $ ./format
2023-07-17 18:49:09 +01:00
Emily 36a53d9f26 treewide: convert all option docs to Markdown
This process was automated by [my fork of `nix-doc-munge`]. All
conversions were automatically checked to produce the same DocBook
result when converted back, modulo minor typographical/formatting
differences on the acceptable-to-desirable spectrum.

To reproduce this commit, run:

  $ NIX_PATH=nixpkgs=flake:nixpkgs/e7e69199f0372364a6106a1e735f68604f4c5a25 \
    nix shell nixpkgs#coreutils \
    -c find . -name '*.nix' \
    -exec nix run -- github:emilazy/nix-doc-munge/98dadf1f77351c2ba5dcb709a2a171d655f15099 \
    {} +
  $ ./format

[my fork of `nix-doc-munge`]: https://github.com/emilazy/nix-doc-munge/tree/home-manager
2023-07-17 18:40:56 +01:00
Emily c1d8d2a3d1 treewide: adjust some DocBook for conversion
The NixOS variant of Markdown doesn't make a distinction between
`<code>` and `<literal>` or `<quote>` and... quotes, and doesn't
support `<parameter>` or `<replaceable>`. These are infrequently used
(apart from `<code>`) and don't add much, so just convert them to
simpler forms to allow the options containing them to be converted
to Markdown automatically.

A few minor syntactic adjustments were also made to make
`nix-doc-munge`'s job easier.
2023-07-17 16:49:35 +01:00
Emily e04de5b308 treewide: mkPackageOption -> mkPackageOptionMD 2023-07-17 16:49:35 +01:00
Emily 21c700d14b treewide: convert options with lists to Markdown
`nix-doc-munge` can't handle these, which is understandable as I can
barely handle them either. There are a few infelicities here: the
current processor can't handle multiple terms to one description in
a description list so they get comma-separated in one case, and one
case that should ideally render as a `<figure>` with a `<figcaption>`
in HTML is reduced to a paragraph with some `<strong>` text. (Which, in
fairness, is how it rendered in practice with the DocBook anyway.) The
docs generator has since been updated to handle figures, but we can't
use it until moving off DocBook output.
2023-07-17 16:49:35 +01:00
Naïm Favier c1cdce3d89
i3-sway: allow arbitrary floating modifier (#4229)
The floating modifier can consist of a combination of modifier keys.
Trying to model this with a regex doesn't seem worth it, so just use
`str`.
2023-07-14 21:26:09 +02:00
Sven Friedrich f63b39a67d
i3-sway: multiple outputs (#4223)
multiple outputs can be assigned to a workspace
2023-07-14 21:25:55 +02:00
Anton Mosich b23c7501f7
i3: remove deprecated example in i3.config.startup (#4201)
Deprecated in cacb8d4, see #265
2023-07-05 12:23:31 +02:00
Sefa Eyeoglu 0144ac418e
sway: add support for XDG autostart using systemd (#3747)
* sway: add support for XDG autostart using systemd

Using the option wayland.windowManager.sway.systemd.xdgAutostart, users
can now choose to start applications present in
$XDG_CONFIG_HOME/autostart when starting their sway session.

This change also renames wayland.windowManager.sway.systemdIntegration
to wayland.windowManager.sway.systemd.enable;

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>

* sway: add Scrumplex to maintainers

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>

---------

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2023-06-10 12:10:40 +02:00
Naïm Favier 607d8fad96
i3-sway: quote output names (#4059)
They can contain spaces.
2023-06-04 15:23:23 +02:00
Naïm Favier 2f6a917ade
i3-sway: fix indentation of bar blocks (#3978)
The `indent` function unindents the first and last line by default, so
the `"bar {"` `"}"` wrapper should go inside the list.
2023-05-11 14:04:29 +02:00
Bernardo Meurer a5a294a622
sway: import NIXOS_OZONE_WL into systemd
Without this, even if you configure a preference for Electron apps to
use Ozone by setting `NIXOS_OZONE_WL=1`, GUI apps launched through
systemd user services use XWayland, since the variable is not set in
their environment.

This fixes that issue by importing it, like we do other variables.
2023-04-23 20:10:16 +02:00
Basti 68eaf4b577
i3-sway: add option trayPadding (tray_padding) for bars (#3829) 2023-04-16 17:34:29 -06:00
arcnmx d633afe0d9
i3-sway: config.focus.wrapping deprecates forceWrapping (#3467)
Stop using the legacy syntax described in the i3 documentation:
https://i3wm.org/docs/userguide.html#_focus_wrapping
2023-01-15 19:20:13 +01:00
stephaneyfx 950aace44e
i3: Do not set i3 package (#3585)
Resolves https://github.com/nix-community/home-manager/issues/3584
2023-01-10 09:57:38 +01:00
Gaétan Lepage 684bdb386c
i3: remove i3/i3-gaps distinction (#3563) 2023-01-08 22:05:36 +01:00
Martin Weinelt d01e7280ad
i3-sway: Use foot as default terminal on sway (#3490) 2023-01-03 19:26:08 +01:00
leifhelm 079a33a015
i3: Fix escaping in documentation
In nix `${` is escaped like this `''${` and not like this `\${`
2022-12-29 17:41:04 +01:00
Mario Rodas b5c083300b
treewide: fix typos 2022-12-05 12:58:02 +01:00
Guillaume Girol c5adf29545
i3: fix reloading when there are several sockets
This can happen after logout/login.

Fixes #527
2022-11-06 00:41:10 +01:00
polykernel 2464c21ab2
sway: import XDG_SESSION_TYPE in systemd user environment (#3328)
- The `XDG_SESSION_TYPE` environment variable is used by some applications and frameworks to
  detect wayland sessions (i.e qt5/6, electron/chromium). It is set by wlroots since version 0.13.0 [1].

- Propagating `XDG_SESSION_TYPE` to the systemd user environment is necessary when processes launched by
  services (e.g emacs) need to inherit the environment variable.

[1] - 90c8452959
2022-10-31 13:09:06 +01:00
Matthew Toohey d89bdff445
sway, bspwm: add extraConfigEarly (#2847) 2022-08-27 00:09:46 -04:00
Robert Helgesson 76fbb1b15e
treewide: replace <link> by <xref> where appropriate 2022-08-26 00:07:08 +02:00
Pedro Lara Campos c5b4177bda
i3-sway: allow "container" and "output" in focus.mouseWarping (#3154)
Allow specifying which kind of mouseWarping to use since sway
supports `mouse_warping output|container|none`.
2022-08-25 15:02:04 -04:00
oxalica 25a9948361
sway: import dbus env vars and explicitly specify them (#3031)
- Importing all environment variables is considered deprecated for
  `systemdctl import-environment`. The list of variables are picked
  from:
  https://github.com/swaywm/sway/wiki/Systemd-integration#managing-user-applications-with-systemd

  The `XDG_CURRENT_DESKTOP` is said to be required for portals, see:
  https://github.com/nix-community/home-manager/pull/2385#issuecomment-1026454162

- DBus activation environment should also be updated. Otherwise, DBus
  activated programs, without a coresponding systemd service, cannot get a
  correct environment and would fail, eg. `mako`.
2022-07-07 11:03:58 -06:00
mgurlitz 538343be86
Make sway onChange script use cfg.package if set (#2937) 2022-05-05 21:29:20 -04:00
Nathan Typanski 6f025b3825
i3-sway: only return current user's socket (#2914)
Constrain the pgrep command to only return results for the current user.
Additionally, quote the socket variables to prevent splitting.

Previously, if multiple users on a system were running `sway`, the
`pgrep` used in finding `swaySocket` would return multiple results. As a
result, reloads of sway would fail.

Fixes #2912.
2022-04-24 23:38:50 +02:00
Sumner Evans f911ebbec9
lib.booleans: add yesNo function (#2818)
Closes #2772
2022-04-07 22:36:13 -06:00
stephaneyfx 48a1584d8b
i3-sway: Empty set argument was passed to wrong function (#2819)
This would give the error "attempt to call something which is not a
function but a list" given that `optionals a b` returns a list. `indent`
is the one taking this empty set as second argument.
2022-03-22 14:04:28 -06:00
Basti 80b4360678
i3/sway: improve i3.nix to handle options as list like in sway, adjusted functions for less new-lines (#2314)
* i3/sway: Improve code to generate config to avoid new-line issues on code/config changes

* Maintainer: Add SebTM as maintainer
2022-03-21 16:52:57 -06:00
Riley Inman c859a5265a
sway: add tray.target 2022-02-17 22:48:14 +01:00
Robert Helgesson 192675b149
docs: fix a few stray periods 2022-01-25 00:10:25 +01:00
Robert Helgesson 0b197562ab
treewide: use remove when possible
See https://github.com/nix-community/home-manager/pull/2566.
2021-12-27 09:03:18 +01:00
Sumner Evans 42ba7b6304
sway: add 'xwayland disable' to sway config if disabled (#2568)
Closes #2567
2021-12-16 01:56:02 -07:00
polykernel 15ae861e1b
swaynag: add module
Swaynag is a replacement of i3-nag for sway. Swaynag is embedded in
Sway's build process albeit it is not an integral part of Sway,
therefore it has been added under `wayland.windowManager.sway` instead
of `programs`. It can be moved at a later time if necessary.

Two unit tests were added validate the module behavior for an empty
configuration and the example configuration.
2021-11-21 18:37:50 +01:00
Naïm Favier bd11e2c5e6
Replace usage of literalExample
Instead use the new function `literalExpression`. See

  https://github.com/NixOS/nixpkgs/pull/136909
2021-10-13 00:16:10 +02:00
Nicolas Berbiche c5b3069145
i3/sway: allow empty criterias using a value of 'true' (#2277)
Co-authored-by: Sumner Evans <me@sumnerevans.com>
2021-08-21 20:41:06 -04:00
Ivan Kovnatsky a5c609b4b1
sway: workspaceLayout: stacked -> stacking (#2272) 2021-08-17 22:58:03 -04:00
Naïm Favier 5569770d1e
files: move dry run logic out of onChange hooks
Fixes #751
2021-08-17 22:14:32 +02:00
Robert Helgesson 5f433eb164
Move platform check into modules
Before, loading a module would be guarded by an optional platform
condition. This made it possible to avoid loading and evaluating a
module if it did not support the host platform.

Unfortunately, this made it impossible to share a single configuration
between GNU/Linux and Darwin hosts, which some wish to do.

This removes the conditional load and instead inserts host platform
assertions in the modules that are platform specific.

Fixes #1906
2021-07-18 20:43:22 +02:00