first commit

This commit is contained in:
FabricSoul 2024-12-19 03:58:54 -05:00
commit 8450ea8068
61 changed files with 3269 additions and 0 deletions

617
dotfiles/i3/.config/i3/config Executable file
View file

@ -0,0 +1,617 @@
# exec --no-startup-id ~/set_once.sh
# This file is a modified version based on default i3-config-wizard config
# source is available here:
# https://raw.githubusercontent.com/endeavouros-team/endeavouros-i3wm-setup/main/etc/skel/.config/i3/config
# Maintainer: joekamprad [joekamprad //a_t// endeavouros.com]
# https://endeavouros.com
#
# iconic font icon search: https://fontawesome.com/v4.7/cheatsheet/
#
# --> to update this run the following command (will backup existing setup file)
# wget --backups=1 https://raw.githubusercontent.com/endeavouros-team/endeavouros-i3wm-setup/main/etc/skel/.config/i3/config -P ~/.config/i3/
#
# Endeavouros-i3 config file
# Source for complete framework of our i3 config and theming here: https://github.com/endeavouros-team/endeavouros-i3wm-setup
# EndeavourOS wiki holds some Information also: https://discovery.endeavouros.com/window-tiling-managers/i3-wm/
# Please see http://i3wm.org/docs/userguide.html for the official i3 reference!
#######################
# config starts here: #
#######################
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
# 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: Noto Sans Regular 10
font pango: FiraCode Nerd Font medium 10
# set the mod key to the winkey:
set $mod Mod4
#####################
# workspace layout: #
#####################
# default i3 tiling mode:
workspace_layout default
# i3 stacking layout:
# Each window will be fullscreen and tabbed top to bottom.
#workspace_layout stacking
# i3 tabbed layout:
# Each new window will open fullscreen as a tab (left to right)
#workspace_layout tabbed
##############################
# extra options for windows: #
##############################
#border indicator on windows:
default_border pixel 1
exec --no-startup-id thunar --daemon
#exec --no-startup-id flatpak run com.github.vladimiry.ElectronMail
#exec --no-startup-id "libinput-gestures-setup start"
#exec_always --no-startup-id "echo $PASSW | sshfs -p 8022 u0_a114@100.65.217.31:/storage/B49B-1F11/Android/data/com.termux/files /home/flavio/server -o password_stdin"
# thin borders
# hide_edge_borders both
# Set inner/outer gaps
gaps inner 10
gaps outer 0
# for inserting password
exec --no-startup-id /usr/lib/polkit-kde-authentication-agent-1
# show window title bars (not officially supported with i3gaps)
#default_border normal
default_border pixel 2
# window title alignment
#title_align center
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# switch/iterate between workspaces
bindsym $mod+Tab workspace next
bindsym $mod+Shift+Tab workspace prev
# switch to workspace
bindcode $mod+10 workspace $ws1
bindcode $mod+11 workspace $ws2
bindcode $mod+12 workspace $ws3
bindcode $mod+13 workspace $ws4
bindcode $mod+14 workspace $ws5
bindcode $mod+15 workspace $ws6
bindcode $mod+16 workspace $ws7
bindcode $mod+17 workspace $ws8
bindcode $mod+18 workspace $ws9
bindcode $mod+19 workspace $ws10
# switch to workspace with numpad keys
bindcode $mod+87 workspace $ws1 bindcode $mod+88 workspace $ws2
bindcode $mod+89 workspace $ws3
bindcode $mod+83 workspace $ws4
bindcode $mod+84 workspace $ws5
bindcode $mod+85 workspace $ws6
bindcode $mod+79 workspace $ws7
bindcode $mod+80 workspace $ws8
bindcode $mod+81 workspace $ws9
bindcode $mod+90 workspace $ws10
# switch to workspace with numlock numpad keys
bindcode $mod+Mod2+87 workspace $ws1
bindcode $mod+Mod2+88 workspace $ws2
bindcode $mod+Mod2+89 workspace $ws3
bindcode $mod+Mod2+83 workspace $ws4
bindcode $mod+Mod2+84 workspace $ws5
bindcode $mod+Mod2+85 workspace $ws6
bindcode $mod+Mod2+79 workspace $ws7
bindcode $mod+Mod2+80 workspace $ws8
bindcode $mod+Mod2+81 workspace $ws9
bindcode $mod+Mod2+90 workspace $ws10
# move focused container to workspace
bindcode $mod+Shift+10 move container to workspace $ws1
bindcode $mod+Shift+11 move container to workspace $ws2
bindcode $mod+Shift+12 move container to workspace $ws3
bindcode $mod+Shift+13 move container to workspace $ws4
bindcode $mod+Shift+14 move container to workspace $ws5
bindcode $mod+Shift+15 move container to workspace $ws6
bindcode $mod+Shift+16 move container to workspace $ws7
bindcode $mod+Shift+17 move container to workspace $ws8
bindcode $mod+Shift+18 move container to workspace $ws9
bindcode $mod+Shift+19 move container to workspace $ws10
# move focused container to workspace with numpad keys
bindcode $mod+Shift+Mod2+87 move container to workspace $ws1
bindcode $mod+Shift+Mod2+88 move container to workspace $ws2
bindcode $mod+Shift+Mod2+89 move container to workspace $ws3
bindcode $mod+Shift+Mod2+83 move container to workspace $ws4
bindcode $mod+Shift+Mod2+84 move container to workspace $ws5
bindcode $mod+Shift+Mod2+85 move container to workspace $ws6
bindcode $mod+Shift+Mod2+79 move container to workspace $ws7
bindcode $mod+Shift+Mod2+80 move container to workspace $ws8
bindcode $mod+Shift+Mod2+81 move container to workspace $ws9
bindcode $mod+Shift+Mod2+90 move container to workspace $ws10
# move focused container to workspace with numpad keys
bindcode $mod+Shift+87 move container to workspace $ws1
bindcode $mod+Shift+88 move container to workspace $ws2
bindcode $mod+Shift+89 move container to workspace $ws3
bindcode $mod+Shift+83 move container to workspace $ws4
bindcode $mod+Shift+84 move container to workspace $ws5
bindcode $mod+Shift+85 move container to workspace $ws6
bindcode $mod+Shift+79 move container to workspace $ws7
bindcode $mod+Shift+80 move container to workspace $ws8
bindcode $mod+Shift+81 move container to workspace $ws9
bindcode $mod+Shift+90 move container to workspace $ws10
# resize window (you can also use the mouse for that):
mode "" {
bindsym h resize shrink width 10 px or 10 ppt
bindsym j resize grow height 10 px or 10 ppt
bindsym k resize shrink height 10 px or 10 ppt
bindsym l 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 $mod+r mode "default"
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode ""
######################################
# start a terminal
bindsym $mod+Return exec --no-startup-id kitty
# kill focused window
bindsym $mod+q kill
# exit-menu
bindsym $mod+Shift+e exec --no-startup-id ~/.config/i3/scripts/powermenu
# Lock the system
# lock with a picture:
#bindsym $mod+l exec --no-startup-id i3lock -i ~/.config/i3/i3-lock-screen.png -p default|win -t
# lock by blurring the screen:
bindsym F9 exec --no-startup-id ~/.config/i3/scripts/blur-lock
# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to update i3)
bindsym $mod+Shift+r restart
# keybinding in fancy rofi (automated):
bindsym F1 exec --no-startup-id ~/.config/i3/scripts/keyhint-2
# alternative
# keybinding list in editor:
# bindsym $mod+F1 exec --no-startup-id xed ~/.config/i3/keybindings
# Backlight control
#bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight +10 && notify-send "Brightness - $(xbacklight -get | cut -d '.' -f 1)%"
#bindsym XF86MonBrightnessDown exec --no-startup-id xbacklight -10 && notify-send "Brightness - $(xbacklight -get | cut -d '.' -f 1)%"
# Backlight setting using dunst osc
bindsym XF86MonBrightnessUp exec --no-startup-id ~/.config/i3/scripts/volume_brightness.sh brightness_up
bindsym XF86MonBrightnessDown exec --no-startup-id ~/.config/i3/scripts/volume_brightness.sh brightness_down
# change focus
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right
# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right
# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# split in horizontal orientation
bindsym $mod+BackSpace split toggle
# split in vertical orientation
#bindsym $mod+v split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
# bindsym $mod+s layout stacking
# bindsym $mod+g layout tabbed
#bindsym $mod+e layout toggle split
bindsym $mod+t layout toggle
# toggle tiling / floating
bindsym $mod+Shift+f floating toggle
# change focus between tiling / floating windows
#bindsym $mod+space focus mode_toggle
# focus the parent container
#bindsym $mod+a focus parent
# open new empty workspace
bindsym $mod+Shift+n exec --no-startup-id ~/.config/i3/scripts/empty_workspace
# Multimedia Keys
# volume
# use meta keys without showing osc
#bindsym XF86AudioRaiseVolume exec --no-startup-id amixer -D pulse sset Master 5%+ && pkill -RTMIN+1 i3blocks
#bindsym XF86AudioLowerVolume exec --no-startup-id amixer -D pulse sset Master 5%- && pkill -RTMIN+1 i3blocks
# use meta keys showing osc using dunst
bindsym XF86AudioRaiseVolume exec --no-startup-id ~/.config/i3/scripts/volume_brightness.sh volume_up
bindsym XF86AudioLowerVolume exec --no-startup-id ~/.config/i3/scripts/volume_brightness.sh volume_down
# gradular volume control
bindsym $mod+XF86AudioRaiseVolume exec --no-startup-id amixer -D pulse sset Master 1%+ && pkill -RTMIN+1 i3blocks
bindsym $mod+XF86AudioLowerVolume exec --no-startup-id amixer -D pulse sset Master 1%- && pkill -RTMIN+1 i3blocks
# mute
#bindsym XF86AudioMute exec --no-startup-id amixer sset Master toggle && killall -USR1 i3blocks
# use meta keys showing osc using dunst
bindsym XF86AudioMute exec --no-startup-id ~/.config/i3/scripts/volume_brightness.sh volume_mute
# mic mute toggle
bindsym XF86AudioMicMute exec amixer sset Capture toggle
# audio control
bindsym XF86AudioPlay exec --no-startup-id playerctl play
bindsym XF86AudioPause exec --no-startup-id playerctl pause
bindsym XF86AudioNext exec --no-startup-id playerctl next
bindsym XF86AudioPrev exec --no-startup-id playerctl previous
# Redirect sound to headphones
#bindsym $mod+p exec --no-startup-id /usr/local/bin/switch-audio-port
## App shortcuts
bindsym $mod+w exec --no-startup-id /usr/bin/firefox
bindsym $mod+n exec --no-startup-id rofi -config ~/.config/rofi/todo.rasi -modi Todo:~/.config/rofi/rofitodo.sh -show Todo
bindsym Print exec --no-startup-id grim $HOME/Immagini/Schermate/$(date +"%Y-%m-%d-%T").png && notify-send "Screenshot saved to ~/$(date +"%Y-%m-%d-%T")-screenshot.png"
bindsym --release Shift+Print exec --no-startup-id $HOME/.config/i3/scripts/miei/schermata.sh
bindsym $mod+Shift+p exec --no-startup-id ~/.config/i3/scripts/power-profiles
##########################################
# configuration for workspace behaviour: #
##########################################
# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
set $ws1 1
set $ws2 2
set $ws3 3
set $ws4 4
set $ws5 5
set $ws6 6
set $ws7 7
set $ws8 8
set $ws9 9
set $ws10 10
# use workspaces on different displays:
# where you have to replace VGA-0/HDMI-0 with the names for your displays
# you can get from xrandr command
# workspace $ws1 output HDMI-1
# workspace $ws2 output HDMI-1
# workspace $ws3 output HDMI-1
# workspace $ws4 output HDMI-1
# workspace $ws5 output HDMI-1
# workspace $ws6 output DP-4
# workspace $ws7 output DP-4
# workspace $ws8 output DP-4
# workspace $ws9 output DP-4
# workspace $ws10 output DP-4
# bind program to workspace and focus to them on startup:
assign [class="discord"] $ws6
assign [class="kitty"] $ws7
assign [class="(?i)firefox"] $ws8
# automatic set focus new window if it opens on another workspace than the current:
#for_window [class=Xfce4-terminal] focus
#for_window [class=(?i)firefox] focus
#for_window [class=Thunar] focus
#for_window [class=Thunderbird] focus
#for_window [class=TelegramDesktop] focus
exec --no-startup-id xset r rate 300 100
exec_always --no-startup-id fcitx5
##############
# compositor #
##############
# transparency
# uncomment one of them to be used
# options could need changes, related to used GPU and drivers.
# to find the right setting consult the archwiki or ask at the forum.
#
# xcompmgr: https://wiki.archlinux.org/title/Xcompmgr
# manpage: https://man.archlinux.org/man/xcompmgr.1.en
# install xcompmgr package to use it (yay -S xcompmgr)
#exec --no-startup-id xcompmgr -C -n &
# or an more specialized config like this:
#exec --no-startup-id xcompmgr -c -C -t-5 -l-5 -r4.2 -o.55 &
#
# or:
#
# picom: https://wiki.archlinux.org/title/Picom
# manpage: https://man.archlinux.org/man/picom.1.en
# The default configuration is available in /etc/xdg/picom.conf
# For modifications, it can be copied to ~/.config/picom/picom.conf or ~/.config/picom.conf
# install picom package (yay -S picom)
# start using default config
#exec_always --no-startup-id picom -b
#
# for custom config:
exec --no-startup-id picom --config ~/.config/picom/picom.conf
#############################################
# autostart applications/services on login: #
#############################################
#get auth work with polkit-gnome
exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
# dex execute .desktop files + apps using /etc/xdg/autostart.
# when second to i3 a DE is installed or mixed usage of i3 + xfce4 or GNOME
# in this cases better disable dex and use manual starting apps using xdg/autostart
# if enabled you should comment welcome app.
# https://github.com/jceb/dex
#exec --no-startup-id dex -a -s /etc/xdg/autostart/:~/.config/autostart/
exec --no-startup-id dex --autostart --environment i3
#exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK
# start welcome app
#exec --no-startup-id sh /usr/share/endeavouros/scripts/welcome --startdelay=3
# num lock activated
#exec --no-startup-id numlockx on
# configure multiple keyboard layouts and hotkey to switch (Alt+CAPSLOCK in this example)
#exec --no-startup-id setxkbmap -layout 'us,sk' -variant altgr-intl,qwerty -option 'grp:alt_caps_toggle'
# start conky:
#exec_always --no-startup-id conky
# start a script to setup displays
# uncomment the next line, use arandr to setup displays and save the file as monitor:
exec --no-startup-id ~/.screenlayout/monitor.sh
# set wallpaper
# exec --no-startup-id sleep 2 && nitrogen --restore
exec_always --no-startup-id sleep 1 && feh --bg-fill $HOME/.config/sfondo.jpg
# set powersavings for display:
# exec --no-startup-id xset s 480 dpms 600 600 600
exec --no-startup-id xset s off
# disable power saving (for example if using xscreensaver)
exec --no-startup-id xset -dpms
#blur enable
#blur_xray enable
#blur_passes 2
#blur_radius 5
# use xautolock to use autosuspend rules for mobile devices
# https://wiki.archlinux.org/title/Session_lock#xautolock
#exec --no-startup-id xautolock -time 60 -locker "systemctl suspend"
# xscreensaver
# https://www.jwz.org/xscreensaver
#exec --no-startup-id xscreensaver --no-splash
# Desktop notifications
# dunst config used ~/.config/dunst/dunstrc
# set alternative config if needed:
#exec --no-startup-id /usr/bin/dunst --config ~/.config/dunst/dunstrc
# may need to run dbus-launch explicitly:
#exec --no-startup-id dbus-launch /usr/bin/dunst
exec --no-startup-id /usr/bin/dunst
# alternative if you installed aside with XFCE4:
# exec --no-startup-id /usr/lib/xfce4/notifyd/xfce4-notifyd &
# autotiling script
# https://github.com/nwg-piotr/autotiling
# `yay -S autotiling ;) (it is in AUR)
#exec_always --no-startup-id autotiling
# Autostart apps as you like
#exec --no-startup-id sleep 2 && xfce4-terminal
#exec --no-startup-id sleep 7 && firefox https://github.com/endeavouros-team/endeavouros-i3wm-setup/blob/main/force-knowledge.md
#exec --no-startup-id sleep 3 && thunar
###############
# system tray #
###############
# if you do not use dex: exec --no-startup-id dex --autostart --environment i3
# you need to have tray apps started manually one by one:
# start blueberry app for managing bluetooth devices from tray:
#exec_always --no-startup-id blueberry-tray
# networkmanager-applet
#exec_always --no-startup-id nm-applet
# clipman-applet
#exec --no-startup-id xfce4-clipman
##################
# floating rules #
##################
# set floating (nontiling) for apps needing it
for_window [class="Yad" instance="yad"] floating enable
for_window [class="Galculator" instance="galculator"] floating enable
for_window [class="Blueberry.py" instance="blueberry.py"] floating enable
# set floating (nontiling) for special apps
for_window [class="Xsane" instance="xsane"] floating enable
for_window [class="Pavucontrol" instance="pavucontrol"] floating enable
for_window [class="qt5ct" instance="qt5ct"] floating enable
for_window [class="Blueberry.py" instance="blueberry.py"] floating enable
for_window [class="Bluetooth-sendto" instance="bluetooth-sendto"] floating enable
for_window [class="Pamac-manager"] floating enable
for_window [window_role="About"] floating enable
#for_window [title=".*"] opacity 1
#for_window [title="^Startpage Search Results Ablaze Floorp$"] opacity 0.9
exec_always --no-startup-id nm-applet --indicator
exec --no-startup-id blueman-applet
# set size of floating window
#for_window [window_role="(?i)GtkFileChooserDialog"] resize set 640 480 #to set size of file choose dialog
#for_window [class=".*"] resize set 640 480 #to change size of all floating windows
# set position of floating window
#for_window [class=".*"] move position center
######################################
# color settings for bar and windows #
######################################
# Define colors variables:
set $darkbluetrans #313244
set $darkblue #b4befe
set $lightblue #eba0ac
#set $urgentred #e53935
set $urgentred #f38ba8
set $white #cdd6f4
set $black #1e1e2e
set $purple #6870A1
set $darkgrey #383c4a
set $grey #b0b5bd
set $mediumgrey #8b8b8b
set $yellowbrown #e1b700
# define colors for windows:
#class border bground text indicator child_border
client.focused $darkblue $black $white $darkblue $darkblue
client.unfocused $purple $black $grey $darkgrey $darkgrey
client.focused_inactive $black $black $grey $darkgrey $darkgrey
client.urgent $urgentred $urgentred $white $darkblue $yellowbrown
############################################
# bar settings (input comes from i3blocks) #
############################################
# Start i3bar to display a workspace bar
# (plus the system information i3status finds out, if available)
bar {
id bar-primary
mode dock
font pango: FiraCode Nerd Font medium 11.3
status_command i3blocks -c ~/.config/i3/i3blocks.conf
position top
# i3bar_command i3bar --transparency
# it could be that you have no primary display set: set one (xrandr --output <output> --primary)
# reference: https://i3wm.org/docs/userguide.html#_tray_output
#tray_output primary
#tray_output none
tray_output none
# When strip_workspace_numbers is set to yes,
# any workspace that has a name of the form
# “[n][:][NAME]” will display only the name.
strip_workspace_numbers yes
##strip_workspace_name no
colors {
separator $purple
# background $darkgrey
background #1e1e2eD9
statusline $white
# border bg txt
focused_workspace #1e1e2eD9 #1e1e2eD9 #b4befe
active_workspace #1e1e2eD9 #1e1e2eD9 #a6adc8
inactive_workspace #1e1e2eD9 #1e1e2eD9 #7f849c
urgent_workspace #1e1e2eD9 #1e1e2eD9 #a6e3a1
}
}
bar {
id bar-tray
mode invisible
font pango: FiraCode Nerd Font medium 11.3
status_command i3blocks -c ~/.config/i3/i3blocks.conf
position top
#modifier none
# i3bar_command i3bar --transparency
# it could be that you have no primary display set: set one (xrandr --output <output> --primary)
# reference: https://i3wm.org/docs/userguide.html#_tray_output
#tray_output primary
# When strip_workspace_numbers is set to yes,
# any workspace that has a name of the form
# “[n][:][NAME]” will display only the name.
strip_workspace_numbers yes
##strip_workspace_name no
colors {
separator $purple
# background $darkgrey
background #1e1e2eD9
statusline $white
# border bg txt
focused_workspace #1e1e2eD9 #1e1e2eD9 #cdd6f4
active_workspace #1e1e2eD9 #1e1e2eD9 #a6adc8
inactive_workspace #1e1e2eD9 #1e1e2eD9 #7f849c
urgent_workspace #1e1e2eD9 #1e1e2eD9 #a6e3a1
}
}
#bindsym $mod+p bar mode dock bar-tray; bar mode invisible bar-primary
#####################################
# Application menu handled by rofi: #
#####################################
## rofi bindings fancy application menu ($mod+d /F9 optional disabled)
bindsym $mod+space exec --no-startup-id rofi -modi drun -show drun \
-config ~/.config/rofi/rofidmenu.rasi
#bindsym F9 exec --no-startup-id rofi -modi drun -show drun \
# -config ~/.config/rofi/rofidmenu.rasi
## rofi bindings for window menu ($mod+t /F10 optional disabled)
bindsym $mod+a exec --no-startup-id rofi -show window \
-config ~/.config/rofi/rofidmenu.rasi
#bindsym F10 exec --no-startup-id rofi -show window \
# -config ~/.config/rofi/rofidmenu.rasi
## rofi bindings to manage clipboard (install rofi-greenclip from the AUR)
#exec --no-startup-id greenclip daemon>/dev/null
#bindsym $mod+c exec --no-startup-id rofi -modi "clipboard:greenclip print" -show clipboard \
# -config ~/.config/rofi/rofidmenu.rasi
bindsym $mod+s exec flameshot gui

View file

@ -0,0 +1,193 @@
# File configurazione i3block
separator=false
markup=pango
separator_block_width=6
color=#cdd6f4
[search]
full_text= 󰍉
color=#f38ba8
command= rofi -modi drun -show drun -config ~/.config/rofi/rofidmenu.rasi
#[files]
#full_text= 
#color=#cba6f7
#command=i3-msg -q exec thunar ~/
[todo]
full_text= 
color=#89b4fa
command=rofi -config ~/.config/rofi/todo.rasi -modi Todo:~/.config/rofi/rofitodo.sh -show Todo
[wallpaper]
full_text=󰸉
color=#fab387
command=~/.config/i3/scripts/miei/wallpaper.sh
[expander]
full_text= 
command=i3-msg -q "exec --no-startup-id ~/.config/i3/scripts/miei/active.sh"
color=#b4befe
[terminal]
full_text= 
color=#94e2d5
command=i3-msg -q exec kitty
[close]
full_text= 󰅙
color=#f38ba8
command=i3-msg -q kill
separator_block_width=0
[simple-2]
full_text=:
color=#717171
[meteo]
command=~/.config/i3/scripts/miei/meteo.sh
interval=1000
[separator]
full_text="⟨"
color=#585b70
#[update]
#full_text=
#command=~/.config/i3/scripts/miei/update.sh
#interval=1800
#[separator]
#full_text="⟨"
#color=#585b70
[cpu_usage]
full_text=
label=
command=~/.config/i3/scripts/miei/cpu.sh
interval=10
#[separator]
#full_text="⟨"
#color=#585b70
#[news]
#full_text=""
#command=~/.config/i3/scripts/miei/feed.sh
#interval=once
#[separator]
#full_text="⟨"
#color=#585b70
#[pavucontrol]
#full_text=
#command=pavucontrol
#[timer]
#full_text=
#command=~/.config/i3/scripts/miei/timer.sh
#interval=1
[separator]
full_text="⟨"
color=#585b70
[pomodoro]
command=~/.config/i3/scripts/pomodoro.sh
interval=1
[separator]
full_text="⟨"
color=#585b70
# [gestione_energia]
# full_text=
# command=/home/flavio/.config/i3/scripts/miei/energia.sh
# interval=once
#
#
#
# [separator]
# full_text="⟨"
# color=#585b70
[volume-pulseaudio]
command=~/.config/i3/scripts/volume
instance=Master
interval=1
#[battery]
#command=~/.config/i3/scripts/battery2
#label=
#interval=30
#[separator]
#full_text="|"
#[separator]
#full_text="|"
#color=#585b70
#[icona]
#full_text=󰁹
#[battery]
#command=~/.config/i3/scripts/miei/power.sh
#label=
#interval=1
[separator]
full_text="⟨"
color=#585b70
[time]
full_text=
label=
interval=1
command=~/.config/i3/scripts/miei/ora.sh
separator_block_width=10
color=#b4befe
#color=#f38ba8
[separator]
full_text=" "
separator_block_width=0
background=#272836
[shutdown_menu]
full_text=<span size="medium"> ⏼ </span>
#full_text=<span size="medium"> ⏼ </span>
command=~/.config/i3/scripts/powermenu
#color=#b4befe
#color=#f5e0dc
#background=#e71853
background=#313244
#separator_block_width=0
#color=#f38ba8
separator_block_width=0

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,11 @@
#!/usr/bin/env bash
PICTURE=/tmp/i3lock.png
SCREENSHOT="scrot -z $PICTURE"
BLUR="5x4"
$SCREENSHOT
convert $PICTURE -blur $BLUR $PICTURE
i3lock -i $PICTURE
rm $PICTURE

View file

@ -0,0 +1,20 @@
#!/usr/bin/bash
if [ -f /tmp/tray ]; then
var=$(cat /tmp/tray)
if [ $var == 1 ]; then
echo 0 > /tmp/tray
i3-msg -q "bar mode dock bar-tray"
i3-msg -q "bar mode invisible bar-primary"
fi
if [ $var == 0 ]; then
echo 1 > /tmp/tray
i3-msg -q "bar mode invisible bar-tray"
i3-msg -q "bar mode dock bar-primary"
fi
else
echo 0 > /tmp/tray
i3-msg -q "bar mode dock bar-tray"
i3-msg -q "bar mode invisible bar-primary"
fi

View file

@ -0,0 +1,6 @@
#!/usr/bin/bash
if [ $BLOCK_BUTTON == 1 ]; then
kitty -e htop
fi
echo ""$[100-$(vmstat 1 2|tail -1|awk '{print $15}')]"%"

View file

@ -0,0 +1,48 @@
#!/usr/bin/bash
file=/tmp/powerprofile
if ! test -f $file; then
echo 0 > $file
powerprofilesctl set power-saver
fi
a=$(cat $file)
if [ $BLOCK_BUTTON == 1 ]
then
if [ $a == 0 ]
then
echo 1 > $file
echo " Blc"
powerprofilesctl set balanced
fi
if [ $a == 1 ]
then
echo 2 > $file
echo " Pro"
powerprofilesctl set performance
fi
if [ $a == 2 ]
then
echo 0 > $file
echo " Eco"
powerprofilesctl set power-saver
fi
fi
if [ $a == 1 ]; then
echo " Blc"
fi
if [ $a == 0 ]; then
echo " Eco"
fi
if [ $a == 2 ]; then
echo " Pro"
fi

View file

@ -0,0 +1,29 @@
#!/usr/bin/bash
a=0
path=~/.config/i3/scripts/miei/feed.sh
if [ $BLOCK_BUTTON == 1 ]
then
if [ $a == 0 ]
then
sed -i '2d' $path
sed -i '2ia=1' $path
a=1
else
sed -i '2d' $path
sed -i '2ia=0' $path
a=0
fi
fi
if [ $a == 1 ]
then
echo "$(curl https://www.lescienze.it/news/ -s -L | grep -o href.*h2 | head -n 1 | grep -o -P '(?<=">).*(?=</a>)')"
else
echo "󰈙 News"
fi
if [ $BLOCK_BUTTON == 3 ]; then
xdg-open https://www.lescienze.it/news/
fi

