Skip to content

Commit 9919243

Browse files
committed
feat(home/desktop): add wsNum field to workspaces, fix discord workspace
1 parent 36e6fe3 commit 9919243

File tree

4 files changed

+26
-14
lines changed

4 files changed

+26
-14
lines changed

home/gabe/shared.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ in {
3737
}
3838
{
3939
class = "discord|vesktop";
40-
ws = "chat";
40+
wsNum = 3;
4141
follow = false;
4242
}
4343
{

home/gabe/voyager.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@
5252
icon = "󰉋";
5353
}
5454
{
55-
name = "five";
55+
name = "music";
5656
number = 5;
57+
icon = "󰓇";
5758
}
5859
{
5960
name = "six";

modules/home-manager/desktop/wm/hyprland/rules.nix

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ in {
99
windowrulev2 = let
1010
inherit (lib) flatten optional;
1111

12-
mkWindowRule2 = opts@{ class, title, ws, ... }:
12+
mkWindowRule2 = opts@{ class, title, ws, wsNum, ... }:
1313
let
1414
wrapSel = type: sel: "${type}:(${sel})";
1515
sel = if opts.initialTitle != "" then
@@ -20,17 +20,20 @@ in {
2020
wrapSel "title" title
2121
else
2222
wrapSel "class" class;
23-
workspace = if ws == "*" then "unset" else "name:${ws}";
24-
in ([ ] # all the rules
25-
++ optional (ws != "") "workspace ${workspace},${sel}"
26-
++ optional (opts.float) "float,${sel}"
27-
++ optional (opts.tile) "tile,${sel}"
28-
++ optional (opts.fullscreen) "fullscreen,${sel}"
29-
++ optional (opts.psuedo) "psuedo,${sel}"
30-
++ optional (opts.pin) "pin,${sel}"
31-
++ optional (!opts.follow) "noinitialfocus,${sel}"
32-
++ optional (opts.maxSize != "") "maxsize ${opts.maxSize},${sel}"
33-
++ optional (opts.opacity != "") "opacity ${opts.opacity},${sel}");
23+
workspace = if (wsNum == null) then
24+
if ws == "*" then "unset" else "name:${ws}"
25+
else
26+
"${toString wsNum}";
27+
# all the rules
28+
in optional (workspace != "name:") "workspace ${workspace},${sel}"
29+
++ optional opts.float "float,${sel}"
30+
++ optional opts.tile "tile,${sel}"
31+
++ optional opts.fullscreen "fullscreen,${sel}"
32+
++ optional opts.psuedo "psuedo,${sel}"
33+
++ optional opts.pin "pin,${sel}"
34+
++ optional (!opts.follow) "noinitialfocus,${sel}"
35+
++ optional (opts.maxSize != "") "maxsize ${opts.maxSize},${sel}"
36+
++ optional (opts.opacity != "") "opacity ${opts.opacity},${sel}";
3437

3538
rules = flatten (map mkWindowRule2 cfg.wm.rules);
3639
in rules;

modules/home-manager/desktop/wm/rules.nix

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ in {
1818
type = bool;
1919
example = toString (!default);
2020
};
21+
mkInt = description:
22+
mkOption {
23+
inherit description;
24+
type = nullOr int;
25+
default = null;
26+
example = "1";
27+
};
2128
in mkOption {
2229
type = listOf (submodule {
2330
options = {
@@ -28,6 +35,7 @@ in {
2835

2936
# which workspace/desktop to send the window to
3037
ws = mkStr "Workspace to send window" "1";
38+
wsNum = mkInt "Workspace number to send window";
3139

3240
# window state
3341
float = mkBool "Float the window" false;

0 commit comments

Comments
 (0)