Added power menu with Rofi

This commit is contained in:
Fabio Scotto di Santolo
2025-09-04 23:10:49 +02:00
parent 56af90de63
commit 7d2ffb2fc9
3 changed files with 124 additions and 93 deletions

View File

@@ -10,6 +10,35 @@
# layout, use the i3-config-wizard # layout, use the i3-config-wizard
# #
# use these keys for focus, movement, and resize directions when reaching for
# the arrows is not convenient
set $left h
set $down j
set $up k
set $right l
set $term 'alacritty'
set $editor 'emacs'
# 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"
###############################################################
###############################################################
################## LOOK AND FEEL ##################
###############################################################
###############################################################
# Import Catppuccin theme defined colors # Import Catppuccin theme defined colors
set $rosewater #f5e0dc set $rosewater #f5e0dc
set $flamingo #f2cdcd set $flamingo #f2cdcd
@@ -49,9 +78,6 @@ client.background $base
# Setting cursor # Setting cursor
# seat seat0 xcursor_theme catppuccin-mocha-lavender-cursors 25 # seat seat0 xcursor_theme catppuccin-mocha-lavender-cursors 25
# Logo key. Use Mod1 for Alt.
set $mod Mod4
# Font for window titles. Will also be used by the bar unless a different font # Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below. # is used in the bar {} block below.
font pango:Noto Sans Regular 10 font pango:Noto Sans Regular 10
@@ -60,58 +86,18 @@ font pango:Noto Sans Regular 10
# text rendering and scalability on retina/hidpi displays (thanks to pango). # text rendering and scalability on retina/hidpi displays (thanks to pango).
#font pango:DejaVu Sans Mono 8 #font pango:DejaVu Sans Mono 8
# Start XDG autostart .desktop files using dex. See also
# https://wiki.archlinux.org/index.php/XDG_Autostart
exec --no-startup-id dex --autostart --environment i3
# The combination of xss-lock, nm-applet and pactl is a popular choice, so
# they are included here as an example. Modify as you see fit.
# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the
# screen before suspend. Use loginctl lock-session to lock your screen.
exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork
# NetworkManager is the most popular way to manage wireless networks on Linux,
# and nm-applet is a desktop environment-independent system tray GUI for it.
exec --no-startup-id nm-applet
# Polkit Authentication agent
exec --no-startup-id /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1
# Use pactl to adjust volume in PulseAudio.
set $refresh_i3status killall -SIGUSR1 i3status
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5% # && $refresh_i3status
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5% # && $refresh_i3status
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle # && $refresh_i3status
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle # && $refresh_i3status
bindsym XF86MonBrightnessUp exec --no-startup-id brightnessctl set +5%
bindsym XF86MonBrightnessDown exec --no-startup-id brightnessctl set 5%-
bindsym $mod+Mod1+l exec ~/.config/i3/scripts/lockscreen.sh
# use these keys for focus, movement, and resize directions when reaching for
# the arrows is not convenient
set $left h
set $down j
set $up k
set $right l
# use Mouse+Mod4 to drag floating windows to their wanted position
floating_modifier $mod
# move tiling windows via drag & drop by left-clicking into the title bar,
# or left-clicking anywhere into the window while holding the floating modifier.
tiling_drag modifier titlebar
set $term 'alacritty'
set $browser 'firefox'
set $editor 'emacs'
# Windows configuration # Windows configuration
default_border pixel 3 default_border pixel 3
default_floating_border pixel 3 default_floating_border pixel 3
gaps inner 5 gaps inner 5
gaps outer 5 gaps outer 5
###############################################################
###############################################################
################## WORKSPACES ##################
###############################################################
###############################################################
# Floating/sticky windows # Floating/sticky windows
for_window [class="Pop-up"] floating enable for_window [class="Pop-up"] floating enable
for_window [class="Bubble"] floating enable for_window [class="Bubble"] floating enable
@@ -127,29 +113,65 @@ for_window [class="Webconsole"] floating enable
for_window [class="Authy"] floating enable for_window [class="Authy"] floating enable
for_window [class="Termfloat"] floating enable, resize set 960 540 for_window [class="Termfloat"] floating enable, resize set 960 540
for_window [class="Mpv"] floating enable, resize set 960 540 for_window [class="Mpv"] floating enable, resize set 960 540
for_window [class="Spotify"] floating enable, move scratchpad
# Workspaces # Workspaces
assign [class="Emacs"] 1 assign [class="Emacs"] 1
assign [class="Firefox"] 2 # FIXME: change class name assign [class="firefox"] 2
assign [class="Telegram"] 3 assign [class="Telegram"] 3
focus_follows_mouse no focus_follows_mouse no
###############################################################
###############################################################
################## KEYBINDINGS ##################
###############################################################
###############################################################
# Logo key. Use Mod1 for Alt.
set $mod Mod4
# start a terminal # start a terminal
bindsym $mod+Return exec $term bindsym $mod+Return exec $term
# kill focused window # kill focused window
bindsym $mod+Shift+q kill bindsym $mod+Shift+q kill
# start default menu application # define mode for launcher
bindsym $mod+d exec "rofi -show drun" mode "launcher" {
bindsym $mod+Shift+s exec "rofi -show ssh" bindsym d exec "rofi -show drun"
bindsym $mod+Shift+w exec "rofi -show window" bindsym s exec "rofi -show ssh"
bindsym $mod+Shift+f exec "rofi -show filebrowser" bindsym w exec "rofi -show window"
bindsym f exec "rofi -show filebrowser"
bindsym q exec ~/.config/i3/scripts/poweroff.sh
bindsym $mod+Shift+b exec $browser bindsym $mod+d mode "default"
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+d mode "launcher"
bindsym $mod+Shift+b exec "flatpak run org.mozilla.firefox"
bindsym $mod+Shift+t exec "flatpak run org.telegram.desktop"
bindsym Print exec flameshot gui bindsym Print exec flameshot gui
# bindsym $mod+Shift+v exec xfce4-clipman-history # bindsym $mod+Shift+v exec xfce4-clipman-history
# Use pactl to adjust volume in PulseAudio.
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5%
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5%
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle
bindsym XF86MonBrightnessUp exec --no-startup-id brightnessctl set +5%
bindsym XF86MonBrightnessDown exec --no-startup-id brightnessctl set 5%-
bindsym $mod+Mod1+l exec ~/.config/i3/scripts/lockscreen.sh
# use Mouse+Mod4 to drag floating windows to their wanted position
floating_modifier $mod
# move tiling windows via drag & drop by left-clicking into the title bar,
# or left-clicking anywhere into the window while holding the floating modifier.
tiling_drag modifier titlebar
# change focus # change focus
bindsym $mod+$left focus left bindsym $mod+$left focus left
bindsym $mod+$down focus down bindsym $mod+$down focus down
@@ -175,7 +197,7 @@ bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right bindsym $mod+Shift+Right move right
# split in horizontal orientation # split in horizontal orientation
# bindsym $mod+h split h bindsym Mod1+h split h
# split in vertical orientation # split in vertical orientation
bindsym $mod+v split v bindsym $mod+v split v
@@ -198,7 +220,7 @@ bindsym $mod+space focus mode_toggle
bindsym $mod+a focus parent bindsym $mod+a focus parent
# focus the child container # focus the child container
#bindsym Mod4+d focus child bindsym Mod1+d focus child
# move the currently focused window to the scratchpad # move the currently focused window to the scratchpad
bindsym $mod+Shift+minus move scratchpad bindsym $mod+Shift+minus move scratchpad
@@ -207,19 +229,6 @@ bindsym $mod+Shift+minus move scratchpad
# If there are multiple scratchpad windows, this command cycles through them. # If there are multiple scratchpad windows, this command cycles through them.
bindsym $mod+minus scratchpad show bindsym $mod+minus scratchpad show
# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
set $ws1 "1"
set $ws2 "2"
set $ws3 "3"
set $ws4 "4"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"
# switch to workspace # switch to workspace
bindsym $mod+1 workspace number $ws1 bindsym $mod+1 workspace number $ws1
bindsym $mod+2 workspace number $ws2 bindsym $mod+2 workspace number $ws2
@@ -252,7 +261,7 @@ bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) # restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session) # exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'" bindsym $mod+Shift+e exec ~/.config/i3/scripts/poweroff.sh
# resize window (you can also use the mouse for that) # resize window (you can also use the mouse for that)
mode "resize" { mode "resize" {
@@ -281,23 +290,29 @@ mode "resize" {
bindsym $mod+r mode "resize" bindsym $mod+r mode "resize"
# Start i3bar to display a workspace bar (plus the system information i3status ###############################################################
# finds out, if available) ###############################################################
# bar { ################## AUTOSTART ##################
# status_command i3bar ###############################################################
# } ###############################################################
####################################################################### # Start XDG autostart .desktop files using dex. See also
# automatically start i3-config-wizard to offer the user to create a # https://wiki.archlinux.org/index.php/XDG_Autostart
# keysym-based config which used their favorite modifier (alt or windows) exec --no-startup-id dex --autostart --environment i3
#
# i3-config-wizard will not launch if there already is a config file # The combination of xss-lock, nm-applet and pactl is a popular choice, so
# in ~/.config/i3/config (or $XDG_CONFIG_HOME/i3/config if set) or # they are included here as an example. Modify as you see fit.
# ~/.i3/config.
# # xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the
# Please remove the following exec line: # screen before suspend. Use loginctl lock-session to lock your screen.
####################################################################### exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork
# exec i3-config-wizard
# NetworkManager is the most popular way to manage wireless networks on Linux,
# and nm-applet is a desktop environment-independent system tray GUI for it.
exec --no-startup-id nm-applet
# Polkit Authentication agent
exec --no-startup-id /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1
### Apply wallpaper ### Apply wallpaper
exec_always feh --bg-scale ~/.config/i3/wallpaper.jpg exec_always feh --bg-scale ~/.config/i3/wallpaper.jpg
@@ -314,5 +329,8 @@ exec_always $notification
### Enable autolock ### Enable autolock
exec_always xautolock -time 5 -locker ~/.config/i3/scripts/lockscreen.sh -detectsleep exec_always xautolock -time 5 -locker ~/.config/i3/scripts/lockscreen.sh -detectsleep
### Screenshot tool ### Run screenshot tool
exec flameshot exec flameshot
### Run my preferred editor
exec $editor

View File

@@ -0,0 +1,13 @@
#!/bin/bash
# Menu di power con rofi
chosen=$(echo -e "⏻ Spegni\n Riavvia\n Logout\n Sospendi\n Iberna" | rofi -dmenu -p "Power Menu:" -theme-str 'window {width: 20%;}')
case "$chosen" in
"⏻ Spegni") systemctl poweroff ;;
" Riavvia") systemctl reboot ;;
" Logout") loginctl terminate-session $XDG_SESSION_ID ;;
" Sospendi") systemctl suspend ;;
" Iberna") systemctl hibernate ;;
*) exit 0 ;;
esac

View File

@@ -164,7 +164,7 @@ format-full-foreground = ${colors.green}
; <bar-capacity> ; <bar-capacity>
; <ramp-capacity> ; <ramp-capacity>
; New in version 3.6.0 ; New in version 3.6.0
format-low = <ramp-capacity> <animation-low> format-low = <ramp-capacity> <label-low>
format-low-foreground = ${colors.red} format-low-foreground = ${colors.red}
; Available tokens: ; Available tokens:
@@ -224,9 +224,9 @@ animation-discharging-framerate = 500
; Only applies if <animation-low> is used ; Only applies if <animation-low> is used
; New in version 3.6.0 ; New in version 3.6.0
animation-low-0 = ! ;animation-low-0 = !
animation-low-1 = ;animation-low-1 =
animation-low-framerate = 200 ;animation-low-framerate = 200
[module/backlight] [module/backlight]
type = internal/backlight type = internal/backlight