Skip to content

Commit 7c5b8db

Browse files
kajusnaubrianmcgillion
authored andcommitted
Desktop: Send windows to desktops
- Add keybind to send active window to next/prev desktop - Improve EWW error handling and logging - Remove 'click outside to close' desktop widget behavior Signed-off-by: Kajus Naujokaitis <kajus.naujokaitis@unikie.com>
1 parent cec3263 commit 7c5b8db

File tree

5 files changed

+58
-48
lines changed

5 files changed

+58
-48
lines changed

modules/desktop/graphics/ewwbar/config/scripts/default.nix

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ let
263263
)
264264
}
265265
catch halt
266-
'
266+
' || echo "{}"
267267
}
268268
269269
get_output() {
@@ -286,7 +286,7 @@ let
286286
}
287287
)
288288
catch halt
289-
'
289+
' || echo "{}"
290290
}
291291
292292
get_input() {
@@ -309,7 +309,7 @@ let
309309
}
310310
)
311311
catch halt
312-
'
312+
' || echo "{}"
313313
}
314314
315315
get_sink_inputs() {
@@ -326,7 +326,7 @@ let
326326
})
327327
]
328328
) catch halt
329-
'
329+
' || echo "[]"
330330
}
331331
332332
get_outputs() {
@@ -351,7 +351,7 @@ let
351351
}
352352
]
353353
) catch halt
354-
'
354+
' || echo "[]"
355355
}
356356
357357
get_inputs() {
@@ -371,11 +371,12 @@ let
371371
),
372372
state: (.state // ""),
373373
friendly_name: (.description // ""),
374+
is_muted: (.mute // false),
374375
device_type: (.active_port as $active_port | .ports[] | select(.name == $active_port).type // "")
375376
}
376377
]
377378
) catch halt
378-
'
379+
' || echo "[]"
379380
}
380381
381382
sinkInputs="[]"
@@ -565,18 +566,20 @@ let
565566
active_windows=$(${ewwCmd} active-windows)
566567
567568
if [[ "$active_windows" == *"$1"* ]]; then
568-
${ewwCmd} close "$1" closer &
569+
#${ewwCmd} close "$1" closer &
570+
${ewwCmd} close "$1" &
569571
exit 0
570572
fi
571573
572574
# Close all windows except the target
573575
for window in "''${windows[@]}"; do
574-
if [[ "$window" != "$1" ]]; then
576+
if [[ "$window" != "$1" && "$active_windows" == *"$window"* ]]; then
575577
${ewwCmd} close "$window" &
576578
fi
577579
done
578580
579-
${ewwCmd} open-many closer "$1" --arg screen="$2" --arg closer:window="$1"
581+
#${ewwCmd} open-many closer "$1" --arg screen="$2" --arg closer:window="$1"
582+
${ewwCmd} open "$1" --screen "$2"
580583
'';
581584
};
582585

modules/desktop/graphics/ewwbar/config/variables/default.nix

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ writeText "variables.yuck" ''
2323
(defpoll audio_streams :interval "60s" "echo []")
2424
(deflisten workspace :initial "1" "${ghaf-workspace}/bin/ghaf-workspace subscribe")
2525
26-
(defvar calendar_day "date '+%d'")
27-
(defvar calendar_month "date '+%-m'")
28-
(defvar calendar_year "date '+%Y'")
29-
3026
(defvar volume-popup-visible "false")
3127
(defvar brightness-popup-visible "false")
3228
(defvar workspace-popup-visible "false")