View file

@ -0,0 +1,29 @@
#!/usr/bin/bash
# quando lo clicco mi ricarica il dispositivo fino al 100% e poi disabilita la feature
path="/sys/devices/pci0000:00/0000:00:14.3/PNP0C09:00/VPC2004:00/conservation_mode"
value=$(cat $path)
if [ $value -eq "" ];then
echo "only ideapad"
fi
level=$( upower -i /org/freedesktop/UPower/devices/battery_BAT1 | grep percentage | grep -o "[0-9]*")
if [ $BLOCK_BUTTON -eq 1 ] && [ $value -eq "1" ];then
echo "󱟡 full"
echo $PASSW | sudo -S sh -c "echo 0 > $path"
fi
if [ $level -ge "95" ] && [ $value -eq "0" ];then
echo "󱈑 Csv"
echo $PASSW | sudo -S sh -c "echo 1 > $path"
fi
if [ $value -eq 0 ];then
echo "󱟡 full"
else
echo "󱈑 Csv"
fi

View file

@ -0,0 +1,9 @@
#!/usr/bin/bash
meteo=$(curl wttr.in/Toronto?format=1 | xargs echo)
first="${meteo%% *}"
if [ "$meteo" == "" ] || [ "$first" == "Unknown" ]; then
echo " Off"
else
echo $meteo
fi

