aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclarkzjw <[email protected]>2022-11-17 10:56:25 -0800
committerclarkzjw <[email protected]>2022-11-17 10:56:25 -0800
commitd2d735742ca61b211c9b48a2209d36395daebcf4 (patch)
treebda27729a1bbac3ab354a1f10d4885899cdbf967 /dot_config/i3
parenta6d2e5e6fb9adc84c32e86630b4846b1765c7d77 (diff)
downloaddotfiles-d2d735742ca61b211c9b48a2209d36395daebcf4.tar.gz
+ add existing config
Diffstat (limited to 'dot_config/i3')
-rw-r--r--dot_config/i3/config631
-rw-r--r--dot_config/i3/i3blocks.conf182
-rw-r--r--dot_config/i3/keybindings106
-rw-r--r--dot_config/i3/scripts/executable_bandwidth2105
-rw-r--r--dot_config/i3/scripts/executable_battery-pinebook-pro18
-rw-r--r--dot_config/i3/scripts/executable_battery1114
-rw-r--r--dot_config/i3/scripts/executable_battery2106
-rw-r--r--dot_config/i3/scripts/executable_blur-lock11
-rw-r--r--dot_config/i3/scripts/executable_cpu_usage62
-rw-r--r--dot_config/i3/scripts/executable_disk48
-rw-r--r--dot_config/i3/scripts/executable_keyboard-layout5
-rw-r--r--dot_config/i3/scripts/executable_keyhint25
-rw-r--r--dot_config/i3/scripts/executable_keyhint-26
-rw-r--r--dot_config/i3/scripts/executable_literal_empty_workspace10
-rw-r--r--dot_config/i3/scripts/executable_memory69
-rw-r--r--dot_config/i3/scripts/executable_openweather93
-rw-r--r--dot_config/i3/scripts/executable_openweather-city43
-rw-r--r--dot_config/i3/scripts/executable_openweather.conf5
-rw-r--r--dot_config/i3/scripts/executable_power-profiles190
-rw-r--r--dot_config/i3/scripts/executable_powermenu186
-rw-r--r--dot_config/i3/scripts/executable_ppd-status11
-rw-r--r--dot_config/i3/scripts/executable_temperature86
-rw-r--r--dot_config/i3/scripts/executable_volume93
-rw-r--r--dot_config/i3/scripts/executable_vpn25
-rw-r--r--dot_config/i3/scripts/executable_worldclock122
25 files changed, 2352 insertions, 0 deletions
diff --git a/dot_config/i3/config b/dot_config/i3/config
new file mode 100644
index 0000000..bb07f08
--- /dev/null
+++ b/dot_config/i3/config
@@ -0,0 +1,631 @@
1# This file is a modified version based on default i3-config-wizard config
2# source is available here:
3# https://raw.githubusercontent.com/endeavouros-team/endeavouros-i3wm-setup/master/.config/i3/config
4# Maintainer: joekamprad [[email protected]]
5# https://endeavouros.com
6#
7# iconic font icon search: https://fontawesome.com/v4.7/cheatsheet/
8#
9# --> to update this run the following command (will backup existing setup file)
10# wget --backups=1 https://raw.githubusercontent.com/endeavouros-team/endeavouros-i3wm-setup/main/.config/i3/config -P ~/.config/i3/
11#
12# Endeavouros-i3 config file
13# Source for complete framework of our i3 config and theming here: https://github.com/endeavouros-team/endeavouros-i3wm-setup
14# EndeavourOS wiki holds some Information also: https://discovery.endeavouros.com/window-tiling-managers/i3-wm/
15# Please see http://i3wm.org/docs/userguide.html for the official i3 reference!
16
17#######################
18# config starts here: #
19#######################
20
21# Font for window titles. Will also be used by the bar unless a different font
22# is used in the bar {} block below.
23# This font is widely installed, provides lots of unicode glyphs, right-to-left
24# text rendering and scalability on retina/hidpi displays (thanks to pango).
25font pango: Noto Sans Regular 11
26
27# set the mod key to the winkey:
28set $mod Mod4
29
30#####################
31# workspace layout: #
32#####################
33
34# default i3 tiling mode:
35workspace_layout default
36
37# i3 stacking layout:
38# Each window will be fullscreen and tabbed top to bottom.
39workspace_layout tabbed
40#workspace_layout stacking
41
42# i3 tabbed layout:
43# Each new window will open fullscreen as a tab (left to right)
44#workspace_layout tabbed
45
46##############################
47# extra options for windows: #
48##############################
49
50#border indicator on windows:
51#new_window pixel 1
52
53# thin borders
54# hide_edge_borders both
55
56# Set inner/outer gaps
57#gaps inner 0
58#gaps outer 0
59
60# show window title bars (not officially supported with i3gaps)
61#default_border normal
62
63# window title alignment
64#title_align center
65
66# Use Mouse+$mod to drag floating windows to their wanted position
67floating_modifier $mod
68
69# switch/iterate between workspaces
70bindsym $mod+Tab workspace next
71bindsym $mod+Shift+Tab workspace prev
72
73# switch to workspace
74bindsym $mod+1 workspace $ws1
75bindsym $mod+2 workspace $ws2
76bindsym $mod+3 workspace $ws3
77bindsym $mod+4 workspace $ws4
78bindsym $mod+5 workspace $ws5
79bindsym $mod+6 workspace $ws6
80bindsym $mod+7 workspace $ws7
81bindsym $mod+8 workspace $ws8
82bindsym $mod+9 workspace $ws9
83bindsym $mod+0 workspace $ws10
84
85# switch to workspace with numpad keys
86bindcode $mod+87 workspace 1
87bindcode $mod+88 workspace 2
88bindcode $mod+89 workspace 3
89bindcode $mod+83 workspace 4
90bindcode $mod+84 workspace 5
91bindcode $mod+85 workspace 6
92bindcode $mod+79 workspace 7
93bindcode $mod+80 workspace 8
94bindcode $mod+81 workspace 9
95bindcode $mod+90 workspace 10
96
97# switch to workspace with numlock numpad keys
98bindcode $mod+Mod2+87 workspace $ws1
99bindcode $mod+Mod2+88 workspace $ws2
100bindcode $mod+Mod2+89 workspace $ws3
101bindcode $mod+Mod2+83 workspace $ws4
102bindcode $mod+Mod2+84 workspace $ws5
103bindcode $mod+Mod2+85 workspace $ws6
104bindcode $mod+Mod2+79 workspace $ws7
105bindcode $mod+Mod2+80 workspace $ws8
106bindcode $mod+Mod2+81 workspace $ws9
107bindcode $mod+Mod2+90 workspace $ws10
108
109# move focused container to workspace
110bindsym $mod+Shift+1 move container to workspace $ws1
111bindsym $mod+Shift+2 move container to workspace $ws2
112bindsym $mod+Shift+3 move container to workspace $ws3
113bindsym $mod+Shift+4 move container to workspace $ws4
114bindsym $mod+Shift+5 move container to workspace $ws5
115bindsym $mod+Shift+6 move container to workspace $ws6
116bindsym $mod+Shift+7 move container to workspace $ws7
117bindsym $mod+Shift+8 move container to workspace $ws8
118bindsym $mod+Shift+9 move container to workspace $ws9
119bindsym $mod+Shift+0 move container to workspace $ws10
120
121# move focused container to workspace with numpad keys
122bindcode $mod+Shift+Mod2+87 move container to workspace $ws1
123bindcode $mod+Shift+Mod2+88 move container to workspace $ws2
124bindcode $mod+Shift+Mod2+89 move container to workspace $ws3
125bindcode $mod+Shift+Mod2+83 move container to workspace $ws4
126bindcode $mod+Shift+Mod2+84 move container to workspace $ws5
127bindcode $mod+Shift+Mod2+85 move container to workspace $ws6
128bindcode $mod+Shift+Mod2+79 move container to workspace $ws7
129bindcode $mod+Shift+Mod2+80 move container to workspace $ws8
130bindcode $mod+Shift+Mod2+81 move container to workspace $ws9
131bindcode $mod+Shift+Mod2+90 move container to workspace $ws10
132
133# move focused container to workspace with numpad keys
134bindcode $mod+Shift+87 move container to workspace $ws1
135bindcode $mod+Shift+88 move container to workspace $ws2
136bindcode $mod+Shift+89 move container to workspace $ws3
137bindcode $mod+Shift+83 move container to workspace $ws4
138bindcode $mod+Shift+84 move container to workspace $ws5
139bindcode $mod+Shift+85 move container to workspace $ws6
140bindcode $mod+Shift+79 move container to workspace $ws7
141bindcode $mod+Shift+80 move container to workspace $ws8
142bindcode $mod+Shift+81 move container to workspace $ws9
143bindcode $mod+Shift+90 move container to workspace $ws10
144
145# resize window (you can also use the mouse for that):
146mode "resize" {
147 bindsym h resize shrink width 10 px or 10 ppt
148 bindsym k resize grow height 10 px or 10 ppt
149 bindsym j resize shrink height 10 px or 10 ppt
150 bindsym l resize grow width 10 px or 10 ppt
151
152 # same bindings, but for the arrow keys
153 bindsym Left resize shrink width 10 px or 10 ppt
154 bindsym Up resize grow height 10 px or 10 ppt
155 bindsym Down resize shrink height 10 px or 10 ppt
156 bindsym Right resize grow width 10 px or 10 ppt
157
158 # back to normal: Enter or Escape
159 # bindsym Return mode "default"
160 bindsym Escape mode "default"
161}
162
163bindsym $mod+r mode "resize"
164bindsym $mod+space [floating] resize set 1280 800
165
166######################################
167# keybindings for different actions: #
168######################################
169
170# start a terminal
171bindsym $mod+Return exec xfce4-terminal
172
173# kill focused window
174bindsym $mod+q kill
175
176# exit-menu
177bindsym $mod+Shift+e exec ~/.config/i3/scripts/powermenu
178
179# Lock the system
180# lock with a picture:
181#bindsym $mod+l exec i3lock -i ~/.config/i3/i3-lock-screen.png -p default|win -t
182# lock by blurring the screen:
183bindsym $mod+l exec ~/.config/i3/scripts/blur-lock
184
185# reload the configuration file
186bindsym $mod+Shift+c reload
187
188# restart i3 inplace (preserves your layout/session, can be used to update i3)
189bindsym $mod+Shift+r restart
190
191# keybinding in fancy rofi (automated):
192bindsym F1 exec ~/.config/i3/scripts/keyhint-2
193# alternative
194# keybinding list in editor:
195# bindsym $mod+F1 exec xed ~/.config/i3/keybindings
196
197# Backlight control
198bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight +5 && notify-send "Brightness - $(xbacklight -get | cut -d '.' -f 1)%"
199bindsym XF86MonBrightnessDown exec --no-startup-id xbacklight -5 && notify-send "Brightness - $(xbacklight -get | cut -d '.' -f 1)%"
200
201# change focus
202bindsym $mod+j focus left
203bindsym $mod+k focus down
204bindsym $mod+b focus up
205bindsym $mod+o focus right
206
207# alternatively, you can use the cursor keys:
208bindsym $mod+Left focus left
209bindsym $mod+Down focus down
210bindsym $mod+Up focus up
211bindsym $mod+Right focus right
212
213# move focused window
214bindsym $mod+Shift+j move left
215bindsym $mod+Shift+k move down
216bindsym $mod+Shift+b move up
217bindsym $mod+Shift+o move right
218
219# alternatively, you can use the cursor keys:
220bindsym $mod+Shift+Left move left
221bindsym $mod+Shift+Down move down
222bindsym $mod+Shift+Up move up
223bindsym $mod+Shift+Right move right
224
225# split in horizontal orientation
226bindsym $mod+h split h
227
228# split in vertical orientation
229bindsym $mod+v split v
230
231# enter fullscreen mode for the focused container
232bindsym $mod+f fullscreen toggle
233
234# change container layout (stacked, tabbed, toggle split)
235bindsym $mod+s layout stacking
236bindsym $mod+g layout tabbed
237bindsym $mod+e layout toggle split
238
239# toggle tiling / floating
240bindsym $mod+Shift+space floating toggle
241
242# change focus between tiling / floating windows
243#bindsym $mod+space focus mode_toggle
244
245# focus the parent container
246bindsym $mod+a focus parent
247
248# open new empty workspace
249bindsym $mod+Shift+n exec --no-startup-id ~/.config/i3/scripts/empty_workspace
250
251# Multimedia Keys
252
253# volume
254bindsym XF86AudioRaiseVolume exec --no-startup-id amixer -D pulse sset Master 5%+ && pkill -RTMIN+1 i3blocks
255bindsym XF86AudioLowerVolume exec --no-startup-id amixer -D pulse sset Master 5%- && pkill -RTMIN+1 i3blocks
256
257# gradular volume control
258bindsym $mod+XF86AudioRaiseVolume exec --no-startup-id amixer -D pulse sset Master 1%+ && pkill -RTMIN+1 i3blocks
259bindsym $mod+XF86AudioLowerVolume exec --no-startup-id amixer -D pulse sset Master 1%- && pkill -RTMIN+1 i3blocks
260
261# mute
262bindsym XF86AudioMute exec --no-startup-id amixer sset Master toggle && killall -USR1 i3blocks
263
264# audio control
265bindsym XF86AudioPlay exec --no-startup-id playerctl play
266bindsym XF86AudioPause exec --no-startup-id playerctl pause
267bindsym XF86AudioNext exec --no-startup-id playerctl next
268bindsym XF86AudioPrev exec --no-startup-id playerctl previous
269
270# Redirect sound to headphones
271#bindsym $mod+p exec /usr/local/bin/switch-audio-port
272
273## App shortcuts
274bindsym $mod+w exec /usr/bin/firefox
275bindsym $mod+n exec /usr/bin/thunar
276bindsym Print exec --no-startup-id mkdir -p ~/Pictures/Screenshot/`date +"%Y/%m"` && scrot ~/Pictures/Screenshot/%Y/%m/%Y-%m-%d-%T-screenshot.png && notify-send "Screenshot saved"
277
278# Power Profiles menu switcher (rofi)
279bindsym $mod+Shift+p exec --no-startup-id ~/.config/i3/scripts/power-profiles
280
281##########################################
282# configuration for workspace behaviour: #
283##########################################
284
285# Define names for default workspaces for which we configure key bindings later on.
286# We use variables to avoid repeating the names in multiple places.
287set $ws1 "1:"
288set $ws2 "2:"
289set $ws3 "3:"
290set $ws4 "4:"
291set $ws5 "5:"
292set $ws6 "6"
293set $ws7 "7"
294set $ws8 "8"
295set $ws9 "9"
296set $ws10 "10"
297
298# use workspaces on different displays:
299# where you have to replace VGA-0/HDMI-0 with the names for your displays
300# you can get from xrandr command
301#workspace $ws1 output VGA-0
302#workspace $ws2 output VGA-0
303#workspace $ws3 output HDMI-0
304#workspace $ws4 output HDMI-0
305#workspace $ws5 output HDMI-0
306
307# bind program to workspace and focus to them on startup:
308#assign [class="Xfce4-terminal"] $ws1
309assign [class="jetbrains-clion"] $ws1
310assign [class="Thunar"] $ws3
311assign [class="thunderbird"] $ws4
312assign [class="TelegramDesktop"] $ws5
313assign [class="discord"] $ws5
314assign [class="Microsoft Teams - Preview"] $ws5
315
316# automatic set focus new window if it opens on another workspace then the current:
317for_window [class=Xfce4-terminal] focus
318for_window [class=(?i)firefox] focus
319for_window [class=Thunar] focus
320for_window [class=thunderbird] focus
321for_window [class=TelegramDesktop] focus
322for_window [class="Microsoft Teams - Preview"] focus
323
324##############
325# compositor #
326##############
327
328# transparency
329# uncomment one of them to be used (picom package is installed per default)
330# options could need changes, related to used GPU and drivers.
331# to find the right setting consult the archwiki or ask at the forum.
332#
333# xcompmgr: https://wiki.archlinux.org/title/Xcompmgr
334# manpage: https://man.archlinux.org/man/xcompmgr.1.en
335#exec --no-startup-id xcompmgr -C -n &
336# or an more specialized config like this:
337#exec --no-startup-id xcompmgr -c -C -t-5 -l-5 -r4.2 -o.55 &
338#
339# or:
340#
341# picom: https://wiki.archlinux.org/title/Picom
342# manpage: https://man.archlinux.org/man/picom.1.en
343# The default configuration is available in /etc/xdg/picom.conf
344# For modifications, it can be copied to ~/.config/picom/picom.conf or ~/.config/picom.conf
345#
346# using default config
347#exec_always --no-startup-id picom --backed glx --vsync
348#exec_always --no-startup-id picom -b
349#
350# for custom config:
351exec_always --no-startup-id picom --config ~/.config/picom.conf
352
353#############################################
354# autostart applications/services on login: #
355#############################################
356
357#get auth work with polkit-gnome
358exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
359
360#ibus daemon
361exec --no-startup-id env GDK_SCALE=1 ibus-daemon -drxR
362
363#fcitx5 daemon
364#exec --no-startup-id fcitx5 -d
365
366# dex execute .desktop files + apps using /etc/xdg/autostart.
367# when second to i3 a DE is installed or mixed usage of i3 + xfce4 or GNOME
368# in this cases better disable dex and use manual starting apps using xdg/autostart
369# if enabled you should comment welcome app.
370# https://github.com/jceb/dex
371#exec --no-startup-id dex -a -s /etc/xdg/autostart/:~/.config/autostart/
372exec --no-startup-id dex --autostart --environment i3
373
374# start welcome app
375#exec --no-startup-id sh /usr/share/endeavouros/scripts/welcome --startdelay=3
376
377# num lock activated
378#exec --no-startup-id numlockx on
379
380# configure multiple keyboard layouts and hotkey to switch (Alt+CAPSLOCK in this example)
381#exec --no-startup-id setxkbmap -layout 'us,sk' -variant altgr-intl,qwerty -option 'grp:alt_caps_toggle'
382
383# start conky:
384#exec_always --no-startup-id conky
385
386# start a script to setup displays
387# uncomment the next line, use arandr to setup displays and save the file as monitor:
388exec --no-startup-id ~/.screenlayout/monitor.sh
389
390# set wallpaper
391exec --no-startup-id sleep 2 && nitrogen --restore
392#exec --no-startup-id feh --bg-fill /usr/share/endeavouros/backgrounds/endeavouros_i3.png
393
394# set powersavings for display:
395#exec --no-startup-id xset s 0 dpms 600 600 600
396
397# disable power saving (for example if using xscreensaver)
398exec --no-startup-id xset -dpms
399
400# use xautolock to use autosuspend rules for mobile devices
401# https://wiki.archlinux.org/title/Session_lock#xautolock
402#exec --no-startup-id xautolock -time 60 -locker "systemctl suspend"
403
404
405# xscreensaver
406# https://www.jwz.org/xscreensaver
407#exec --no-startup-id xscreensaver --no-splash
408
409# Desktop notifications
410exec --no-startup-id dunst --config ~/.config/dunst/dunstrc
411# alternative if you installed aside with XFCE4:
412#exec --no-startup-id env GDK_SCALE=2 /usr/lib/xfce4/notifyd/xfce4-notifyd &
413
414# autotiling script
415# https://github.com/nwg-piotr/autotiling
416# `yay -S autotiling ;) (it is in AUR)
417#exec_always --no-startup-id autotiling
418
419# Autostart apps as you like
420#exec --no-startup-id sleep 2 && xfce4-terminal
421#exec --no-startup-id sleep 7 && firefox https://github.com/endeavouros-team/endeavouros-i3wm-setup/blob/main/force-knowledge.md
422#exec --no-startup-id sleep 3 && thunar
423exec --no-startup-id sleep 1 && thunderbird
424
425###############
426# system tray #
427###############
428# if you do not use dex: exec --no-startup-id dex --autostart --environment i3
429# you need to have tray apps started manually one by one:
430
431# start blueberry app for managing bluetooth devices from tray:
432#exec --no-startup-id blueberry-tray
433
434# networkmanager-applet
435#exec --no-startup-id nm-applet
436
437# clipman-applet
438#exec --no-startup-id xfce4-clipman
439
440##################
441# floating rules #
442##################
443
444# set floating (nontiling) for apps needing it
445for_window [class="Yad" instance="yad"] floating enable
446for_window [class="Galculator" instance="galculator"] floating enable
447for_window [class="Blueberry.py" instance="blueberry.py"] floating enable
448
449# set floating (nontiling) for special apps
450for_window [class="Xsane" instance="xsane"] floating enable
451for_window [class="Pavucontrol" instance="pavucontrol"] floating enable
452for_window [class="qt5ct" instance="qt5ct"] floating enable
453for_window [class="Blueberry.py" instance="blueberry.py"] floating enable
454for_window [class="Bluetooth-sendto" instance="bluetooth-sendto"] floating enable
455for_window [class="Pamac-manager"] floating enable
456for_window [window_role="About"] floating enable
457for_window [class="copyq"] floating enable
458for_window [class="Nm-connection-editor"] floating enable
459for_window [class="flameshot"] floating enable
460for_window [class="TelegramDesktop"] floating enable resize set 1300 1200
461for_window [class="eudic"] floating enable resize set 800 800
462
463# Make the currently focused window a scratchpad
464bindsym $mod+Shift+m move scratchpad
465
466# Show the first scratchpad window
467bindsym $mod+m scratchpad show
468
469# set border of floating window
470for_window [class="urxvt"] border pixel 1
471
472# set size of floating window
473#for_window [window_role="(?i)GtkFileChooserDialog"] resize set 640 480 #to set size of file choose dialog
474#for_window [class=".*"] resize set 1280 680 #to change size of all floating windows
475
476# set position of floating window
477for_window [class=".*"] move position center
478
479######################################
480# color settings for bar and windows #
481######################################
482
483# Define colors variables:
484set $darkbluetrans #08052be6
485set $darkblue #08052b
486set $lightblue #5294e2
487set $urgentred #e53935
488set $white #ffffff
489set $black #000000
490set $purple #e345ff
491set $darkgrey #383c4a
492set $grey #b0b5bd
493set $mediumgrey #8b8b8b
494set $yellowbrown #e1b700
495
496# define colors for windows:
497#class border bground text indicator child_border
498client.focused $lightblue $darkblue $white $mediumgrey $mediumgrey
499client.unfocused $darkblue $darkblue $grey $darkgrey $darkgrey
500client.focused_inactive $darkblue $darkblue $grey $black $black
501client.urgent $urgentred $urgentred $white $yellowbrown $yellowbrown
502
503############################################
504# bar settings (input comes from i3blocks) #
505############################################
506
507# Start i3bar to display a workspace bar
508# (plus the system information i3status finds out, if available)
509bar {
510 font pango: Noto Sans Regular 16
511 status_command i3blocks -c ~/.config/i3/i3blocks.conf
512 position bottom
513 output eDP-1
514 i3bar_command i3bar
515 #i3bar_command i3bar --transparency
516 #tray_output none
517 tray_output primary
518 tray_padding 0
519 strip_workspace_numbers no
520
521 colors {
522 separator $purple
523 background $darkgrey
524 statusline $white
525 focused_workspace $mediumgrey $grey $darkgrey $purple
526 active_workspace $lightblue $mediumgrey $darkgrey $purple
527 inactive_workspace $darkgrey $darkgrey $grey $purple
528 urgent_workspace $urgentred $urgentred $white $purple
529 }
530}
531
532
533bar {
534 font pango: Noto Sans Regular 11
535 status_command i3blocks -c ~/.config/i3/i3blocks.conf
536 position bottom
537 i3bar_command i3bar
538 output DP-3
539 tray_output primary
540 tray_padding 0
541 strip_workspace_numbers no
542
543 colors {
544 separator $purple
545 background $darkgrey
546 statusline $white
547 focused_workspace $mediumgrey $grey $darkgrey $purple
548 active_workspace $lightblue $mediumgrey $darkgrey $purple
549 inactive_workspace $darkgrey $darkgrey $grey $purple
550 urgent_workspace $urgentred $urgentred $white $purple
551 }
552}
553
554
555bar {
556 font pango: Noto Sans Regular 11
557 status_command i3blocks -c ~/.config/i3/i3blocks.conf
558 position bottom
559 i3bar_command i3bar
560 output DP-4
561 tray_output primary
562 tray_padding 0
563 strip_workspace_numbers no
564
565 colors {
566 separator $purple
567 background $darkgrey
568 statusline $white
569 focused_workspace $mediumgrey $grey $darkgrey $purple
570 active_workspace $lightblue $mediumgrey $darkgrey $purple
571 inactive_workspace $darkgrey $darkgrey $grey $purple
572 urgent_workspace $urgentred $urgentred $white $purple
573 }
574}
575
576# you can add different bars for multidisplay setups on each display:
577# set output HDMI-0 to the display you want the bar, --transparency can be set.
578# Transparency needs rgba color codes to be used where the last two letters are the transparency factor see here:
579# https://gist.github.com/lopspower/03fb1cc0ac9f32ef38f4
580# #08052be6 --> e6=90%
581
582# bar {
583# font pango: Noto Sans Regular 10
584# status_command i3blocks -c ~/.config/i3/i3blocks-2.conf
585# i3bar_command i3bar --transparency
586# output HDMI-0
587# position bottom
588#
589# When strip_workspace_numbers is set to yes,
590# any workspace that has a name of the form
591# “[n][:][NAME]” will display only the name.
592#strip_workspace_numbers yes
593##strip_workspace_name no
594#
595# colors {
596# separator $purple
597# background $darkbluetrans
598# statusline $white
599# border bg txt indicator
600# focused_workspace $lighterblue $lighterblue $darkblue $purple
601# active_workspace $lightdblue $lightdblue $darkblue $purple
602# inactive_workspace $darkblue $darkblue $lightdblue $purple
603# urgent_workspace $urgentred $urgentred $white $purple
604# }
605#}
606
607#####################################
608# Application menu handled by rofi: #
609#####################################
610
611## rofi bindings fancy application menu ($mod+d /F9 optional disabled)
612
613bindsym $mod+d exec rofi -modi drun -show drun \
614 -config ~/.config/rofi/rofidmenu.rasi
615
616#bindsym F9 exec rofi -modi drun -show drun \
617# -config ~/.config/rofi/rofidmenu.rasi
618
619## rofi bindings for window menu ($mod+t /F10 optional disabled)
620
621bindsym $mod+t exec rofi -show window \
622 -config ~/.config/rofi/rofidmenu.rasi
623
624#bindsym F10 exec rofi -show window \
625# -config ~/.config/rofi/rofidmenu.rasi
626
627## rofi bindings to manage clipboard (install rofi-greenclip from the AUR)
628
629#exec --no-startup-id greenclip daemon>/dev/null
630#bindsym $mod+c exec --no-startup-id rofi -modi "clipboard:greenclip print" -show clipboard \
631# -config ~/.config/rofi/rofidmenu.rasi
diff --git a/dot_config/i3/i3blocks.conf b/dot_config/i3/i3blocks.conf
new file mode 100644
index 0000000..dd9f5ac
--- /dev/null
+++ b/dot_config/i3/i3blocks.conf
@@ -0,0 +1,182 @@
1# i3blocks config file changed for EndeavourOS-i3 setup
2
3# source is available here:
4# https://raw.githubusercontent.com/endeavouros-team/endeavouros-i3wm-setup/main/.config/i3/i3blocks.conf
5# Maintainer: joekamprad [[email protected]]
6# Former Visual Designer: Florent Valetti [@FLVAL EndeavourOS]
7# created for i3wm setup on EndeavourOS
8# https://endeavouros.com
9
10# cheatsheet for icon fonts used on the block-bar:
11# https://fontawesome.com/v4.7/cheatsheet/
12
13# --> to update this run the following command:
14# wget --backups=1 https://raw.githubusercontent.com/endeavouros-team/endeavouros-i3wm-setup/main/.config/i3/i3blocks.conf -P ~/.config/i3/
15
16# Please see man i3blocks for a complete reference!
17# The man page is also hosted at http://vivien.github.io/i3blocks
18
19
20# List of valid properties:
21#
22# align
23# color
24# command
25# full_text
26# instance
27# interval
28# label
29# min_width
30# name
31# separator
32# separator_block_width
33# short_text
34# signal
35# urgent
36
37# Global properties
38#
39# The top properties below are applied to every block, but can be overridden.
40separator=false
41markup=pango
42
43#[Weather]
44#command=~/.config/i3/scripts/openweather
45# or:
46#command=~/.config/i3/scripts/openweather-city
47#interval=1800
48#color=#7275b3
49
50#[terminal]
51#full_text= 
52#color=#807dfe
53#command=i3-msg -q exec xfce4-terminal
54
55#[browser]
56#full_text= 
57#color=#ff7f81
58#command=i3-msg -q exec firefox
59
60#[files]
61#full_text= 
62#color=#7f3fbf
63#command=i3-msg -q exec thunar ~/
64
65#[mail]
66#full_text= 
67#color=#dbcb75
68#command=i3-msg -q exec thunderbird
69
70#[simple-2]
71#full_text=: :
72#color=#717171
73
74# Disk usage
75#
76# The directory defaults to $HOME if the instance is not specified.
77# The script may be called with a optional argument to set the alert
78# (defaults to 10 for 10%).
79#[disk]
80#label=
81#instance=/home
82#command=~/.config/i3/scripts/disk
83#interval=30
84
85# Memory usage
86#
87# The type defaults to "mem" if the instance is not specified.
88#[memory]
89#label=
90#command=~/.config/i3/scripts/memory
91#interval=2
92
93#[cpu_usage]
94#label=
95#command=~/.config/i3/scripts/cpu_usage
96##min_width=CPU: 100.00%
97#interval=2
98
99[CPU-temperature]
100label=
101command=~/.config/i3/scripts/temperature
102interval=30
103#T_WARN=70
104#T_CRIT=90
105#SENSOR_CHIP=""
106# where SENSOR_CHIP can be find with sensors output
107# can be used also for GPU temperature or other temperature sensors lm-sensors detects.
108
109# showing name of connected network (enable for wifi use)
110[net]
111label=
112command=echo "$(LANG=C nmcli d | grep connected | awk '{print $4}' | head -n1)"
113interval=30
114
115[bandwidth]
116command=~/.config/i3/scripts/bandwidth2
117interval=persist
118
119# Battery indicator
120[battery]
121command=~/.config/i3/scripts/battery2
122# for alternative battery script change to battery1
123# change this to battery-pinebook-pro if you are running on pinebook-pro
124label=
125interval=30
126
127#[simple-2]
128#full_text=:
129#color=#717171
130
131[pavucontrol]
132full_text=
133command=pavucontrol
134
135[volume-pulseaudio]
136command=~/.config/i3/scripts/volume
137instance=Master
138interval=1
139
140# display keyboard layout name
141# for keyboard layouts switcher
142# see i3 config file
143# this needs xkblayout-state installed from the AUR:
144# https://aur.archlinux.org/packages/xkblayout-state-git
145#[keyboard-layout]
146#command=~/.config/i3/scripts/keyboard-layout
147#interval=2
148
149#[keybindings]
150#full_text=
151#command=~/.config/i3/scripts/keyhint
152
153# power-profiles-daemon implementation:
154# needs package power-profiles-daemon installed and the service running see here:
155# https://wiki.archlinux.org/title/CPU_frequency_scaling#power-profiles-daemon
156
157#set power-profile
158[ppd_menu]
159full_text=
160command=~/.config/i3/scripts/power-profiles
161color=#407437
162
163#Show the current power-profile
164#[ppd-status]
165#command=~/.config/i3/scripts/ppd-status
166#interval=5
167
168[time]
169command=date '+%a %b %d %H:%M'
170interval=1
171
172[worldclock]
173full_text=Clock
174command=~/.config/i3/scripts/worldclock
175
176[shutdown_menu]
177full_text=
178command=~/.config/i3/scripts/powermenu
179
180[simple-2]
181full_text=:
182color=#717171
diff --git a/dot_config/i3/keybindings b/dot_config/i3/keybindings
new file mode 100644
index 0000000..f5edbc6
--- /dev/null
+++ b/dot_config/i3/keybindings
@@ -0,0 +1,106 @@
1EndeavourOS i3wm Keybindings cheat sheet:
2
3--> to update this run the following command:
4wget --backups=1 https://raw.githubusercontent.com/endeavouros-team/endeavouros-i3wm-setup/main/.config/i3/keybindings -P ~/.config/i3/
5
6All sources and updates are available at GitHub:
7https://github.com/endeavouros-team/endeavouros-i3wm-setup
8
9For reference consult our WIKI:
10https://discovery.endeavouros.com/window-tiling-managers/i3-wm/
11
12 = windows key
13
14# start xfce4-terminal
15+Return
16
17# kill focused window
18+q
19
20# Application menu search by typing (fancy Rofi menu):
21+d
22
23# Window switcher menu (fancy Rofi menu):
24+t
25
26# fancy exit-menu on bottom right:
27+Shift+e
28
29# Lock the system
30# lock with a picture or blurring the screen (options in config)
31+l
32
33# reload the configuration file
34+Shift+c
35
36# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
37+Shift+r
38
39# keybinding in fancy rofi (automated)
40F1
41
42# full keybinding list in editor:
43+F1
44
45# change window focus
46+j focus left
47+k focus down
48+b focus up
49+o focus right
50
51# alternatively, you can use the cursor keys:
52+Left focus left
53+Down focus down
54+Up focus up
55+Right focus right
56
57# move a focused window
58+Shift+j move left
59+Shift+k move down
60+Shift+b move up
61+Shift+o move right
62
63# alternatively, you can use the cursor keys:
64+Shift+Left move left
65+Shift+Down move down
66+Shift+Up move up
67+Shift+Right move right
68
69# split in horizontal orientation
70+h split h
71
72# split in vertical orientation
73+v split v
74
75# enter fullscreen mode for the focused container
76+f fullscreen toggle
77
78# change container layout (stacked, tabbed, toggle split)
79+s layout stacking
80+g layout tabbed
81+e layout toggle split
82
83# toggle tiling / floating
84+Shift+space floating toggle
85
86# change focus between tiling / floating windows
87+space focus mode_toggle
88
89# focus the parent container
90+a focus parent
91
92# focus the child container
93#+d focus child
94
95# resize floating window
96+right mouse button
97
98## Multimedia Keys
99
100# Redirect sound to headphones
101+p
102
103## App shortcuts
104+w starts Firefox
105+n starts Thunar
106 Button screenshot
diff --git a/dot_config/i3/scripts/executable_bandwidth2 b/dot_config/i3/scripts/executable_bandwidth2
new file mode 100644
index 0000000..ebd398a
--- /dev/null
+++ b/dot_config/i3/scripts/executable_bandwidth2
@@ -0,0 +1,105 @@
1#!/usr/bin/env bash
2#
3# Copyright (C) 2015 James Murphy
4# Licensed under the terms of the GNU GPL v2 only.
5#
6# i3blocks blocklet script to monitor bandwidth usage
7
8iface="${BLOCK_INSTANCE}"
9iface="${IFACE:-$iface}"
10dt="${DT:-3}"
11unit="${UNIT:-KB}"
12LABEL="${LABEL:-: }" # down arrow up arrow
13#LABEL="${LABEL:-<span font='FontAwesome'> </span>}" # down arrow up arrow
14printf_command="${PRINTF_COMMAND:-"printf \"${LABEL}%1.0f/%1.0f %s/s\\n\", rx, wx, unit;"}"
15
16function default_interface {
17 ip route | awk '/^default via/ {print $5; exit}'
18}
19
20function check_proc_net_dev {
21 if [ ! -f "/proc/net/dev" ]; then
22 echo "/proc/net/dev not found"
23 exit 1
24 fi
25}
26
27function list_interfaces {
28 check_proc_net_dev
29 echo "Interfaces in /proc/net/dev:"
30 grep -o "^[^:]\\+:" /proc/net/dev | tr -d " :"
31}
32
33while getopts i:t:u:p:lh opt; do
34 case "$opt" in
35 i) iface="$OPTARG" ;;
36 t) dt="$OPTARG" ;;
37 u) unit="$OPTARG" ;;
38 p) printf_command="$OPTARG" ;;
39 l) list_interfaces && exit 0 ;;
40 h) printf \
41"Usage: bandwidth3 [-i interface] [-t time] [-u unit] [-p printf_command] [-l] [-h]
42Options:
43-i\tNetwork interface to measure. Default determined using \`ip route\`.
44-t\tTime interval in seconds between measurements. Default: 3
45-u\tUnits to measure bytes in. Default: Mb
46\tAllowed units: Kb, KB, Mb, MB, Gb, GB, Tb, TB
47\tUnits may have optional it/its/yte/ytes on the end, e.g. Mbits, KByte
48-p\tAwk command to be called after a measurement is made.
49\tDefault: printf \"<span font='FontAwesome'> </span>%%-5.1f/%%5.1f %%s/s\\\\n\", rx, wx, unit;
50\tExposed variables: rx, wx, tx, unit, iface
51-l\tList available interfaces in /proc/net/dev
52-h\tShow this help text
53" && exit 0;;
54 esac
55done
56
57check_proc_net_dev
58
59iface="${iface:-$(default_interface)}"
60while [ -z "$iface" ]; do
61 echo No default interface
62 sleep "$dt"
63 iface=$(default_interface)
64done
65
66case "$unit" in
67 Kb|Kbit|Kbits) bytes_per_unit=$((1024 / 8));;
68 KB|KByte|KBytes) bytes_per_unit=$((1024));;
69 Mb|Mbit|Mbits) bytes_per_unit=$((1024 * 1024 / 8));;
70 MB|MByte|MBytes) bytes_per_unit=$((1024 * 1024));;
71 Gb|Gbit|Gbits) bytes_per_unit=$((1024 * 1024 * 1024 / 8));;
72 GB|GByte|GBytes) bytes_per_unit=$((1024 * 1024 * 1024));;
73 Tb|Tbit|Tbits) bytes_per_unit=$((1024 * 1024 * 1024 * 1024 / 8));;
74 TB|TByte|TBytes) bytes_per_unit=$((1024 * 1024 * 1024 * 1024));;
75 *) echo Bad unit "$unit" && exit 1;;
76esac
77
78scalar=$((bytes_per_unit * dt))
79init_line=$(cat /proc/net/dev | grep "^[ ]*$iface:")
80if [ -z "$init_line" ]; then
81 echo Interface not found in /proc/net/dev: "$iface"
82 exit 1
83fi
84
85init_received=$(awk '{print $2}' <<< $init_line)
86init_sent=$(awk '{print $10}' <<< $init_line)
87
88(while true; do cat /proc/net/dev; sleep "$dt"; done) |\
89 stdbuf -oL grep "^[ ]*$iface:" |\
90 awk -v scalar="$scalar" -v unit="$unit" -v iface="$iface" '
91BEGIN{old_received='"$init_received"';old_sent='"$init_sent"'}
92{
93 received=$2
94 sent=$10
95 rx=(received-old_received)/scalar;
96 wx=(sent-old_sent)/scalar;
97 tx=rx+wr;
98 old_received=received;
99 old_sent=sent;
100 if(rx >= 0 && wx >= 0){
101 '"$printf_command"';
102 fflush(stdout);
103 }
104}
105'
diff --git a/dot_config/i3/scripts/executable_battery-pinebook-pro b/dot_config/i3/scripts/executable_battery-pinebook-pro
new file mode 100644
index 0000000..fd97370
--- /dev/null
+++ b/dot_config/i3/scripts/executable_battery-pinebook-pro
@@ -0,0 +1,18 @@
1#!/usr/bin/env bash
2#simple Shellscript for i3blocks on Pinebook pro
3#05012020 [email protected] Gerhard S.
4#battery-symbols: on Manjaro you need the awesome-terminal-fonts package installed!
5PERCENT=$(cat /sys/class/power_supply/cw2015-battery/capacity)
6STATUS=$(cat /sys/class/power_supply/cw2015-battery/status)
7case $((
8 $PERCENT >= 0 && $PERCENT <= 20 ? 1 :
9 $PERCENT > 20 && $PERCENT <= 40 ? 2 :
10 $PERCENT > 40 && $PERCENT <= 60 ? 3 :
11 $PERCENT > 60 && $PERCENT <= 80 ? 4 : 5)) in
12#
13 (1) echo $STATUS:"" :$PERCENT%;;
14 (2) echo $STATUS:"" :$PERCENT%;;
15 (3) echo $STATUS:"" :$PERCENT%;;
16 (4) echo $STATUS:"" :$PERCENT%;;
17 (5) echo $STATUS:"" :$PERCENT%;;
18esac
diff --git a/dot_config/i3/scripts/executable_battery1 b/dot_config/i3/scripts/executable_battery1
new file mode 100644
index 0000000..3b9d5a7
--- /dev/null
+++ b/dot_config/i3/scripts/executable_battery1
@@ -0,0 +1,114 @@
1#!/usr/bin/perl
2#
3# Copyright 2014 Pierre Mavro <[email protected]>
4# Copyright 2014 Vivien Didelot <[email protected]>
5#
6# Licensed under the terms of the GNU GPL v3, or any later version.
7#
8# This script is meant to use with i3blocks. It parses the output of the "acpi"
9# command (often provided by a package of the same name) to read the status of
10# the battery, and eventually its remaining time (to full charge or discharge).
11#
12# The color will gradually change for a percentage below 85%, and the urgency
13# (exit code 33) is set if there is less that 5% remaining.
14
15# Edited by Andreas Lindlbauer <[email protected]>
16
17use strict;
18use warnings;
19use utf8;
20
21# otherwise we get in console "Wide character in print at"
22binmode(STDOUT, ':utf8');
23
24# my $acpi;
25my $upower;
26my $percent;
27my $bat_state;
28my $status;
29my $ac_adapt;
30my $full_text;
31my $short_text;
32my $label = '😅';
33my $bat_number = $ENV{BLOCK_INSTANCE} || 0;
34
35open (UPOWER, "upower -i /org/freedesktop/UPower/devices/battery_BAT$bat_number | grep 'percentage' |") or die;
36$upower = <UPOWER>;
37close(UPOWER);
38
39# fail on unexpected output
40if ($upower !~ /: (\d+)%/) {
41 die "$upower\n";
42}
43
44$percent = $1;
45$full_text = "$percent%";
46
47open (BAT_STATE, "upower -i /org/freedesktop/UPower/devices/battery_BAT$bat_number | grep 'state' |") or die;
48$bat_state = <BAT_STATE>;
49close(BAT_STATE);
50
51if ($bat_state !~ /: (\w+)/) {
52 die "$bat_state\n";
53}
54$status = $1;
55
56if ($status eq 'discharging') {
57 $full_text .= ' ';
58} elsif ($status eq 'charging') {
59 $full_text .= ' ';
60} elsif ($status eq 'Unknown') {
61 open (AC_ADAPTER, "acpi -a |") or die;
62 $ac_adapt = <AC_ADAPTER>;
63 close(AC_ADAPTER);
64
65 if ($ac_adapt =~ /: ([\w-]+)/) {
66 $ac_adapt = $1;
67
68 if ($ac_adapt eq 'on-line') {
69 $full_text .= ' CHR';
70 } elsif ($ac_adapt eq 'off-line') {
71 $full_text .= ' DIS';
72 }
73 }
74}
75
76$short_text = $full_text;
77
78if ($percent < 20) {
79 $label = '';
80} elsif ($percent < 45) {
81 $label = '';
82} elsif ($percent < 70) {
83 $label = '';
84} elsif ($percent < 95) {
85 $label = '';
86} else {
87 $label = '';
88}
89
90# print text
91print " ${label}";
92print " $full_text\n";
93print " ${label}";
94print " $short_text\n";
95
96# consider color and urgent flag only on discharge
97if ($status eq 'discharging') {
98
99 if ($percent < 20) {
100 print "#FF0000\n";
101 } elsif ($percent < 40) {
102 print "#FFAE00\n";
103 } elsif ($percent < 60) {
104 print "#FFF600\n";
105 } elsif ($percent < 85) {
106 print "#A8FF00\n";
107 }
108
109 if ($percent < 5) {
110 exit(33);
111 }
112}
113
114exit(0);
diff --git a/dot_config/i3/scripts/executable_battery2 b/dot_config/i3/scripts/executable_battery2
new file mode 100644
index 0000000..2d55dab
--- /dev/null
+++ b/dot_config/i3/scripts/executable_battery2
@@ -0,0 +1,106 @@
1#!/usr/bin/env python3
2#
3# Copyright (C) 2016 James Murphy
4# Licensed under the GPL version 2 only
5#
6# A battery indicator blocklet script for i3blocks
7
8from subprocess import check_output
9import os
10import re
11
12config = dict(os.environ)
13status = check_output(['acpi'], universal_newlines=True)
14
15if not status:
16 # stands for no battery found
17 color = config.get("color_10", "red")
18 fulltext = "<span color='{}'><span font='FontAwesome'>\uf00d \uf240</span></span>".format(color)
19 percentleft = 100
20else:
21 # if there is more than one battery in one laptop, the percentage left is
22 # available for each battery separately, although state and remaining
23 # time for overall block is shown in the status of the first battery
24 batteries = status.split("\n")
25 state_batteries=[]
26 commasplitstatus_batteries=[]
27 percentleft_batteries=[]
28 time = ""
29 for battery in batteries:
30 if battery!='':
31 state_batteries.append(battery.split(": ")[1].split(", ")[0])
32 commasplitstatus = battery.split(", ")
33 if not time:
34 time = commasplitstatus[-1].strip()
35 # check if it matches a time
36 time = re.match(r"(\d+):(\d+)", time)
37 if time:
38 time = ":".join(time.groups())
39 timeleft = " ({})".format(time)
40 else:
41 timeleft = ""
42
43 p = int(commasplitstatus[1].rstrip("%\n"))
44 if p>0:
45 percentleft_batteries.append(p)
46 commasplitstatus_batteries.append(commasplitstatus)
47 state = state_batteries[0]
48 commasplitstatus = commasplitstatus_batteries[0]
49 if percentleft_batteries:
50 percentleft = int(sum(percentleft_batteries)/len(percentleft_batteries))
51 else:
52 percentleft = 0
53
54 # stands for charging
55 color = config.get("color_charging", "yellow")
56 FA_LIGHTNING = "<span color='{}'><span font='FontAwesome'>\uf0e7</span></span>".format(color)
57
58 # stands for plugged in
59 FA_PLUG = "<span font='FontAwesome'>\uf1e6</span>"
60
61 # stands for using battery
62 FA_BATTERY = "<span font='FontAwesome'>\uf240</span>"
63
64 # stands for unknown status of battery
65 FA_QUESTION = "<span font='FontAwesome'>\uf128</span>"
66
67
68 if state == "Discharging":
69 fulltext = FA_BATTERY + " "
70 elif state == "Full":
71 fulltext = FA_PLUG + " "
72 timeleft = ""
73 elif state == "Unknown":
74 fulltext = FA_QUESTION + " " + FA_BATTERY + " "
75 timeleft = ""
76 else:
77 fulltext = FA_LIGHTNING + " " + FA_PLUG + " "
78
79 def color(percent):
80 if percent < 10:
81 # exit code 33 will turn background red
82 return config.get("color_10", "#FFFFFF")
83 if percent < 20:
84 return config.get("color_20", "#FF3300")
85 if percent < 30:
86 return config.get("color_30", "#FF6600")
87 if percent < 40:
88 return config.get("color_40", "#FF9900")
89 if percent < 50:
90 return config.get("color_50", "#FFCC00")
91 if percent < 60:
92 return config.get("color_60", "#FFFF00")
93 if percent < 70:
94 return config.get("color_70", "#FFFF33")
95 if percent < 80:
96 return config.get("color_80", "#FFFF66")
97 return config.get("color_full", "#FFFFFF")
98
99 form = '<span color="{}">{}%</span>'
100 fulltext += form.format(color(percentleft), percentleft)
101 #fulltext += timeleft
102
103print(fulltext)
104print(fulltext)
105if percentleft < 10:
106 exit(33)
diff --git a/dot_config/i3/scripts/executable_blur-lock b/dot_config/i3/scripts/executable_blur-lock
new file mode 100644
index 0000000..4ff7ed6
--- /dev/null
+++ b/dot_config/i3/scripts/executable_blur-lock
@@ -0,0 +1,11 @@
1#!/usr/bin/env bash
2
3PICTURE=/tmp/i3lock.png
4SCREENSHOT="scrot -z $PICTURE"
5
6BLUR="5x4"
7
8$SCREENSHOT
9convert $PICTURE -blur $BLUR $PICTURE
10i3lock -i $PICTURE
11rm $PICTURE
diff --git a/dot_config/i3/scripts/executable_cpu_usage b/dot_config/i3/scripts/executable_cpu_usage
new file mode 100644
index 0000000..8d8a267
--- /dev/null
+++ b/dot_config/i3/scripts/executable_cpu_usage
@@ -0,0 +1,62 @@
1#!/usr/bin/perl
2#
3# Copyright 2014 Pierre Mavro <[email protected]>
4# Copyright 2014 Vivien Didelot <[email protected]>
5# Copyright 2014 Andreas Guldstrand <[email protected]>
6#
7# Licensed under the terms of the GNU GPL v3, or any later version.
8
9use strict;
10use warnings;
11use utf8;
12use Getopt::Long;
13
14# default values
15my $t_warn = $ENV{T_WARN} // 50;
16my $t_crit = $ENV{T_CRIT} // 80;
17my $cpu_usage = -1;
18my $decimals = $ENV{DECIMALS} // 0;
19my $label = $ENV{LABEL} // "";
20
21sub help {
22 print "Usage: cpu_usage [-w <warning>] [-c <critical>] [-d <decimals>]\n";
23 print "-w <percent>: warning threshold to become yellow\n";
24 print "-c <percent>: critical threshold to become red\n";
25 print "-d <decimals>: Use <decimals> decimals for percentage (default is $decimals) \n";
26 exit 0;
27}
28
29GetOptions("help|h" => \&help,
30 "w=i" => \$t_warn,
31 "c=i" => \$t_crit,
32 "d=i" => \$decimals,
33);
34
35# Get CPU usage
36$ENV{LC_ALL}="en_US"; # if mpstat is not run under en_US locale, things may break, so make sure it is
37open (MPSTAT, 'mpstat 1 1 |') or die;
38while (<MPSTAT>) {
39 if (/^.*\s+(\d+\.\d+)[\s\x00]?$/) {
40 $cpu_usage = 100 - $1; # 100% - %idle
41 last;
42 }
43}
44close(MPSTAT);
45
46$cpu_usage eq -1 and die 'Can\'t find CPU information';
47
48# Print short_text, full_text
49print "${label}";
50printf "%02.${decimals}f%%\n", $cpu_usage;
51print "${label}";
52printf "%02.${decimals}f%%\n", $cpu_usage;
53
54# Print color, if needed
55if ($cpu_usage >= $t_crit) {
56 print "#FF0000\n";
57 exit 33;
58} elsif ($cpu_usage >= $t_warn) {
59 print "#FFFC00\n";
60}
61
62exit 0;
diff --git a/dot_config/i3/scripts/executable_disk b/dot_config/i3/scripts/executable_disk
new file mode 100644
index 0000000..e18c7aa
--- /dev/null
+++ b/dot_config/i3/scripts/executable_disk
@@ -0,0 +1,48 @@
1#!/usr/bin/env bash
2# Copyright (C) 2014 Julien Bonjean <[email protected]>
3
4# This program is free software: you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation, either version 3 of the License, or
7# (at your option) any later version.
8
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13
14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17DIR="${DIR:-$BLOCK_INSTANCE}"
18DIR="${DIR:-$HOME}"
19ALERT_LOW="${ALERT_LOW:-$1}"
20ALERT_LOW="${ALERT_LOW:-10}" # color will turn red under this value (default: 10%)
21
22LOCAL_FLAG="-l"
23if [ "$1" = "-n" ] || [ "$2" = "-n" ]; then
24 LOCAL_FLAG=""
25fi
26
27df -h -P $LOCAL_FLAG "$DIR" | awk -v label="$LABEL" -v alert_low=$ALERT_LOW '
28/\/.*/ {
29 # full text
30 print label $4
31
32 # short text
33 print label $4
34
35 use=$5
36
37 # no need to continue parsing
38 exit 0
39}
40
41END {
42 gsub(/%$/,"",use)
43 if (100 - use < alert_low) {
44 # color
45 print "#FF0000"
46 }
47}
48'
diff --git a/dot_config/i3/scripts/executable_keyboard-layout b/dot_config/i3/scripts/executable_keyboard-layout
new file mode 100644
index 0000000..9a3e314
--- /dev/null
+++ b/dot_config/i3/scripts/executable_keyboard-layout
@@ -0,0 +1,5 @@
1#!/usr/bin/env bash
2
3KBD=$(/usr/bin/xkblayout-state print '%s')
4echo $KBD
5
diff --git a/dot_config/i3/scripts/executable_keyhint b/dot_config/i3/scripts/executable_keyhint
new file mode 100644
index 0000000..8b8c3e3
--- /dev/null
+++ b/dot_config/i3/scripts/executable_keyhint
@@ -0,0 +1,25 @@
1#!/bin/bash
2
3Main() {
4 source /usr/share/endeavouros/scripts/eos-script-lib-yad || return 1
5
6 local command=(
7 eos_yad --title="EndeavourOS i3-wm keybindings:" --no-buttons --geometry=400x345-15-400 --list
8 --column=key: --column=description: --column=command:
9 "ESC" "close this app" ""
10 "=" "modkey" "(set mod Mod4)"
11 "+enter" "open a terminal" ""
12 "+Shift+n" "new empty workspace" ""
13 "+w" "open Browser" ""
14 "+n" "open Filebrowser" ""
15 "+d" "app menu" ""
16 "+q" "close focused app" ""
17 "Print-key" "screenshot" ""
18 "+Shift+e" "logout menu" ""
19 "F1" "open keybinding helper" ""
20 )
21
22 "${command[@]}"
23}
24
25Main "$@"
diff --git a/dot_config/i3/scripts/executable_keyhint-2 b/dot_config/i3/scripts/executable_keyhint-2
new file mode 100644
index 0000000..2e86d12
--- /dev/null
+++ b/dot_config/i3/scripts/executable_keyhint-2
@@ -0,0 +1,6 @@
1I3_CONFIG=$HOME/.config/i3/config
2mod_key=$(sed -nre 's/^set \$mod (.*)/\1/p' ${I3_CONFIG})
3grep "^bindsym" ${I3_CONFIG} \
4 | sed "s/-\(-\w\+\)\+//g;s/\$mod/${mod_key}/g;s/Mod1/Alt/g;s/exec //;s/bindsym //;s/^\s\+//;s/^\([^ ]\+\) \(.\+\)$/\2: \1/;s/^\s\+//" \
5 | tr -s ' ' \
6 | rofi -dmenu -theme ~/.config/rofi/rofikeyhint.rasi
diff --git a/dot_config/i3/scripts/executable_literal_empty_workspace b/dot_config/i3/scripts/executable_literal_empty_workspace
new file mode 100644
index 0000000..b962cde
--- /dev/null
+++ b/dot_config/i3/scripts/executable_literal_empty_workspace
@@ -0,0 +1,10 @@
1#!/usr/bin/env bash
2
3MAX_DESKTOPS=20
4
5WORKSPACES=$(seq -s '\n' 1 1 ${MAX_DESKTOPS})
6
7EMPTY_WORKSPACE=$( (i3-msg -t get_workspaces | tr ',' '\n' | grep num | awk -F: '{print int($2)}' ; \
8 echo -e ${WORKSPACES} ) | sort -n | uniq -u | head -n 1)
9
10i3-msg workspace ${EMPTY_WORKSPACE}
diff --git a/dot_config/i3/scripts/executable_memory b/dot_config/i3/scripts/executable_memory
new file mode 100644
index 0000000..6a69a6f
--- /dev/null
+++ b/dot_config/i3/scripts/executable_memory
@@ -0,0 +1,69 @@
1#!/usr/bin/env bash
2# Copyright (C) 2014 Julien Bonjean <[email protected]>
3
4# This program is free software: you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation, either version 3 of the License, or
7# (at your option) any later version.
8
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13
14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17TYPE="${BLOCK_INSTANCE:-mem}"
18
19awk -v type=$TYPE '
20/^MemTotal:/ {
21 mem_total=$2
22}
23/^MemFree:/ {
24 mem_free=$2
25}
26/^Buffers:/ {
27 mem_free+=$2
28}
29/^Cached:/ {
30 mem_free+=$2
31}
32/^SwapTotal:/ {
33 swap_total=$2
34}
35/^SwapFree:/ {
36 swap_free=$2
37}
38END {
39 if (type == "swap") {
40 free=swap_free/1024/1024
41 used=(swap_total-swap_free)/1024/1024
42 total=swap_total/1024/1024
43 } else {
44 free=mem_free/1024/1024
45 used=(mem_total-mem_free)/1024/1024
46 total=mem_total/1024/1024
47 }
48
49 pct=0
50 if (total > 0) {
51 pct=used/total*100
52 }
53
54 # full text
55 # printf("%.1fG/%.1fG (%.f%%)\n", used, total, pct)
56
57 # short text
58 printf("%.f%%\n", pct)
59
60 # color
61 if (pct > 90) {
62 print("#FF0000")
63 } else if (pct > 80) {
64 print("#FFAE00")
65 } else if (pct > 70) {
66 print("#FFF600")
67 }
68}
69' /proc/meminfo
diff --git a/dot_config/i3/scripts/executable_openweather b/dot_config/i3/scripts/executable_openweather
new file mode 100644
index 0000000..c51f9d3
--- /dev/null
+++ b/dot_config/i3/scripts/executable_openweather
@@ -0,0 +1,93 @@
1#!/usr/bin/env bash
2# Edited by Andreas Lindlbauer <[email protected]>
3
4temps=("#0600FF" "#0500FF" "#0400FF" "#0300FF" "#0200FF" "#0100FF" "#0000FF" "#0002FF" "#0012FF" "#0022FF" "#0032FF" "#0044FF" "#0054FF" "#0064FF" "#0074FF" "#0084FF" "#0094FF" "#00A4FF" "#00B4FF" "#00C4FF" "#00D4FF" "#00E4FF" "#00FFF4" "#00FFD0" "#00FFA8" "#00FF83" "#00FF5C" "#00FF36" "#00FF10" "#17FF00" "#3EFF00" "#65FF00" "#B0FF00" "#FDFF00" "#FFF000" "#FFDC00" "#FFC800" "#FFB400" "#FFA000" "#FF8C00" "#FF7800" "#FF6400" "#FF5000" "#FF3C00" "#FF2800" "#FF1400" "#FF0000")
5
6command -v jq >/dev/null 2>&1 || { echo >&2 "Program 'jq' required but it is not installed.
7Aborting."; exit 1; }
8command -v wget >/dev/null 2>&1 || { echo >&2 "Program 'wget' required but is not installed.
9Aborting."; exit 1; }
10
11# To use this script you need to create an API key here https://home.openweathermap.org
12# You need to put your Open Weather APIKEY here:
13APIKEY="keykeykey"
14# And get your Latitute and Longitudes to put in here:
15LAT="XX.XXXX"
16LON="XX.XXXX"
17URL="http://api.openweathermap.org/data/2.5/onecall?lat=${LAT}&lon=${LON}&units=metric&exclude=minutely,hourly,daily&APPID=${APIKEY}"
18WEATHER_RESPONSE=$(wget -qO- "${URL}")
19
20WEATHER_CONDITION=$(echo "$WEATHER_RESPONSE" | jq '.current.weather[0].main' | sed 's/"//g')
21WEATHER_TEMP=$(echo "$WEATHER_RESPONSE" | jq '.current.feels_like')
22WEATHER_INT=${WEATHER_TEMP%.*}
23
24TIME_NOW=$( echo "$WEATHER_RESPONSE" | jq '.current.dt')
25SUNRISE=$( echo "$WEATHER_RESPONSE" | jq '.current.sunrise')
26SUNSET=$( echo "$WEATHER_RESPONSE" | jq '.current.sunset')
27DESCRIPTION=$( echo "$WEATHER_RESPONSE" | jq '.current.weather[0].description' | sed 's/"//g')
28WEATHER_ALERT=$( echo "$WEATHER_RESPONSE" | jq '.alerts[0].event' | sed 's/"//g')
29DAYTIME="n"
30
31if [[ "$TIME_NOW" > "$SUNRISE" ]] && [[ "$TIME_NOW" < "$SUNSET" ]]; then
32 DAYTIME="d"
33fi
34
35case $WEATHER_CONDITION in
36 'Clouds')
37 if [ "$DAYTIME" == "d" ]; then
38 WEATHER_ICON=""
39 else
40 WEATHER_ICON=""
41 fi
42 ;;
43 'Rain')
44 WEATHER_ICON=""
45 ;;
46 'Drizzle')
47 if [ "$DAYTIME" == "d" ]; then
48 WEATHER_ICON=""
49 else
50 WEATHER_ICON=""
51 fi
52 ;;
53 'Thunderstorm')
54 WEATHER_ICON=""
55 ;;
56 'Snow')
57 WEATHER_ICON=""
58 ;;
59 'Clear')
60 if [ "$DAYTIME" == "d" ]; then
61 WEATHER_ICON=""
62 else
63 WEATHER_ICON=""
64 fi
65 ;;
66 *)
67 WEATHER_ICON="🌫"
68 ;;
69esac
70
71WEATHER_COLOR="#FFFFFF"
72if [ "$WEATHER_INT" -lt "-11" ]; then
73 WEATHER_COLOR="#0000FF"
74elif [ "$WEATHER_INT" -gt 35 ]; then
75 WEATHER_COLOR="#FF0000"
76else
77 WEATHER_INT=$(( WEATHER_INT + 11 ))
78 WEATHER_COLOR="${temps[$WEATHER_INT]}"
79fi
80
81full_text="${WEATHER_ICON} ${WEATHER_TEMP}°C: ${DESCRIPTION} "
82if [ "$WEATHER_ALERT" != "null" ]; then
83 WARN_START=$(echo "$WEATHER_RESPONSE" | jq '.alerts[0].start')
84 WARN_END=$(echo "$WEATHER_RESPONSE" | jq '.alerts[0].end')
85 WARN_START=$(date -d @"$WARN_START" +%a_%k:%M)
86 WARN_END=$(date -d @"$WARN_END" +%a_%k:%M)
87 full_text="${WEATHER_ICON} ${WEATHER_TEMP}°C: ${DESCRIPTION}  ${WEATHER_ALERT} from ${WARN_START} to ${WARN_END}  "
88fi
89
90
91echo "${full_text}"
92echo "${WEATHER_TEMP}°C "
93echo "${WEATHER_COLOR}"
diff --git a/dot_config/i3/scripts/executable_openweather-city b/dot_config/i3/scripts/executable_openweather-city
new file mode 100644
index 0000000..6ea051c
--- /dev/null
+++ b/dot_config/i3/scripts/executable_openweather-city
@@ -0,0 +1,43 @@
1#!/usr/bin/env bash
2
3command -v jq >/dev/null 2>&1 || { echo >&2 "Program 'jq' required but it is not installed.
4Aborting."; exit 1; }
5command -v wget >/dev/null 2>&1 || { echo >&2 "Program 'wget' required but is not installed.
6Aborting."; exit 1; }
7
8# To use this script you need to create an API key here https://home.openweathermap.org
9# You need to put your Open Weather APIKEY here:
10APIKEY="keykey"
11# find your City ID here: https://openweathermap.org/
12# search for your city and copy the ID from the URL inside the browser.
13CITY_ID="idid"
14URL="http://api.openweathermap.org/data/2.5/weather?id=${CITY_ID}&units=metric&APPID=${APIKEY}"
15
16WEATHER_RESPONSE=$(wget -qO- "${URL}")
17
18WEATHER_CONDITION=$(echo $WEATHER_RESPONSE | jq '.weather[0].main' | sed 's/"//g')
19WEATHER_TEMP=$(echo $WEATHER_RESPONSE | jq '.main.temp')
20WIND_DIR=$( echo "$WEATHER_RESPONSE" | jq '.wind.deg')
21WIND_SPEED=$( echo "$WEATHER_RESPONSE" | jq '.wind.speed')
22
23WIND_SPEED=$(awk "BEGIN {print 60*60*$WIND_SPEED/1000}")
24WIND_DIR=$(awk "BEGIN {print int(($WIND_DIR % 360)/22.5)}")
25DIR_ARRAY=( N NNE NE ENE E ESE SE SSE S SSW SW WSW W WNW NW NNW N )
26WIND_DIR=${DIR_ARRAY[WIND_DIR]}
27
28case $WEATHER_CONDITION in
29 'Clouds')
30 WEATHER_ICON=""
31 ;;
32 'Rain')
33 WEATHER_ICON=""
34 ;;
35 'Snow')
36 WEATHER_ICON=""
37 ;;
38 *)
39 WEATHER_ICON=""
40 ;;
41esac
42
43echo "${WEATHER_ICON} ${WEATHER_TEMP}°C: ${WIND_SPEED} km/h ${WIND_DIR}"
diff --git a/dot_config/i3/scripts/executable_openweather.conf b/dot_config/i3/scripts/executable_openweather.conf
new file mode 100644
index 0000000..f11aa86
--- /dev/null
+++ b/dot_config/i3/scripts/executable_openweather.conf
@@ -0,0 +1,5 @@
1# Weather
2[Weather]
3command=~/.config/i3/scripts/openweather
4interval=1800
5color=#7275b3
diff --git a/dot_config/i3/scripts/executable_power-profiles b/dot_config/i3/scripts/executable_power-profiles
new file mode 100644
index 0000000..feb63dc
--- /dev/null
+++ b/dot_config/i3/scripts/executable_power-profiles
@@ -0,0 +1,190 @@
1#!/usr/bin/env bash
2#
3# Use rofi/zenity to change system runstate thanks to systemd.
4#
5# Note: this currently relies on associative array support in the shell.
6#
7# Inspired from i3pystatus wiki:
8# https://github.com/enkore/i3pystatus/wiki/Shutdown-Menu
9#
10# Copyright 2015 Benjamin Chrétien <chretien at lirmm dot fr>
11#
12# This program is free software: you can redistribute it and/or modify
13# it under the terms of the GNU General Public License as published by
14# the Free Software Foundation, either version 3 of the License, or
15# (at your option) any later version.
16
17# This program is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20# GNU General Public License for more details.
21
22# You should have received a copy of the GNU General Public License
23# along with this program. If not, see <http://www.gnu.org/licenses/>.
24
25# power-profiles-daemon implementation:
26# needs package power-profiles-daemon installed and the service running see here:
27# https://wiki.archlinux.org/title/CPU_frequency_scaling#power-profiles-daemon
28# used in i3-blocks: ~/.config/i3/i3blocks.conf together with: ~/.config/i3/scripts/ppd-status
29
30
31#######################################################################
32# BEGIN CONFIG #
33#######################################################################
34
35# Use a custom lock script
36#LOCKSCRIPT="i3lock-extra -m pixelize"
37
38# Colors: FG (foreground), BG (background), HL (highlighted)
39FG_COLOR="#bbbbbb"
40BG_COLOR="#111111"
41HLFG_COLOR="#111111"
42HLBG_COLOR="#bbbbbb"
43BORDER_COLOR="#222222"
44
45# Options not related to colors
46#ROFI_TEXT=":"
47#ROFI_OPTIONS=(-width -11 -location 0 -hide-scrollbar -bw 30 -color-window "#dd310027,#dd0310027,#dd310027" -padding 5)
48#ROFI_OPTIONS=(-width -18 -location 4 -hide-scrollbar -color-window "#cc310027,#00a0009a,#cc310027" -padding 5 -font "Sourcecode Pro Regular 10, FontAwesome 9")
49ROFI_OPTIONS=(-theme ~/.config/rofi/power-profiles.rasi)
50# Zenity options
51ZENITY_TITLE="Power Profiles"
52ZENITY_TEXT="Set Profiles:"
53ZENITY_OPTIONS=(--column= --hide-header)
54
55#######################################################################
56# END CONFIG #
57#######################################################################
58
59# Whether to ask for user's confirmation
60enable_confirmation=false
61
62# Preferred launcher if both are available
63preferred_launcher="rofi"
64
65usage="$(basename "$0") [-h] [-c] [-p name] -- display a menu for shutdown, reboot, lock etc.
66
67where:
68 -h show this help text
69 -c ask for user confirmation
70 -p preferred launcher (rofi or zenity)
71
72This script depends on:
73 - systemd,
74 - i3,
75 - rofi or zenity."
76
77# Check whether the user-defined launcher is valid
78launcher_list=(rofi zenity)
79function check_launcher() {
80 if [[ ! "${launcher_list[@]}" =~ (^|[[:space:]])"$1"($|[[:space:]]) ]]; then
81 echo "Supported launchers: ${launcher_list[*]}"
82 exit 1
83 else
84 # Get array with unique elements and preferred launcher first
85 # Note: uniq expects a sorted list, so we cannot use it
86 i=1
87 launcher_list=($(for l in "$1" "${launcher_list[@]}"; do printf "%i %s\n" "$i" "$l"; let i+=1; done \
88 | sort -uk2 | sort -nk1 | cut -d' ' -f2- | tr '\n' ' '))
89 fi
90}
91
92# Parse CLI arguments
93while getopts "hcp:" option; do
94 case "${option}" in
95 h) echo "${usage}"
96 exit 0
97 ;;
98 c) enable_confirmation=true
99 ;;
100 p) preferred_launcher="${OPTARG}"
101 check_launcher "${preferred_launcher}"
102 ;;
103 *) exit 1
104 ;;
105 esac
106done
107
108# Check whether a command exists
109function command_exists() {
110 command -v "$1" &> /dev/null 2>&1
111}
112
113# systemctl required
114if ! command_exists systemctl ; then
115 exit 1
116fi
117
118# menu defined as an associative array
119typeset -A menu
120
121# Menu with keys/commands
122
123menu=(
124 [ Performance]="powerprofilesctl set performance"
125 [ Balanced]="powerprofilesctl set balanced"
126 [ Power Saver]="powerprofilesctl set power-saver"
127 [ Cancel]=""
128)
129
130menu_nrows=${#menu[@]}
131
132# Menu entries that may trigger a confirmation message
133menu_confirm="Shutdown Reboot Hibernate Suspend Halt Logout"
134
135launcher_exe=""
136launcher_options=""
137rofi_colors=""
138
139function prepare_launcher() {
140 if [[ "$1" == "rofi" ]]; then
141 rofi_colors=(-bc "${BORDER_COLOR}" -bg "${BG_COLOR}" -fg "${FG_COLOR}" \
142 -hlfg "${HLFG_COLOR}" -hlbg "${HLBG_COLOR}")
143 launcher_exe="rofi"
144 launcher_options=(-dmenu -i -lines "${menu_nrows}" -p "${ROFI_TEXT}" \
145 "${rofi_colors}" "${ROFI_OPTIONS[@]}")
146 elif [[ "$1" == "zenity" ]]; then
147 launcher_exe="zenity"
148 launcher_options=(--list --title="${ZENITY_TITLE}" --text="${ZENITY_TEXT}" \
149 "${ZENITY_OPTIONS[@]}")
150 fi
151}
152
153for l in "${launcher_list[@]}"; do
154 if command_exists "${l}" ; then
155 prepare_launcher "${l}"
156 break
157 fi
158done
159
160# No launcher available
161if [[ -z "${launcher_exe}" ]]; then
162 exit 1
163fi
164
165launcher=(${launcher_exe} "${launcher_options[@]}")
166selection="$(printf '%s\n' "${!menu[@]}" | sort | "${launcher[@]}")"
167
168function ask_confirmation() {
169 if [ "${launcher_exe}" == "rofi" ]; then
170 confirmed=$(echo -e "Yes\nNo" | rofi -dmenu -i -lines 2 -p "${selection}?" \
171 "${rofi_colors}" "${ROFI_OPTIONS[@]}")
172 [ "${confirmed}" == "Yes" ] && confirmed=0
173 elif [ "${launcher_exe}" == "zenity" ]; then
174 zenity --question --text "Are you sure you want to ${selection,,}?"
175 confirmed=$?
176 fi
177
178 if [ "${confirmed}" == 0 ]; then
179 i3-msg -q "exec --no-startup-id ${menu[${selection}]}"
180 fi
181}
182
183if [[ $? -eq 0 && ! -z ${selection} ]]; then
184 if [[ "${enable_confirmation}" = true && \
185 ${menu_confirm} =~ (^|[[:space:]])"${selection}"($|[[:space:]]) ]]; then
186 ask_confirmation
187 else
188 i3-msg -q "exec --no-startup-id ${menu[${selection}]}"
189 fi
190fi
diff --git a/dot_config/i3/scripts/executable_powermenu b/dot_config/i3/scripts/executable_powermenu
new file mode 100644
index 0000000..e72f0a2
--- /dev/null
+++ b/dot_config/i3/scripts/executable_powermenu
@@ -0,0 +1,186 @@
1#!/usr/bin/env bash
2#
3# Use rofi/zenity to change system runstate thanks to systemd.
4#
5# Note: this currently relies on associative array support in the shell.
6#
7# Inspired from i3pystatus wiki:
8# https://github.com/enkore/i3pystatus/wiki/Shutdown-Menu
9#
10# Copyright 2015 Benjamin Chrétien <chretien at lirmm dot fr>
11#
12# This program is free software: you can redistribute it and/or modify
13# it under the terms of the GNU General Public License as published by
14# the Free Software Foundation, either version 3 of the License, or
15# (at your option) any later version.
16
17# This program is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20# GNU General Public License for more details.
21
22# You should have received a copy of the GNU General Public License
23# along with this program. If not, see <http://www.gnu.org/licenses/>.
24
25# modified to work with latest rofi update by joekamprad <[email protected]>
26
27#######################################################################
28# BEGIN CONFIG #
29#######################################################################
30
31# Use a custom lock script
32#LOCKSCRIPT="i3lock-extra -m pixelize"
33
34# Colors: FG (foreground), BG (background), HL (highlighted)
35FG_COLOR="#bbbbbb"
36BG_COLOR="#111111"
37HLFG_COLOR="#111111"
38HLBG_COLOR="#bbbbbb"
39BORDER_COLOR="#222222"
40
41# Options not related to colors (most rofi options do not work anymore)
42ROFI_OPTIONS=(-theme ~/.config/rofi/powermenu.rasi)
43# Zenity options
44ZENITY_TITLE="Power Menu"
45ZENITY_TEXT="Action:"
46ZENITY_OPTIONS=(--column= --hide-header)
47
48#######################################################################
49# END CONFIG #
50#######################################################################
51
52# Whether to ask for user's confirmation
53enable_confirmation=false
54
55# Preferred launcher if both are available
56preferred_launcher="rofi"
57
58usage="$(basename "$0") [-h] [-c] [-p name] -- display a menu for shutdown, reboot, lock etc.
59
60where:
61 -h show this help text
62 -c ask for user confirmation
63 -p preferred launcher (rofi or zenity)
64
65This script depends on:
66 - systemd,
67 - i3,
68 - rofi or zenity."
69
70# Check whether the user-defined launcher is valid
71launcher_list=(rofi zenity)
72function check_launcher() {
73 if [[ ! "${launcher_list[@]}" =~ (^|[[:space:]])"$1"($|[[:space:]]) ]]; then
74 echo "Supported launchers: ${launcher_list[*]}"
75 exit 1
76 else
77 # Get array with unique elements and preferred launcher first
78 # Note: uniq expects a sorted list, so we cannot use it
79 i=1
80 launcher_list=($(for l in "$1" "${launcher_list[@]}"; do printf "%i %s\n" "$i" "$l"; let i+=1; done \
81 | sort -uk2 | sort -nk1 | cut -d' ' -f2- | tr '\n' ' '))
82 fi
83}
84
85# Parse CLI arguments
86while getopts "hcp:" option; do
87 case "${option}" in
88 h) echo "${usage}"
89 exit 0
90 ;;
91 c) enable_confirmation=true
92 ;;
93 p) preferred_launcher="${OPTARG}"
94 check_launcher "${preferred_launcher}"
95 ;;
96 *) exit 1
97 ;;
98 esac
99done
100
101# Check whether a command exists
102function command_exists() {
103 command -v "$1" &> /dev/null 2>&1
104}
105
106# systemctl required
107if ! command_exists systemctl ; then
108 exit 1
109fi
110
111# menu defined as an associative array
112typeset -A menu
113
114# Menu with keys/commands
115
116menu=(
117 [ Shutdown]="systemctl poweroff"
118 [ Reboot]="systemctl reboot"
119 [ Suspend]="systemctl suspend"
120 [ Hibernate]="systemctl hibernate"
121 [ Lock]="~/.config/i3/scripts/blur-lock"
122 [ Logout]="i3-msg exit"
123 [ Cancel]=""
124)
125
126menu_nrows=${#menu[@]}
127
128# Menu entries that may trigger a confirmation message
129menu_confirm="Shutdown Reboot Hibernate Suspend Halt Logout"
130
131launcher_exe=""
132launcher_options=""
133rofi_colors=""
134
135function prepare_launcher() {
136 if [[ "$1" == "rofi" ]]; then
137 rofi_colors=(-bc "${BORDER_COLOR}" -bg "${BG_COLOR}" -fg "${FG_COLOR}" \
138 -hlfg "${HLFG_COLOR}" -hlbg "${HLBG_COLOR}")
139 launcher_exe="rofi"
140 launcher_options=(-dmenu -i -lines "${menu_nrows}" -p "${ROFI_TEXT}" \
141 "${rofi_colors}" "${ROFI_OPTIONS[@]}")
142 elif [[ "$1" == "zenity" ]]; then
143 launcher_exe="zenity"
144 launcher_options=(--list --title="${ZENITY_TITLE}" --text="${ZENITY_TEXT}" \
145 "${ZENITY_OPTIONS[@]}")
146 fi
147}
148
149for l in "${launcher_list[@]}"; do
150 if command_exists "${l}" ; then
151 prepare_launcher "${l}"
152 break
153 fi
154done
155
156# No launcher available
157if [[ -z "${launcher_exe}" ]]; then
158 exit 1
159fi
160
161launcher=(${launcher_exe} "${launcher_options[@]}")
162selection="$(printf '%s\n' "${!menu[@]}" | sort | "${launcher[@]}")"
163
164function ask_confirmation() {
165 if [ "${launcher_exe}" == "rofi" ]; then
166 confirmed=$(echo -e "Yes\nNo" | rofi -dmenu -i -lines 2 -p "${selection}?" \
167 "${rofi_colors}" "${ROFI_OPTIONS[@]}")
168 [ "${confirmed}" == "Yes" ] && confirmed=0
169 elif [ "${launcher_exe}" == "zenity" ]; then
170 zenity --question --text "Are you sure you want to ${selection,,}?"
171 confirmed=$?
172 fi
173
174 if [ "${confirmed}" == 0 ]; then
175 i3-msg -q "exec ${menu[${selection}]}"
176 fi
177}
178
179if [[ $? -eq 0 && ! -z ${selection} ]]; then
180 if [[ "${enable_confirmation}" = true && \
181 ${menu_confirm} =~ (^|[[:space:]])"${selection}"($|[[:space:]]) ]]; then
182 ask_confirmation
183 else
184 i3-msg -q "exec ${menu[${selection}]}"
185 fi
186fi
diff --git a/dot_config/i3/scripts/executable_ppd-status b/dot_config/i3/scripts/executable_ppd-status
new file mode 100644
index 0000000..8e6eb7b
--- /dev/null
+++ b/dot_config/i3/scripts/executable_ppd-status
@@ -0,0 +1,11 @@
1#!/usr/bin/env bash
2#
3# power-profiles-daemon implementation:
4# needs package power-profiles-daemon installed and the service running see here:
5# https://wiki.archlinux.org/title/CPU_frequency_scaling#power-profiles-daemon
6# used in i3-blocks: ~/.config/i3/i3blocks.conf together with: ~/.config/i3/scripts/power-profiles
7
8# script to show current power profile
9
10current_profile=$(/usr/bin/powerprofilesctl get)
11echo "$current_profile"
diff --git a/dot_config/i3/scripts/executable_temperature b/dot_config/i3/scripts/executable_temperature
new file mode 100644
index 0000000..4e31610
--- /dev/null
+++ b/dot_config/i3/scripts/executable_temperature
@@ -0,0 +1,86 @@
1#!/usr/bin/env perl
2# Copyright 2014 Pierre Mavro <[email protected]>
3# Copyright 2014 Vivien Didelot <[email protected]>
4# Copyright 2014 Andreas Guldstrand <[email protected]>
5# Copyright 2014 Benjamin Chretien <chretien at lirmm dot fr>
6
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16
17# You should have received a copy of the GNU General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20# Edited by Andreas Lindlbauer <[email protected]>
21
22use strict;
23use warnings;
24use utf8;
25use Getopt::Long;
26
27binmode(STDOUT, ":utf8");
28
29# default values
30my $t_warn = $ENV{T_WARN} || 70;
31my $t_crit = $ENV{T_CRIT} || 90;
32my $chip = $ENV{SENSOR_CHIP} || "";
33my $temperature = -9999;
34my $label = "😀 ";
35
36sub help {
37 print "Usage: temperature [-w <warning>] [-c <critical>] [--chip <chip>]\n";
38 print "-w <percent>: warning threshold to become yellow\n";
39 print "-c <percent>: critical threshold to become red\n";
40 print "--chip <chip>: sensor chip\n";
41 exit 0;
42}
43
44GetOptions("help|h" => \&help,
45 "w=i" => \$t_warn,
46 "c=i" => \$t_crit,
47 "chip=s" => \$chip);
48
49# Get chip temperature
50open (SENSORS, "sensors -u $chip |") or die;
51while (<SENSORS>) {
52 if (/^\s+temp1_input:\s+[\+]*([\-]*\d+\.\d)/) {
53 $temperature = $1;
54 last;
55 }
56}
57close(SENSORS);
58
59$temperature eq -9999 and die 'Cannot find temperature';
60
61if ($temperature < 45) {
62 $label = '';
63} elsif ($temperature < 55) {
64 $label = '';
65} elsif ($temperature < 65) {
66 $label = '';
67} elsif ($temperature < 75) {
68 $label = '';
69} else {
70 $label = '';
71}
72# Print short_text, full_text
73print "${label}";
74print " $temperature°C\n";
75print "${label}";
76print " $temperature°C\n";
77
78# Print color, if needed
79if ($temperature >= $t_crit) {
80 print "#FF0000\n";
81 exit 33;
82} elsif ($temperature >= $t_warn) {
83 print "#FFFC00\n";
84}
85
86exit 0;
diff --git a/dot_config/i3/scripts/executable_volume b/dot_config/i3/scripts/executable_volume
new file mode 100644
index 0000000..39618e1
--- /dev/null
+++ b/dot_config/i3/scripts/executable_volume
@@ -0,0 +1,93 @@
1#!/usr/bin/env bash
2# Copyright (C) 2014 Julien Bonjean <[email protected]>
3# Copyright (C) 2014 Alexander Keller <[email protected]>
4
5# This program is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation, either version 3 of the License, or
8# (at your option) any later version.
9
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14
15# You should have received a copy of the GNU General Public License
16# along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18# original source: https://github.com/vivien/i3blocks-contrib/tree/master/volume
19# check the readme: https://github.com/vivien/i3blocks-contrib/blob/master/volume/README.md
20#------------------------------------------------------------------------
21
22# The second parameter overrides the mixer selection
23# For PulseAudio users, eventually use "pulse"
24# For Jack/Jack2 users, use "jackplug"
25# For ALSA users, you may use "default" for your primary card
26# or you may use hw:# where # is the number of the card desired
27if [[ -z "$MIXER" ]] ; then
28 MIXER="default"
29 if command -v pulseaudio >/dev/null 2>&1 && pulseaudio --check ; then
30 # pulseaudio is running, but not all installations use "pulse"
31 if amixer -D pulse info >/dev/null 2>&1 ; then
32 MIXER="pulse"
33 fi
34 fi
35 [ -n "$(lsmod | grep jack)" ] && MIXER="jackplug"
36 MIXER="${2:-$MIXER}"
37fi
38
39# The instance option sets the control to report and configure
40# This defaults to the first control of your selected mixer
41# For a list of the available, use `amixer -D $Your_Mixer scontrols`
42if [[ -z "$SCONTROL" ]] ; then
43 SCONTROL="${BLOCK_INSTANCE:-$(amixer -D $MIXER scontrols |
44 sed -n "s/Simple mixer control '\([^']*\)',0/\1/p" |
45 head -n1
46 )}"
47fi
48
49# The first parameter sets the step to change the volume by (and units to display)
50# This may be in in % or dB (eg. 5% or 3dB)
51if [[ -z "$STEP" ]] ; then
52 STEP="${1:-5%}"
53fi
54
55# AMIXER(1):
56# "Use the mapped volume for evaluating the percentage representation like alsamixer, to be
57# more natural for human ear."
58NATURAL_MAPPING=${NATURAL_MAPPING:-0}
59if [[ "$NATURAL_MAPPING" != "0" ]] ; then
60 AMIXER_PARAMS="-M"
61fi
62
63#------------------------------------------------------------------------
64
65capability() { # Return "Capture" if the device is a capture device
66 amixer $AMIXER_PARAMS -D $MIXER get $SCONTROL |
67 sed -n "s/ Capabilities:.*cvolume.*/Capture/p"
68}
69
70volume() {
71 amixer $AMIXER_PARAMS -D $MIXER get $SCONTROL $(capability)
72}
73
74format() {
75
76 perl_filter='if (/.*\[(\d+%)\] (\[(-?\d+.\d+dB)\] )?\[(on|off)\]/)'
77 perl_filter+='{CORE::say $4 eq "off" ? "MUTE" : "'
78 # If dB was selected, print that instead
79 perl_filter+=$([[ $STEP = *dB ]] && echo '$3' || echo '$1')
80 perl_filter+='"; exit}'
81 output=$(perl -ne "$perl_filter")
82 echo "$LABEL$output"
83}
84
85#------------------------------------------------------------------------
86
87case $BLOCK_BUTTON in
88 3) amixer $AMIXER_PARAMS -q -D $MIXER sset $SCONTROL $(capability) toggle ;; # right click, mute/unmute
89 4) amixer $AMIXER_PARAMS -q -D $MIXER sset $SCONTROL $(capability) ${STEP}+ unmute ;; # scroll up, increase
90 5) amixer $AMIXER_PARAMS -q -D $MIXER sset $SCONTROL $(capability) ${STEP}- unmute ;; # scroll down, decrease
91esac
92
93volume | format
diff --git a/dot_config/i3/scripts/executable_vpn b/dot_config/i3/scripts/executable_vpn
new file mode 100644
index 0000000..a348f96
--- /dev/null
+++ b/dot_config/i3/scripts/executable_vpn
@@ -0,0 +1,25 @@
1#!/usr/bin/env bash
2#
3# Copyright (C) 2021 Andreas Lindlbauer
4# Licensed under the terms of EUPLv1.2.
5#
6# i3blocks blocklet script to monitor the (nord)vpn connection
7
8vpnstatus="📢"
9nordvpn_output=$(nordvpn status | cat -v | head -1 | sed -e 's/\^M-^M ^M//g' )
10if [ "${nordvpn_output}" = "Status: Connected" ]; then
11 vpnstatus="🥸"
12elif [ "${nordvpn_output}" = "A new version of NordVPN is available! Please update the application." ]; then
13 nordvpn_output=$(nordvpn status | cat -v | head -2 | tail -1 | sed -e 's/\^M-^M ^M//g' )
14 if [ "${nordvpn_output}" = "Status: Connected" ]; then
15 vpnstatus="🥴"
16 elif [ "${nordvpn_output}" = "Status: Disconnected" ]; then
17 vpnstatus="📢"
18 fi
19elif [ "${nordvpn_output}" = "Status: Disconnected" ]; then
20 vpnstatus="📢"
21elif [[ "$nordvpn_output" == *\/* ]] || [[ "$nordvpn_output" == *\\* ]]; then
22 vpnstatus="Something's very wrong"
23fi
24
25echo "$vpnstatus"
diff --git a/dot_config/i3/scripts/executable_worldclock b/dot_config/i3/scripts/executable_worldclock
new file mode 100644
index 0000000..573800e
--- /dev/null
+++ b/dot_config/i3/scripts/executable_worldclock
@@ -0,0 +1,122 @@
1#!/usr/bin/env bash
2#
3# Use rofi/zenity to display world clock.
4#
5# Note: this currently relies on associative array support in the shell.
6#
7# Inspired from i3pystatus wiki:
8# https://github.com/enkore/i3pystatus/wiki/Shutdown-Menu
9#
10# Copyright 2022 Jinwei Zhao <i at jinwei dot me>
11#
12# This program is free software: you can redistribute it and/or modify
13# it under the terms of the GNU General Public License as published by
14# the Free Software Foundation, either version 3 of the License, or
15# (at your option) any later version.
16
17# This program is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20# GNU General Public License for more details.
21
22# You should have received a copy of the GNU General Public License
23# along with this program. If not, see <http://www.gnu.org/licenses/>.
24
25# modified to work with latest rofi update by joekamprad <[email protected]>
26
27#######################################################################
28# BEGIN CONFIG #
29#######################################################################
30
31# Colors: FG (foreground), BG (background), HL (highlighted)
32FG_COLOR="#bbbbbb"
33BG_COLOR="#111111"
34HLFG_COLOR="#111111"
35HLBG_COLOR="#bbbbbb"
36BORDER_COLOR="#222222"
37
38# Options not related to colors (most rofi options do not work anymore)
39ROFI_OPTIONS=(-theme ~/.config/rofi/worldclock.rasi)
40
41#######################################################################
42# END CONFIG #
43#######################################################################
44
45# Preferred launcher if both are available
46preferred_launcher="rofi"
47
48# Check whether the user-defined launcher is valid
49launcher_list=(rofi)
50function check_launcher() {
51 if [[ ! "${launcher_list[@]}" =~ (^|[[:space:]])"$1"($|[[:space:]]) ]]; then
52 echo "Supported launchers: ${launcher_list[*]}"
53 exit 1
54 else
55 # Get array with unique elements and preferred launcher first
56 # Note: uniq expects a sorted list, so we cannot use it
57 i=1
58 launcher_list=($(for l in "$1" "${launcher_list[@]}"; do printf "%i %s\n" "$i" "$l"; let i+=1; done \
59 | sort -uk2 | sort -nk1 | cut -d' ' -f2- | tr '\n' ' '))
60 fi
61}
62
63# Parse CLI arguments
64while getopts "hcp:" option; do
65 case "${option}" in
66 p) preferred_launcher="${OPTARG}"
67 check_launcher "${preferred_launcher}"
68 ;;
69 *) exit 1
70 ;;
71 esac
72done
73
74# Check whether a command exists
75function command_exists() {
76 command -v "$1" &> /dev/null 2>&1
77}
78
79# menu defined as an associative array
80typeset -A menu
81
82menu=(
83 [🇨🇦: `date '+%b %d %H:%M'`]=""
84 [🇬🇧: `TZ=Europe/London date '+%b %d %H:%M'`]=""
85 [🇨🇳: `TZ=Asia/Shanghai date '+%b %d %H:%M'`]=""
86)
87
88menu_nrows=${#menu[@]}
89
90launcher_exe=""
91launcher_options=""
92rofi_colors=""
93
94function prepare_launcher() {
95 if [[ "$1" == "rofi" ]]; then
96 rofi_colors=(-bc "${BORDER_COLOR}" -bg "${BG_COLOR}" -fg "${FG_COLOR}" \
97 -hlfg "${HLFG_COLOR}" -hlbg "${HLBG_COLOR}")
98 launcher_exe="rofi"
99 launcher_options=(-dmenu -i -lines "${menu_nrows}" -p "${ROFI_TEXT}" \
100 "${rofi_colors}" "${ROFI_OPTIONS[@]}")
101 elif [[ "$1" == "zenity" ]]; then
102 launcher_exe="zenity"
103 launcher_options=(--list --title="${ZENITY_TITLE}" --text="${ZENITY_TEXT}" \
104 "${ZENITY_OPTIONS[@]}")
105 fi
106}
107
108for l in "${launcher_list[@]}"; do
109 if command_exists "${l}" ; then
110 prepare_launcher "${l}"
111 break
112 fi
113done
114
115# No launcher available
116if [[ -z "${launcher_exe}" ]]; then
117 exit 1
118fi
119
120launcher=(${launcher_exe} "${launcher_options[@]}")
121printf '%s\n' "${!menu[@]}" | sort | "${launcher[@]}"
122
Powered by cgit v1.2.3 (git 2.41.0)