Some jiggering with i3 bindings

main
Dan Buch 7 years ago
parent 78f9a52d6a
commit 67fe0be22f
Signed by: meatballhat
GPG Key ID: 9685130D8B763EA7

@ -0,0 +1,49 @@
#!/usr/bin/env python3
import codecs
import glob
import os
import os.path
import sys
def main():
screenlayout_dir = os.path.expanduser('~/.screenlayout')
if not os.path.isdir(screenlayout_dir):
os.makedirs(screenlayout_dir)
profiles = [
os.path.basename(f)
for f in glob.glob(os.path.join(screenlayout_dir, '*.sh'))
]
if len(profiles) == 0:
return 0
cur_profile = profiles[0]
cur_profile_path = os.path.join(screenlayout_dir, '.current')
if os.path.isfile(cur_profile_path):
with codecs.open(cur_profile_path, encoding='utf-8') as infile:
cur_profile = infile.read().strip()
if cur_profile not in profiles:
print('ERROR:{}: current profile {} not found'.format(progname,
cur_profile), file=sys.stderr)
cur_profile = profiles[0]
cur_idx = profiles.index(cur_profile)
next_idx = cur_idx + 1
if next_idx >= (len(profiles) - 1):
next_idx = abs(next_idx - len(profiles))
next_profile = profiles[next_idx]
with codecs.open(cur_profile_path, 'w', encoding='utf-8') as outfile:
outfile.write(next_profile)
os.execl(os.path.join(screenlayout_dir, next_profile), '--')
return 0
if __name__ == '__main__':
sys.exit(main())

@ -109,8 +109,10 @@ bindsym XF86AudioMute exec pactl set-sink-mute 0 toggle
bindsym XF86MonBrightnessDown exec ~/.i3status-update-do xbacklight -5
bindsym XF86MonBrightnessUp exec ~/.i3status-update-do xbacklight +5
bindsym XF86Calculator exec i3lock -c ed1c24
bindsym XF86Tools exec xfce4-screenshooter
bindsym XF86Tools exec i3lock -c ed1c24
bindsym XF86Calculator exec xcalc
bindsym XF86Display exec ~/.i3-screenlayout-toggle
bindsym Print exec xfce4-screenshooter
# resize window (you can also use the mouse for that)
mode "resize" {

Loading…
Cancel
Save