Skip to content

Instantly share code, notes, and snippets.

@katoozi
Last active February 3, 2024 01:26
Show Gist options
  • Save katoozi/22007abc9e1e154b87414db673b7d294 to your computer and use it in GitHub Desktop.
Save katoozi/22007abc9e1e154b87414db673b7d294 to your computer and use it in GitHub Desktop.
my i3 config files
#!/bin/sh -e
# Take a screenshot
#scrot /tmp/screen_locked.png
# Pixellate it 10x
#mogrify -scale 10% -scale 1000% /tmp/screen_locked.png
# Lock screen displaying this image.
i3lock -i /usr/share/backgrounds/warty-final-ubuntu.png
# Turn the screen off after a delay.
sleep 60; pgrep i3lock && xset dpms force off
opacity-rule = [
"93:class_g = 'URxvt' && !_NET_WM_STATE@:32a",
"90:class_g = 'Qvim' && !_NET_WM_STATE@:32a",
"95:class_g = 'Zathura' && !_NET_WM_STATE@:32a",
"95:class_g = 'Spacefm' && !_NET_WM_STATE@:32a",
"88:class_g = 'LilyTerm' && !_NET_WM_STATE@:32a",
"80:class_g = 'i3-bar' && !_NET_WM_STATE@:32a",
"50:class_g = 'i3-frame' && !_NET_WM_STATE@:32a",
"100:name *= 'i3lock'",
"0:_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'"
];
mark-ovredir-focused = true;
inactive-opacity = 0.8;
menu-opacity = 0.9;
gaps inner 5
gaps outer 5
smart_gaps on
smart_gaps inverse_outer
smart_borders on
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
#
# This config file uses keycodes (bindsym) and was written for the QWERTY
# layout.
#
# To get a config file with the same key positions, but for your current
# layout, use the i3-config-wizard
#
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:consolas 7, pango:FontAwesome 7
#font pango:'Segoe UI' 7, pango:FontAwesome 7
#font pango:FontAwesome 7, pango:consolas 7
# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
#font pango:DejaVu Sans Mono 8
# Before i3 v4.8, we used to recommend this one as the default:
# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
# The font above is very space-efficient, that is, it looks good, sharp and
# clear in small sizes. However, its unicode glyph coverage is limited, the old
# X core fonts rendering does not support right-to-left and this being a bitmap
# font, it doesn’t scale on retina/hidpi displays.
# use these keys for focus, movement, and resize directions when reaching for
# the arrows is not convenient
set $up l
set $down k
set $left j
set $right semicolon
# use Mouse+Mod1 to drag floating windows to their wanted position
floating_modifier Mod1
# start a terminal
#bindsym Mod1+Return exec i3-sensible-terminal
bindsym Mod1+Return exec urxvt
# Music Player. rhythmbox-client
bindcode ctrl+85 exec rhythmbox-client --next
bindcode ctrl+Mod2+85 exec rhythmbox-client --next
bindcode ctrl+83 exec rhythmbox-client --previous
bindcode ctrl+Mod2+83 exec rhythmbox-client --previous
bindcode ctrl+90 exec rhythmbox-client --pause
bindcode ctrl+Mod2+90 exec rhythmbox-client --pause
bindcode ctrl+87 exec rhythmbox-client --play
bindcode ctrl+Mod2+87 exec rhythmbox-client --play
bindcode ctrl+84 exec rhythmbox-client
bindcode ctrl+Mod2+84 exec rhythmbox-client
# lock the system
bindsym Mod4+l exec i3lock -i /usr/share/backgrounds/warty-final-ubuntu.png
#exec xautolock -time 10 -locker '/home/mohammad/.i3/auto_lock.sh' &
# Multimedia Settings
#bindsym XF86AudioRaiseVolume exec amixer -q set Master 2dB+ unmute
#bindsym XF86AudioLowerVolume exec amixer -q set Master 2dB- unmute
#bindsym XF86AudioMute exec /home/mohammad/.i3/mute_script.sh
bindsym XF86AudioRaiseVolume exec --no-startup-id /home/mohammad/.i3/sound_script.sh incr #increase sound volume
bindsym XF86AudioLowerVolume exec --no-startup-id /home/mohammad/.i3/sound_script.sh decr #decrease sound volume
bindsym XF86AudioMute exec --no-startup-id /home/mohammad/.i3/sound_script.sh # mute sound
exec --no-startup-id systemctl enable pulseaudio.service --user
exec --no-startup-id pulseaudio --start
# Sreen brightness controls
bindsym XF86MonBrightnessUp exec xbacklight -inc 20 # increase screen brightness
bindsym XF86MonBrightnessDown exec xbacklight -dec 20 # decrease screen brightness
# Touchpad controls
bindsym XF86TouchpadToggle exec touchpad-indicator -c
# Media player controls
bindsym XF86AudioPlay exec playerctl play
bindsym XF86AudioPause exec playerctl pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
# Num lock and Caps lock
bindsym --release shift+Caps_Lock exec pkill -SIGRTMIN+11 i3blocks
bindsym --release Num_Lock exec pkill -SIGRTMIN+11 i3blocks
#bindsym ctrl+KP_RIGHT exec rhythmbox-client --next
# kill focused window
#bindsym Mod1+Shift+q kill
bindsym Mod1+F4 kill
# start dmenu (a program launcher)
#bindsym Mod1+d exec dmenu_run -l 10
#bindsym Mod1+d exec rofi -show run -lines 3 -eh 2 -width 100 -padding 800 -opacity "85" -bw 0 -bc "$bg-color" -bg "$bg-color" -fg "$text-color" -hlbg "$bg-color" -hlfg "#9575cd" -font "consolas 18"
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# bindsym Mod1+d exec --no-startup-id i3-dmenu-desktop
# change focus
bindsym Mod1+$left focus left
bindsym Mod1+$down focus down
bindsym Mod1+$up focus up
bindsym Mod1+$right focus right
# alternatively, you can use the cursor keys:
bindsym Mod1+Left focus left
bindsym Mod1+Down focus down
bindsym Mod1+Up focus up
bindsym Mod1+Right focus right
# move focused window
bindsym Mod1+Shift+$left move left
bindsym Mod1+Shift+$down move down
bindsym Mod1+Shift+$up move up
bindsym Mod1+Shift+$right move right
# alternatively, you can use the cursor keys:
bindsym Mod1+Shift+Left move left
bindsym Mod1+Shift+Down move down
bindsym Mod1+Shift+Up move up
bindsym Mod1+Shift+Right move right
# split in horizontal orientation
bindsym Mod1+h split h
# split in vertical orientation
bindsym Mod1+v split v
# enter fullscreen mode for the focused container
bindsym Mod1+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
bindsym Mod1+s layout stacking
bindsym Mod1+w layout tabbed
bindsym Mod1+e layout toggle split
# toggle tiling / floating
bindsym Mod1+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym Mod1+space focus mode_toggle
# focus the parent container
bindsym Mod1+a focus parent
# focus the child container
#bindsym Mod1+d focus child
# move the currently focused window to the scratchpad
bindsym Mod1+Shift+minus move scratchpad
# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
bindsym Mod1+minus scratchpad show
set $workspace1 "1: Terminal "
set $workspace2 "2:  "
set $workspace3 "3: Code "
set $workspace4 "4: Telegram "
set $workspace5 "5: Music "
set $workspace6 "6: Video "
set $workspace7 "7: OutLine "
set $workspace8 "8: Skype "
# switch to workspace
bindsym Mod1+1 workspace $workspace1
bindsym Mod1+2 workspace $workspace2
bindsym Mod1+3 workspace $workspace3
bindsym Mod1+4 workspace $workspace4
bindsym Mod1+5 workspace $workspace5
bindsym Mod1+6 workspace $workspace6
bindsym Mod1+7 workspace $workspace7
bindsym Mod1+8 workspace $workspace8
bindsym Mod1+9 workspace 9
bindsym Mod1+0 workspace 10
# move focused container to workspace
bindsym Mod1+Shift+1 move container to workspace $workspace1
bindsym Mod1+Shift+2 move container to workspace $workspace2
bindsym Mod1+Shift+3 move container to workspace $workspace3
bindsym Mod1+Shift+4 move container to workspace $workspace4
bindsym Mod1+Shift+5 move container to workspace $workspace5
bindsym Mod1+Shift+6 move container to workspace $workspace6
bindsym Mod1+Shift+7 move container to workspace $workspace7
bindsym Mod1+Shift+8 move container to workspace $workspace8
bindsym Mod1+Shift+9 move container to workspace 9
bindsym Mod1+Shift+0 move container to workspace 0
for_window [class=".*"] border pixel 0
#for [window_type=floating] border pixel full
assign [class="Google-chrome"] $workspace2
for_window [class="Google-chrome"] focus
assign [class="Outline"] $workspace8
for_window [class="Outline"] focus
assign [class="Gnome-terminal"] $workspace1
for_window [class="Gnome-terminal"] focus
assign [class="Rhythmbox"] $workspace5
assign [class="TelegramDesktop"] $workspace4
for_window [class="TelegramDesktop"] focus
assign [class="Code"] $workspace3
for_window [class="Code"] focus
assign [class="Firefox"] $workspace2
for_window [class="Firefox"] focus
assign [class="mpv"] $workspace6
for_window [class="mpv"] focus
assign [class="Skype"] $workspace9
for_window [class="Skype"] focus
# reload the configuration file
bindsym Mod1+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym Mod1+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym Mod1+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 $left resize shrink width 10 px or 10 ppt
bindsym $down resize grow height 10 px or 10 ppt
bindsym $up resize shrink height 10 px or 10 ppt
bindsym $right resize grow width 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym Mod1+r mode "resize"
set $bg-color #2f343f40
set $inactive-bg-color #2f343f40
set $text-color #2fff3f
set $inactive-text-color #676F7F
set $urgent-bg-color #E5393540
set $urgent-text-color #676F7F
# window colors
# border background text indicator
client.focused #FFFF00 #2f343f #FFFF00 #00ff00
client.unfocused $inactive-bg-color $inactive-bg-color #FFFF00 #00ff00
client.focused_inactive $inactive-bg-color $inactive-bg-color $inactive-text-color #00ff00
client.urgent $urgent-bg-color $urgent-bg-color $text-color #00ff00
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
position top
font pango:FontAwesome 7
status_command i3blocks -c ~/.i3/i3blocks.conf
i3bar_command i3bar -t
colors {
statusline #aaffff
background #2f343f40
separator #a1a1a1
# border background text
focused_workspace $bg-color $bg-color $text-color
inactive_workspace $inactive-bg-color $inactive-bg-color $inactive-text-color
urgent_workspace $urgent-bg-color $urgent-bg-color $text-color
}
}
exec_always --no-startup-id numlockx on
exec_always --no-startup-id feh --bg-scale /usr/share/backgrounds/warty-final-ubuntu.png
set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown
mode "$mode_system" {
bindsym l exec --no-startup-id /home/mohammad/.i3/i3exit lock, mode "default"
bindsym e exec --no-startup-id /home/mohammad/.i3/i3exit logout, mode "default"
bindsym s exec --no-startup-id /home/mohammad/.i3/i3exit suspend, mode "default"
bindsym h exec --no-startup-id /home/mohammad/.i3/i3exit hibernate, mode "default"
bindsym r exec --no-startup-id /home/mohammad/.i3/i3exit reboot, mode "default"
bindsym Shift+s exec --no-startup-id /home/mohammad/.i3/i3exit shutdown, mode "default"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym Mod1+Prior mode "$mode_system"
# openvpn connection keys
set $openvpn_connection_key 427487ef-3f69-4877-9f56-21a4177f6ded
set $openvonnect_connection_key fe818b14-caf9-4f84-ad3f-46925d0b7624
bindsym ctrl+Mod4+f exec nmcli con down $openvpn_connection_key .mohammad
bindsym ctrl+Mod4+o exec nmcli con up $openvpn_connection_key .mohammad
set $mode_vpn OpenVpn(o), AnyConnect(a), IpSec(i), OutLine(l)
mode "$mode_vpn" {
bindsym a exec nmcli con up $openvonnect_connection_key openconnect, mode "default"
bindsym o exec nmcli con up $openvpn_connection_key mohammad, mode "default"
bindsym l exec /home/mohammad/Desktop/OutLineVpn/Outline-Client.AppImage, mode "default"
bindsym i exec i3-input -F 'echo '%s' | sudo -S /media/mohammad/G/vpn/IpsecVpnConnectScript/connect.sh' -P "Password: ", mode "default"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym Mod4+v mode "$mode_vpn"
#bindsym Mod1+d exec rofi -show run -lines 10 -eh 2 -width 100 -padding 800 -opacity 85 -font "consolas 18"
exec --no-startup-id "setxkbmap -layout us,ir -option 'grp:win_space_toggle'"
bindsym ctrl+Mod4+g exec google-chrome-stable
bindsym ctrl+Mod4+k exec skypeforlinux
bindsym ctrl+Mod4+r exec firefox
bindsym ctrl+Mod4+v exec code
bindsym ctrl+Mod4+t exec /media/mohammad/D/Telegram/Telegram
bindsym ctrl+Mod4+u exec /home/mohammad/.i3/dmenu-umount.sh
bindsym ctrl+Mod4+m exec /home/mohammad/.i3/dmenumount.sh
bindsym Mod2+XF86Display exec /home/mohammad/.i3/displayselect.sh
bindsym XF86Display exec /home/mohammad/.i3/displayselect.sh
bindsym ctrl+Mod4+s exec /home/mohammad/.i3/google-search.sh && i3-msg workspace "2: Chrome "
bindsym XF86Calculator exec gnome-calculator
bindsym XF86HomePage exec google-chrome-stable 'https://google.com'
bindsym XF86Mail exec google-chrome-stable 'https://mail.google.com/mail/u/0/'
bindsym ctrl+Mod4+l exec urxvt
bindsym Mod1+Tab workspace next
bindsym Shift+Mod1+Tab workspace prev
bindsym Mod4+s exec dmenu_run -l 10
bindsym ctrl+Mod1+t exec urxvt
exec --no-startup-id i3-msg 'exec urxvt'
# manage touchpad
#exec --no-startup-id exec touchpad-indicator
# manage wifi
exec_always --no-startup-id exec nm-applet etc
#exec_always --no-startup-id exec blueman-applet
# enable transitions
exec_always --no-startup-id compton --config ~/.i3/.compton.conf
# Screen Shots
#bindsym Home exec scrot '%Y-%m-%d-%s_screenshot_$wx$h.jpg' -e 'mv $f ~/Pictures/'
bindsym Control+Mod4+Home exec gnome-screenshot -i
#!/bin/sh
# A UI for detecting and selecting all displays.
# Probes xrandr for connected displays and lets user select one to use.
# User may also select "manual selection" which opens arandr.
# I plan on adding a routine from multi-monitor setups later.
twoscreen() { # If multi-monitor is selected and there are two screens.
mirror=$(printf "no\\nyes" | dmenu -i -p "Mirror displays?")
# Mirror displays using native resolution of external display and a scaled
# version for the internal display
if [ "$mirror" = "yes" ]; then
external=$(echo "$screens" | dmenu -i -p "Optimize resolution for:")
internal=$(echo "$screens" | grep -v "$external")
res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" | \
tail -n 1 | awk '{print $1}')
res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" | \
tail -n 1 | awk '{print $1}')
res_ext_x=$(echo $res_external | sed 's/x.*//')
res_ext_y=$(echo $res_external | sed 's/.*x//')
res_int_x=$(echo $res_internal | sed 's/x.*//')
res_int_y=$(echo $res_internal | sed 's/.*x//')
scale_x=$(echo "$res_ext_x / $res_int_x" | bc -l)
scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l)
xrandr --output "$external" --auto --scale 1.0x1.0 \
--output "$internal" --auto --same-as "$external" \
--scale "$scale_x"x"$scale_y"
else
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
secondary=$(echo "$screens" | grep -v "$primary")
direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?")
xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0
fi
}
morescreen() { # If multi-monitor is selected and there are more than two screens.
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
secondary=$(echo "$screens" | grep -v "$primary" | dmenu -i -p "Select secondary display:")
direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?")
tertiary=$(echo "$screens" | grep -v "$primary" | grep -v "$secondary" | dmenu -i -p "Select third display:")
xrandr --output "$primary" --auto --output "$secondary" --"$direction"-of "$primary" --auto --output "$tertiary" --"$(printf "left\\nright" | grep -v "$direction")"-of "$primary" --auto
}
multimon() { # Multi-monitor handler.
case "$(echo "$screens" | wc -l)" in
1) xrandr $(echo "$allposs" | grep -v "$screens" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;;
2) twoscreen ;;
*) morescreen ;;
esac ;}
# set PASSWORD env variable in /etc/enviroment file
echo $PASSWORD | sudo -S su
# Get all possible displays
allposs=$(xrandr -q | grep "connected")
# Get all connected screens.
screens=$(echo "$allposs" | grep " connected" | awk '{print $1}')
# Get user choice including multi-monitor and manual selection:
chosen=$(printf "%s\\nmulti-monitor\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") &&
case "$chosen" in
"manual selection") arandr ; exit ;;
"multi-monitor") multimon ;;
*) xrandr --output "$chosen" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "$chosen" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;;
esac
setbg # Fix background if screen size/arangement has changed.
remaps # Re-remap keys if keyboard added (for laptop bases)
pgrep -x dunst >/dev/null && killall dunst && setsid dunst & # Restart dunst to ensure proper location on screen
#!/bin/sh
unmountusb() { \
chosen="$(echo "$usbdrives" | dmenu -i -p "Unmount which drive?" | awk '{print $1}')"
sudo -A umount "$chosen" && notify-send " USB unmounting" "$chosen unmounted." && exit 0
}
# set PASSWORD env variable in /etc/enviroment file
echo $PASSWORD | sudo -S su
usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | awk '$2=="part"&&$4!=""&&match($4, "/media/mohammad/External/*")&&$3!="128M"&&$3!="500M"&&$3!="1K"{printf "%s (%s)\n",$4, $3}')"
if [ -z "$anddrives" ]; then
echo "USB drive(s) detected."
unmountusb
fi
#!/bin/sh
# Gives a dmenu prompt to mount unmounted drives.
# If they're in /etc/fstab, they'll be mounted automatically.
# Otherwise, you'll be prompted to give a mountpoint from already existsing directories.
# If you input a novel directory, it will prompt you to create that directory.
getmount() { \
[ -z "$chosen" ] && exit 1
mp="$(find $1 | dmenu -i -p "Type in mount point.")"
[ "$mp" = "" ] && exit 1
if [ ! -d "$mp" ]; then
mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?")
[ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp")
fi
}
mountusb() { \
chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?" | awk '{print $1}')"
sudo -A mount "$chosen" && notify-send " USB mounting" "$chosen mounted." && exit 0
alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$2=="part"&&$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not \( -path *%s -prune \) \ \n",$3}')
getmount "/media/mohammad/External/ -maxdepth 5 -type d $alreadymounted"
partitiontype="$(lsblk -no "fstype" "$chosen")"
case "$partitiontype" in
"vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;;
*) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" 741 "$mp";;
esac
notify-send "💻 USB mounting" "$chosen mounted to $mp."
}
mountandroid() { \
chosen=$(echo "$anddrives" | dmenu -i -p "Which Android device?" | cut -d : -f 1)
getmount "$HOME -maxdepth 3 -type d"
simple-mtpfs --device "$chosen" "$mp"
notify-send "🤖 Android Mounting" "Android device mounted to $mp."
}
asktype() { \
case $(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?") in
USB) mountusb ;;
Android) mountandroid ;;
esac
}
# set PASSWORD env variable in /etc/enviroment file
echo $PASSWORD | sudo -S su
anddrives=$(simple-mtpfs -l 2>/dev/null)
usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | awk '$2=="part"&&$4==""&&$3!="128M"&&$3!="500M"&&$3!="1K"{printf "%s (%s)\n",$1,$3}')"
if [ -z "$usbdrives" ]; then
[ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit
echo "Android device(s) detected."
mountandroid
else
if [ -z "$anddrives" ]; then
echo "USB drive(s) detected."
mountusb
else
echo "Mountable USB drive(s) and Android device(s) detected."
asktype
fi
fi
#!/bin/sh
# Gives a dmenu prompt to search DuckDuckGo.
# Without input, will open DuckDuckGo.com.
# URLs will be directly handed to the browser.
# Anything else, it search it.
browser=${BROWSER:-google-chrome-stable}
pgrep -x dmenu && exit
choice=$(echo "" | dmenu -i -p "Search Google:") || exit 1
if [ "$choice" = "" ]; then
$browser "https://google.com"
else
if echo "$choice" | grep "^(http:\/\/|https:\/\/)?[a-zA-Z0-9]+\.[a-zA-Z]+(/)?.*$"; then
$browser "$choice"
else
$browser "https://google.com/search?q=$choice"
fi
fi
# i3blocks config file
#
# Please see man i3blocks for a complete reference!
# The man page is also hosted at http://vivien.github.io/i3blocks
#
# List of valid properties:
#
# align
# color
# command
# full_text
# instance
# interval
# label
# min_width
# name
# separator
# separator_block_width
# short_text
# signal
# urgent
# Global properties
#
# The top properties below are applied to every block, but can be overridden.
# Each block command defaults to the script name to avoid boilerplate.
command=/usr/share/i3blocks/$BLOCK_NAME
separator_block_width=15
markup=none
# Volume indicator
#
# The first parameter sets the step (and units to display)
# The second parameter overrides the mixer selection
# See the script for details.
[volume]
label=VOL
label=
instance=Master
color=#f2f907
interval=1
signal=10
# Memory usage
#
# The type defaults to "mem" if the instance is not specified.
[memory]
label=
color=#00FF00
interval=2
#[memory]
#label=SWAP
#instance=swap
#separator=false
#interval=30
# Disk usage
#
# The directory defaults to $HOME if the instance is not specified.
# The script may be called with a optional argument to set the alert
# (defaults to 10 for 10%).
#[disk]
#label=
#instance=/mnt/data
#interval=30
# Network interface monitoring
#
# If the instance is not specified, use the interface used for default route.
# The address can be forced to IPv4 or IPv6 with -4 or -6 switches.
[iface]
label=
instance=enp0s25
color=#00FF00
interval=1
#separator=false
[iface]
label=
instance=wlo1
color=#00FF00
interval=1
separator=false
[wifi]
label=
instance=wlo1
interval=10
separator=false
[bandwidth]
label=
color=#00FF00
instance=wlo1
interval=1
#[wificonnector]
#command=nm-applet etc
#interval=persist
# CPU usage
#
# The script may be called with -w and -c switches to specify thresholds,
# see the script for details.
[cpu_usage]
label=
interval=1
color=#00FF00
min_width=100.00%
#separator=false
#[load_average]
#interval=1
#label=
# Battery indicator
#
# The battery instance defaults to 0.
#[battery]
#label=BAT
#label=⚡
#instance=1
#interval=1
# Date Time
#
[time]
color=#f2f907
command=date '+%Y-%m-%d %r'
interval=1
# Generic media player support
#
# This displays "ARTIST - SONG" if a music is playing.
# Supported players are: spotify, vlc, audacious, xmms2, mplayer, and others.
#[mediaplayer]
#instance=rhythmbox-client
#interval=1
#signal=10
# OpenVPN support
#
# Support multiple VPN, with colors.
#[openvpn]
#instance=wlo1
#command=/home/mohammad/.i3/openvpn.sh
#interval=1
#label=
#color=#00ff00
# Temperature
#
# Support multiple chips, though lm-sensors.
# The script may be called with -w and -c switches to specify thresholds,
# see the script for details.
#[temperature]
#label=TEMP
#interval=1
# Key indicators
#
# Add the following bindings to i3 config file:
#
# bindsym --release Caps_Lock exec pkill -SIGRTMIN+11 i3blocks
# bindsym --release Num_Lock exec pkill -SIGRTMIN+11 i3blocks
#[keyindicator]
#instance=CAPS
#interval=once
#signal=11
#[keyindicator]
#instance=NUM
#interval=once
#signal=11
#[internetspeed]
#interval=1
#command=indicator-netspeed
#[touchbar]
#interval=persist
#command=touchpad-indicator
[language]
label=
color=#f2f907
interval=persist
command=/home/mohammad/.i3/language.sh
#!/bin/sh
lock() {
i3lock
}
case "$1" in
lock)
lock
;;
logout)
i3-msg exit
;;
suspend)
lock && systemctl suspend
;;
hibernate)
lock && systemctl hibernate
;;
reboot)
systemctl reboot
;;
shutdown)
systemctl poweroff
;;
*)
echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|shutdown}"
exit 2
esac
exit 0
# i3status configuration file.
# see "man i3status" for documentation.
# It is important that this file is edited as UTF-8.
# The following line should contain a sharp s:
# ß
# If the above line is not correctly displayed, fix your editor first!
general {
colors = true
interval = 5
}
order += "ipv6"
order += "disk /"
order += "wireless _first_"
order += "ethernet _first_"
order += "battery all"
order += "load"
order += "tztime local"
order += "volume master"
wireless _first_ {
format_up = "W: (%quality at %essid) %ip"
format_down = "W: down"
}
ethernet _first_ {
# if you use %speed, i3status requires root privileges
format_up = "E: %ip (%speed)"
format_down = "E: down"
}
battery all {
format = "%status %percentage %remaining"
}
tztime local {
format = "%Y-%m-%d %H:%M:%S"
}
load {
format = "%1min"
}
disk "/" {
format = "%avail"
}
volume master {
format = "♪:%volume"
device = "default"
mixer = "Master"
mixer_idx = 0
}
killall kbdd 2>/dev/null
kbdd >/dev/null || exit 1
# Get initial state of layout
N=$( dbus-send --print-reply=literal --dest=ru.gentoo.KbddService\
/ru/gentoo/KbddService ru.gentoo.kbdd.getCurrentLayout 2>/dev/null |\
sed -un 's/^.*uint32 //p' )
# In case dbus service wasn't available yet, poll until service is ready
while [[ -z "$N" ]]; do
sleep .1
N=$( dbus-send --print-reply=literal --dest=ru.gentoo.KbddService\
/ru/gentoo/KbddService ru.gentoo.kbdd.getCurrentLayout 2>/dev/null |\
sed -un 's/^.*uint32 //p' )
done
echo $( dbus-send --print-reply=literal --dest=ru.gentoo.KbddService \
/ru/gentoo/KbddService ru.gentoo.kbdd.getLayoutName uint32:$N )
# Parse dbus output
dbus-monitor "interface='ru.gentoo.kbdd',member='layoutNameChanged'" |\
sed -un '0~2p' | sed -un 's:.*string "\(.*\)".*:\1:p' | sed -u '/:/d'
#!/bin/bash
CURRENT_STATE=`amixer get Master | egrep 'Playback.*?\[o' | egrep -o '\[o.+\]'`
if [[ $CURRENT_STATE == '[on]' ]]; then
amixer set Master mute
else
amixer set Master unmute
amixer set Front unmute
amixer set Headphone unmute
fi
status="$(nmcli -t -f type,state,connection d | egrep "^(tun|tap):connected" | awk -F':' '{ print $3 }')"
if [ "$status" = "tun0" ]
then
echo Up
else
echo Down
fi
#!/bin/bash
sink="$(pactl list sinks | grep "Sink #")"
sink_length="${#sink}"
position="$(echo $sink | grep -b -o "#")"
position="${position:0:1}"
number="${sink:position+1:sink_length}"
if [ "$1" = "incr" ]; then
pactl set-sink-volume $number +5%
elif [ "$1" = "decr" ]; then
pactl set-sink-volume $number -5%
else
pactl set-sink-mute $number toggle
fi
#!/bin/bash
if synclient -l | grep "TouchpadOff .*=.*0" ; then
synclient TouchpadOff=1 ;
else
synclient TouchpadOff=0 ;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment