rewrote the hlwm setup, improved fish one, added a bunch of shit, learned fish
This commit is contained in:
		
							parent
							
								
									69a5ebf098
								
							
						
					
					
						commit
						502d5ff636
					
				| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
helix/runtime
 | 
			
		||||
| 
						 | 
				
			
			@ -854,4 +854,3 @@ key_bindings:
 | 
			
		|||
 | 
			
		||||
  # Print all received window events.
 | 
			
		||||
  #print_events: false
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| 
						 | 
				
			
			@ -0,0 +1,27 @@
 | 
			
		|||
# Vertical Candidate List
 | 
			
		||||
Vertical Candidate List=False
 | 
			
		||||
# Use Per Screen DPI
 | 
			
		||||
PerScreenDPI=True
 | 
			
		||||
# Use mouse wheel to go to prev or next page
 | 
			
		||||
WheelForPaging=True
 | 
			
		||||
# Font
 | 
			
		||||
Font="Sans 14"
 | 
			
		||||
# Menu Font
 | 
			
		||||
MenuFont="Sans 14"
 | 
			
		||||
# Tray Font
 | 
			
		||||
TrayFont="Sans Bold 14"
 | 
			
		||||
# Tray Label Outline Color
 | 
			
		||||
TrayOutlineColor=#000000
 | 
			
		||||
# Tray Label Text Color
 | 
			
		||||
TrayTextColor=#ffffff
 | 
			
		||||
# Prefer Text Icon
 | 
			
		||||
PreferTextIcon=False
 | 
			
		||||
# Show Layout Name In Icon
 | 
			
		||||
ShowLayoutNameInIcon=True
 | 
			
		||||
# Use input method language to display text
 | 
			
		||||
UseInputMethodLangaugeToDisplayText=True
 | 
			
		||||
# Theme
 | 
			
		||||
Theme=default
 | 
			
		||||
# Force font DPI on Wayland
 | 
			
		||||
ForceWaylandDPI=0
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -10,6 +10,8 @@ SpellEnabled=True
 | 
			
		|||
EmojiEnabled=True
 | 
			
		||||
# Enable Chaizi
 | 
			
		||||
ChaiziEnabled=True
 | 
			
		||||
# Enable Characters in Unicode CJK Extension B
 | 
			
		||||
ExtBEnabled=True
 | 
			
		||||
# Enable Cloud Pinyin
 | 
			
		||||
CloudPinyinEnabled=False
 | 
			
		||||
# Cloud Pinyin Index
 | 
			
		||||
| 
						 | 
				
			
			@ -24,10 +26,16 @@ PinyinInPreedit=False
 | 
			
		|||
Prediction=False
 | 
			
		||||
# Prediction Size
 | 
			
		||||
PredictionSize=10
 | 
			
		||||
# Action when switching input method
 | 
			
		||||
SwitchInputMethodBehavior="Commit current preedit"
 | 
			
		||||
# Select 2nd Candidate
 | 
			
		||||
SecondCandidate=
 | 
			
		||||
# Select 3rd Candidate
 | 
			
		||||
ThirdCandidate=
 | 
			
		||||
# Use Keypad as Selection key
 | 
			
		||||
UseKeypadAsSelection=False
 | 
			
		||||
# Use BackSpace to cancel the selection
 | 
			
		||||
BackSpaceToUnselect=True
 | 
			
		||||
# Number of Sentences
 | 
			
		||||
Number of sentence=2
 | 
			
		||||
# Prompt long word length when input length over (0 for disable)
 | 
			
		||||
| 
						 | 
				
			
			@ -80,7 +88,7 @@ FirstRun=False
 | 
			
		|||
[Fuzzy]
 | 
			
		||||
# ue -> ve
 | 
			
		||||
VE_UE=True
 | 
			
		||||
# gn -> ng
 | 
			
		||||
# Common Typo
 | 
			
		||||
NG_GN=True
 | 
			
		||||
# Inner Segment (xian -> xi'an)
 | 
			
		||||
Inner=True
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,7 @@
 | 
			
		|||
set -x BROWSER (which firefox)
 | 
			
		||||
set -x TERM "xterm-256color"
 | 
			
		||||
alias hc=herbstclient
 | 
			
		||||
set fish_greeting ""
 | 
			
		||||
 | 
			
		||||
# Local per-machine changes
 | 
			
		||||
source $HOME/.fishrc
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,43 @@
 | 
			
		|||
# This file contains fish universal variable definitions.
 | 
			
		||||
# VERSION: 3.0
 | 
			
		||||
SETUVAR __fish_initialized:3400
 | 
			
		||||
SETUVAR _flag_secs:1
 | 
			
		||||
