Created
May 31, 2016 12:29
-
-
Save aruhier/22188d12f5c7220c2cccb8d1292b2ffd to your computer and use it in GitHub Desktop.
bspwm, sxhkd and barython
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from barython import Panel, Screen | |
from barython.widgets.base import TextWidget, Widget | |
from barython.widgets.battery import BatteryWidget | |
from barython.widgets.clock import ClockWidget | |
from barython.widgets.audio import PulseAudioWidget | |
from barython.widgets.mpd import MPDWidget | |
from barython.widgets.xorg import ActiveWindowWidget | |
from barython.widgets.bspwm import BspwmDesktopWidget, BspwmDesktopPoolWidget | |
import logging | |
logging.basicConfig(level=logging.DEBUG) | |
### COLORS ### | |
RTJ_RED = '#FFBF0905' | |
RTJ_PINK = '#FF82046B' | |
RTJ_PURPLE = '#FF5401B7' | |
RTJ_BLUE = '#FF262BD5' | |
RTJ_TEAL = '#FF30A18E' | |
RTJ_GREEN = '#FF3C9020' | |
RTJ_EYES = '#FFFFF7C6' | |
RTJ_STAR = '#FFFFC203' | |
RTJ_ORANGE = '#FFFF763B' | |
# Previous Theme Colors | |
COLOR_FOREGROUND = '#FFA3A3AB' | |
COLOR_BACKGROUND = '#FF2d2d2d' | |
COLOR_ACTIVE_MONITOR_FG = '#FF252527' | |
COLOR_ACTIVE_MONITOR_BG = '#FF58C5F1' | |
COLOR_INACTIVE_MONITOR_FG = '#FF58C5F1' | |
COLOR_INACTIVE_MONITOR_BG = '#FF252527' | |
COLOR_DEFAULT_DARK = '#FF252527' | |
COLOR_DEFAULT_LIGHT = '#FFF6F9FF' | |
COLOR_FOCUSED_OCCUPIED_FG = RTJ_RED | |
COLOR_FOCUSED_OCCUPIED_BG = RTJ_STAR | |
COLOR_FOCUSED_FREE_FG = RTJ_RED | |
COLOR_FOCUSED_FREE_BG = RTJ_EYES | |
COLOR_FOCUSED_URGENT_FG = RTJ_RED | |
COLOR_FOCUSED_URGENT_BG = RTJ_ORANGE | |
COLOR_OCCUPIED_FG = COLOR_DEFAULT_DARK | |
COLOR_OCCUPIED_BG = '#FFFFDA65' | |
COLOR_FREE_FG = COLOR_DEFAULT_DARK | |
COLOR_FREE_BG = RTJ_EYES | |
COLOR_URGENT_FG = COLOR_DEFAULT_LIGHT | |
COLOR_URGENT_BG = RTJ_RED | |
COLOR_LAYOUT_FG = '#FFA3A3AB' | |
COLOR_LAYOUT_BG = '#FF252527' | |
COLOR_TITLE_FG = '#FFA3A3AB' | |
COLOR_TITLE_BG = '#FF252527' | |
COLOR_STATUS_FG = '#FFA3A3AB' | |
COLOR_STATUS_BG = '#FF252527' | |
# COLORSCHEME | |
BLACK = "#FF525252" | |
RED = "#FFd64937" | |
GREEN = "#FF93B569" | |
YELLOW = "#FFF3D1A7" | |
BLUE = "#FF96A8B7" | |
MAGENTA = "#FF9F9CA9" | |
CYAN = "#FF88AABB" | |
WHITE = "#FFf9f9f9" | |
DARK = "#FF2d2d2d" | |
PANNA = "#FFbea492" | |
### | |
class CustomClockWidget(ClockWidget): | |
def organize_result(self, date_now, **kwargs): | |
date = date_now.strftime("%a %d %b").title() | |
clock = self.decorate(date_now.strftime("%H:%M"), font=2) | |
return Widget.organize_result( | |
self, "{} {}".format(date, clock) | |
) | |
PADDING = 2 | |
p = Panel(instance_per_screen=True, | |
fg=COLOR_FOREGROUND, bg=COLOR_BACKGROUND, | |
fonts=("DejaVu Sans Mono for Powerline:size=10.5", | |
"DejaVu Sans Mono for Powerline:size=10.5:style=bold", | |
"FontAwesome:size=12"), | |
clickable=40, refresh=0.1, keep_unplugged_screens=False) | |
mpd = MPDWidget( | |
fg=COLOR_DEFAULT_LIGHT, bg=RTJ_RED, padding=PADDING, refresh=0.5, | |
icon={ | |
"play": "\uf04c", "pause": "\uf04b", "stop": "\uf04d" | |
} | |
) | |
pa = PulseAudioWidget( | |
fg=COLOR_DEFAULT_LIGHT, | |
bg=RTJ_BLUE, | |
refresh=0.1, | |
icon={ | |
"ouput_mute": "\uf026", | |
"volume": ((0, "\uf026"), (1, "\uf027"), (70, "\uf028")), | |
}, | |
padding=PADDING | |
) | |
bspwm_kwargs = { | |
"fg": COLOR_DEFAULT_DARK, "bg": RTJ_EYES, | |
"fg_focused_occupied": COLOR_FOCUSED_OCCUPIED_FG, | |
"bg_focused_occupied": COLOR_FOCUSED_OCCUPIED_BG, | |
"fg_focused_free": COLOR_FOCUSED_FREE_FG, | |
"bg_focused_free": COLOR_FOCUSED_FREE_BG, | |
"fg_focused_urgent": COLOR_FOCUSED_URGENT_FG, | |
"bg_focused_urgent": COLOR_FOCUSED_URGENT_BG, | |
"fg_free": COLOR_FREE_FG, "bg_free": COLOR_FREE_BG, | |
"fg_occupied": COLOR_OCCUPIED_FG, "bg_occupied": COLOR_OCCUPIED_BG, | |
"fg_urgent": COLOR_URGENT_FG, "bg_urgent": COLOR_URGENT_BG, | |
"fg_focused_monitor": COLOR_ACTIVE_MONITOR_FG, | |
"bg_focused_monitor": COLOR_ACTIVE_MONITOR_BG, | |
"fixed_order": [ | |
"a", "s", "d", "f", "u", "i", "o", "p", "7", "8", "9", "0", ")", | |
], | |
"padding": 1 | |
} | |
clock = CustomClockWidget(fg=COLOR_DEFAULT_LIGHT, bg=RTJ_GREEN, | |
date_format="%H:%M", icon="\uf073", refresh=0.5, | |
padding=PADDING) | |
# active_window = ActiveWindowWidget(fg=COLOR_DEFAULT_LIGHT, bg=RTJ_GREEN, | |
# refresh=0.2, padding=PADDING) | |
# battery = BatteryWidget(fg=COLOR_DEFAULT_LIGHT, padding=PADDING) | |
for s in (Screen("DVI-D-0"), Screen("LVDS1"), Screen("DP1")): | |
main_screen = s | |
main_screen.add_widget( | |
"l", # active_window, | |
mpd, TextWidget(fg=RTJ_RED, bg=COLOR_BACKGROUND, text="") | |
) | |
main_screen.add_widget( | |
"c", | |
TextWidget(bg=RTJ_EYES, fg=COLOR_BACKGROUND, text=""), | |
BspwmDesktopPoolWidget(**bspwm_kwargs), | |
TextWidget(bg=RTJ_EYES, fg=COLOR_BACKGROUND, text=""), | |
) | |
main_screen.add_widget( | |
"r", | |
# battery, | |
TextWidget(fg=RTJ_BLUE, bg=COLOR_BACKGROUND, text=""), | |
pa, | |
TextWidget(fg=RTJ_GREEN, bg=RTJ_BLUE, text=""), | |
clock | |
) | |
p.add_screen(main_screen) | |
for s in (Screen("HDMI-0"), Screen("DVI-I-0")): | |
p.add_screen(s) | |
s.add_widget( | |
"c", | |
TextWidget(bg=RTJ_EYES, fg=COLOR_BACKGROUND, text=""), | |
BspwmDesktopPoolWidget(**bspwm_kwargs), | |
TextWidget(bg=RTJ_EYES, fg=COLOR_BACKGROUND, text=""), | |
) | |
s.add_widget("r", | |
TextWidget(fg=RTJ_GREEN, bg=COLOR_BACKGROUND, text=""), | |
clock) | |
p.start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
bspc config wm_name LG3D | |
bspc config border_width 1 | |
bspc config window_gap 3 | |
bspc config split_ratio 0.5 | |
bspc config borderless_monocle true | |
bspc config gapless_monocle false | |
bspc config focus_by_distance true | |
bspc config ignore_ewmh_focus true | |
bspc config remove_disabled_monitors false | |
bspc config remove_unplugged_monitors false | |
bspc monitor HDMI-0 -d s | |
bspc monitor DVI-D-0 -d a | |
bspc monitor DVI-I-0 -d d | |
bspc monitor -a f u i o p 7 8 9 0 ")" | |
# bspc monitor HDMI-0 -s DVI-D-0 | |
bspc config top_padding 18 | |
sleep 1 | |
xsetroot -cursor_name left_ptr & | |
nvidia-settings --load-config-only & | |
feh --bg-fill ~/.config/qtile/wallpaper.jpg & | |
python ~/git/github/barython/test.py & | |
light-locker --no-lock-on-suspend & | |
xset -dpms & | |
xset s off & | |
xset -b & | |
setxkbmap -layout us -option compose:ralt & | |
compton -cG --backend glx --unredir-if-possible & | |
sleep 1 | |
nm-applet & | |
pa-applet & | |
redshift-gtk & | |
clipit & | |
owncloud & | |
sxhkd & | |
sleep 2 | |
trayer --edge top --align right --expand false --margin 300 --widthtype request --height 18 --alpha 0 --transparent true --tint 0xFF2d2d2d --monitor "primary" --SetDockType true --SetPartialStrut false --iconspacing 5 & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# bspwm hotkeys | |
# | |
super + ctrl + q | |
pkill panel; bspc quit | |
super + z | |
bspc node -c | |
# max | |
super + t | |
bspc desktop -l next | |
# balance | |
super + b | |
bspc desktop -B | |
# float/fullscreen | |
super + {ctrl+f,ctrl+shift+f} | |
bspc node -t "~"{floating,fullscreen} | |
# Jump to last in history | |
super + {_, shift+}Tab | |
bspc {node,desktop} -f last | |
# switch with last | |
super + apostrophe | |
bspc node -s last | |
# move to manual | |
super + y | |
bspc node -n 'last.!automatic' | |
# swap with biggest | |
super + semicolon | |
bspc node -s biggest | |
# move around | |
super + {_,shift + }{h,j,k,l} | |
bspc node -{f,s} {west,south,north,east}.local | |
# move in cycle | |
alt + {_,shift + }Tab | |
bspc node -f {next,prev} | |
# swap in cycle | |
super + {_,shift + }m | |
bspc node @/ -C {forward,backward} | |
# rotate the desktop | |
super + {_,shift + }comma | |
bspc node @/ -R {90,270} | |
# prev/nex desktop | |
super + ctrl + {o,i} | |
bspc desktop -f {prev,next} | |
# preselection | |
super + ctrl + {h,j,k,l} | |
bspc node -p {west,south,north,east} | |
# cancel preselection | |
super + ctrl + {_,shift + }space | |
bspc {node -p cancel,desktop -c} | |
# resize | |
alt + super + {h,j,k,l} | |
bspc node {@west -r -20, @north -r +20, @north -r -20, @west -r +20} | |
# resize | |
alt + super + shift + {h,j,k,l} | |
bspc node {@east -r -20, @south -r +20, @south -r -20, @east -r +20} | |
# set ratio FIND NEW | |
super + ctrl + {1-9} | |
bspc node -o 0.{1-9} | |
# move to desktop | |
super + {a,s,d,f,u,i,o,p,7,8,9,0,minus} | |
Dt={a,s,d,f,u,i,o,p,7,8,9,0,')'}; \ | |
Mc=$(bspc query -M -m); \ | |
Mt=$(bspc query -M -d "$Dt"); \ | |
if [ "$M" != "$Mc" ]; \ | |
then Dc=$(bspc query -D -d); \ | |
Dft=$(bspc query -d "$Mt":focused -D); \ | |
if [ "$Dft" = "$Dt" ]; \ | |
then bspc desktop "$Dt" -s "$Dc"; \ | |
else; \ | |
bspc desktop "$Dt" -m "$Mc"; \ | |
bspc desktop -f "$Dt"; \ | |
fi; \ | |
else; \ | |
bspc desktop -f "$Dt"; \ | |
fi | |
# move window to desktop | |
super + shift + {a,s,d,f,u,i,o,p,7,8,9,0,minus} | |
bspc node -d {a,s,d,f,u,i,o,p,7,8,9,0,")"} | |
# move to screen | |
super + {q,w,e} | |
bspc monitor -f {^1,^2,^3} | |
# move window to screen | |
super + shift + {q,z,e} | |
bspc node -m {^1,^2,^3} | |
~button1 | |
bspc pointer -g focus | |
super + button{1-3} | |
bspc pointer -g {move,resize_side,resize_corner} | |
super + !button{1-3} | |
bspc pointer -t %i %i | |
super + @button{1-3} | |
bspc pointer -u | |
# Volume Keys | |
XF86AudioMute | |
pamixer -t | |
super + F1 | |
pamixer -t | |
XF86AudioRaiseVolume | |
pamixer -i 5 | |
super + F3 | |
pamixer -i 5 | |
XF86AudioLowerVolume | |
pamixer -d 5 | |
super + F2 | |
pamixer -d 5 | |
XF86AudioRaiseVolume + shift | |
pamixer -i 1 | |
super + shift + F3 | |
pamixer -i 1 | |
XF86AudioLowerVolume + shift | |
pamixer -d 1 | |
super + shift + F2 | |
pamixer -d 1 | |
# Media Keys | |
XF86AudioPrev | |
mpc prev | |
super + F5 | |
mpc prev | |
XF86AudioPlay | |
mpc toggle | |
super + F4 | |
mpc toggle | |
XF86AudioNext | |
mpc next | |
super + F6 | |
mpc next | |
# | |
# wm independent hotkeys | |
# | |
super + Return | |
urxvt | |
super + r | |
rofi -show run | |
super + ctrl + p | |
clerk --queue show | |
super + ctrl + shift + l | |
light-locker-command -l | |
# make sxhkd reload its configuration files: | |
super + shift + ctrl + Escape | |
pkill -USR1 -x sxhkd | |
alt + z | |
firefox | |
alt + x | |
thunderbird |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment