guest@dotshare [~/groups/wms/i3] $ ls i3polybar/ | cat

i3+polybar (scrot)

simurgh Nov 23, 2020 (wms/i3)

i3_config(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
# i3 config file
########################################################################
########################################################################



set $mod Mod4
#default_border pixel
font pango:monospace 9
for_window [tiling] border pixel 

exec --no-startup-id picom -b --config ~/.config/picom/picom.conf 
set $fileManager pcmanfm-qt
set $trp transparent

# Margins
for_window [class="^.*"] border pixel 1     
for_window [class="i3bar"] gaps outer current set 8
smart_gaps on
gaps inner 12 # Отступы между окнами
gaps outer 2  # Отступы от экрана



# class                 border  backgr. text    indicator child_border
client.focused          #55aa55 #082C08 #ffffff #55aa55   #55aa55
client.focused_inactive #333333 #5f676a #ffffff #484e50   #082C08
client.unfocused        #333333 #222222 #888888 #292d2e   #082C08
client.urgent           #2f343a #900000 #ffffff #900000   #900000
client.background       #ffffff


#xec --no-startup-id pcmanfm --desktop &
exec --no-startup-id pcmanfm &
exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork
exec --no-startup-id nitrogen --restore
exec --no-startup-id setxkbmap "us,ru" ",winkeys" "grp:toggle"
exec --no-startup-id flameshot
exec --no-startup-id crow &
exec --no-startup-id --systray pavucontrol &
#exec --no-startup-id telegram-desktop
exec --no-startup-id numlockx on
#exec --no-startup-id psi-plus &
exec --no-startup-id xfce4-clipman &


exec_always --no-startup-id sh ~/.config/polybar/launch.sh


bindsym $mod+z exec /usr/bin/sakura  -e  /usr/bin/mc


bindsym Insert exec xfce4-screenshooter
bindsym $mod+F1 exec pcmanfm-qt /home/simurgh/
bindsym $mod+F2 exec pcmanfm-qt /home/simurgh/Downloads/
bindsym $mod+F3 exec firefox
bindsym $mod+F4 exec telegram-desktop
bindsym $mod+F5 exec simplescreenrecorder
#bindsym $mod+F6 exec guvcview
bindsym $mod+F6 exec pavucontrol
bindsym F12 exec subl3 ~/.config/i3/config

bindsym XF86MonBrightnessUp exec xbacklight -inc 10
bindsym XF86MonBrightnessDown exec xbacklight -dec 10





# Use pactl to adjust volume in PulseAudio.
set $refresh_i3status killall -SIGUSR1 i3status
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5% && $refresh_i3status
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5% && $refresh_i3status
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status




#floating_modifier $mod


bindsym $mod+Return exec sakura  #i3-sensible-terminal




bindsym $mod+c kill

bindsym $mod+d exec --no-startup-id rofi -show run




# 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+semicolon 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 v

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

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





# TYPES CONTAINER
#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 number $ws1
bindsym $mod+2 workspace number $ws2
bindsym $mod+3 workspace number $ws3
bindsym $mod+4 workspace number $ws4
bindsym $mod+5 workspace number $ws5
bindsym $mod+6 workspace number $ws6
bindsym $mod+7 workspace number $ws7
bindsym $mod+8 workspace number $ws8
bindsym $mod+9 workspace number $ws9
bindsym $mod+0 workspace number $ws10

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

# 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 semicolon 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 Up resize grow height 10 px or 10 ppt
        bindsym Down 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"




#bar {




    #   position top
       #separator_symbol "_"
     #  status_command i3status
       
#}

CLICK TO VIEW

x

picom.conf(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
# Backend
# =======
backend = "glx";

# GLX Backend
# ===========
glx-no-stencil             = true;
glx-copy-from-front        = false;

# Shadows
# =======
shadow               = false;
shadow-offset-x      = -20;
shadow-offset-y      = 20;
shadow-opacity       = 0.5;
shadow-radius        = 20;
shadow-ignore-shaped = true;
shadow-exclude       = [
  "class_g = 'Firefox' && argb",
  "name   *= 'Chromium'",
  "name   *= 'compton'",
];

# Opacity
# =======
inactive-opacity          = 1;
active-opacity            = 1;
frame-opacity             = 1;
inactive-opacity-override = false;


# Blur
# ====
blur: {
  method:    "kernel";
  size:      20;
  deviation: 10;
}

# Fade
# ====
fading               = true;
fade-delta           = 5;
fade-in-step         = 0.02;
fade-out-step        = 0.02;
fade-exclude         = [];

# Other
# =====
drm = true;
mark-wmwin-focused     = true;
mark-ovredir-focused   = true;
use-ewmh-active-win    = true;
detect-rounded-corners = true;
detect-client-opacity  = true;
refresh-rate           = 0;
vsync                  = true;
dbe                    = false;
#sw-opti               = true;
unredir-if-possible    = false;
detect-transient       = true;
detect-client-leader   = true;
focus-exclude          = [];

# Window Types
# ============
wintypes: {
  tooltip       = { fade = true; shadow = false; };
  menu          = { fade = true; shadow = false;  };
  popup_menu    = { fade = true; shadow = false;  };
  dropdown_menu = { fade = true; shadow = false;  };
  utility       = { fade = true; shadow = false;  };
  dialog        = { fade = true; shadow = false;  };
  notify        = { fade = true; shadow = false;  };
  unknown       = { fade = true; shadow = false;  };
};

# XSync
# =====
xrender-sync-fence = true;
 

x

polybar(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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
;==========================================================
;
;
;   ██████╗  ██████╗ ██╗  ██╗   ██╗██████╗  █████╗ ██████╗
;   ██╔══██╗██╔═══██╗██║  ╚██╗ ██╔╝██╔══██╗██╔══██╗██╔══██╗
;   ██████╔╝██║   ██║██║   ╚████╔╝ ██████╔╝███████║██████╔╝
;   ██╔═══╝ ██║   ██║██║    ╚██╔╝  ██╔══██╗██╔══██║██╔══██╗
;   ██║     ╚██████╔╝███████╗██║   ██████╔╝██║  ██║██║  ██║
;   ╚═╝      ╚═════╝ ╚══════╝╚═╝   ╚═════╝ ╚═╝  ╚═╝╚═╝  ╚═╝
;
;
;==========================================================



[colors]
#background = ${xrdb:color0:#222}
background = #222
background-alt = transparent
#foreground = ${xrdb:color7:#222}
foreground = #55aa55 
foreground-alt = #555
primary = #55aa55
secondary = #122E0D
alert = #EA3636

###зеленый текст бара (был этот ##dfdfdf)

[bar/mybar]
#monitor = ${env:MONITOR:HDMI-1}
width = 100%
height = 24

#offset-x = 1%
#offset-y = 1%

radius = 6.0
fixed-center = false
locale = ru_RU.UTF-8

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



line-size = 3
line-color = #f00


border-size = 4
border-color = #00000000

padding-left = 2
padding-right = 2

module-margin-left = 2
module-margin-right = 2

#font-0 = liberation:pixelsize=10;1
#font-1 = FontAwesome:fontformat=truetype:size=8:antialias=false;0
#font-2 = awesome:pixelsize=10;1


font-0 = fixed:pixelsize=10;1
font-1 = unifont:fontformat=truetype:size=8:antialias=false;0
font-2 = siji:pixelsize=10;1
font-3 = Material Icons:style=Regular
font-4 = FontAwesome 5 Free:size=10:style=Solid;3


modules-left =  i3 date openweathermap-forecast
modules-center = 
modules-right = temperature  memory cpu wlan pulseaudio battery xkeyboard 

tray-position = right
tray-padding = 2
tray-transparent = true
#tray-background = #0063ff

wm-restack = i3

;override-redirect = true

scroll-up = i3wm-wsnext
scroll-down = i3wm-wsprev

cursor-click = pointer
cursor-scroll = ns-resize



[module/xwindow]
type = internal/xwindow
label = %title:0:30:...%



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

;format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
format-prefix-underline = ${colors.secondary}

label-layout =  Язык  %layout%
;label-layout-underline = ${colors.secondary}

label-indicator-padding = 2
label-indicator-margin = 1
label-indicator-background = ${colors.secondary}
label-indicator-underline = ${colors.secondary}

[module/openweathermap-forecast]
type = custom/script
exec = ~/.config/polybar/openweathermap-forecast.sh
interval = 600
label-font = 6


[module/filesystem]
type = internal/fs
interval = 25

mount-0 = /

label-mounted = %{F#0a81f5}%mountpoint%%{F-}: %percentage_used%%
label-unmounted = %mountpoint% not mounted
label-unmounted-foreground = ${colors.foreground-alt}

[module/bspwm]
type = internal/bspwm

label-focused = %index%
label-focused-background = ${colors.background-alt}
label-focused-underline= ${colors.primary}
label-focused-padding = 2

label-occupied = %index%
label-occupied-padding = 2

label-urgent = %index%!
label-urgent-background = ${colors.alert}
label-urgent-padding = 2

label-empty = %index%
label-empty-foreground = ${colors.foreground-alt}
label-empty-padding = 2

; Separator in between workspaces
; label-separator = |



[module/i3]
type = internal/i3
format = <label-state> <label-mode>
index-sort = true
wrapping-scroll = false

; Only show workspaces on the same output as the bar
;pin-workspaces = true

label-mode-padding = 2
label-mode-foreground = #000
label-mode-background = ${colors.primary}

; focused = Active workspace on focused monitor
label-focused = %index%
label-focused-background = ${colors.background-alt}
label-focused-underline= ${colors.primary}
label-focused-padding = 2

; unfocused = Inactive workspace on any monitor
label-unfocused = %index%
label-unfocused-padding = 2

; visible = Active workspace on unfocused monitor
label-visible = %index%
label-visible-background = ${self.label-focused-background}
label-visible-underline = ${self.label-focused-underline}
label-visible-padding = ${self.label-focused-padding}

; urgent = Workspace with urgency hint set
label-urgent = %index%
label-urgent-background = ${colors.alert}
label-urgent-padding = 2

; Separator in between workspaces
; label-separator = |



[module/xbacklight]
type = internal/xbacklight

format = <label> <bar>
label = BL

bar-width = 10
bar-indicator = |
bar-indicator-foreground = #fff
bar-indicator-font = 2
bar-fill =
bar-fill-font = 2
bar-fill-foreground = #9f78e1
bar-empty =
bar-empty-font = 2
bar-empty-foreground = ${colors.foreground-alt}


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



[module/cpu]
type = internal/cpu
interval = 2
format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
;format-underline = #f90000
label =  Нагрузка %percentage:2%%



[module/memory]
type = internal/memory
interval = 2
format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
;format-underline = #4bffdc
label =  Память %percentage_used%%



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

format-connected =  Сигнал: <ramp-signal> 
;format-connected-underline = #9f78e1

;format-disconnected =
format-disconnected = <label-disconnected>
;format-disconnected-underline = ${self.format-connected-underline}
;label-disconnected = %ifname% disconnected
;label-disconnected-foreground = ${colors.foreground-alt}
label-disconnected = НЕТ СИГНАЛА
label-disconnected-foreground = #DF2929

ramp-signal-0 = очень слабый
ramp-signal-1 = низкий
ramp-signal-2 = средний
ramp-signal-3 = сильный
ramp-signal-4 = очень сильный
ramp-signal-foreground = ${colors.foreground}
ramp-signal-framerate = 1000


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

format-connected-underline = #55aa55
format-connected-prefix = " "
format-connected-prefix-foreground = ${colors.foreground-alt}
label-connected = %local_ip%

format-disconnected =
;format-disconnected = <label-disconnected>
;format-disconnected-underline = ${self.format-connected-underline}
;label-disconnected = %ifname% disconnected
;label-disconnected-foreground = ${colors.foreground-alt}

[module/date]
type = internal/date
interval = 1
dqate =
time =%{F#E0D9FF} %H:%M:%S 

#клик ЛКМ на время открывает дату
date-alt =%{F#E0D9FF} %a %e %B %Y
time-alt = %H:%M

format-prefix =
#format-prefix-foreground = ${colors.foreground-alt}
#format-overline = #7163AF
#format-underline = #7163AF
label = %date% %time%

#Фон для модуля
#format-background = #7163AF
#format-foreground = #E0D9FF


[module/pulseaudio]
type = internal/pulseaudio

format-volume = <label-volume> <bar-volume>
label-volume =  Громкость  %percentage%%
label-volume-foreground = ${root.foreground}

label-muted = ВЫКЛЮЧЕНО
label-muted-foreground = #DF2929

bar-volume-width = 15
bar-volume-foreground-0 = #55aa55
bar-volume-foreground-1 = #55aa55
bar-volume-foreground-2 = #55aa55
bar-volume-foreground-3 = #55aa55
bar-volume-foreground-4 = #55aa55
bar-volume-foreground-5 = #f5a70a
bar-volume-foreground-6 = #f5a70a
bar-volume-foreground-7 = #ff5555
bar-volume-foreground-8 = #ff5555
bar-volume-gradient = false
bar-volume-indicator = |
bar-volume-indicator-font = 2
bar-volume-fill =
bar-volume-fill-font = 2
bar-volume-empty =
bar-volume-empty-font = 2
bar-volume-empty-foreground = ${colors.foreground-alt}



[module/alsa]
type = internal/alsa

format-volume = <label-volume> <bar-volume>
label-volume = VOL
label-volume-foreground = ${root.foreground}

format-muted-prefix = " "
format-muted-foreground = ${colors.foreground-alt}
label-muted = sound muted

bar-volume-width = 10
bar-volume-foreground-0 = #55aa55
bar-volume-foreground-1 = #55aa55
bar-volume-foreground-2 = #55aa55
bar-volume-foreground-3 = #55aa55
bar-volume-foreground-4 = #55aa55
bar-volume-foreground-5 = #f5a70a
bar-volume-foreground-6 = #ff5555
bar-volume-gradient = false
bar-volume-indicator = |
bar-volume-indicator-font = 2
bar-volume-fill =
bar-volume-fill-font = 2
bar-volume-empty =
bar-volume-empty-font = 2
bar-volume-empty-foreground = ${colors.foreground-alt}





[module/battery]
type = internal/battery
label-font = 5
full-at = 98

battery = BAT1
adapter = ADP1

label-full =%percentage%%
label-charging = Заряжается %percentage%%
format-charging = <animation-charging> <label-charging>

label-discharging = РАЗРЯЖАЕТСЯ %percentage%%
label-discharging-foreground = #DF2929
format-discharging = <label-discharging>

animation-charging-0 =
animation-charging-1 =
animation-charging-2 =
animation-charging-3 =
animation-charging-4 =
animation-charging-framerate = 250



[module/temperature]
type = internal/temperature
thermal-zone = 0
warn-temperature = 75

label = Температура %temperature%
label-warn = ЖАРКО!  %temperature%
;label-warn-foreground = #CA4E4E
label-warn-foreground = #DF2929
#format-overline = #DFC257
#format-underline = #DFC257
format-warn-underline = #CA4E4E
interval = 10

format = <ramp> <label>
format-warn = <ramp> <label-warn>
ramp-0 = 
ramp-1 =
ramp-2 =
ramp-foreground = ${root.foreground}
;ramp-foreground = #FBE191
;ramp-foreground = ${colors.foreground-icon}



[settings]
screenchange-reload = true
;compositing-background = xor
;compositing-background = screen
;compositing-foreground = source
;compositing-border = over
;pseudo-transparency = false

[global/wm]
margin-top = 5
margin-bottom = 5

; vim:ft=dosini
 

x

launch.sh(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#!/bin/bash

# Завершить текущие экземпляры polybar
killall -q polybar

# Ожидание полного завершения работы процессов
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done

# Запуск Polybar со стандартным расположением конфигурационного файла в ~/.config/polybar/config
polybar mybar &

#echo "Polybar загрузился..."
 

x

openweathermap(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
#!/bin/sh
# название файла- openweathermap-forecast.sh
get_icon() {
    case $1 in
        # Icons for weather-icons
        01d) icon="Чистое небо";;
        01n) icon="Чистое небо";;
        02d) icon="Облачность";;
        02n) icon="Облачность";;
        03*) icon="Мал.обл";;
        04*) icon="Мал.обл";;
        09d) icon="Дождь";;
        09n) icon="Дождь";;
        10d) icon="Дождик";;
        10n) icon="Дождик";;
        11d) icon="Гроза";;
        11n) icon="Гроза";;
        13d) icon="Снег";;
        13n) icon="Снег";;
        50d) icon="Туман";;
        50n) icon="Туман";;
        *) icon="";

        # Icons for Font Awesome 5 Pro
        #01d) icon="";;
        #01n) icon="";;
        #02d) icon="";;
        #02n) icon="";;
        #03d) icon="";;
        #03n) icon="";;
        #04*) icon="";;
        #09*) icon="";;
        #10d) icon="";;
        #10n) icon="";;
        #11*) icon="";;
        #13*) icon="";;
        #50*) icon="";;
        #*) icon="";
    esac

    echo $icon
}