View file

@ -0,0 +1,33 @@
#!/usr/bin/bash
a=0
path=~/.config/i3/scripts/miei/ora.sh
cambia_var () {
if [ $a == 0 ]; then
sed -i '2d' $path
sed -i '2ia=1' $path
# se non mostri la variabile subito ci sarà il delay di interval
a=1
return 1
fi
if [ $a == 1 ]; then
sed -i '2d' $path
sed -i '2ia=0' $path
a=0
return 0
fi
}
if [ $BLOCK_BUTTON == 1 ]; then
cambia_var
fi
if [ $a == 0 ]; then
date '+%a %d %b %H:%M'
fi
if [ $a == 1 ]; then
date '+%H:%M'
fi

View file

@ -0,0 +1,52 @@
#!/usr/bin/bash
#echo " 󰣐 󰣐 󰣐 󰣐 󰋔 "
#echo ""
#echo "#a6e3a1"
#
if [ $(cat /sys/class/power_supply/ACAD/online) == 1 ];then
~/.config/i3/scripts/miei/power_charge.sh
exit 1
fi
level=$( upower -i /org/freedesktop/UPower/devices/battery_BAT1 | grep percentage | grep -o "[0-9]*")
unit=20
vite=$(($level/unit))
if [ $vite == 5 ]; then
echo ""
echo ""
echo "#cdd6f4"
fi
if [ $vite == 4 ]; then
echo ""
echo ""
echo "#a6e3a1"
fi
if [ $vite == 3 ]; then
echo ""
echo ""
echo "#a6e3a1"
fi
if [ $vite == 2 ]; then
echo ""
echo ""
echo "#fab387"
fi
if [ $vite == 1 ]; then
echo ""
echo ""
echo "#fab387"
fi
if [ "$level" -lt "20" ] && [ "$level" -ge "10" ]; then
echo ""
echo ""
echo "#f38ba8"
fi
if [ "$level" -lt "10" ]; then
echo "!"
echo ""
echo "#f38ba8"
fi