SETUVAR fish_color_autosuggestion:555\x1ebrblack
 | 
			
		||||
SETUVAR fish_color_cancel:\x2dr
 | 
			
		||||
SETUVAR fish_color_command:blue
 | 
			
		||||
SETUVAR fish_color_comment:red
 | 
			
		||||
SETUVAR fish_color_cwd:green
 | 
			
		||||
SETUVAR fish_color_cwd_root:red
 | 
			
		||||
SETUVAR fish_color_end:green
 | 
			
		||||
SETUVAR fish_color_error:brred
 | 
			
		||||
SETUVAR fish_color_escape:brcyan
 | 
			
		||||
SETUVAR fish_color_history_current:\x2d\x2dbold
 | 
			
		||||
SETUVAR fish_color_host:normal
 | 
			
		||||
SETUVAR fish_color_host_remote:yellow
 | 
			
		||||
SETUVAR fish_color_normal:normal
 | 
			
		||||
SETUVAR fish_color_operator:brcyan
 | 
			
		||||
SETUVAR fish_color_param:cyan
 | 
			
		||||
SETUVAR fish_color_quote:yellow
 | 
			
		||||
SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold
 | 
			
		||||
SETUVAR fish_color_search_match:\x2d\x2dbackground\x3d111
 | 
			
		||||
SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
 | 
			
		||||
SETUVAR fish_color_status:red
 | 
			
		||||
SETUVAR fish_color_user:brgreen
 | 
			
		||||
SETUVAR fish_color_valid_path:\x2d\x2dunderline
 | 
			
		||||
SETUVAR fish_key_bindings:fish_default_key_bindings
 | 
			
		||||
SETUVAR fish_pager_color_completion:normal
 | 
			
		||||
SETUVAR fish_pager_color_description:B3A06D\x1eyellow\x1e\x2di
 | 
			
		||||
SETUVAR fish_pager_color_prefix:cyan\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
 | 
			
		||||
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
 | 
			
		||||
SETUVAR fish_pager_color_selected_background:\x2dr
 | 
			
		||||
SETUVAR fish_user_paths:/home/emilis/\x2ebin\x1e/home/emilis/\x2ecargo/bin\x1e/usr/local/jdk\x2d17/bin/
 | 
			
		||||
SETUVAR hlwm_group_active:1
 | 
			
		||||
SETUVAR hlwm_group_count:3
 | 
			
		||||
SETUVAR hlwm_mod:Mod4
 | 
			
		||||
SETUVAR hlwm_tags_per_group:5
 | 
			
		||||
SETUVAR notify_bg:\x23330033
 | 
			
		||||
SETUVAR notify_fg:\x23898989
 | 
			
		||||
SETUVAR notify_font:\x2dmisc\x2dterminessttf\x20nerd\x20font\x20mono\x2dmedium\x2d\x2a\x2d\x2a\x2d\x2a\x2d12\x2d\x2a\x2d\x2a\x2d\x2a\x2d\x2a\x2d\x2a\x2d\x2a\x2d\x2a
 | 
			
		||||
SETUVAR notify_padding:30
 | 
			
		||||
SETUVAR notify_secs:1
 | 
			
		||||
SETUVAR spawn_log_color:0000ff
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,35 @@
 | 
			
		|||
set -g __fish_git_prompt_show_informative_status 1
 | 
			
		||||
set -g __fish_git_prompt_hide_untrackedfiles 1
 | 
			
		||||
set -g __fish_git_prompt_color_branch -o blue
 | 
			
		||||
set -g __fish_git_prompt_showupstream "informative"
 | 
			
		||||
set -g __fish_git_prompt_char_upstream_ahead "↑"
 | 
			
		||||
set -g __fish_git_prompt_char_upstream_behind "↓"
 | 
			
		||||
set -g __fish_git_prompt_char_upstream_prefix ""
 | 
			
		||||
set -g __fish_git_prompt_char_stagedstate "●"
 | 
			
		||||
set -g __fish_git_prompt_char_dirtystate "✚"
 | 
			
		||||
set -g __fish_git_prompt_char_untrackedfiles "…"
 | 
			
		||||
set -g __fish_git_prompt_char_conflictedstate "✖"
 | 
			
		||||
set -g __fish_git_prompt_char_cleanstate "✔"
 | 
			
		||||
set -g __fish_git_prompt_color_dirtystate blue
 | 
			
		||||
set -g __fish_git_prompt_color_stagedstate yellow
 | 
			
		||||
set -g __fish_git_prompt_color_invalidstate red
 | 
			
		||||
set -g __fish_git_prompt_color_untrackedfiles $fish_color_normal
 | 
			
		||||
set -g __fish_git_prompt_color_cleanstate -o green
 | 
			
		||||
