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/displays.pl b/sway/displays.pl index f9051f0..7e2dfd2 100755 --- a/sway/displays.pl +++ b/sway/displays.pl @@ -49,7 +49,7 @@ my $active_outputs = "$ENV{'HOME'}/.spool/active_outputs"; # You can get the model from (quoted with *): # $ swaymsg -t get_outputs --raw my %outputs = ( - 'LG TV SSCR2' => 'TV', + 'DENON-AVAMP' => 'TV', 'Paperlike253' => 'eInk', '0x4140' => 'yoga' ); 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/startsway.sh b/sway/startsway.sh index 9416297..216282c 100755 --- a/sway/startsway.sh +++ b/sway/startsway.sh @@ -1,8 +1,31 @@ #!/bin/bash rm $HOME/.swaylog echo sway > $HOME/.spool/last_login_gui +<<<<<<< HEAD +export SSH_AUTH_SOCK=~/.ssh/ssh-agent.sock +export SWAYSOCK="$HOME/.spool/sway-ipc.sock" +export QT_QPA_PLATFORM="wayland-egl;wayland;xcb" +export QT_QPA_PLATFORMTHEME=qt5ct +export QML_IMPORT_PATH="/usr/lib/qt/qml" +export QT_PLUGIN_PATH="/usr/lib/qt/plugins" +export QML2_IMPORT_PATH="/usr/lib/qt/qml" +export SDL_VIDEODRIVER="wayland" +export MOZ_ENABLE_WAYLAND="1" +export MOZ_WEBRENDER="1" +export XDG_SESSION_TYPE="wayland" +export XDG_CURRENT_DESKTOP="sway" +export XDG_CONFIG_HOME="${HOME}/.config" +export XDG_DATA_DIRS="$XDG_DATA_DIRS:${HOME}/.config/flatpak/exports/share" +export CHROME_EXECUTABLE="/usr/bin/chromium" +export FLATPAK_IDE_LOG_LEVEL="0" +export "$( gnome-keyring-daemon --start )" + +#WLR_RENDERER=vulkan sway --debug 2>> $HOME/.swaylog >> $HOME/.swaylog +WLR_RENDERER=gles2 sway --debug 2>> $HOME/.swaylog >> $HOME/.swaylog; export SWAYSOCK=`sway --get-socketpath` +======= export SWAYSOCK="$HOME/.spool/sway-ipc.sock" #WLR_RENDERER=vulkan sway --debug 2>> $HOME/.swaylog >> $HOME/.swaylog WLR_RENDERER=gles2 $HOME/build/sway/build/sway/sway --debug 2>> $HOME/.swaylog >> $HOME/.swaylog export SWAYSOCK=`sway --get-socketpath` systemctl --user stop wallpapers.service +>>>>>>> master diff --git a/sway/window-fade.pl b/sway/window-fade.pl index f872864..11de4ad 100755 --- a/sway/window-fade.pl +++ b/sway/window-fade.pl @@ -31,12 +31,12 @@ value The target opacity or offset between 0 (full transparency) and 1 exit(0); } -sub set_background +sub set_opacity { - my $target = shift || return "No target or image provided"; - my $cropped = shift || return "No image provided"; + my $attribute = shift || return "No target or image provided"; + my $target = shift || return "No image provided"; # TODO get fallback from javascript - my $cmd = "output $target background $cropped fill #000000"; + my $cmd = "output $attribute opacity $target"; print "Running $cmd\n"; my $ret = $s->message(0,$cmd)->recv; if ($ret->[0]->{success}) { diff --git a/wofi/wofi-alt-tab.sh b/wofi/wofi-alt-tab.sh index 3aae524..217cc9a 100755 --- a/wofi/wofi-alt-tab.sh +++ b/wofi/wofi-alt-tab.sh @@ -5,8 +5,18 @@ swaymsg -t get_tree | sed -e 's/^.*\-\- \(.*\)$/\1/' | sed -e 's/^\(.*\) [—-] .*$/\1/'| sed -e 's/^\([0-9]*\)\t*\(.*\)/\2 \1/' | +<<<<<<< HEAD + wofi -s $HOME/.dotfiles/wofi/style.css -c \ + $HOME/.dotfiles/wofi/sidebar -d | { + read -r + id=`echo $REPLY | rev | cut -d' ' -f1 | rev` + swaymsg "[con_id=$id]" focus + } + echo $id $REPLY +======= wofi -I -s /home/jpm/.dotfiles/wofi/style.css -c \ $HOME/.dotfiles/wofi/sidebar --show dmenu | { read -r id name swaymsg "[con_id=$id]" focus } +>>>>>>> master