View file

@ -0,0 +1,47 @@
#!/usr/bin/bash
#echo " 󰣐 󰣐 󰣐 󰣐 󰋔 "
#echo ""
#echo "#a6e3a1"
# 󰁹󱐋
level=$( upower -i /org/freedesktop/UPower/devices/battery_BAT1 | grep percentage | grep -o "[0-9]*")
unit=20
vite=$(($level/unit))
if [ $vite == 5 ]; then
echo "󱐋 "
echo ""
echo "#cdd6f4"
fi
if [ $vite == 4 ]; then
echo "󱐋 "
echo ""
echo "#a6e3a1"
fi
if [ $vite == 3 ]; then
echo "󱐋 "
echo ""
echo "#a6e3a1"
fi
if [ $vite == 2 ]; then
echo "󱐋 "
echo ""
echo "#fab387"
fi
if [ $vite == 1 ]; then
echo "󱐋 "
echo ""
echo "#fab387"
fi
if [ "$level" -lt "20" ] && [ "$level" -ge "10" ]; then
echo "󱐋 "
echo ""
echo "#f38ba8"
fi
if [ "$level" -lt "10" ]; then
echo "󱐋 !"
echo ""
echo "#f38ba8"
fi

View file

@ -0,0 +1,10 @@
#!/usr/bin/bash
a=$(date +"%Y-%m-%d-%T")-schermata.png
maim --select ~/Immagini/Schermate/$a
notify-send "Screenshot saved to ~/$a"
#kdialog --yesno "Screenshot salvato, vuoi aprirlo?"
#if [ $? == 0 ]; then
eog ~/Immagini/Schermate/$a
#fi