KEY="сюда вставьте ключ полученный на сайте openweathermap.org"
CITY="сюда код города(в адресной строке браузера с найденым городом на вышеуказанном сайте- адрес заканчивается этим кодом!)"
UNITS="metric"
SYMBOL="°"

API="https://api.openweathermap.org/data/2.5"

if [ -n "$CITY" ]; then
    if [ "$CITY" -eq "$CITY" ] 2>/dev/null; then
        CITY_PARAM="id=$CITY"
    else
        CITY_PARAM="q=$CITY"
    fi

    weather=$(curl -sf "$API/weather?appid=$KEY&$CITY_PARAM&units=$UNITS")
else
    location=$(curl -sf https://location.services.mozilla.com/v1/geolocate?key=geoclue)

    if [ -n "$location" ]; then
        location_lat="$(echo "$location" | jq '.location.lat')"
        location_lon="$(echo "$location" | jq '.location.lng')"

        weather=$(curl -sf "$API/weather?appid=$KEY&lat=$location_lat&lon=$location_lon&units=$UNITS")
    fi
fi

if [ -n "$weather" ]; then
    weather_temp=$(echo "$weather" | jq ".main.temp" | cut -d "." -f 1)
    weather_icon=$(echo "$weather" | jq -r ".weather[0].icon")

    echo "$(get_icon "$weather_icon")" "$weather_temp$SYMBOL"
fi
 

x

Comments

simurgh said about 1 month ago

subl3 rofi meld nitrogen picom caja\pcmanfm-qt flameshot clipman-plugin crow-translate ristretto audacious mc sakura smplayer simplescreenrecorder guvcview pavucontrol