guest@dotshare [~/groups/wms/i3] $ ls paper-plane/ | cat

paper plane (scrot)

zionek May 11, 2018 (wms/i3)

i3config(raw, dl)

SCROT

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#

set $rofi "rofi -show run -font 'snap 10' -color-normal '#000000,#ffffff,#222222,#44bbff,#ffffff' -color-window '#000000,#ffffff'"


# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!

set $mod Mod4

# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:monospace 8

# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
#font pango:DejaVu Sans Mono 8

# Before i3 v4.8, we used to recommend this one as the default:
# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
# The font above is very space-efficient, that is, it looks good, sharp and
# clear in small sizes. However, its unicode glyph coverage is limited, the old
# X core fonts rendering does not support right-to-left and this being a bitmap
# font, it doesn’t scale on retina/hidpi displays.

# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod

# start a terminal
bindsym $mod+Return exec termite

# kill focused window
bindsym $mod+Shift+q kill

# start dmenu (a program launcher)
#bindsym $mod+d exec dmenu_run
bindsym $mod+d exec $rofi

# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop

# change focus
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+ntilde focus right

# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right

# move focused window
bindsym $mod+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+ntilde move right

# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right

# split in horizontal orientation
bindsym $mod+h split h

# split in vertical orientation
bindsym $mod+v split v

# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle

# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split

# toggle tiling / floating
bindsym $mod+Shift+space floating toggle

# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle

# focus the parent container
bindsym $mod+a focus parent

# focus the child container
#bindsym $mod+d focus child

# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
set $ws1 "1"
set $ws2 "2"
set $ws3 "3"
set $ws4 "4"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"

# switch to workspace
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace $ws3
bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace $ws5
bindsym $mod+6 workspace $ws6
bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace $ws9
bindsym $mod+0 workspace $ws10

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $ws1
bindsym $mod+Shift+2 move container to workspace $ws2
bindsym $mod+Shift+3 move container to workspace $ws3
bindsym $mod+Shift+4 move container to workspace $ws4
bindsym $mod+Shift+5 move container to workspace $ws5
bindsym $mod+Shift+6 move container to workspace $ws6
bindsym $mod+Shift+7 move container to workspace $ws7
bindsym $mod+Shift+8 move container to workspace $ws8
bindsym $mod+Shift+9 move container to workspace $ws9
bindsym $mod+Shift+0 move container to workspace $ws10

assign [class="Google-chrome"] $ws2
#assign [class="Firefox"] $ws2
assign [class="Spotify"] $ws3
#assign [class="Vlc"] $ws5
assign [class="Dolphin"] $ws6
assign [class="VirtualBox"] $ws6
assign [class="Simplescreenrecorder"] $ws10
#for_window [class="Spotify"] floating enable move container to workspace $workspace3
assign [class="xfce4-terminal"] $ws1

# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"

# resize window (you can also use the mouse for that)
mode "resize" {
        # These bindings trigger as soon as you enter the resize mode

        # Pressing left will shrink the window’s width.
        # Pressing right will grow the window’s width.
        # Pressing up will shrink the window’s height.
        # Pressing down will grow the window’s height.
        bindsym j resize shrink width 10 px or 10 ppt
        bindsym k resize grow height 10 px or 10 ppt
        bindsym l resize shrink height 10 px or 10 ppt
        bindsym ntilde resize grow width 10 px or 10 ppt

        # same bindings, but for the arrow keys
        bindsym Left resize shrink width 10 px or 10 ppt
        bindsym Down resize grow height 10 px or 10 ppt
        bindsym Up resize shrink height 10 px or 10 ppt
        bindsym Right resize grow width 10 px or 10 ppt

        # back to normal: Enter or Escape or $mod+r
        bindsym Return mode "default"
        bindsym Escape mode "default"
        bindsym $mod+r mode "default"
}

bindsym $mod+r mode "resize"

# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
#bar {
#	font pango:sans, awesome 10
#        #status_command i3status
#	status_command i3blocks -c /home/angelaguayo/.config/i3/i3blocks.conf
#}

exec --no-startup-id feh --bg-scale /home/angelaguayo/wall.png

exec --no-startup-id compton

exec --no-startup-id polybar example


#GAPSSSSS
# Disable window titlebars entirely
for_window [class="^.*"] border pixel 2

# Set inner/outer gaps
gaps inner 10
gaps outer 15


# Additionally, you can issue commands with the following syntax. This
#is useful to bind keys to changing the gap size.
# gaps inner|outer current|all set|plus|minus <px>
# gaps inner all set 10
# gaps outer all plus 5

# Smart gaps (gaps used if only more than one container on the
#workspace)
#smart_gaps on

# Smart borders (draw borders around container only if it is not the
#only container on this workspace)
# on|no_gaps (on=always activate and no_gaps=only activate if the gap
#size to the edge of the screen is 0)
smart_borders on