View file

@ -0,0 +1,80 @@
#!/usr/bin/bash
#creazione meccanismo di cambiamento timer modalità m (modifica)
path=/tmp/miotimer
modifica () {
if [ $BLOCK_BUTTON == 4 ];then
current=$((current + 1))
echo $mode > $path
echo $current >> $path
fi
if [ $BLOCK_BUTTON == 5 ] && [ $current != 0 ];then
current=$((current - 1))
echo $mode > $path
echo $current >> $path
fi
if [ $current == 0 ];then
echo "󰔛 Tmr"
else
echo "$(sed '2!d' $path) m"
echo ""
echo "#f9e2af"
fi
}
timer () {
start=$(sed '2!d' $path)
start=$((start * 60))
now=$(date +%s)
first=$(sed '3!d' $path)
manca=$((start-now+first))
if [ $manca != 0 ];then
echo "󰄉 $((manca / 60)):$((manca % 60))"
echo ""
echo "#a6e3a1"
else
echo "󰔛 Tmr"
notify-send "Timer is over"
rm $path
fi
}
if [ -f $path ]
then
mode=$(sed '1!d' $path)
current=$(sed '2!d' $path)
if [ $BLOCK_BUTTON == 1 ] && [ $current != 0 ];then
if [ $mode == "w" ];then
rm $path
echo "󰔛 Tmr"
exit
fi
mode=w
echo $mode > $path
echo $current >> $path
echo $(date +%s) >> $path
fi
if [ $mode == "m" ];then
modifica
fi
if [ $mode == "w" ];then
timer
fi
else
echo m > $path
echo 0 >> $path
echo "󰔛 Tmr"
fi

