eww: Trim title of focused window
This commit is contained in:
parent
380909e5f9
commit
5ad22d8d7d
1 changed files with 8 additions and 3 deletions
|
@ -35,9 +35,14 @@ use ipc ipc-cmd
|
|||
def workspaces [] {
|
||||
let workspaces = (ipc-cmd "-t" "get_workspaces" | select id name focused urgent visible)
|
||||
let mode = (ipc-cmd "-t" "get_binding_state")
|
||||
let focused_title = ((ipc-cmd --raw "-t" "get_tree") | jaq -r '.. | (.nodes? // empty)[] | select(.focused) | {name}' | from json)
|
||||
|
||||
{ workspaces: $workspaces, mode: $mode.name, title: $focused_title.name }
|
||||
let focused_title_full = ((ipc-cmd --raw "-t" "get_tree") | jaq -r '.. | (.nodes? // empty)[] | select(.focused) | {name}' | from json).name
|
||||
mut focused_title = ($focused_title_full | str substring -g 0..150)
|
||||
|
||||
if ($focused_title_full | str length) > 150 {
|
||||
$focused_title = ($focused_title | append "..." | str join "")
|
||||
}
|
||||
|
||||
{ workspaces: $workspaces, mode: $mode.name, title: $focused_title }
|
||||
}
|
||||
|
||||
def main [] {
|
||||
|
|
Loading…
Reference in a new issue