set -g __fish_git_prompt_color_prefix -o blue
 | 
			
		||||
set -g __fish_git_prompt_color_suffix -o blue
 | 
			
		||||
 | 
			
		||||
function fish_prompt
 | 
			
		||||
    set_color $fish_color_cwd
 | 
			
		||||
    echo -n \(
 | 
			
		||||
    set_color magenta
 | 
			
		||||
    echo -n \[(echo -n $USER)\] 
 | 
			
		||||
    set_color $fish_color_cwd
 | 
			
		||||
    echo -n (hostname):
 | 
			
		||||
    set_color cyan
 | 
			
		||||
    echo -n (prompt_pwd)
 | 
			
		||||
    set_color $fish_color_cwd
 | 
			
		||||
    echo -n (fish_git_prompt)
 | 
			
		||||
    echo -n \)
 | 
			
		||||
    set_color normal
 | 
			
		||||
    echo -n ' > '
 | 
			
		||||
  end
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,33 @@
 | 
			
		|||
#!/usr/bin/env
 | 
			
		||||
 | 
			
		||||
function parent_dir
 | 
			
		||||
    set -f trace (status stack-trace)
 | 
			
		||||
    # By index:
 | 
			
		||||
    # 1: in command substitution
 | 
			
		||||
    # 2: parent.fish line
 | 
			
		||||
    # 3: in function 'parent'
 | 
			
		||||
    # 4: caller import line
 | 
			
		||||
    # 5: in command substitution
 | 
			
		||||
    # 6: caller "parent" invokation line
 | 
			
		||||
    # 7: in function calling parent
 | 
			
		||||
    # 8: jackpot! here's the parent of the caller
 | 
			
		||||
    set -f parent_line $trace[8]
 | 
			
		||||
    set -f parent_split (string split 'of file' $parent_line)
 | 
			
		||||
    set -f parent (string trim $parent_split[2])
 | 
			
		||||
 | 
			
		||||
    # qualify ~
 | 
			
		||||
    set -f parent (string replace '~' "$HOME" $parent)
 | 
			
		||||
    
 | 
			
		||||
    # Qualify the path to absolute and remove the filename
 | 
			
		||||
    set -f parent_dir (realpath $parent)
 | 
			
		||||
    set -f parent (string join '/' (string split '/' $parent_dir)[1..-2])
 | 
			
		||||
    echo $parent
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function import
 | 
			
		||||
    set -f self_directory (parent_dir)
 | 
			
		||||
    if set -q debug;
 | 
			
		||||
        echo "importing $argv.fish from [$self_directory]"
 | 
			
		||||
    end
 | 
			
		||||
    source $self_directory/"$argv.fish"
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,8 @@
 | 
			
		|||
#!/usr/bin/env fish
 | 
			
		||||
 | 
			
		||||
# Helper script to initialize fish scripts
 | 
			
		||||
function initscript
 | 
			
		||||
    set -f file "$argv.fish"
 | 
			
		||||
    echo "#!/usr/bin/env fish" >> "$file"
 | 
			
		||||
    chmod +x "$file"
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,4 @@
 | 
			
		|||
#!/usr/bin/env fish
 | 
			
		||||
function mkcd
 | 
			
		||||
	mkdir $argv; and cd $argv
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,8 @@
 | 
			
		|||
function prompt_pwd --description 'Print the current working directory, NOT shortened to fit the prompt'
 | 
			
		||||
    if test "$PWD" != "$HOME"
 | 
			
		||||
        printf "%s" (echo $PWD|sed -e 's|/private||' -e "s|^$HOME|~|")
 | 
			
		||||
    else
 | 
			
		||||
        echo '~'
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
[editor]
 | 
			
		||||
auto-save = true
 | 
			
		||||
auto-completion = true
 | 
			
		||||
 | 
			
		||||
[editor.statusline]
 | 
			
		||||
#left = ["mode", "spinner"]
 | 
			
		||||
 | 
			
		||||
[editor.lsp]
 | 
			
		||||
display-messages = true
 | 
			
		||||
| 
						 | 
				
			
			@ -2,6 +2,5 @@
 | 
			
		|||
 | 
			
		||||
pushd /home/emilis/.config/herbstluftwm
 | 
			
		||||
echo starting fish script
 | 
			
		||||
echo (pwd)
 | 
			
		||||
./autostart.fish
 | 
			
		||||
fish ./autostart.fish
 | 
			
		||||
popd
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,19 +1,41 @@
 | 
			
		|||
#!/usr/local/bin/fish
 | 
			
		||||
#!/usr/bin/env fish
 | 
			
		||||
import fish_functions/log
 | 
			
		||||