View file

@ -0,0 +1,16 @@
#!/usr/bin/bash
if [ $BLOCK_BUTTON -eq "1" ];then
kitty -e sudo dnf upgrade
kitty -e flatpak update
fi
numero=$(dnf check-update| grep -Ec ' updates$')
if [ $numero -eq "0" ];then
echo " "
else
echo "󰏕 $numero"
echo ""
echo "#f9e2af"
fi

View file

@ -0,0 +1,78 @@
#!/bin/bash
level=$(pactl get-sink-volume @DEFAULT_SINK@ | grep -Po '[0-9]{1,3}(?=%)' | head -1 )
unit=10
vite=$(($level/unit))
mute=$(pactl get-sink-mute @DEFAULT_SINK@)
if [ "$mute" == "Mute: sì" ] || [ "$mute" == "Mute: yes" ]; then
echo " "
echo ""
echo "#cdd6f4"
else
if [ $vite == 10 ]; then
echo " "
echo ""
echo "#f38ba8"
fi
if [ $vite == 9 ]; then
echo " "
echo ""
echo "#f38ba8"
fi
if [ $vite == 8 ]; then
echo " "
echo ""
echo "#f38ba8"
fi
if [ $vite == 7 ]; then
echo " "
echo ""
echo "#f38ba8"
fi
if [ $vite == 6 ]; then
echo " "
echo ""
echo "#fab387"
fi
if [ $vite == 5 ]; then
echo " "
echo ""
echo "#fab387"
fi
if [ $vite == 4 ]; then
echo " "
echo ""
echo "#a6e3a1"
fi
if [ $vite == 3 ]; then
echo " "
echo ""
echo "#a6e3a1"
fi
if [ $vite == 2 ]; then
echo " "
echo ""
echo "#a6e3a1"
fi
if [ $vite == 1 ]; then
echo " "
echo ""
echo "#a6e3a1"
fi
if [ $vite == 0 ] && [ $level != 0 ]; then
echo " "
echo ""
echo "#a6e3a1"
fi
if [ $vite == 0 ] && [ $level == 0 ]; then
echo " "
echo ""
echo "#cdd6f4"
fi
fi

View file

@ -0,0 +1,26 @@
#!/usr/bin/bash
w_path=~/.config/wallpaper/
c_path=~/.config/wallpaper/current
config=~/.config/
current=$(cat $c_path)
if [ $BLOCK_BUTTON == 1 ];then
new=$((current+1))
if [ $new == 13 ]; then
new=0
fi
fi
if [ $BLOCK_BUTTON == 3 ];then
new=$((current - 1))
if [ $new == "-1" ]; then
new=12
fi
fi
rm "${config}sfondo.jpg"
cp "$w_path$new.jpg" $config
mv "$config$new.jpg" "${config}sfondo.jpg"
sed -i '1d' $c_path
echo $new >> $c_path
feh --bg-fill ~/.config/sfondo.jpg

View file

@ -0,0 +1,132 @@
#!/bin/bash
if [ -f /tmp/pomo_timer ];then
pluto=$(cat /tmp/pomo_timer)
case $BLOCK_BUTTON in
3) if [ $pluto -eq "0" ];then
echo "1" > /tmp/pomo_timer
pluto=1
else
echo "0" > /tmp/pomo_timer
pluto=0
fi
;;
esac
if [ $pluto -eq "0" ];then
# Config variables
# 40min = 2400s
# 25min = 1500s
# 20min = 1200s
# 5min = 300s
# In secondi
work_time=2400
break_time=1200
msg_start=" Pom"
work_prefix=" "
break_prefix="󰅶 "
#start_color="#b39df3"
#start_color="#E06C75"
start_color="#cdd6f4"
break_color="#a6e3a1"
work_color="#f38ba8"
break_command="notify-send -t 2500 'Grab a tea'"
work_command="notify-send -t 2500 'Time to work!'"
pom_path="/tmp/pomodoro"
function display () {
min=$((s/60))
sek=$((s%60))
if [ $min -eq 0 ]
then
min=00
elif [ $min -lt 10 ]
then
min=0$min
fi
if [ $sek -lt 10 ]
then
sek=0$sek
fi
case $2 in # richiamo alla seconda variabile, t
w)
echo "$work_prefix$min:$sek"
echo $min:$sek
echo $work_color
;;
b)
echo "$break_prefix$min:$sek"
echo $min:$sek
echo $break_color
;;
esac
}
if [ -f "$pom_path" ] && [ "$(wc -l $pom_path | awk '{print $1}')" -eq 2 ]
then
p=$(sed '1 d' $pom_path) # time
t=$(sed '2 d' $pom_path) # mode
case $t in
w) dur=$work_time;;
b) dur=$break_time;;
esac
now=$(date +%s)
s=$((dur-now+p)) # sec mancanti basandosi su orologio e istante chiamata questa fzione
if [ $s -le 0 ] # if time less than 0 then switch mode
then
case $t in
w)
echo b > $pom_path
eval "$break_command"
paplay $HOME/.config/i3/scripts/bell.wav
;;
b)
echo w > $pom_path
eval "$work_command"
paplay $HOME/.config/i3/scripts/bell_end.wav
;;
esac
echo "$now" >> $pom_path
fi
display "$s" "$t"
else
echo "$msg_start"
echo "$msg_start"
echo "$start_color"
fi
case $BLOCK_BUTTON in
1)
if [ -f $pom_path ]; then # if file exists then stop reset timer
rm $pom_path
else
echo w > $pom_path # else start timer
date +%s >> $pom_path
fi
;;
esac
# è scritto in modo carino ma non ha sostanziali differenze rispetto al mio , per aggiornarsi sfrutta l'interval integrato. Inoltre è vincolato dalla stampa dell'orario effettivo che non gli permette di andare fuori dal taiming e rimanere sempre in orario. Dovrei evitare la funzione di chiamata e quella di sleep ed optare per un intervallo dentro il blocco. L'aggiornamento nel primo caso non cambia nulla nel secondo mostra secondi differenti ma si può fare.
fi
if [ $pluto -eq "1" ];then
~/.config/i3/scripts/miei/timer.sh
fi
else
echo "0" > /tmp/pomo_timer
fi

