Skip to content

Commit

Permalink
Tweak i3 & rofi to be slightly more friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinpinto committed Feb 27, 2024
1 parent fc4ab89 commit 81c47dd
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 13 deletions.
2 changes: 1 addition & 1 deletion dotfiles/dot_config/private_rofi/config.rasi.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ configuration {
show-icons: false;
terminal: "alacritty";
disable-history: true;
sidebar-mode: true;
sidebar-mode: false;

timeout {
action: "kb-cancel";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- /* vim: set filetype=sh : */ -}}
{{ if (and (eq .chezmoi.os "linux") (not .is_devcontainer)) -}}
#!/usr/bin/env bash
CURRENT_WS_NAME=$(i3-msg -t get_workspaces | jq '.[] | select(.focused==true).name')
NEW_WS_NAME=$(zenity --title="Rename: ${CURRENT_WS_NAME}" --text="New name:" --entry)
if [ -z "$NEW_WS_NAME" ]; then
zenity --error --text="This script needs a workspace name to function correctly"
exit 1
fi
i3-msg "rename workspace to \"${NEW_WS_NAME}\""
{{ end -}}
8 changes: 5 additions & 3 deletions dotfiles/private_bin/private_executable_rofi-launcher.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ I3LOCK='/usr/bin/i3lock --color 333333'
if [ -z $@ ]; then
function gen_options()
{
option_list=("Lock Screen","Logout","Reboot Computer","Shutdown Computer","Enable Screensaver","Disable Screensaver","Toggle Do Not Disturb (DND)","Initiate Backup","Check Email","Create Development Workspace","2FA Tokens","Emoji Picker","Reset Workspace","Grab Screenshot","Calculator","URL Cleaner")
option_list=("Lock Screen","Logout","Reboot Computer","Shutdown Computer","Enable Screensaver","Disable Screensaver","Toggle Do Not Disturb (DND)","Initiate Backup","Check Email","Create Development Workspace","2FA Tokens","Emoji Picker","Reset Workspace","Grab Screenshot","Calculator","URL Cleaner","Rename i3 Workspace")
echo ${option_list[@]} | tr ',' '\n' | sort
}

echo "Choose an option from the list below:"; gen_options
gen_options
else
OPTION=$@

Expand Down Expand Up @@ -69,6 +68,9 @@ else
'URL Cleaner')
coproc (rofi-url-handler)
;;
'Rename i3 Workspace')
coproc (rofi-i3-rename-workspace)
;;
*)
echo "Invalid option \"$OPTION\""
exit 2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
{{- /* vim: set filetype=sh : */ -}}
{{ if (and (eq .chezmoi.os "linux") (not .is_devcontainer)) -}}
#!/usr/bin/env bash
if [ -z $@ ]; then
function gen_workspaces()
{
i3-msg -t get_workspaces | jq --raw-output ".[] | (.name)" | sort -n
}
echo temporary; gen_workspaces
echo -ne "NEW\nscratch\n"; gen_workspaces
else
WORKSPACE=$@
if [ x"temporary" = x"${WORKSPACE}" ]; then
if [ x"scratch" = x"${WORKSPACE}" ]; then
i3-msg workspace scratch >/dev/null
elif [ x"NEW" = x"${WORKSPACE}" ]; then
ws_name=new_workspace_$(echo $RANDOM | md5sum | head -c 5)
i3-msg workspace "${ws_name}" >/dev/null
elif [ -n "${WORKSPACE}" ]; then
i3-msg workspace "${WORKSPACE}" >/dev/null
fi
Expand Down
2 changes: 1 addition & 1 deletion dotfiles/private_dot_i3/config
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ bindsym $mod+BackSpace exec firefox
bindsym $mod+Shift+q kill

# rofi launcher
bindsym $mod+d exec "rofi -switchers 'workspaces:rofi-switch-workspaces,launcher:rofi-launcher,run' -show launcher"
bindsym $mod+d exec "rofi -combi-modi 'launcher:rofi-launcher,workspaces:rofi-switch-workspaces,drun' -show combi -modes combi -display-combi 'choice'"

# change focus
bindsym $mod+h focus left
Expand Down
6 changes: 0 additions & 6 deletions dotfiles/private_dot_i3/executable_rename_workspace.sh

This file was deleted.

0 comments on commit 81c47dd

Please sign in to comment.