import fish_functions/set_default
 | 
			
		||||
import fish_functions/notify
 | 
			
		||||
import fish_functions/restart_svcs
 | 
			
		||||
import fish_functions/group
 | 
			
		||||
 | 
			
		||||
alias hc=herbstclient
 | 
			
		||||
 | 
			
		||||
set -g THIS_PATH (pwd)
 | 
			
		||||
log "starting in $THIS_PATH"
 | 
			
		||||
 | 
			
		||||
# default font if not set
 | 
			
		||||
set_default hlwm_font "-*-fixed-medium-*-*-*-12-*-*-*-*-*-*-*"
 | 
			
		||||
 | 
			
		||||
hc emit_hook reload
 | 
			
		||||
if command -sq "xsetroot";
 | 
			
		||||
	xsetroot -solid black
 | 
			
		||||
end
 | 
			
		||||
hc keyunbind --all
 | 
			
		||||
groups_reset
 | 
			
		||||
 | 
			
		||||
# set -l Mod Mod1 # alt
 | 
			
		||||
set -g Mod Mod4
 | 
			
		||||
set -g AltMod Mod1
 | 
			
		||||
 | 
			
		||||
set -u hlwm_mod $Mod
 | 
			
		||||
 | 
			
		||||
function key
 | 
			
		||||
	log "Registering $Mod-$argv[1] to [$argv[2..]]"
 | 
			
		||||
	hc keybind $Mod-$argv[1] $argv[2..]
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
hc keybind $Mod-Shift-r reload
 | 
			
		||||
hc keybind $Mod-Shift-c close
 | 
			
		||||
hc keybind $Mod-s spawn "flameshot" gui
 | 
			
		||||
hc keybind $Mod-Return spawn "dmenu_run"
 | 
			
		||||
hc keybind $Mod-Delete spawn "alacritty"
 | 
			
		||||
hc keybind $Mod-Home spawn "alacritty"
 | 
			
		||||
 | 
			
		||||
# basic movement in tiling and floating mode
 | 
			
		||||
# focusing clients
 | 
			
		||||
| 
						 | 
				
			
			@ -21,17 +43,15 @@ hc keybind $Mod-Left  focus left
 | 
			
		|||
hc keybind $Mod-Down  focus down
 | 
			
		||||
hc keybind $Mod-Up    focus up
 | 
			
		||||
hc keybind $Mod-Right focus right
 | 
			
		||||
hc keybind $Mod-h     focus left
 | 
			
		||||
hc keybind $Mod-j     focus down
 | 
			
		||||
hc keybind $Mod-k     focus up
 | 
			
		||||
hc keybind $Mod-l     focus right
 | 
			
		||||
 | 
			
		||||
# Move frames
 | 
			
		||||
hc keybind $Mod-Shift-Right shift right
 | 
			
		||||
hc keybind $Mod-Shift-Left shift left
 | 
			
		||||
hc keybind $Mod-Shift-Up shift up
 | 
			
		||||
hc keybind $Mod-Shift-Down shift down
 | 
			
		||||
 | 
			
		||||
# frames
 | 
			
		||||
#hc keybind $Mod-u       split   bottom  0.5
 | 
			
		||||
hc keybind $Mod-u       split   bottom  0.5
 | 
			
		||||
hc keybind $Mod-o       split   right   0.5
 | 
			
		||||
hc keybind $Mod-r	remove
 | 
			
		||||
hc keybind $Mod-f	fullscreen toggle
 | 
			
		||||
| 
						 | 
				
			
			@ -44,24 +64,37 @@ hc keybind $Mod-Control-Down    resize down +$resize_step
 | 
			
		|||
hc keybind $Mod-Control-Up      resize up +$resize_step
 | 
			
		||||
hc keybind $Mod-Control-Right   resize right +$resize_step
 | 
			
		||||
 | 
			
		||||
set -l tag_names 1 2 3 4
 | 
			
		||||
set -l secondary_tags 1 2 3 4
 | 
			
		||||
hc rename default "$tag_names[1]" || true
 | 
			
		||||
for tag in $tag_names
 | 
			
		||||
set_default -u hlwm_tags_per_group 5
 | 
			
		||||
set_default -u hlwm_group_count 3
 | 
			
		||||
log "registering $hlwm_group_count groups, with $hlwm_tags_per_group tags per"
 | 
			
		||||
set -l tag_indexes (seq $hlwm_tags_per_group)
 | 
			
		||||
 | 
			
		||||
hc silent rename default $tag_indexes[1]
 | 
			
		||||
for group_num in (seq $hlwm_group_count)
 | 
			
		||||
	for tag_index in $tag_indexes
 | 
			
		||||
		set -l tag (math $tag_index + '(('$group_num -1')' x $hlwm_tags_per_group ')')
 | 
			
		||||
		log "adding tag <$tag>"
 | 
			
		||||
		hc add "$tag"
 | 
			
		||||
	hc keybind $Mod-$tag use_index (math $tag-1)
 | 
			
		||||
	hc keybind $Mod-Shift-$tag move_index (math $tag-1)
 | 
			
		||||
	end
 | 
			
		||||
for tag in $secondary_tags
 | 
			
		||||
	set -l actual_tag (math $tag+$tag_names[-1])
 | 
			
		||||
	set -l actual_index (math $actual_tag-1)
 | 
			
		||||
	hc add "$actual_tag"
 | 
			
		||||
	hc keybind $AltMod-$tag use_index $actual_index
 | 
			
		||||
	hc keybind $AltMod-Shift-$tag move_index $actual_index
 | 
			
		||||
end
 | 
			
		||||
group_set_keybinds
 | 
			
		||||
 | 
			
		||||
# set -l rename_result (hc rename default "$tag_names[1]")
 | 
			
		||||
# for tag in $tag_names
 | 
			
		||||
# 	hc add "$tag"
 | 
			
		||||
# 	hc keybind $Mod-$tag use_index (math $tag-1)
 | 
			
		||||
# 	hc keybind $Mod-Shift-$tag move_index (math $tag-1)
 | 
			
		||||
# end
 | 
			
		||||
# for tag in $secondary_tags
 | 
			
		||||
# 	set -l actual_tag (math $tag+$tag_names[-1])
 | 
			
		||||
# 	set -l actual_index (math $actual_tag-1)
 | 
			
		||||
# 	hc add "$actual_tag"
 | 
			
		||||
# 	hc keybind $AltMod-$tag use_index $actual_index
 | 
			
		||||
# 	hc keybind $AltMod-Shift-$tag move_index $actual_index
 | 
			
		||||
# end
 | 
			
		||||
 | 
			
		||||
# focus
 | 
			
		||||
hc keybind $Mod-Tab cycle_all +1
 | 
			
		||||
hc keybind $Mod-Tab cycle
 | 
			
		||||
hc keybind $Mod-i jumpto urgent
 | 
			
		||||
 | 
			
		||||
# mus
 | 
			
		||||
| 
						 | 
				
			
			@ -74,6 +107,7 @@ hc mousebind $Mod-Button3 resize
 | 
			
		|||
#          Theming          #
 | 
			
		||||
#############################
 | 
			
		||||
set -l ACTIVE "#800080"
 | 
			
		||||
# TODO: Consider 6600ff for active
 | 
			
		||||
set -l NORMAL "#330033"
 | 
			
		||||
set -l URGENT "#7811A1"
 | 
			
		||||
alias hcs="hc set"
 | 
			
		||||
| 
						 | 
				
			
			@ -165,11 +199,35 @@ hc unlock
 | 
			
		|||
 | 
			
		||||
# Start services
 | 
			
		||||
 | 
			
		||||
echo 'Starting services'
 | 
			
		||||
./start_svcs.fish
 | 
			
		||||
echo 'Services start script complete'
 | 
			
		||||
log 'Starting services'
 | 
			
		||||
restart_svcs "fcitx5"
 | 
			
		||||
log 'Services start done'
 | 
			
		||||
 | 
			
		||||
function keybind_fn
 | 
			
		||||
	argparse -i 'direct=' -- $argv
 | 
			
		||||
	set -f script_name "fn_caller"
 | 
			
		||||
	if set -q _flag_direct
 | 
			
		||||
		set -f script_name $_flag_direct
 | 
			
		||||
	end
 | 
			
		||||
	key $argv[1] try spawn (printf "fish\n%s" "$THIS_PATH/fish_cmds/$script_name.fish") $argv[2]
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
log "Registering custom command binds"
 | 
			
		||||
keybind_fn i "toggle_idle_screen"
 | 
			
		||||
keybind_fn --direct="toggle_group" "Shift-Tab"
 | 
			
		||||
log "Custom commands bound"
 | 
			
		||||
 | 
			
		||||
set -l monitors (hc list_monitors | cut -d: -f1)
 | 
			
		||||
if not set -q hlwm_skip_panel
 | 
			
		||||
	# For now, still use bash panel.sh
 | 
			
		||||
for monitor in (hc list_monitors | cut -d: -f1)
 | 
			
		||||
	for monitor in $monitors
 | 
			
		||||
		bash ./panel.sh "$monitor" &
 | 
			
		||||
	end
 | 
			
		||||