View file

@ -0,0 +1,184 @@
#!/usr/bin/env bash
#
# Use rofi/zenity to change system runstate thanks to systemd.
#
# Note: this currently relies on associative array support in the shell.
#
# Inspired from i3pystatus wiki:
# https://github.com/enkore/i3pystatus/wiki/Shutdown-Menu
#
# Copyright 2015 Benjamin Chrétien <chretien at lirmm dot fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# modified to work with latest rofi update by joekamprad <joekamprad@endeavouros.com>
#######################################################################
# BEGIN CONFIG #
#######################################################################
# Use a custom lock script
#LOCKSCRIPT="i3lock-extra -m pixelize"
# Colors: FG (foreground), BG (background), HL (highlighted)
FG_COLOR="#bbbbbb"
BG_COLOR="#111111"
HLFG_COLOR="#111111"
HLBG_COLOR="#bbbbbb"
BORDER_COLOR="#222222"
# Options not related to colors (most rofi options do not work anymore)
ROFI_OPTIONS=(-theme ~/.config/rofi/pw.rasi)
# Zenity options
ZENITY_TITLE="Power Menu"
ZENITY_TEXT="Action:"
ZENITY_OPTIONS=(--column= --hide-header)
#######################################################################
# END CONFIG #
#######################################################################
# Whether to ask for user's confirmation
enable_confirmation=false
# Preferred launcher if both are available
preferred_launcher="rofi"
usage="$(basename "$0") [-h] [-c] [-p name] -- display a menu for shutdown, reboot, lock etc.
where:
-h show this help text
-c ask for user confirmation
-p preferred launcher (rofi or zenity)
This script depends on:
- systemd,
- i3,
- rofi or zenity."
# Check whether the user-defined launcher is valid
launcher_list=(rofi zenity)
function check_launcher() {
if [[ ! "${launcher_list[@]}" =~ (^|[[:space:]])"$1"($|[[:space:]]) ]]; then
echo "Supported launchers: ${launcher_list[*]}"
exit 1
else
# Get array with unique elements and preferred launcher first
# Note: uniq expects a sorted list, so we cannot use it
i=1
launcher_list=($(for l in "$1" "${launcher_list[@]}"; do printf "%i %s\n" "$i" "$l"; let i+=1; done \
| sort -uk2 | sort -nk1 | cut -d' ' -f2- | tr '\n' ' '))
fi
}
# Parse CLI arguments
while getopts "hcp:" option; do
case "${option}" in
h) echo "${usage}"
exit 0
;;
c) enable_confirmation=true
;;
p) preferred_launcher="${OPTARG}"
check_launcher "${preferred_launcher}"
;;
*) exit 1
;;
esac
done
# Check whether a command exists
function command_exists() {
command -v "$1" &> /dev/null 2>&1
}
# systemctl required
if ! command_exists systemctl ; then
exit 1
fi
# menu defined as an associative array
typeset -A menu
# Menu with keys/commands
menu=(
[ Shutdown]="systemctl poweroff"
[ Reboot]="systemctl reboot"
[ Suspend]="systemctl suspend"
[ Lock]="~/.config/i3/scripts/blur-lock"
[ Logout]="i3-msg exit"
)
menu_nrows=${#menu[@]}
# Menu entries that may trigger a confirmation message
menu_confirm="Shutdown Reboot Hibernate Suspend Halt Logout"
launcher_exe=""
launcher_options=""
rofi_colors=""
function prepare_launcher() {
if [[ "$1" == "rofi" ]]; then
rofi_colors=(-bc "${BORDER_COLOR}" -bg "${BG_COLOR}" -fg "${FG_COLOR}" \
-hlfg "${HLFG_COLOR}" -hlbg "${HLBG_COLOR}")
launcher_exe="rofi"
launcher_options=(-dmenu -i -lines "${menu_nrows}" -p "${ROFI_TEXT}" \
"${rofi_colors}" "${ROFI_OPTIONS[@]}")
elif [[ "$1" == "zenity" ]]; then
launcher_exe="zenity"
launcher_options=(--list --title="${ZENITY_TITLE}" --text="${ZENITY_TEXT}" \
"${ZENITY_OPTIONS[@]}")
fi
}
for l in "${launcher_list[@]}"; do
if command_exists "${l}" ; then
prepare_launcher "${l}"
break
fi
done
# No launcher available
if [[ -z "${launcher_exe}" ]]; then
exit 1
fi
launcher=(${launcher_exe} "${launcher_options[@]}")
selection="$(printf '%s\n' "${!menu[@]}" | sort | "${launcher[@]}")"
function ask_confirmation() {
if [ "${launcher_exe}" == "rofi" ]; then
confirmed=$(echo -e "Yes\nNo" | rofi -dmenu -i -lines 2 -p "${selection}?" \
"${rofi_colors}" "${ROFI_OPTIONS[@]}")
[ "${confirmed}" == "Yes" ] && confirmed=0
elif [ "${launcher_exe}" == "zenity" ]; then
zenity --question --text "Are you sure you want to ${selection,,}?"
confirmed=$?
fi
if [ "${confirmed}" == 0 ]; then
i3-msg -q "exec --no-startup-id ${menu[${selection}]}"
fi
}
if [[ $? -eq 0 && ! -z ${selection} ]]; then
if [[ "${enable_confirmation}" = true && \
${menu_confirm} =~ (^|[[:space:]])"${selection}"($|[[:space:]]) ]]; then
ask_confirmation
else
i3-msg -q "exec --no-startup-id ${menu[${selection}]}"
fi
fi

View file

@ -0,0 +1,97 @@
#!/usr/bin/env bash
# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info>
# Copyright (C) 2014 Alexander Keller <github@nycroth.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# original source: https://github.com/vivien/i3blocks-contrib/tree/master/volume
# check the readme: https://github.com/vivien/i3blocks-contrib/blob/master/volume/README.md
#------------------------------------------------------------------------
# The second parameter overrides the mixer selection
# For PulseAudio users, eventually use "pulse"
# For Jack/Jack2 users, use "jackplug"
# For ALSA users, you may use "default" for your primary card
# or you may use hw:# where # is the number of the card desired
if [[ -z "$MIXER" ]] ; then
MIXER="default"
if command -v pulseaudio >/dev/null 2>&1 && pulseaudio --check ; then
# pulseaudio is running, but not all installations use "pulse"
if amixer -D pulse info >/dev/null 2>&1 ; then
MIXER="pulse"
fi
fi
[ -n "$(lsmod | grep jack)" ] && MIXER="jackplug"
MIXER="${2:-$MIXER}"
fi
# The instance option sets the control to report and configure
# This defaults to the first control of your selected mixer
# For a list of the available, use `amixer -D $Your_Mixer scontrols`
if [[ -z "$SCONTROL" ]] ; then
SCONTROL="${BLOCK_INSTANCE:-$(amixer -D $MIXER scontrols |
sed -n "s/Simple mixer control '\([^']*\)',0/\1/p" |
head -n1
)}"
fi
# The first parameter sets the step to change the volume by (and units to display)
# This may be in in % or dB (eg. 5% or 3dB)
if [[ -z "$STEP" ]] ; then
STEP="${1:-5%}"
fi
# AMIXER(1):
# "Use the mapped volume for evaluating the percentage representation like alsamixer, to be
# more natural for human ear."
NATURAL_MAPPING=${NATURAL_MAPPING:-0}
if [[ "$NATURAL_MAPPING" != "0" ]] ; then
AMIXER_PARAMS="-M"
fi
#------------------------------------------------------------------------
capability() { # Return "Capture" if the device is a capture device
amixer $AMIXER_PARAMS -D $MIXER get $SCONTROL |
sed -n "s/ Capabilities:.*cvolume.*/Capture/p"
}
volume() {
amixer $AMIXER_PARAMS -D $MIXER get $SCONTROL $(capability)
}
format() {
perl_filter='if (/.*\[(\d+%)\] (\[(-?\d+.\d+dB)\] )?\[(on|off)\]/)'
perl_filter+='{CORE::say $4 eq "off" ? "0%" : "'
# If dB was selected, print that instead
perl_filter+=$([[ $STEP = *dB ]] && echo '$3' || echo '$1')
perl_filter+='"; exit}'
# output=$(/home/flavio/.config/i3/scripts/miei/volcolor.sh)
# valore=${output::-1}
# basandomi sul valore di output cambio icona
~/.config/i3/scripts/miei/volcolor.sh
}
#------------------------------------------------------------------------
case $BLOCK_BUTTON in
1) amixer $AMIXER_PARAMS -q -D $MIXER sset $SCONTROL $(capability) toggle ;; # right click, mute/unmute
3) pavucontrol;;
4) amixer $AMIXER_PARAMS -q -D $MIXER sset $SCONTROL $(capability) ${STEP}+ unmute ;; # scroll up, increase
5) amixer $AMIXER_PARAMS -q -D $MIXER sset $SCONTROL $(capability) ${STEP}- unmute ;; # scroll down, decrease
esac
volume | format

