balta2ar / brotab

Control your browser's tabs from the command line
MIT License
389 stars 27 forks source link

Display windowing system window ID in output of windows command #84

Open taladar opened 1 year ago

taladar commented 1 year ago

To identify which window in e.g. wmctrl is which window in brotab it would be useful if brotab could display the window id by the windowing system for each window, not just its own internal id.

This would a script to e.g. open new tabs in the Firefox window on workspace x specifically and not just in the one last focussed.

bjohas commented 1 year ago

I would be interested in this too.

slastra commented 10 months ago
#!/bin/bash
# Activate tab,  window, and workspace 

sep="␞"
tabs=`bt list | awk -v sep="$sep" -F "\t" '{print $2 sep $1}'`
tabs=`echo -e "New Window\n$tabs" `
selected=`echo "$tabs" \
| rofi -dmenu -i -select "$active_window" -p ""  -display-columns 1 -display-column-separator $sep -theme ~/.config/rofi/combi.rasi\
| head -1 `
if [ "$selected" ]; then
    if [ "$selected" == "New Window" ]; then
        brave
        exit 0
    fi
    tab_id=`echo $selected | awk -F $sep '{print $2}'`
    echo $tab_id
    bt activate $tab_id
    bt_window_id=`echo $tab_id | cut -d'.' -f2`
    active_tab_id=`bt active | grep $bt_window_id |cut -f1`
    window_name=`echo "$tabs" | grep $active_tab_id | awk -F $sep '{print $1}'`
    window_id=`wmctrl -l | grep "$window_name" | cut -f1`
    wmctrl -i -a $window_id
fi