else
 | 
			
		||||
	# undo all the padding
 | 
			
		||||
	for monitor in $monitors;
 | 
			
		||||
		hc pad $monitor 0
 | 
			
		||||
	end
 | 
			
		||||
	notify skipping panel
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
#!/usr/bin/env fish
 | 
			
		||||
import ../fish_functions/log
 | 
			
		||||
 | 
			
		||||
set_default spawn_log_color "0000ff"
 | 
			
		||||
log -c $spawn_log_color "trying to spawn $argv[1] with args: <$argv[2..]>"
 | 
			
		||||
 | 
			
		||||
import ../fish_functions/$argv[1]
 | 
			
		||||
 | 
			
		||||
$argv[1] $argv[2..]
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,4 @@
 | 
			
		|||
#!/usr/bin/env fish
 | 
			
		||||
import ../fish_functions/group
 | 
			
		||||
 | 
			
		||||
group_switch
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
#!/usr/bin/env fish
 | 
			
		||||
set -g FISH_CMDS_PATH $HOME/.config/herbstluftwm/fish_cmds
 | 
			
		||||
 | 
			
		||||
# cmd_string returns the shell command to invoke
 | 
			
		||||
# the fish_cmds file title given to it as an argument
 | 
			
		||||
function cmd_string
 | 
			
		||||
    set -f FISH_PATH (status fish-path)
 | 
			
		||||
    printf "$FISH_PATH\n$FISH_CMDS_PATH/$argv.fish"
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,13 @@
 | 
			
		|||
#!/usr/bin/env fish
 | 
			
		||||
 | 
			
		||||
function hlwm_active
 | 
			
		||||
    echo (herbstclient attr theme.active.color)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function hlwm_normal
 | 
			
		||||
    echo (herbstclient attr theme.normal.color)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function hlwm_text
 | 
			
		||||
    echo (herbstclient attr theme.normal.title_color)
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,41 @@
 | 
			
		|||
#!/usr/bin/env
 | 
			
		||||
import notify
 | 
			
		||||
import log
 | 
			
		||||
import set_default
 | 
			
		||||
 | 
			
		||||
alias hc=herbstclient
 | 
			
		||||
 | 
			
		||||
set -g tag_color "ff99cc"
 | 
			
		||||
 | 
			
		||||
function groups_reset
 | 
			
		||||
    set -e hlwm_group_active
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function group_switch
 | 
			
		||||
    set -f current $hlwm_group_active
 | 
			
		||||
    if not set -q hlwm_group_active
 | 
			
		||||
        set -U hlwm_group_active 2 
 | 
			
		||||
    else if test $hlwm_group_active -eq $hlwm_group_count
 | 
			
		||||
        set -U hlwm_group_active 1
 | 
			
		||||
    else
 | 
			
		||||
        set -U hlwm_group_active (math $hlwm_group_active + 1)
 | 
			
		||||
    end
 | 
			
		||||
    log -c $tag_color "group $current -> $hlwm_group_active" 
 | 
			
		||||
    group_set_keybinds
 | 
			
		||||
    notify "Group $hlwm_group_active"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
# group_set_keybinds sets the keybinds to the given tab group
 | 
			
		||||
function group_set_keybinds 
 | 
			
		||||
    set_default hlwm_mod Mod4
 | 
			
		||||
    log "group_set_keybinds: $hlwm_group_active"
 | 
			
		||||
    if not set -q hlwm_group_active;
 | 
			
		||||
        set -U hlwm_group_active 1
 | 
			
		||||
    end
 | 
			
		||||
    set -l offset (math (math $hlwm_group_active-1) x $hlwm_tags_per_group)
 | 
			
		||||
    for tag in (seq $hlwm_tags_per_group)
 | 
			
		||||
        set -l actual_tag (math $tag + $offset)
 | 
			
		||||
        hc keybind $hlwm_mod-$tag use_index (math $actual_tag-1)
 | 
			
		||||
        hc keybind $hlwm_mod-Shift-$tag move_index (math $actual_tag-1)
 | 
			
		||||
    end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,20 @@
 | 
			
		|||
#!/usr/bin/env fish
 | 
			
		||||
import parent
 | 
			
		||||
import set_default
 | 
			
		||||
 | 
			
		||||
# calls logger with a specific color
 | 
			
		||||
#
 | 
			
		||||
# examples:
 | 
			
		||||
#
 | 
			
		||||
# log "hello there"
 | 
			
		||||
# log -c magenta "im berry"
 | 
			
		||||
# log --color cc00cc "just like the blueberries"
 | 
			
		||||
function log
 | 
			
		||||
    set -f log_name (parent)
 | 
			
		||||
    argparse 'c/color=' -- $argv
 | 
			
		||||
    if not set -q _flag_color;
 | 
			
		||||
        set -g _flag_color green
 | 
			
		||||
    end
 | 
			
		||||
    
 | 
			
		||||
    echo -s "[ " (set_color $_flag_color) $log_name (set_color normal) " ]: $argv" 1>&2
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,25 @@
 | 
			
		|||
