diff options
| author | Peter Son Struschka <me@peter-struschka.com> | 2020-07-29 16:40:02 +0800 |
|---|---|---|
| committer | Peter Son Struschka <me@peter-struschka.com> | 2020-07-29 16:48:22 +0800 |
| commit | a1d6fc2f3e6ab041cc51cb085ac59a646a126d25 (patch) | |
| tree | b1ca8b11365cd255dd2f93a47dd0e918e1dae16a /bspwm/.local | |
| parent | 556bbd7fd182937e32eb5320a27ba337ac454be0 (diff) | |
| download | dotfiles-a1d6fc2f3e6ab041cc51cb085ac59a646a126d25.tar.gz dotfiles-a1d6fc2f3e6ab041cc51cb085ac59a646a126d25.tar.bz2 dotfiles-a1d6fc2f3e6ab041cc51cb085ac59a646a126d25.tar.lz dotfiles-a1d6fc2f3e6ab041cc51cb085ac59a646a126d25.tar.xz dotfiles-a1d6fc2f3e6ab041cc51cb085ac59a646a126d25.tar.zst dotfiles-a1d6fc2f3e6ab041cc51cb085ac59a646a126d25.zip | |
basics+bspwm+herbstluftwm+i3wm+meta+polybar+xmonad: wm configs overhaul
Created polybar as its own config instead of duplicated in bspwm and
i3's directories allowing them both to be installed.
Created herbstluftwm, xmonad window manager configs.
Added scripts for a status bar, and fixed scripts.
Diffstat (limited to 'bspwm/.local')
| -rwxr-xr-x | bspwm/.local/bin/rofi_goto_workspace | 4 | ||||
| -rwxr-xr-x | bspwm/.local/bin/rofi_moveto_workspace | 4 | ||||
| -rwxr-xr-x | bspwm/.local/bin/rofi_workspace_prompt | 3 | ||||
| -rwxr-xr-x | bspwm/.local/bin/spotifycl | 207 | ||||
| l--------- | bspwm/.local/share/config-files/polybar | 1 | ||||
| -rw-r--r-- | bspwm/.local/share/lock/lock.png | bin | 3959 -> 0 bytes | |||
| -rw-r--r-- | bspwm/.local/share/lock/rick_lock.png | bin | 113100 -> 0 bytes | |||
| -rwxr-xr-x | bspwm/.local/share/scripts/lock.sh | 15 |
8 files changed, 0 insertions, 234 deletions
diff --git a/bspwm/.local/bin/rofi_goto_workspace b/bspwm/.local/bin/rofi_goto_workspace deleted file mode 100755 index 35e8762..0000000 --- a/bspwm/.local/bin/rofi_goto_workspace +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -NAME=`rofi_workspace_prompt` -i3-msg workspace $NAME diff --git a/bspwm/.local/bin/rofi_moveto_workspace b/bspwm/.local/bin/rofi_moveto_workspace deleted file mode 100755 index 9cc0b9d..0000000 --- a/bspwm/.local/bin/rofi_moveto_workspace +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -NAME=`rofi_workspace_prompt` -i3-msg move container to workspace $NAME diff --git a/bspwm/.local/bin/rofi_workspace_prompt b/bspwm/.local/bin/rofi_workspace_prompt deleted file mode 100755 index f59d1fa..0000000 --- a/bspwm/.local/bin/rofi_workspace_prompt +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -echo `i3-msg -t get_workspaces | jq '.[].name' | sed 's/\"//g' | rofi -dmenu` diff --git a/bspwm/.local/bin/spotifycl b/bspwm/.local/bin/spotifycl deleted file mode 100755 index ffee9f0..0000000 --- a/bspwm/.local/bin/spotifycl +++ /dev/null @@ -1,207 +0,0 @@ -#!/usr/bin/env python - -# MIT License -# -# Copyright (c) 2018 Andreas Backx -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - - -import os -import socket -import sys -import time -import traceback -from concurrent.futures import ThreadPoolExecutor - -import click -import dbus -import dbus.mainloop.glib -import spotipy -import spotipy.util as util -from dbus.mainloop.glib import DBusGMainLoop -from gi.repository import GLib -from spotipy import SpotifyException -from spotipy.oauth2 import SpotifyClientCredentials - -inactive_color = '%{F#6E6E6E}' -active_color = '%{F#CECECE}' -default_color = '%{F-}' - -server_address = '/tmp/spotifycl-socket' - - -class Spotify: - - SPOTIFY_BUS = 'org.mpris.MediaPlayer2.spotify' - SPOTIFYD_BUS = 'org.mpris.MediaPlayer2.spotifyd' - SPOTIFY_OBJECT_PATH = '/org/mpris/MediaPlayer2' - - PLAYER_INTERFACE = 'org.mpris.MediaPlayer2.Player' - PROPERTIES_INTERFACE = 'org.freedesktop.DBus.Properties' - - SAVE_REMOVE = b'save' - - def __init__(self): - DBusGMainLoop(set_as_default=True) - self.session_bus = dbus.SessionBus() - self.last_output = '' - self.empty_output = True - - # Last shown metadata - self.last_title = None - # Whether the current song is added to the library - self.saved_track = False - # Whether to ignore the update - self.ignore = False - - def monitor(self): - self.setup_properties_changed() - self.freedesktop = self.session_bus.get_object( - "org.freedesktop.DBus", - "/org/freedesktop/DBus" - ) - self.freedesktop.connect_to_signal( - "NameOwnerChanged", - self.on_name_owner_changed, - arg0=self.SPOTIFYD_BUS - ) - - executor = ThreadPoolExecutor(max_workers=2) - executor.submit(self._start_glib_loop) - executor.submit(self._start_server) - - def _start_glib_loop(self): - loop = GLib.MainLoop() - loop.run() - - def _start_server(self): - try: - os.unlink(server_address) - except OSError: - if os.path.exists(server_address): - raise - sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) - sock.bind(server_address) - sock.listen(5) - - @property - def metadata_status(self): - spotify_properties = dbus.Interface( - self.spotify, - dbus_interface=Spotify.PROPERTIES_INTERFACE - ) - metadata = spotify_properties.Get( - Spotify.PLAYER_INTERFACE, - 'Metadata' - ) - playback_status = spotify_properties.Get( - Spotify.PLAYER_INTERFACE, - 'PlaybackStatus' - ) - return metadata, playback_status - - def output(self, line): - if not line: - self.empty_output = True - if line != self.last_output: - print(line, flush=True) - self.last_output = line - - def setup_spotify(self): - try: - self.spotify = self.session_bus.get_object( - Spotify.SPOTIFY_BUS, - Spotify.SPOTIFY_OBJECT_PATH - ) - except dbus.DBusException: - self.spotify = self.session_bus.get_object(Spotify.SPOTIFYD_BUS, Spotify.SPOTIFY_OBJECT_PATH) - - def setup_properties_changed(self): - try: - self.setup_spotify() - self.spotify.connect_to_signal( - 'PropertiesChanged', - self.on_properties_changed - ) - - if self.empty_output: - metadata, playback_status = self.metadata_status - self.output_playback_status( - data={ - 'Metadata': metadata, - 'PlaybackStatus': playback_status, - } - ) - - except dbus.DBusException: - self.output('') - - def output_playback_status(self, data, retry=False): - if self.ignore: - return - - metadata = data['Metadata'] - artists = metadata['xesam:artist'] - artist = artists[0] if artists else None - - if not artist: - self.output('') - return - - title = metadata['xesam:title'] - playback_status = data['PlaybackStatus'] - same_song = title == self.last_title - - color = active_color if playback_status == 'Playing' else inactive_color - # divider = '+' if same_song and self.saved_track else '-' - self.output(f'{color}{artist} - {title}{default_color}') - - if not same_song: - self.last_title = title - - def on_properties_changed(self, interface, data, *args, **kwargs): - self.output_playback_status(data) - - def on_name_owner_changed(self, name, old_owner, new_owner): - if name == self.SPOTIFY_BUS: - if new_owner: - # Spotify was opened. - self.setup_properties_changed() - else: - # Spotify was closed. - self.spotify = None - self.output('') - - -@click.group() -def cli(): - """Script for listening to Spotify over dbus and adding tracks to your library.""" - pass - - -@cli.command() -def status(): - """Follow the status of the currently playing song on Spotify.""" - spotify = Spotify() - spotify.monitor() - - -if __name__ == '__main__': - cli() diff --git a/bspwm/.local/share/config-files/polybar b/bspwm/.local/share/config-files/polybar deleted file mode 120000 index 87fad9e..0000000 --- a/bspwm/.local/share/config-files/polybar +++ /dev/null @@ -1 +0,0 @@ -../../../.config/polybar/config
\ No newline at end of file diff --git a/bspwm/.local/share/lock/lock.png b/bspwm/.local/share/lock/lock.png Binary files differdeleted file mode 100644 index 7759b82..0000000 --- a/bspwm/.local/share/lock/lock.png +++ /dev/null diff --git a/bspwm/.local/share/lock/rick_lock.png b/bspwm/.local/share/lock/rick_lock.png Binary files differdeleted file mode 100644 index 4037c32..0000000 --- a/bspwm/.local/share/lock/rick_lock.png +++ /dev/null diff --git a/bspwm/.local/share/scripts/lock.sh b/bspwm/.local/share/scripts/lock.sh deleted file mode 100755 index 7a3dd42..0000000 --- a/bspwm/.local/share/scripts/lock.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -revert() { - rm /tmp/*screen*.png - xset dpms 0 0 0 -} -trap revert HUP INT TERM -xset +dpms dpms 0 0 5 - -ffmpeg -loglevel quiet -y -f x11grab -video_size `xdpyinfo | grep 'dimensions' | awk '{print $2}'` -i $DISPLAY -i ~/.local/share/lock/rick_lock.png -filter_complex "boxblur=5:1,overlay=(main_w-overlay_w-400):(main_h-overlay_h-5)" -vframes 1 /tmp/screen.png - -#scrot -d 1 /tmp/locking_screen.png -#convert -blur 0x8 /tmp/locking_screen.png /tmp/screen_blur.png -#convert -composite /tmp/screen_blur.png ~/.rick_lock.png -gravity South -geometry -20x1200 /tmp/screen.png -i3lock -eui /tmp/screen.png -revert |