View file

@ -0,0 +1,98 @@
#!/bin/bash
# original source: https://gitlab.com/Nmoleo/i3-volume-brightness-indicator
# taken from here: https://gitlab.com/Nmoleo/i3-volume-brightness-indicator
# See README.md for usage instructions
bar_color="#a6da95"
volume_step=5
brightness_step=5%
max_volume=100
# Uses regex to get volume from pactl
function get_volume {
pactl get-sink-volume @DEFAULT_SINK@ | grep -Po '[0-9]{1,3}(?=%)' | head -1
}
# Uses regex to get mute status from pactl
function get_mute {
pactl get-sink-mute @DEFAULT_SINK@ | grep -Po '(?<=Mute: )(yes|no)'
}
# Uses regex to get brightness from xbacklight
function get_brightness {
brightnessctl g | grep -Po '[0-9]{1,3}' | head -n 1
}
# Returns a mute icon, a volume-low icon, or a volume-high icon, depending on the volume
function get_volume_icon {
volume=$(get_volume)
mute=$(get_mute)
if [ "$volume" -eq 0 ] || [ "$mute" == "yes" ] ; then
volume_icon="󰸈 "
elif [ "$volume" -lt 50 ]; then
volume_icon="󰕾 "
else
volume_icon=" "
fi
}
# Always returns the same icon - I couldn't get the brightness-low icon to work with fontawesome
function get_brightness_icon {
brightness_icon=" "
}
# Displays a volume notification using dunstify
function show_volume_notif {
volume=$(get_mute)
get_volume_icon
dunstify -t 1000 -r 2593 -u normal "$volume_icon $volume%" -h int:value:$volume -h string:hlcolor:$bar_color
}
# Displays a brightness notification using dunstify
function show_brightness_notif {
massima=$(brightnessctl m)
brightness=$(($(get_brightness)*100/$massima))
get_brightness_icon
dunstify -t 1000 -r 2593 -u normal "$brightness_icon $brightness%" -h int:value:$brightness -h string:hlcolor:$bar_color
}
# Main function - Takes user input, "volume_up", "volume_down", "brightness_up", or "brightness_down"
case $1 in
volume_up)
# Unmutes and increases volume, then displays the notification
pactl set-sink-mute @DEFAULT_SINK@ 0
volume=$(get_volume)
if [ $(( "$volume" + "$volume_step" )) -gt $max_volume ]; then
pactl set-sink-volume @DEFAULT_SINK@ $max_volume%
else
pactl set-sink-volume @DEFAULT_SINK@ +$volume_step%
fi
show_volume_notif
;;
volume_down)
# Raises volume and displays the notification
pactl set-sink-volume @DEFAULT_SINK@ -$volume_step%
show_volume_notif
;;
volume_mute)
# Toggles mute and displays the notification
pactl set-sink-mute @DEFAULT_SINK@ toggle
show_volume_notif
;;
brightness_up)
# Increases brightness and displays the notification
brightnessctl s +$brightness_step
show_brightness_notif
;;
brightness_down)
# Decreases brightness and displays the notification
brightnessctl s $brightness_step-
show_brightness_notif
;;
esac