#!/usr/bin/env fish
 | 
			
		||||
import colors
 | 
			
		||||
import set_default
 | 
			
		||||
import log
 | 
			
		||||
 | 
			
		||||
set_default notify_fg (hlwm_text)
 | 
			
		||||
set_default notify_bg (hlwm_normal)
 | 
			
		||||
set_default notify_font $hlwm_font
 | 
			
		||||
set_default notify_padding 30
 | 
			
		||||
 | 
			
		||||
function notify
 | 
			
		||||
    argparse -i 'secs=!_validate_int --min 1' -- $argv
 | 
			
		||||
    set_default _flag_secs 1
 | 
			
		||||
    set -f text_width (textwidth "$notify_font" "$argv")
 | 
			
		||||
    
 | 
			
		||||
    echo "$argv" |                                  \
 | 
			
		||||
        dzen2                                       \
 | 
			
		||||
            -p $_flag_secs                          \
 | 
			
		||||
            -fg $notify_fg                          \
 | 
			
		||||
            -bg $notify_bg                          \
 | 
			
		||||
            -fn $notify_font                        \
 | 
			
		||||
            -ta 'c'                                 \
 | 
			
		||||
            -w (math $text_width + $notify_padding) \
 | 
			
		||||
            -h 16
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,27 @@
 | 
			
		|||
#!/usr/bin/env fish
 | 
			
		||||
 | 
			
		||||
# parent prints the parent script's filename
 | 
			
		||||
function parent
 | 
			
		||||
    set -f trace (status stack-trace)
 | 
			
		||||
    # By index:
 | 
			
		||||
    # 1: in command substitution
 | 
			
		||||
    # 2: parent.fish line
 | 
			
		||||
    # 3: in function 'parent'
 | 
			
		||||
    # 4: caller import line
 | 
			
		||||
    # 5: in command substitution
 | 
			
		||||
    # 6: caller "parent" invokation line
 | 
			
		||||
    # 7: in function calling parent
 | 
			
		||||
    # 8: jackpot! here's the parent of the caller
 | 
			
		||||
    set -f parent_line $trace[8]
 | 
			
		||||
    set -f parent_split (string split 'of file' $parent_line)
 | 
			
		||||
    set -f parent (string trim $parent_split[2])
 | 
			
		||||
    # Clean up the parent a lil bit
 | 
			
		||||
    set -f parent (realpath (string replace '~' "$HOME" $parent))
 | 
			
		||||
    set -f parent_parts (string split '/' $parent)
 | 
			
		||||
    set -f parent (string join '/' $parent_parts[-1])
 | 
			
		||||
 | 
			
		||||
    # remove .fish suffix
 | 
			
		||||
    set -f parent (string replace '.fish' '' $parent)
 | 
			
		||||
 | 
			
		||||
    echo $parent
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
#!/usr/bin/env fish
 | 
			
		||||
import log
 | 
			
		||||
 | 
			
		||||
alias hc=herbstclient
 | 
			
		||||
 | 
			
		||||
function restart_svcs
 | 
			
		||||
	for cmd in $argv
 | 
			
		||||
		if not command -sq "$cmd"; 
 | 
			
		||||
			log -c yellow "command [$cmd] not found, skipping..."
 | 
			
		||||
			continue
 | 
			
		||||
		end
 | 
			
		||||
		log -c red "killing [$cmd]"
 | 
			
		||||
		pkill -9 $cmd
 | 
			
		||||
		log -c magenta "starting [$cmd]"
 | 
			
		||||
		hc silent spawn "$cmd"
 | 
			
		||||
	end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,25 @@
 | 
			
		|||
#!/usr/bin/env fish
 | 
			
		||||
 | 
			
		||||
# set_default sets a variable with
 | 
			
		||||
# global scope (-g), if it is not already set
 | 
			
		||||
#
 | 
			
		||||
# Examples:
 | 
			
		||||
#
 | 
			
		||||
# set EXAMPLE_1 "hello"
 | 
			
		||||
# set_default EXAMPLE_1 "world"
 | 
			
		||||
# echo $EXAMPLE_1 # "hello"
 | 
			
		||||
#
 | 
			
		||||
# set_default EXAMPLE_2 "world"
 | 
			
		||||
# echo $EXAMPLE_2 # "world"
 | 
			
		||||
