Merge branch 'master' of ssh://git@git.john.me.tz:223/jpm/scripts.git

Conflicts:
	sway/window-fade.pl
This commit is contained in:
John Mertz 2022-11-04 11:36:18 -04:00
commit eed99b2283
6 changed files with 89 additions and 5 deletions

47
sway/alt-tab.py Normal file
View File

@ -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'])

View File

@ -49,7 +49,7 @@ my $active_outputs = "$ENV{'HOME'}/.spool/active_outputs";
# You can get the model from (quoted with *): # You can get the model from (quoted with *):
# $ swaymsg -t get_outputs --raw # $ swaymsg -t get_outputs --raw
my %outputs = ( my %outputs = (
'LG TV SSCR2' => 'TV', 'DENON-AVAMP' => 'TV',
'Paperlike253' => 'eInk', 'Paperlike253' => 'eInk',
'0x4140' => 'yoga' '0x4140' => 'yoga'
); );

4
sway/hud.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
flatpak run com.github.Eloston.UngoogledChromium --app="https://papillon.john.me.tz/hud.php?theme=dark&refresh=3600"

View File

@ -1,8 +1,31 @@
#!/bin/bash #!/bin/bash
rm $HOME/.swaylog rm $HOME/.swaylog
echo sway > $HOME/.spool/last_login_gui 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" export SWAYSOCK="$HOME/.spool/sway-ipc.sock"
#WLR_RENDERER=vulkan sway --debug 2>> $HOME/.swaylog >> $HOME/.swaylog #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 WLR_RENDERER=gles2 $HOME/build/sway/build/sway/sway --debug 2>> $HOME/.swaylog >> $HOME/.swaylog
export SWAYSOCK=`sway --get-socketpath` export SWAYSOCK=`sway --get-socketpath`
systemctl --user stop wallpapers.service systemctl --user stop wallpapers.service
>>>>>>> master

View File

@ -31,12 +31,12 @@ value The target opacity or offset between 0 (full transparency) and 1
exit(0); exit(0);
} }
sub set_background sub set_opacity
{ {
my $target = shift || return "No target or image provided"; my $attribute = shift || return "No target or image provided";
my $cropped = shift || return "No image provided"; my $target = shift || return "No image provided";
# TODO get fallback from javascript # TODO get fallback from javascript
my $cmd = "output $target background $cropped fill #000000"; my $cmd = "output $attribute opacity $target";
print "Running $cmd\n"; print "Running $cmd\n";
my $ret = $s->message(0,$cmd)->recv; my $ret = $s->message(0,$cmd)->recv;
if ($ret->[0]->{success}) { if ($ret->[0]->{success}) {

View File

@ -5,8 +5,18 @@ swaymsg -t get_tree |
sed -e 's/^.*\-\- \(.*\)$/\1/' | sed -e 's/^.*\-\- \(.*\)$/\1/' |
sed -e 's/^\(.*\) [—-] .*$/\1/'| sed -e 's/^\(.*\) [—-] .*$/\1/'|
sed -e 's/^\([0-9]*\)\t*\(.*\)/\2 \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 \ wofi -I -s /home/jpm/.dotfiles/wofi/style.css -c \
$HOME/.dotfiles/wofi/sidebar --show dmenu | { $HOME/.dotfiles/wofi/sidebar --show dmenu | {
read -r id name read -r id name
swaymsg "[con_id=$id]" focus swaymsg "[con_id=$id]" focus
} }
>>>>>>> master