diff --git a/send-to-kodi.sh b/send-to-kodi.sh index e40e422..81279eb 100755 --- a/send-to-kodi.sh +++ b/send-to-kodi.sh @@ -1,5 +1,7 @@ #!/bin/bash +# TODO replace `zenity` with `wofi` + # Required settings host=192.168.2.66 port=8080 diff --git a/sway/alacritty-bell.sh b/sway/alacritty-bell.sh new file mode 100755 index 0000000..37cdf65 --- /dev/null +++ b/sway/alacritty-bell.sh @@ -0,0 +1,2 @@ +#!/bin/bash +swaymsg "[pid=$(echo $ALACRITTY_LOG | sed -E 's/\/tmp\/Alacritty-(.*)\.log/\1/')] urgent enable" diff --git a/sway/alt-tab.py b/sway/alt-tab.py new file mode 100644 index 0000000..88bdfd7 --- /dev/null +++ b/sway/alt-tab.py @@ -0,0 +1,47 @@ +#!/bin/env python3 + +import subprocess +import json + + +def handle_container(con): + """ + Recursively find all windows + """ + + windows = [] + + if 'app_id' in con.keys(): + app_id = con['id'] + app_name = con['app_id'] if con['app_id'] else con['window_properties']['class'] + app_title = con['name'] + + windows.append((app_id, app_name, app_title,)) + + for child in con['nodes']: + windows = windows + handle_container(child) + + return windows + + +tree = json.loads(subprocess.check_output(['swaymsg', '-t', 'get_tree'])) +windows = [] + +# Find all workspaces and the windows in them +for output in tree['nodes']: + for workspace in output['nodes']: + if 'nodes' not in workspace.keys(): + continue + + for container in workspace['nodes']: + windows = windows + handle_container(container) + for container in workspace['floating_nodes']: + windows = windows + handle_container(container) + +# Format the list of windows for dmenu/rofi +windows_string = '\n'.join([f"<{app_id}> {app_name} --- {app_title}" for app_id, app_name, app_title in windows]) + +# Call rofi and move focus to the selected window +selection = subprocess.check_output(['wofi', '-s', '/home/jpm/.dotfiles/wofi/style.css', '-c', '/home/jpm/.dotfiles/wofi/sidebar', '-d'], input=windows_string, universal_newlines=True) +window_id = selection.split(' ')[0][1:-1] +subprocess.call(['swaymsg', f"[con_id=\"{window_id}\"]", 'focus']) diff --git a/sway/hud.sh b/sway/hud.sh new file mode 100755 index 0000000..2b393b3 --- /dev/null +++ b/sway/hud.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +flatpak run com.github.Eloston.UngoogledChromium --app="https://papillon.john.me.tz/hud.php?theme=dark&refresh=3600" + diff --git a/sway/idle.sh b/sway/idle.sh index c93e922..e11e571 100755 --- a/sway/idle.sh +++ b/sway/idle.sh @@ -1,50 +1,76 @@ #!/bin/bash -BLFILE="/home/jpm/.config/blc.last" -OPFILE="/home/jpm/.config/active_outputs" +BLFILE="/home/jpm/.spool/idle.dim" +OPFILE="/home/jpm/.spool/active_outputs" + +FADE_TIMEOUT=60 # one minute +DIM_TIMEOUT=120 # two minutes +LOCK_TIMEOUT=300 # five minutes +DPMS_TIMEOUT=600 # ten minutes +SUSPEND_TIMEOUT=3600 # one hour + +function usage() +{ + echo "usage: $0