# Press $mod+Shift+g to enter the gap mode. Choose o or i for modifying
#outer/inner gaps. Press one of + / - (in-/decrement for current
#workspace) or 0 (remove gaps for current workspace). If you also press
#Shift with these keys, the change will be global for all workspaces.
set $mode_gaps Gaps: (o) outer, (i) inner
set $mode_gaps_outer Outer Gaps: +|-|0 (local), Shift + +|-|0 (global)
set $mode_gaps_inner Inner Gaps: +|-|0 (local), Shift + +|-|0 (global)
bindsym $mod+Shift+g mode "$mode_gaps"


mode "$mode_gaps" {
        bindsym o      mode "$mode_gaps_outer"
        bindsym i      mode "$mode_gaps_inner"
        bindsym Return mode "default"
        bindsym Escape mode "default"
}

mode "$mode_gaps_inner" {
        bindsym plus  gaps inner current plus 5
        bindsym minus gaps inner current minus 5
        bindsym 0     gaps inner current set 0

        bindsym Shift+plus  gaps inner all plus 5
        bindsym Shift+minus gaps inner all minus 5
        bindsym Shift+0     gaps inner all set 0

        bindsym Return mode "default"
        bindsym Escape mode "default"
}
mode "$mode_gaps_outer" {
        bindsym plus  gaps outer current plus 5
        bindsym minus gaps outer current minus 5
        bindsym 0     gaps outer current set 0

        bindsym Shift+plus  gaps outer all plus 5
        bindsym Shift+minus gaps outer all minus 5
        bindsym Shift+0     gaps outer all set 0

        bindsym Return mode "default"
        bindsym Escape mode "default"
}

CLICK TO VIEW

x

polybar_config(raw, dl)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
[colors]
;background = #88040811
background = #00000000
background-1 = #416a88
background-2 = #638faa
background-3 = #2b4866
background-4 = #85aec8
background-5 = #a2b4bf
background-6 = #040811
background-7 = #04B486
urgent = #ff0000

;foreground = #ffffff
foreground = #000000
foreground-alt = #222222
primary = #EEEFFD
secondary = #EEEFFD


[bar/example]
#monitor = LVDS1
monitor = ${env:MONITOR:LVDS1}
width = 1366
height = 25
offset-x = 0%
offset-y = 0%
radius = 2.0
fixed-center = true
top = true

background = ${colors.background}
foreground = ${colors.foreground}

;line-size = 0
line-color = #ff0000

underline-size = 2
line-size = 2

border-size = 5
border-color = #00ff0000

padding-left = 0
padding-right = 0

module-margin-left = 0
module-margin-right = 0
;module-margin-background = ${colors.background-1}

font-0 = Roboto:pixelsize=10;1
font-1 = FontAwesome:pixelsize=10;1
font-2 = sm4tik:pixelsize=10;1

modules-left = i3
modules-center = spotify next
modules-right = weather xkeyboard volume wlan battery xbacklight date

[module/i3]
type = internal/i3
enable-click = true
enable-scroll = true
wrapping-scroll = true

ws-icon-0 = 1; terminal
ws-icon-1 = 2; chrome
ws-icon-2 = 3; spotify
ws-icon-3 = 4; social 

ws-icon-4 = 5;
ws-icon-5 = 6;
ws-icon-6 = 7;
ws-icon-7 = 8;
ws-icon-8 = 9;
ws-icon-9 = 10;
ws-icon-default =

format = <label-state> <label-mode>

label-focused = %icon%
label-focused-background = ${colors.background-4}
;label-focused-underline = ${color-background-7}
;label-focused-underline = ${module/bspwm.label-focused-underline}
label-focused-padding = 2

label-unfocused = %icon%
label-unfocused-padding = 2

label-occupied = %icon%
label-occupied-padding = 2

label-urgent = %icon%
label-urgent-background = ${colors.urgent}
label-urgent-padding = 2

label-empty = %icon%
label-empty-foreground = #44ffffff
label-empty-padding = 4


[module/spotify]
type = custom/script
interval = 10
format-background = ${colors.background-7}
format-padding = 2
exec = python /home/angelaguayo/spotify.py -t 42

[module/next]
type = custom/script
exec = echo 

format-padding = 1
format = <label>
;format-foreground = ${colors.my_foreground}
format-background = ${colors.background-7}
click-left = playerctl next

;[module/music]
;type = custom/script
;exec = if [[ "$(playerctl status)" = "Playing" ]]; then playerctl metadata xesam:artist; echo -n " - "; playerctl metadata xesam:title; else echo -n ""; fi
;exec-if = [[ "$(playerctl status)" = "Playing" || "$(playerctl status)" = "Paused" ]] && echo "0"
;interval = 1
;format = <label>

[module/wlan]
type = internal/network
interface = wlp2s0
interval = 3.0

format-connected =  <ramp-signal>
format-connected-padding = 2
;format-connected-background = ${colors.background-1}

format-disconnected-padding = 1
format-disconnected-background = #ff0000

ramp-signal-0 = 0
ramp-signal-1 = 1
ramp-signal-2 = 2
ramp-signal-3 = 3
ramp-signal-4 = 4
ramp-signal-5 = 5
ramp-signal-6 = 6
ramp-signal-7 = 7


[module/battery]
type = internal/battery
battery = BAT0
adapter = ACAD
full-at = 87

label-charging =  %percentage%%
;label-charging-foreground = ${colors.background-alt}
format-charging =  <animation-charging> <label-charging>
;format-charging-background = ${colors.background-1}
format-charging-padding = 1

label-discharging = %percentage%%  
format-discharging =  <ramp-capacity> <label-discharging>
;format-discharging-background = ${colors.background-1}
format-discharging-padding = 1

label-full = %percentage%%
;format-full-background = ${colors.background-1}
;format-full-foreground = ${colors.background-1}
format-full-padding = 2
format-padding = 2

ramp-capacity-0 =
ramp-capacity-1 =
ramp-capacity-2 =
ramp-capacity-3 =
ramp-capacity-4 =

animation-charging-0 = 
animation-charging-1 = 
animation-charging-2 = 
animation-charging-3 = 
animation-charging-4 = 
;animation-charging-foreground = ${colors.background-alt}
animation-charging-framerate = 750


[module/xbacklight]
type = internal/xbacklight

format =  <label> <bar>
label = "  "
;label-background = ${colors.background-1}
bar-width = 10
bar-indicator =
bar-indicator-foreground = #ff
;bar-indicator-background = ${colors.background-1}
bar-indicator-font = 2
bar-fill =
bar-fill-font = 2
bar-fill-foreground = #9f78e1
;bar-fill-background = ${colors.background-1}
bar-empty =
bar-empty-font = 2
;bar-empty-background = ${colors.background-1}
;format-full-background = ${colors.background-1}

[module/backlight-acpi]
inherit = module/xbacklight
type = internal/backlight
card = intel_backlight


[module/date]
type = internal/date
interval = 1

time = "%H:%M"
time-alt = "%Y-%m-%d, %H:%M"

format-prefix-foreground = ${colors.foreground-alt}
format-padding = 2
;format-background = ${colors.background-3}
format-background-underline = ${colors.background-3}
format = %{A1:gsimplecal & disown:}  <label> %{A}
label = %date% %time%

[module/volume]
type = internal/volume

;format-muted-background = ${colors.background-1}
;format-volume-background = ${colors.background-1}
format-volume-padding = 2
format-volume = "<ramp-volume> <label-volume>"
label-muted = " mute"

; Only applies if <ramp-volume> is used
ramp-volume-0 =
ramp-volume-1 =
ramp-volume-2 =

[module/xkeyboard]
type = internal/xkeyboard
blacklist-0 = num lock

label-layout =%layout%
label-layout-padding = 2
;label-layout-background = ${colors.background-1}

label-indicator-padding = 2
;label-indicator-background = ${colors.background-1}

[module/weather]
type = custom/script
interval = 10
;format-background = ${colors.background-2}
format-padding = 2
format = <label>
format-prefix = " "
exec = python3 ~/.config/polybar/weather

[settings]
screenchange-reload = true

[global/wm]
margin-top = 30
margin-bottom = 5
wm-restack = i3
 

x

weather.sh(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#!usr/bin/python3

import urllib.request, json

###### openweather --------------
city = "YourCity"
api_key = "YourApiKey" 
######
weather = eval(str(urllib.request.urlopen("http://api.openweathermap.org/data/2.5/weather?q={}&APPID={}".format(city, api_key)).read())[2:-1])

info = weather["weather"][0]["description"].capitalize()
temp = int(float(weather["main"]["temp"]) - 272.15)

print("%s, %i °C" % (info, temp))
 

x

spotify(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/python

import sys
import dbus
import argparse


parser = argparse.ArgumentParser()
parser.add_argument('-t', '--trunclen', type=int, metavar='trunclen')
args = parser.parse_args()

if args.trunclen is not None:
    trunclen = args.trunclen
else:
    trunclen = 25

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")

    artist = metadata['xesam:artist'][0]
    song = metadata['xesam:title']

    if len(song) > trunclen:
        song = song[0:trunclen]
        song += '...' 
        if ('(' in song) and (')' not in song):
            song += ')'
    output = ' ' + artist + ' - ' + song
    
    # Python3 uses UTF-8 by default. 
    if sys.version_info.major == 3:
        print(output)
    else:
        print(output.encode('UTF-8'))
except Exception as e:
    if isinstance(e, dbus.exceptions.DBusException):
        print("")
    else:
        print(e)
 

x

Notes

arch linux
i3gaps
polybar