New backup 2025-03-11 21:45:06
This commit is contained in:
parent
65d9727ef6
commit
7399625f4f
3 changed files with 51 additions and 37 deletions
|
@ -18,20 +18,21 @@
|
|||
(windowtitle)
|
||||
(scratchpad :array scratchpadArray)))
|
||||
|
||||
(defpoll scratchpadArray :interval "5s"
|
||||
'scripts/bar/scratchpad')
|
||||
(defwidget scratchpad [array]
|
||||
(box :orientation "v"
|
||||
:space-evenly false
|
||||
:class "workspaces"
|
||||
(box :space-evenly false
|
||||
(for entry in array
|
||||
(button :tooltip "${entry.name}
|
||||
test"
|
||||
(image :path {entry.icon}
|
||||
:image-width 25
|
||||
:image-height 25)
|
||||
)))))
|
||||
;(deflisten scratchpadArray :initial "${[1]}"
|
||||
; 'scripts/bar/scratchpad')
|
||||
;(defwidget scratchpad [array]
|
||||
; (box :orientation "v"
|
||||
; :space-evenly false
|
||||
; :class "workspaces"
|
||||
; (box :space-evenly false
|
||||
; (for entry in array
|
||||
; (button :onclick 'swaymsg [con_id=${entry.win_id}] focus'
|
||||
; :tooltip "${entry.name}
|
||||
;${entry.title}"
|
||||
; (image :path {entry.icon}
|
||||
; :image-width 25
|
||||
; :image-height 25)
|
||||
; )))))
|
||||
; (image :path "/usr/share/icons/hicolor/scalable/apps/org.kde.dolphin.svg"
|
||||
; :image-width 25
|
||||
; :image-height 25)
|
||||
|
@ -62,6 +63,7 @@ test"
|
|||
(include "modules/bar/profile.yuck")
|
||||
(include "modules/bar/workspaces.yuck")
|
||||
(include "modules/bar/window_name.yuck")
|
||||
(include "modules/bar/scratchpad.yuck")
|
||||
|
||||
;centergroup
|
||||
(include "modules/bar/music.yuck")
|
||||
|
|
15
de/home/.config/eww/modules/bar/scratchpad.yuck
Normal file
15
de/home/.config/eww/modules/bar/scratchpad.yuck
Normal file
|
@ -0,0 +1,15 @@
|
|||
(deflisten scratchpadArray :initial "${[1]}"
|
||||
'scripts/bar/scratchpad')
|
||||
(defwidget scratchpad [array]
|
||||
(box :orientation "h"
|
||||
:space-evenly false
|
||||
:class "workspaces"
|
||||
; (box :space-evenly false
|
||||
(for entry in array
|
||||
(button :onclick 'swaymsg [con_id=${entry.win_id}] focus'
|
||||
:tooltip "${entry.name}
|
||||
${entry.title}"
|
||||
(image :path {entry.icon}
|
||||
:image-width 20
|
||||
:image-height 20)
|
||||
))))
|
|
@ -152,37 +152,27 @@ get_icon() {
|
|||
echo "$icon"
|
||||
}
|
||||
|
||||
id_fmt='%s'
|
||||
ws_fmt='%s'
|
||||
app_fmt='%-15.15s'
|
||||
title_fmt='%s'
|
||||
|
||||
applist_array=()
|
||||
applist=""
|
||||
shopt -s lastpipe
|
||||
swaymsg -t get_tree |
|
||||
# get list of windows as tab-separated columns
|
||||
jq -r "$jq_get_windows | $jq_windows_to_tsv" |
|
||||
column -s $'\t' -o $'\t' -t | while IFS=$'\t' read -r win_id ws_name app_name win_title pid; do
|
||||
function get_scratchpad() {
|
||||
applist_array=()
|
||||
applist=""
|
||||
shopt -s lastpipe
|
||||
swaymsg -t get_tree |
|
||||
# get list of windows as tab-separated columns
|
||||
jq -r "$jq_get_windows | $jq_windows_to_tsv" |
|
||||
column -s $'\t' -o $'\t' -t | while IFS=$'\t' read -r win_id ws_name app_name win_title pid; do
|
||||
shopt -s extglob
|
||||
app_name="${app_name%%*( )}"
|
||||
icon=$( get_icon "$app_name" "$pid" )
|
||||
[[ "$verbose" ]] && printf "[%s]=%s\n" "$app_name" "$icon" >&2
|
||||
# shellcheck disable=SC2059
|
||||
applist_array_item=$(jq -n --arg icon "${icon}" --arg name "${app_name##*.}" '{icon: $icon,name: $name}')
|
||||
applist_array_item=$(jq -n --arg icon "${icon}" --arg name "${app_name##*.}" --arg title "${win_title}" --arg win_id "${win_id}" '{icon: $icon,name: $name,title: $title,win_id: $win_id}')
|
||||
# echo "${applist_array_item}"
|
||||
applist_array+=("${applist_array_item}")
|
||||
# echo "${applist_array[@]}"
|
||||
applist=$(printf '%s\n' "${applist_array[@]}" | jq -s .)
|
||||
# echo ${applist}
|
||||
# jq -n --arg icon "${icon}" --arg name "${app_name##*.}" '{icon: $icon,name: $name}'
|
||||
# printf "img:$icon:text:${id_fmt}\t${app_fmt}\t${ws_fmt}\t${title_fmt}\n" \
|
||||
# "$win_id" \
|
||||
# "${app_name##*.}" \
|
||||
# "$ws_name" \
|
||||
# "$win_title"
|
||||
done
|
||||
echo ${applist}
|
||||
done
|
||||
applist=$(printf '%s\n' "${applist_array[@]}" | jq -s .)
|
||||
echo ${applist}
|
||||
}
|
||||
#echo "${applist_array[@]}"
|
||||
#printf '%s\n' "${applist_array[@]}"
|
||||
#echo "${applist_array[@]}"
|
||||
|
@ -190,3 +180,10 @@ echo ${applist}
|
|||
#echo ${applist}
|
||||
#sort -k3 -k2
|
||||
#wofi --cache-file=/dev/null --insensitive --allow-images --show dmenu --prompt='Focus a window'
|
||||
|
||||
get_scratchpad
|
||||
swaymsg -t subscribe '["window"]' --monitor | {
|
||||
while read -r event; do
|
||||
get_scratchpad
|
||||
done
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue