Update things

This commit is contained in:
Arti Zirk 2019-03-08 14:45:36 +02:00
parent c3796928c1
commit 1545673b88
3 changed files with 50 additions and 3 deletions

39
.bin/sway-apps.py Executable file
View File

@ -0,0 +1,39 @@
#!/usr/bin/python3
# source https://gitlab.com/snippets/1832968
import json
from subprocess import Popen, PIPE, run
def get_tree():
proc = run(['swaymsg', '-t', 'get_tree'], capture_output=True)
return json.loads(proc.stdout)
def traverse(data, out):
if 'nodes' not in data:
return
if data['type'] == 'con' and 'window_properties' in data:
props = data['window_properties']
out.append((f'{props["class"]}: {props["title"]}'))
for node in data['nodes']:
if 'nodes' in node:
traverse(node, out)
def main():
apps = []
traverse(get_tree(), apps)
in_data = '\n'.join(apps).encode()
with Popen(['fzf'], stdout=PIPE, stdin=PIPE) as proc:
stdout, _ = proc.communicate(in_data)
app = stdout.decode().split(':')[1].strip()
run(['swaymsg', f'[title="{app}"] focus'])
if __name__ == '__main__':
main()

View File

@ -16,10 +16,12 @@ set $right l
# Your preferred terminal emulator
set $term gnome-terminal
# Your preferred application launcher
# Note: it's recommended that you pass the final command to sway
# None: it's recommended that you pass the final command to sway
#set $menu dmenu_path | dmenu | xargs swaymsg exec
set $menu gnome-terminal --title=swayapplauncher -- ~/.bin/desktop_launcher.sh
### Output configuration
#
# Default wallpaper (more resolutions are available in __DATADIR__/backgrounds/sway/)
@ -59,6 +61,8 @@ bindsym Scroll_Lock exec swaylock -c 333333AA -s tile -i ~/Pildid/background.png
exec ~/code/dropbox-filesystem-fix/dropbox_start.py
bindsym Alt+Tab exec gnome-terminal --title=swayapplauncher -- ~/.bin/sway-apps.py
### Input configuration
#
# Example configuration:
@ -225,6 +229,7 @@ bindsym XF86MonBrightnessDown exec --no-startup-id brightnessctl --quiet set 5%-
# launcher float
for_window [title=".*swayapplauncher.*"] floating enable
for_window [title="Authy"] floating enable
# screenshots
bindsym Print exec grim $(xdg-user-dir PICTURES)/$(date +'screenshot_%Y-%m-%d-%H%M%S_grim.png')
@ -259,17 +264,17 @@ input * {
xkb_layout ee,ee
xkb_variant us,
xkb_options caps:escape
xkb_numlock enabled
tap enabled
natural_scroll disabled
}
input 1133:4123:Logitech_M705 {
pointer_accel -0.6
natural_scroll disabled
accel_profile adaptive
}
input 1267:32:Elan_Touchpad {
natural_scroll enabled
pointer_accel 0.1
}

3
.zshrc
View File

@ -74,3 +74,6 @@ function gedit {
fi
PATH=$REAL_PATH env -u VIRTUAL_ENV /usr/bin/gedit $@;
}
# i don't like that systemd by default uses a pager
export SYSTEMD_PAGER=''