From 163716cb0cc51cf0bd44f76f0bbb94f590384b07 Mon Sep 17 00:00:00 2001 From: Marco Thomas Date: Fri, 26 Mar 2021 13:00:16 +0100 Subject: [PATCH] Change some bindings --- README.md | 4 +- files/.config/i3/config | 4 +- files/.zshrc | 6 +- files/scripts/dwm_bar/battery.sh | 7 ++ files/scripts/dwm_bar/spotify_status.py | 141 ------------------------ 5 files changed, 14 insertions(+), 148 deletions(-) create mode 100755 files/scripts/dwm_bar/battery.sh delete mode 100755 files/scripts/dwm_bar/spotify_status.py diff --git a/README.md b/README.md index b3cd6a0..e2476f1 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,12 @@ ## System -+ Bar: polybar ++ Bar: polybar (and dwmblocks) + Compositor: picom-git + Notifications: dunst + Shell: zsh + Terminal: alacritty -+ WM: i3-gaps ++ WM: i3-gaps (and dwm) ## Programs diff --git a/files/.config/i3/config b/files/.config/i3/config index 978cdbe..4cb4118 100644 --- a/files/.config/i3/config +++ b/files/.config/i3/config @@ -60,13 +60,13 @@ bindsym $mod+Shift+l move right bindsym $mod+Shift+q kill -bindsym $mod+f fullscreen toggle +#bindsym $mod+f fullscreen toggle bindsym $mod+Shift+space floating toggle bindsym $mod+s split v bindsym $mod+v split h -bindsym $mod+a layout toggle stacking splith +bindsym $mod+f layout toggle stacking splith bindsym $mod+comma workspace prev bindsym $mod+period workspace next diff --git a/files/.zshrc b/files/.zshrc index c32b9f8..9a1a262 100644 --- a/files/.zshrc +++ b/files/.zshrc @@ -49,9 +49,9 @@ if [[ -x $(which nvim 2> /dev/null) ]]; then alias vim="nvim" fi -if [[ -x $(which swallow 2> /dev/null) ]]; then - alias zathura="swallow zathura" -fi +#if [[ -x $(which swallow 2> /dev/null) ]]; then +# alias zathura="swallow zathura" +#fi alias updoot="yay -Syu" alias dhl="yay" diff --git a/files/scripts/dwm_bar/battery.sh b/files/scripts/dwm_bar/battery.sh new file mode 100755 index 0000000..f79bcd0 --- /dev/null +++ b/files/scripts/dwm_bar/battery.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +if [ -f "/sys/class/power_supply/BAT0/capacity" ];then + echo $(cat /sys/class/power_supply/BAT0/capacity)% +else + echo 100% +fi diff --git a/files/scripts/dwm_bar/spotify_status.py b/files/scripts/dwm_bar/spotify_status.py deleted file mode 100755 index 2f9af68..0000000 --- a/files/scripts/dwm_bar/spotify_status.py +++ /dev/null @@ -1,141 +0,0 @@ -#!/usr/bin/env python - -import sys -import dbus -import argparse - -parser = argparse.ArgumentParser() -parser.add_argument( - '-t', - '--trunclen', - type=int, - metavar='trunclen' -) -parser.add_argument( - '-f', - '--format', - type=str, - metavar='custom format', - dest='custom_format' -) -parser.add_argument( - '-p', - '--playpause', - type=str, - metavar='play-pause indicator', - dest='play_pause' -) -parser.add_argument( - '--font', - type=str, - metavar='the index of the font to use for the main label', - dest='font' -) -parser.add_argument( - '--playpause-font', - type=str, - metavar='the index of the font to use to display the playpause indicator', - dest='play_pause_font' -) -parser.add_argument( - '-q', - '--quiet', - action='store_true', - help="if set, don't show any output when the current song is paused", - dest='quiet', -) - -args = parser.parse_args() - - -def fix_string(string): - # corrects encoding for the python version used - if sys.version_info.major == 3: - return string - else: - return string.encode('utf-8') - - -def truncate(name, trunclen): - if len(name) > trunclen: - name = name[:trunclen] - name += '...' - if ('(' in name) and (')' not in name): - name += ')' - return name - - - -# Default parameters -output = fix_string(u'{play_pause} {artist}: {song}') -trunclen = 60 -play_pause = fix_string(u'\u25B6,\u23F8') # first character is play, second is paused - -label_with_font = '{label}' -font = args.font -play_pause_font = args.play_pause_font - -quiet = args.quiet - -# parameters can be overwritten by args -if args.trunclen is not None: - trunclen = args.trunclen -if args.custom_format is not None: - output = args.custom_format -if args.play_pause is not None: - play_pause = args.play_pause - -try: - session_bus = dbus.SessionBus() - spotify_bus = session_bus.get_object( - 'org.mpris.MediaPlayer2.spotify', - '/org/mpris/MediaPlayer2' - ) - - spotify_properties = dbus.Interface( - spotify_bus, - 'org.freedesktop.DBus.Properties' - ) - - metadata = spotify_properties.Get('org.mpris.MediaPlayer2.Player', 'Metadata') - status = spotify_properties.Get('org.mpris.MediaPlayer2.Player', 'PlaybackStatus') - - # Handle play/pause label - - play_pause = play_pause.split(',') - - if status == 'Playing': - play_pause = play_pause[0] - elif status == 'Paused': - play_pause = play_pause[1] - else: - play_pause = str() - - if play_pause_font: - play_pause = label_with_font.format(font=play_pause_font, label=play_pause) - - # Handle main label - - artist = fix_string(metadata['xesam:artist'][0]) if metadata['xesam:artist'] else '' - song = fix_string(metadata['xesam:title']) if metadata['xesam:title'] else '' - album = fix_string(metadata['xesam:album']) if metadata['xesam:album'] else '' - - if (quiet and status == 'Paused') or (not artist and not song and not album): - print('') - else: - if font: - artist = label_with_font.format(font=font, label=artist) - song = label_with_font.format(font=font, label=song) - album = label_with_font.format(font=font, label=album) - - # Add 4 to trunclen to account for status symbol, spaces, and other padding characters - print(truncate(output.format(artist=artist, - song=song, - play_pause=play_pause, - album=album), trunclen + 4)) - -except Exception as e: - if isinstance(e, dbus.exceptions.DBusException): - print('') - else: - print(e)