modules/desktop/graphics/ewwbar/config/widgets/default.nix

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ writeText "widgets.yuck" ''
3131
:space-evenly false
3232
(box
3333
:hexpand true
34-
:visible { header-left != "" ? "true" : "false" }
34+
:visible { header-left != "" }
3535
:orientation "h"
3636
:spacing 5
3737
:halign "fill"
3838
:space-evenly false
3939
(label :class "header"
40-
:visible { header-left != "" && header-left != "null" ? "true" : "false" }
40+
:visible { header-left != "" && header-left != "null" }
4141
:text header-left
4242
:halign "start")
4343
(eventbox
@@ -53,7 +53,7 @@ writeText "widgets.yuck" ''
5353
)
5454
)
5555
(label :class "header"
56-
:visible { header-right != "" && header-right != "null" ? "true" : "false" }
56+
:visible { header-right != "" && header-right != "null" }
5757
:text header-right
5858
:hexpand "true"
5959
:limit-width 35
@@ -64,7 +64,7 @@ writeText "widgets.yuck" ''
6464
:spacing 5
6565
:space-evenly false
6666
(eventbox
67-
:active { icon-onclick != "" && icon-onclick != "null" ? "true" : "false" }
67+
:active { icon-onclick != "" && icon-onclick != "null" }
6868
:visible {image != "" || icon != "" || app_icon != ""}
6969
:onclick icon-onclick
7070
:height 24
@@ -75,8 +75,7 @@ writeText "widgets.yuck" ''
7575
(image
7676
:class "icon"
7777
:visible { image == "" }
78-
:path {image ?: ""}
79-
:icon {icon != "" ? icon : app_icon != "" ? app_icon : "" }
78+
:icon {icon != "" ? icon : app_icon != "" ? app_icon : "icon-missing" }
8079
:image-height 24
8180
:image-width 24
8281
:style {app_icon != "" ? "opacity: ''${level == 0 || level == min ? "0.5" : "1"}" : ""}
@@ -94,7 +93,7 @@ writeText "widgets.yuck" ''
9493
:max 100
9594
:min { min ?: 0 }))
9695
(eventbox
97-
:visible { settings-onclick != "" && settings-onclick != "null" ? "true" : "false" }
96+
:visible { settings-onclick != "" && settings-onclick != "null" }
9897
:onclick settings-onclick
9998
:height 24
10099
:width 24
@@ -110,7 +109,7 @@ writeText "widgets.yuck" ''
110109
(box :orientation "v" :space-evenly "false" :spacing 0
111110
(box
112111
:hexpand true
113-
:visible { header-left != "" ? "true" : "false" }
112+
:visible { header-left != "" }
114113
:orientation "h"
115114
:spacing 5
116115
:halign "fill"
@@ -119,14 +118,14 @@ writeText "widgets.yuck" ''
119118
:halign "start"
120119
:hexpand true
121120
:active { header-onclick != "" && header-onclick != "null" }
122-
:visible { header-left != "" ? "true" : "false" }
121+
:visible { header-left != "" }
123122
:onclick header-onclick
124123
:height 24
125124
:width 24
126125
:class "default_button"
127126
(box :orientation "h" :space-evenly "false" :spacing 5 :halign "fill"
128127
(label :class "header"
129-
:visible { header-left != "" && header-left != "null" ? "true" : "false" }
128+
:visible { header-left != "" && header-left != "null" }
130129
:text header-left
131130
:halign "start")
132131
(image
@@ -136,7 +135,7 @@ writeText "widgets.yuck" ''
136135
)
137136
138137
(label :class "header"
139-
:visible { header-right != "" && header-right != "null" ? "true" : "false" }
138+
:visible { header-right != "" && header-right != "null" }
140139
:text header-right
141140
:hexpand "true"
142141
:limit-width 35
@@ -155,7 +154,7 @@ writeText "widgets.yuck" ''
155154
:spacing 5
156155
:space-evenly false
157156
(eventbox
158-
:active { icon-onclick != "" && icon-onclick != "null" ? "true" : "false" }
157+
:active { icon-onclick != "" && icon-onclick != "null" }
159158
:visible {image != "" || icon != "" || app_icon != ""}
160159
:onclick icon-onclick
161160
:height 24
@@ -166,8 +165,7 @@ writeText "widgets.yuck" ''
166165
(image
167166
:class "icon"
168167
:visible { image == "" }
169-
:path {image ?: ""}
170-
:icon {icon != "" ? icon : app_icon != "" ? app_icon : "" }
168+
:icon {icon != "" ? icon : app_icon != "" ? app_icon : "icon-missing" }
171169
:image-height 24
172170
:image-width 24
173171
:style {app_icon != "" ? "opacity: ''${level == 0 || level == min ? "0.5" : "1"}" : ""}
@@ -185,7 +183,7 @@ writeText "widgets.yuck" ''
185183
:max 100
186184
:min { min ?: 0 }))
187185
(eventbox
188-
:visible { settings-onclick != "" && settings-onclick != "null" ? "true" : "false" }
186+
:visible { settings-onclick != "" && settings-onclick != "null" }
189187
:onclick settings-onclick
190188
:height 24
191189
:width 24
@@ -206,6 +204,7 @@ writeText "widgets.yuck" ''
206204
:hexpand false
207205
:space-evenly false
208206
(slider_with_children
207+
:visible { audio_output != "" }
209208
:class "qs-slider"
210209
:header-left {audio_output.friendly_name =~ '.*sof-hda-dsp.*' ? "Built-in ''${audio_output.device_type}" :
211210
audio_output.friendly_name}
@@ -225,7 +224,7 @@ writeText "widgets.yuck" ''
225224
(volume_mixer :visible {arraylength(audio_streams) > 0})
226225
))
227226
(slider_with_children
228-
:visible { audio_input.state == "RUNNING" }
227+
:visible { audio_input != "" && audio_input.state == "RUNNING" }
229228
:class "qs-slider"
230229
:header-left {audio_input.friendly_name =~ '.*sof-hda-dsp.*' ? "Built-in ''${audio_input.device_type}" :
231230
audio_input.friendly_name }
@@ -238,6 +237,7 @@ writeText "widgets.yuck" ''
238237
:level { audio_input.is_muted == "true" ? "0" : audio_input.volume_percentage }
239238
:onchange "${ewwScripts.eww-audio}/bin/eww-audio set_source_volume ''${audio_input.device_index} {} &"
240239
(audio_input_selector)
240+
(label :text "Placeholder" :visible false)
241241
)
242242
243243
(slider
@@ -316,7 +316,7 @@ writeText "widgets.yuck" ''
316316
:class "qs-slider"
317317
:header-left {entry.name}
318318
:level {entry.muted == "true" ? "0" : entry.level}
319-
:app_icon {entry.icon_name != "" ? entry.icon_name : ""}
319+
:app_icon {entry.icon_name != "" ? entry.icon_name : "icon-missing"}
320320
:image { entry.muted == "true" || entry.level == 0 ? "${pkgs.ghaf-artwork}/icons/volume-0.svg" :
321321
entry.level <= 25 ? "${pkgs.ghaf-artwork}/icons/volume-1.svg" :
322322
entry.level <= 75 ? "${pkgs.ghaf-artwork}/icons/volume-2.svg" : "${pkgs.ghaf-artwork}/icons/volume-3.svg" }
@@ -336,7 +336,7 @@ writeText "widgets.yuck" ''
336336
:spacing 6
337337
:space-evenly false
338338
(label :class "header"
339-
:visible { header != "" && header != "null" ? "true" : "false" }
339+
:visible { header != "" && header != "null" }
340340
:text header
341341
:hexpand true
342342
:vexpand true
@@ -363,7 +363,7 @@ writeText "widgets.yuck" ''
363363
:halign "start"
364364
:hexpand true
365365
(label :halign "start" :class "title" :text title)
366-
(label :visible {subtitle != "" ? "true" : "false"} :halign "start" :class "subtitle" :text subtitle :limit-width 13))))))
366+
(label :visible {subtitle != ""} :halign "start" :class "subtitle" :text subtitle :limit-width 13))))))
367367
368368
;; Power Menu Buttons ;;
369369
(defwidget power_menu []
@@ -422,7 +422,7 @@ writeText "widgets.yuck" ''
422422
:space-evenly true
423423
:spacing 10
424424
(widget_button
425-
:visible { EWW_BATTERY != "" ? "true" : "false" }
425+
:visible { EWW_BATTERY != "" }
426426
:header "Battery"
427427
:title {EWW_BATTERY != "" ? "''${battery.capacity}%" : "100%"}
428428
:subtitle { battery.status == 'Charging' ? "Charging" :
@@ -503,17 +503,20 @@ writeText "widgets.yuck" ''
503503
:space-evenly "false"
504504
:spacing 14
505505
:valign "center"
506-
(image :class "icon"
506+
(image :visible { bright-icon != "" }
507+
:class "icon"
507508
:path bright-icon
508509
:image-height 24
509510
:image-width 24)
510-
(image :class "icon"
511+
(image :visible { vol-icon != "" && audio_output != "" }
512+
:class "icon"
511513
:path vol-icon
512514
:image-height 24
513515
:image-width 24)
514-
(image :visible { audio_input.state == "RUNNING" }
516+
(image :visible { audio_input != "" && audio_input.state == "RUNNING" }
515517
:icon "microphone-sensitivity-high")
516-
(image :class "icon"
518+
(image :visible { bat-icon != "" }
519+
:class "icon"
517520
:path bat-icon
518521
:image-height 24
519522
:image-width 24))))
@@ -587,10 +590,7 @@ writeText "widgets.yuck" ''
587590
(defwidget cal []
588591
(desktop-widget
589592
(calendar :class "cal"
590-
:show-week-numbers false
591-
:day calendar_day
592-
:month calendar_month
593-
:year calendar_year)))
593+
:show-week-numbers false)))
594594
595595
;; Left Widgets ;;
596596
(defwidget workspaces []

modules/desktop/graphics/ewwbar/config/windows/default.nix

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ writeText "windows.yuck" ''
1616
:height "28px"
1717
:width {width ?: "100%"}
1818
:anchor "top center")
19-
:focusable "false"
19+
:focusable "none"
2020
:hexpand "false"
2121
:vexpand "false"
2222
:stacking "fg"
@@ -28,15 +28,15 @@ writeText "windows.yuck" ''
2828
:geometry (geometry :y "0px"
2929
:x "0px"
3030
:anchor "top center")
31-
:stacking "fg"
31+
:stacking "overlay"
3232
(cal))
3333
3434
;; Power menu window ;;
3535
(defwindow power-menu
3636
:geometry (geometry :y "0px"
3737
:x "0px"
3838
:anchor "top right")
39-
:stacking "fg"
39+
:stacking "overlay"
4040
(power-menu-widget))
4141
4242
${lib.optionalString useGivc ''
@@ -46,7 +46,7 @@ writeText "windows.yuck" ''
4646
:x "0px"
4747
:width "360px"
4848
:anchor "top right")
49-
:stacking "fg"
49+
:stacking "overlay"
5050
(quick-settings-widget))
5151
5252
@@ -57,6 +57,7 @@ writeText "windows.yuck" ''
5757
:x "0px"
5858
:anchor "bottom center")
5959
:stacking "overlay"
60+
:focusable "none"
6061
(volume-popup))
6162
6263
;; Brightness Popup Window ;;
@@ -66,6 +67,7 @@ writeText "windows.yuck" ''
6667
:x "0px"
6768
:anchor "bottom center")
6869
:stacking "overlay"
70+
:focusable "none"
6971
(brightness-popup))
7072
7173
;; Workspace Popup Window ;;
@@ -75,13 +77,14 @@ writeText "windows.yuck" ''
7577
:x "0px"
7678
:anchor "bottom center")
7779
:stacking "overlay"
80+
:focusable "none"
7881
(workspace-popup))
7982
''}
8083
8184
;; Closer Window ;;
8285
(defwindow closer [window]
83-
:geometry (geometry :width "100%" :height "100%")
84-
:stacking "fg"
85-
:focusable false
86+
:geometry (geometry :width "300%" :height "300%")
87+
:stacking "overlay"
88+
:focusable "none"
8689
(closer :window window))
8790
''

modules/desktop/graphics/labwc.config.nix

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,14 @@ let
118118
<keybind key="W-A-Left">
119119
<action name="Execute" command="bash -c 'echo 1 > ~/.config/eww/workspace; ${ghaf-workspace}/bin/ghaf-workspace prev'" />
120120
</keybind>
121+
<keybind key="W-S-Right">
122+
<action name="SendToDesktop" to="right" follow="no" wrap="yes" />
123+
<action name="Execute" command="bash -c 'echo 1 > ~/.config/eww/workspace; ${ghaf-workspace}/bin/ghaf-workspace next'" />
124+
</keybind>
125+
<keybind key="W-S-Left">
126+
<action name="SendToDesktop" to="left" follow="no" wrap="yes" />
127+
<action name="Execute" command="bash -c 'echo 1 > ~/.config/eww/workspace; ${ghaf-workspace}/bin/ghaf-workspace prev'" />
128+
</keybind>
121129
<keybind key="W-l">
122130
<action name="Execute" command="${pkgs.systemd}/bin/loginctl lock-session" />
123131
</keybind>

0 commit comments

Comments
 (0)