fixed set_default bug making stuff universal when it shouldn't be, drastically improved groups to be far more ergonomic, moved some hlwm stuff to fish/fish_functions
This commit is contained in:
parent
502d5ff636
commit
3ae6f01d88
|
@ -1 +1,2 @@
|
|||
helix/runtime
|
||||
fish/fish_variables
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
# 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
|
|
@ -29,5 +29,9 @@ function import
|
|||
if set -q debug;
|
||||
echo "importing $argv.fish from [$self_directory]"
|
||||
end
|
||||
if starts_with '/' "$argv"
|
||||
source "$argv.fish"
|
||||
return 0
|
||||
end
|
||||
source $self_directory/"$argv.fish"
|
||||
end
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
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..]"
|
||||
if set -q _flag_universal
|
||||
# echo "set -U $argv[1] $argv[2..]" 1>&2
|
||||
set -U $argv[1] $argv[2..]
|
||||
else
|
||||
echo "set -g $argv[1] $argv[2..]"
|
||||
# echo "set -g $argv[1] $argv[2..]" 1>&2
|
||||
set -g $argv[1] $argv[2..]
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env fish
|
||||
|
||||
function starts_with
|
||||
set -l first_char (string sub -l 1 "$argv[2..]")
|
||||
if test $first_char = $argv[1]
|
||||
return 0
|
||||
end
|
||||
return 1
|
||||
end
|
|
@ -1,6 +1,5 @@
|
|||
#!/usr/bin/env fish
|
||||
|
||||
pushd /home/emilis/.config/herbstluftwm
|
||||
echo starting fish script
|
||||
fish ./autostart.fish
|
||||
pushd $HOME/.config/herbstluftwm
|
||||
fish ./main.fish
|
||||
popd
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env fish
|
||||
import ../fish_functions/group
|
||||
|
||||
# if test -eq "$argv[1]" = "move"
|
||||
|
||||
# end
|
||||
|
||||
group_switch "$argv"
|
|
@ -1,4 +0,0 @@
|
|||
#!/usr/bin/env fish
|
||||
import ../fish_functions/group
|
||||
|
||||
group_switch
|
|
@ -1,18 +1,109 @@
|
|||
#!/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
|
||||
# group_active_reset resets the active group (unset)
|
||||
function group_active_reset
|
||||
set -q hlwm_group_active
|
||||
end
|
||||
|
||||
function group_switch
|
||||
set -f current $hlwm_group_active
|
||||
|
||||
set -f arg $argv[1]
|
||||
if not set -q arg
|
||||
set -f arg '+'
|
||||
end
|
||||
if test "$arg" = "+"
|
||||
group_up
|
||||
else if test "$arg" = "-"
|
||||
group_down
|
||||
else if test $arg -eq $arg
|
||||
# is a number
|
||||
group_index $arg
|
||||
else
|
||||
log -c $tag_color "invalid group index [$arg], use '+', '-', or a real integer"
|
||||
return 1
|
||||
end
|
||||
|
||||
# update the tag it should now be on, if it switched
|
||||
if test $hlwm_group_active -ne $current
|
||||
update_tag $current
|
||||
end
|
||||
group_set_keybinds
|
||||
notify "Group $hlwm_group_active"
|
||||
log -c $tag_color "group $current -> $hlwm_group_active"
|
||||
end
|
||||
|
||||
# move_to_group moves the focused window to the relative tag on
|
||||
# a given group
|
||||
function move_to_group
|
||||
set -f move_to "$argv"
|
||||
if test "$move_to" = "$hlwm_group_active"
|
||||
log -c $tag_color "ignoring move as it's already in the active group"
|
||||
return 0
|
||||
else if test $move_to -lt 1 -o $move_to -gt $hlwm_group_count
|
||||
log -c $tag_color "invalid group index [$move_to]:" \
|
||||
"out of range [1:$hlwm_group_count]"
|
||||
return 1
|
||||
end
|
||||
set -f new_tag (translate_tag $hlwm_group_active $move_to)
|
||||
log -c $tag_color "moving window to group [$move_to]" \
|
||||
"tag -> $new_tag"
|
||||
end
|
||||
|
||||
# translate_tag translates the current tag from
|
||||
# the group provided in the first argument,
|
||||
# from which the relative tag is calculated, to
|
||||
# what the tag should be if it was in the second argument
|
||||
function translate_tag
|
||||
set -f current_actual (hc attr tags.focus.index)
|
||||
set -f tl_from $argv[1]
|
||||
set -f tl_to $argv[2]
|
||||
set -f offset_from (math (math $tl_from - 1) x $hlwm_tags_per_group)
|
||||
set -f offset_to (math (math $tl_to - 1) x $hlwm_tags_per_group)
|
||||
set -f relative_tag_from (math $current_actual - $offset_from)
|
||||
log -c $tag_color \
|
||||
"calculated relative tag to group [$tl_from] to be [$relative_tag_from]"
|
||||
set -f actual_tag_to (math $relative_tag_from + $offset_to)
|
||||
log -c $tag_color \
|
||||
"relative tag [$relative_tag_from] translated to group [$tl_to]" \
|
||||
"becomes actual tag [$actual_tag_to]"
|
||||
echo $actual_tag_to
|
||||
end
|
||||
|
||||
function update_tag
|
||||
set -f new_tag (translate_tag $argv $hlwm_group_active)
|
||||
log -c $tag_color "moving frame focus to tag: [$new_tag]"
|
||||
hc use_index $new_tag
|
||||
end
|
||||
|
||||
function group_down
|
||||
if not set -q hlwm_group_active
|
||||
# Treat unset == 1, so move back to the last one
|
||||
set -U hlwm_group_active $hlwm_group_count
|
||||
else if test $hlwm_group_active -eq 1
|
||||
set -U hlwm_group_active $hlwm_group_count
|
||||
else
|
||||
set -U hlwm_group_active (math $hlwm_group_active - 1)
|
||||
end
|
||||
end
|
||||
|
||||
function group_index
|
||||
if test $argv -gt $hlwm_group_count
|
||||
set -f $argv $hlwm_group_count
|
||||
else if test $argv -lt 1
|
||||
set -f $argv 1
|
||||
end
|
||||
|
||||
set -U hlwm_group_active $argv
|
||||
end
|
||||
|
||||
function group_up
|
||||
if not set -q hlwm_group_active
|
||||
set -U hlwm_group_active 2
|
||||
else if test $hlwm_group_active -eq $hlwm_group_count
|
||||
|
@ -20,15 +111,12 @@ function group_switch
|
|||
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"
|
||||
log -c $tag_color "setting keybinds for group: $hlwm_group_active"
|
||||
if not set -q hlwm_group_active;
|
||||
set -U hlwm_group_active 1
|
||||
end
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#!/usr/bin/env fish
|
||||
import parent
|
||||
import set_default
|
||||
|
||||
# calls logger with a specific color
|
||||
#
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#!/usr/bin/env fish
|
||||
import colors
|
||||
import set_default
|
||||
import log
|
||||
|
||||
set_default notify_fg (hlwm_text)
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
#!/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"
|
||||
|
||||
alias hc=herbstclient
|
||||
|
||||
# default font if not set
|
||||
set_default hlwm_font "-*-fixed-medium-*-*-*-12-*-*-*-*-*-*-*"
|
||||
|
||||
|
@ -18,7 +16,7 @@ if command -sq "xsetroot";
|
|||
xsetroot -solid black
|
||||
end
|
||||
hc keyunbind --all
|
||||
groups_reset
|
||||
group_active_reset
|
||||
|
||||
# set -l Mod Mod1 # alt
|
||||
set -g Mod Mod4
|
||||
|
@ -69,29 +67,25 @@ 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"
|
||||
# set -l tag (math $tag_index + '(('$group_num -1')' x $hlwm_tags_per_group ')')
|
||||
log "adding tag [$tag_index] to group [$group_num]"
|
||||
hc add "$group_num:$tag_index"
|
||||
end
|
||||
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
|
||||
# Remove the default tag, if present (switching to the first tag)
|
||||
if set -l default_tag (hc get_attr tags.by-name.default.index)
|
||||
set -l focused_tag (hc get_attr tags.focus.index)
|
||||
if test $focused_tag -eq $default_tag
|
||||
hc use_index 1
|
||||
end
|
||||
hc merge_tag "default"
|
||||
log "removed default tag from index [$default_tag]"
|
||||
end
|
||||
|
||||
group_set_keybinds
|
||||
|
||||
# focus
|
||||
hc keybind $Mod-Tab cycle
|
||||
|
@ -111,7 +105,6 @@ set -l ACTIVE "#800080"
|
|||
set -l NORMAL "#330033"
|
||||
set -l URGENT "#7811A1"
|
||||
alias hcs="hc set"
|
||||
#alias hct=hc attr theme
|
||||
function hct
|
||||
hc attr theme.$argv[1] $argv[2]
|
||||
end
|
||||
|
@ -124,8 +117,6 @@ function off
|
|||
hcs $argv[1] off
|
||||
end
|
||||
|
||||
|
||||
|
||||
hct tiling.reset 1
|
||||
hct floating.reset 1
|
||||
hcs frame_border_active_color $ACTIVE
|
||||
|
@ -214,7 +205,11 @@ end
|
|||
|
||||
log "Registering custom command binds"
|
||||
keybind_fn i "toggle_idle_screen"
|
||||
keybind_fn --direct="toggle_group" "Shift-Tab"
|
||||
keybind_fn --direct="switch_group" "grave" "+" # backtick
|
||||
keybind_fn --direct="switch_group" "Tab-grave" "-"
|
||||
for group_index in (seq $hlwm_group_count)
|
||||
keybind_fn --direct="switch_group" "F$group_index" "$group_index"
|
||||
end
|
||||
log "Custom commands bound"
|
||||
|
||||
set -l monitors (hc list_monitors | cut -d: -f1)
|
|
@ -0,0 +1,3 @@
|
|||
# hlwm conf todo
|
||||
|
||||
- [ ] use hlwm attrs (new_attr in herbstluftwm(1)) rather than fish env
|
Loading…
Reference in New Issue