function set_default
 | 
			
		||||
    argparse -i 'u/universal' -- $argv
 | 
			
		||||
    if not set -q $argv[1];
 | 
			
		||||
        if set _flag_universal
 | 
			
		||||
            echo "set -U $argv[1] $argv[2..]"
 | 
			
		||||
            set -U $argv[1] $argv[2..]
 | 
			
		||||
        else
 | 
			
		||||
            echo "set -g $argv[1] $argv[2..]"
 | 
			
		||||
            set -g $argv[1] $argv[2..]
 | 
			
		||||
        end
 | 
			
		||||
    end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,14 @@
 | 
			
		|||
#!/usr/bin/env fish
 | 
			
		||||
import notify
 | 
			
		||||
 | 
			
		||||
function toggle_idle_screen
 | 
			
		||||
	if xset q | rg "DPMS is Enabled"
 | 
			
		||||
		# Disable
 | 
			
		||||
		xset -dpms
 | 
			
		||||
		notify "screen idle off"
 | 
			
		||||
	else
 | 
			
		||||
		# Enable
 | 
			
		||||
	 	xset +dpms
 | 
			
		||||
		notify "screen idle on"
 | 
			
		||||
	end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -24,7 +24,7 @@ x=${geometry[0]}
 | 
			
		|||
y=${geometry[1]}
 | 
			
		||||
panel_width=${geometry[2]}
 | 
			
		||||
panel_height=16
 | 
			
		||||
font="-*-fixed-medium-*-*-*-12-*-*-*-*-*-*-*"
 | 
			
		||||
font="${hlwm_font:=-*-fixed-medium-*-*-*-12-*-*-*-*-*-*-*}"
 | 
			
		||||
# extract colors from hlwm and omit alpha-value
 | 
			
		||||
bgcolor=$(hc get frame_border_normal_color|sed 's,^\(\#[0-9a-f]\{6\}\)[0-9a-f]\{2\}$,\1,')
 | 
			
		||||
selbg=$(hc get window_border_active_color|sed 's,^\(\#[0-9a-f]\{6\}\)[0-9a-f]\{2\}$,\1,')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,16 @@
 | 
			
		|||
#!/usr/bin/env bash
 | 
			
		||||
 | 
			
		||||
installdir=/
 | 
			
		||||
 | 
			
		||||
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
 | 
			
		||||
defaultpanel="$XDG_CONFIG_HOME/herbstluftwm/panel.sh"
 | 
			
		||||
 | 
			
		||||
[ -x "$defaultpanel" ] || defaultpanel="$installdir/etc/xdg/herbstluftwm/panel.sh"
 | 
			
		||||
 | 
			
		||||
panelcmd="${1:-$defaultpanel}"
 | 
			
		||||
 | 
			
		||||
herbstclient emit_hook quit_panel
 | 
			
		||||
 | 
			
		||||
for i in $(herbstclient list_monitors | cut -d':' -f1) ; do
 | 
			
		||||
    "$panelcmd" $i &
 | 
			
		||||
done
 | 
			
		||||
| 
						 | 
				
			
			@ -1,9 +0,0 @@
 | 
			
		|||
#!/usr/local/bin/fish
 | 
			
		||||
set -l cmds "fcitx5"
 | 
			
		||||
 | 
			
		||||
for cmd in $cmds
 | 
			
		||||
	echo "[ $cmd ] killing existing"
 | 
			
		||||
	pkill -9 $cmd
 | 
			
		||||
	echo "[ $cmd ] starting..."
 | 
			
		||||
	$cmd &
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,25 @@
 | 
			
		|||
#!/usr/bin/env fish
 | 
			
		||||
set -l me (status dirname)
 | 
			
		||||
 | 
			
		||||
set -l config_dir "$HOME/.config"
 | 
			
		||||
if not test -e $config_dir
 | 
			
		||||
    mkdir $HOME/.config
 | 
			
		||||
else
 | 
			
		||||
    # Move over helix/runtime here first (before deletion)
 | 
			
		||||
    if test -e $config_dir/helix/runtime
 | 
			
		||||
        if not test -e $config_dir/helix/runtime
 | 
			
		||||
            mv "$config_dir/helix/runtime" "$me/helix/"
 | 
			
		||||
        end
 | 
			
		||||
    end
 | 
			
		||||
end
 | 
			
		||||
for directory in */
 | 
			
		||||
    if test -L (string sub -e -1 $config_dir/$directory)
 | 
			
		||||
        echo "already have a simlink for <$(string sub -e -1 $directory)>"
 | 
			
		||||
        continue
 | 
			
		||||
    else
 | 
			
		||||
        echo "removing <$directory>"
 | 
			
		||||
        rm -rf "$config_dir/$directory"
 | 
			
		||||
    end
 | 
			
		||||
    ln -s "$(pwd)/$directory" "$HOME/.config/"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue